simov / markdown-viewer

Markdown Viewer / Browser Extension
MIT License
1.01k stars 131 forks source link

File containing HTML does not render if loaded from command line. #247

Open tcouey opened 5 days ago

tcouey commented 5 days ago

This is a bit of an edge case, granted, but it is a bug. If I launch Firefox 127 (on Windows 10) from the command line and give it a markdown file to open, it opens the raw file. If I then press F5, it loads the extension and renders properly. Here's the really weird thing, it only happens if the file contains an HTML tag (in this case, a tag). Because of the other <a rel="noreferrer nofollow" target="_blank" href="https://github.com/simov/markdown-viewer/issues/209">issue </a> with HTML, I have the <title> tag as the second line in the file. If the file is just pure markdown, it loads fine from the command line. Here's a sample that triggers the bug:</p> <pre><code># July 3, 2024 (Wednesday) <title>July 3, 2024 (Wednesday)</title> ## Topic</code></pre> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>