annotate mrjunejune/src/tools/markdown_to_html/index.html @ 216:e82b80b24012 default tip

[MrJuneJune] Make webp translate background job.
author June Park <parkjune1995@gmail.com>
date Sat, 28 Feb 2026 21:04:43 -0800
parents 4c725fde6999
children
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
214
4c725fde6999 [MrJuneJune] Fixed linkedin path and images modules.
MrJuneJune <me@mrjunejune.com>
parents: 184
diff changeset
57 ![Alt text](https://mrjunejune.com/public/epi_favicon.svg)
76
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}}
214
4c725fde6999 [MrJuneJune] Fixed linkedin path and images modules.
MrJuneJune <me@mrjunejune.com>
parents: 184
diff changeset
71 <script type="module">
4c725fde6999 [MrJuneJune] Fixed linkedin path and images modules.
MrJuneJune <me@mrjunejune.com>
parents: 184
diff changeset
72 import createModule from '/markdown_to_html_bin.js';
4c725fde6999 [MrJuneJune] Fixed linkedin path and images modules.
MrJuneJune <me@mrjunejune.com>
parents: 184
diff changeset
73
4c725fde6999 [MrJuneJune] Fixed linkedin path and images modules.
MrJuneJune <me@mrjunejune.com>
parents: 184
diff changeset
74 // Get DOM elements
4c725fde6999 [MrJuneJune] Fixed linkedin path and images modules.
MrJuneJune <me@mrjunejune.com>
parents: 184
diff changeset
75 const input = document.getElementById('input');
4c725fde6999 [MrJuneJune] Fixed linkedin path and images modules.
MrJuneJune <me@mrjunejune.com>
parents: 184
diff changeset
76 const output = document.getElementById('output');
4c725fde6999 [MrJuneJune] Fixed linkedin path and images modules.
MrJuneJune <me@mrjunejune.com>
parents: 184
diff changeset
77 const copy = document.getElementById('copy');
4c725fde6999 [MrJuneJune] Fixed linkedin path and images modules.
MrJuneJune <me@mrjunejune.com>
parents: 184
diff changeset
78
4c725fde6999 [MrJuneJune] Fixed linkedin path and images modules.
MrJuneJune <me@mrjunejune.com>
parents: 184
diff changeset
79 // Modern Emscripten exports a factory function that returns a Promise
4c725fde6999 [MrJuneJune] Fixed linkedin path and images modules.
MrJuneJune <me@mrjunejune.com>
parents: 184
diff changeset
80 createModule().then(Module => {
184
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
81 // 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
82 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
83 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
84
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
85 function convert() {
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
86 output.innerHTML = '';
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
87 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
88
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
89 // 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
90 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
91 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
92 markdownFree(ptr);
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 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
95 }
76
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
96
184
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
97 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
98 convert();
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
99
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
100 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
101 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
102 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
103 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
104 '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
105 '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
106 })];
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
107 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
108 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
109 setTimeout(() => {
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
110 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
111 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
112 }, 1000);
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
113 }).catch(err => {
8c74204fd362 [MD to HTML] Updated so it can be used through readme to html
MrJuneJune <me@mrjunejune.com>
parents: 93
diff changeset
114 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
115 });
76
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
116 });
214
4c725fde6999 [MrJuneJune] Fixed linkedin path and images modules.
MrJuneJune <me@mrjunejune.com>
parents: 184
diff changeset
117 });
76
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
118 </script>
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
119 </body>
35b1abc37969 Updating my website to use seobeo library.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
120 </html>