zerodevx / zero-md-docs

Instantly publish markdown from Github docs folder
ISC License
7 stars 0 forks source link

Incompatible with VSCode Live Server #4

Open terryzfeng opened 2 months ago

terryzfeng commented 2 months ago

Is there any way to log error messages when the Markdown fails to parse? Right now it just silently fails and there is no way to debug/check; all links are broken, taking me directly to .md files.

terryzfeng commented 2 months ago

Related to #3 (when there are errors in markdown doc generation)

zerodevx commented 2 months ago

Can you post your index.html and readme.md?

terryzfeng commented 2 months ago

After further testing, it looks like VSCode Live Server is not compatible with zero-md-docs index.html. That's how I usually do my web testing. If I open the index.html with Live Server and click the home tab, it takes me to directly to the .md file. If I serve everything with my own python http.server, it seems to work and display .md content inside the page as intended.

index.html

<!-- index.html -->
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <!-- Import modules and stylesheet -->
    <script type="module" src="https://cdn.jsdelivr.net/npm/zero-md@3?register"></script>
    <script type="module" src="https://cdn.jsdelivr.net/npm/zero-md-docs@1"></script>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zero-md-docs@1/dist/default.min.css" />
  </head>
  <body>
    <!-- Declare `app` entry point -->
    <div id="app"></div>
  </body>
</html>

readme.md

<!-- readme.md -->
- [home](home.md)

home.md

- [link](https://example.com)
zerodevx commented 2 months ago

After further testing, it looks like VSCode Live Server is not compatible with zero-md-docs

Not sure how that extension works under the hood - zero-md-docs intercepts anchor links pointing to *.md files and loads them in the zero-md component instead, but seems like that isn't working there. Things work when using a standards-based server so I'm sure if there's something we need to fix here.

zerodevx commented 2 months ago

Just in case it helps, I cut a new release v1.0.2 with updated dependencies. No changes on your end - https://cdn.jsdelivr.net/npm/zero-md-docs@1 should pick up the latest.

terryzfeng commented 2 months ago

Thanks! Yeah I'm not sure what Live Server does differently but hopefully, this will be useful reference if anyone else runs into this issue!