r0x0r/pywebview

mermaid diagrams cannot be displayed locally

kxmatjob opened this issue · 3 comments

Specification

  • pywebview version: 5.1
  • operating system: windows 10
  • web renderer:chrome
  • python: 3.8.10

Description

# -*- coding: utf-8 -*-
import webview
webview.create_window('Hello world', 'test2.html')
webview.create_window('Hello world', 'test3.html')
webview.start()

test2.html used <script src="C:/Users/Administrator/node_modules/mermaid/dist/mermaid.min.js"></script> displayed failed, But it can be displayed in Chrome.
the mermaid install by npm, it version is 9.0.1
then i cannot find reason, thanks for your help :)

test3.html used <script src="https://cdn.jsdelivr.net/npm/mermaid@8.13.4/dist/mermaid.min.js"></script> displayed success

   <!DOCTYPE html>
   <html lang="en">
   <head>
       <meta charset="UTF-8">
       <title>Mermaid in PyWebView</title>
       <!-- Mermaid JS -->
       <script src="https://cdn.jsdelivr.net/npm/mermaid@8.13.4/dist/mermaid.min.js"></script>
   </head>
   <body>
       <!-- Mermaid -->
       <div class="mermaid">
            graph TD
            start_proc[start]-->detecting[sys check]
            detecting-->reachable{dest ip is ok}
            reachable--IP ok-->detecting

            reachable--IP bad-->confirm[run program]

            confirm--switch-->wechat_or_sms{select sms or wechat}

            wechat_or_sms--0-->send_sms[send sms]
            wechat_or_sms--1-->send_wechat[send wechat]

            send_sms-->shutdown
            send_wechat-->shutdown[run]
            shutdown-->end_proc>end]
       </div>

       <script>
           // init
           mermaid.initialize({startOnLoad:true});
       </script>
   </body>
   </html>

test2 launches a http server so local path C:/Users/Administrator/node_modules/mermaid/dist/ is not available. You may access local paths by using a full path name of test3.html.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

The message to post on the issue when closing it. If none provided, will not comment when closing an issue.