annotate mrjunejune/src/tools/markdown_to_html/index.html @ 184:8c74204fd362

[MD to HTML] Updated so it can be used through readme to html
author MrJuneJune <me@mrjunejune.com>
date Fri, 23 Jan 2026 22:20:35 -0800
parents be91a73d801a
children 4c725fde6999
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
76
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
1 <!DOCTYPE html>
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
2 <html lang="en">
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
3 <head>
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
4 <meta charset="UTF-8">
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
6 <title>Markdown to HTML Converter</title>
80
d55157451947 [MrJuneJune] Updating my homepage.
June Park <parkjune1995@gmail.com>
parents: 79
diff changeset
7 {{/parts/base_head.html}}
76
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
8 <link rel="stylesheet" href="markdown_to_html/index.css" />
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
9 </head>
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
10 <body>
78
June Park <parkjune1995@gmail.com>
parents: 76
diff changeset
11 {{/parts/header.html}}
76
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
12 <div class="header">
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
13 <h1>Markdown to HTML Converter</h1>
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
14 </div>
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
15
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
16 <div class="container">
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
17 <div class="panel">
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
18 <div class="label">Markdown Input</div>
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
19 <textarea id="input" placeholder="Type your markdown here..."># Welcome to Markdown Converter
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
20
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
21 ## Features
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
22
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
23 This converter supports:
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
24
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
25 - **Bold text** and *italic text*
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
26 - [Links](https://example.com)
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
27 - `inline code`
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
28 - ~~strikethrough~~
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
29
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
30 ### Lists
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
31
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
32 1. Ordered lists
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
33 2. Like this one
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
34 3. With numbers
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
35
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
36 - Unordered lists
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
37 - Use dashes
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
38 - Or asterisks
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
39
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
40 ### Code Blocks
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
41
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
42 ```
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
43 function example() {
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
44 return "Hello World";
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
45 }
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
46 ```
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
47
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
48 ### Blockquotes
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
49
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
50 > This is a blockquote
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
51 > It can span multiple lines
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
52
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
53 ---
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
54
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
55 ### Images
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
56
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
57 ![Alt text](https://via.placeholder.com/150)
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
58
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
59 **Try editing this text!**</textarea>
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
60 </div>
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
61
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
62 <div class="panel">
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
63 <div class="title">
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
64 <div class="label">HTML Output</div>
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
65 <button id="copy"> Copy </button>
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
66 </div>
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
67 <div id="output"></div>
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
68 </div>
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
69 </div>
93
be91a73d801a [MrJuneJune] Updated my website.
June Park <parkjune1995@gmail.com>
parents: 84
diff changeset
70 {{/parts/footer.html}}
184
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
71 <script src="/markdown_to_html_bin.js"></script>
76
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
72 <script>
184
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
73 // Wait for WASM module to be ready
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
74 Module.onRuntimeInitialized = () => {
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
75 // Get raw pointer so we can free it after use
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
76 const markdownToHtmlPtr = Module.cwrap('markdown_to_html', 'number', ['string']);
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
77 const markdownFree = Module.cwrap('markdown_free', null, ['number']);
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
78
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
79 function convert() {
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
80 output.innerHTML = '';
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
81 const markdown = input.value;
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
82
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
83 // Get pointer, convert to string, then free the C memory
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
84 const ptr = markdownToHtmlPtr(markdown);
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
85 const html = Module.UTF8ToString(ptr);
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
86 markdownFree(ptr);
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
87
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
88 output.innerHTML = html;
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
89 }
76
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
90
184
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
91 input.addEventListener('input', convert);
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
92 convert();
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
93
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
94 copy.addEventListener('click', () => {
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
95 const htmlBlob = new Blob([output.innerHTML], { type: 'text/html'});
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
96 const textBlob = new Blob([output.innerText], { type: 'text/plain'});
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
97 const data = [new ClipboardItem({
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
98 'text/html': htmlBlob,
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
99 'text/plain': textBlob
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
100 })];
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
101 navigator.clipboard.write(data).then(() => {
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
102 copy.textContent = "Copied!";
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
103 setTimeout(() => {
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
104 copy.textContent = "Copy";
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
105 copy.classList.remove('success');
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
106 }, 1000);
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
107 }).catch(err => {
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
108 console.error('Failed to copy: ', err);
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
109 });
76
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
110 });
184
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
111 };
76
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
112 </script>
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
113 </body>
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
114 </html>