Mercurial
annotate markdown_converter/main.js @ 54:b3e82d22f961
[PostDog] Initial commit BROKEN
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Fri, 19 Dec 2025 13:58:52 -0800 |
| parents | |
| children |
| rev | line source |
|---|---|
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1 // # |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2 // ## |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3 // []() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4 // _ _ |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5 // * * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6 // 1. |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
7 // - |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
8 // \s\s |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
9 // |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
10 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
11 function Lexer(character) { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
12 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
13 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
14 /** |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
15 * @params |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
16 * value: string |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
17 */ |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
18 function mardownConverter(value) { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
19 let i = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
20 let character; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
21 const domElements = []; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
22 while (i < value.length) { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
23 character = value[i] |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
24 switch(character) { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
25 case "#": { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
26 if |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
27 const dom = document.createElement("h1"); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
28 domElements.append(dom) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
29 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
30 case "_": { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
31 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
32 case "_" { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
33 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
34 case "*" { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
35 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
36 default { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
37 return character; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
38 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
39 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
40 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
41 } |