Mercurial
diff mrjunejune/src/tools/markdown_to_html/index.html @ 231:09a96dcb2b4c hg-web
[merge] Join existing hg-web branch head
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Sun, 02 Aug 2026 16:50:48 -0700 |
| parents | 4c725fde6999 |
| children | 60a876c4587a |
line wrap: on
line diff
--- a/mrjunejune/src/tools/markdown_to_html/index.html Sun Jan 25 10:44:04 2026 -0800 +++ b/mrjunejune/src/tools/markdown_to_html/index.html Sun Aug 02 16:50:48 2026 -0700 @@ -54,7 +54,7 @@ ### Images - + **Try editing this text!**</textarea> </div> @@ -68,10 +68,16 @@ </div> </div> {{/parts/footer.html}} - <script src="/markdown_to_html_bin.js"></script> - <script> - // Wait for WASM module to be ready - Module.onRuntimeInitialized = () => { + <script type="module"> + import createModule from '/markdown_to_html_bin.js'; + + // Get DOM elements + const input = document.getElementById('input'); + const output = document.getElementById('output'); + const copy = document.getElementById('copy'); + + // Modern Emscripten exports a factory function that returns a Promise + createModule().then(Module => { // Get raw pointer so we can free it after use const markdownToHtmlPtr = Module.cwrap('markdown_to_html', 'number', ['string']); const markdownFree = Module.cwrap('markdown_free', null, ['number']); @@ -108,7 +114,7 @@ console.error('Failed to copy: ', err); }); }); - }; + }); </script> </body> </html>