@honkit/markup-it 6.0.3 → 6.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__tests__/syntax.d.ts +2 -0
- package/lib/__tests__/syntax.d.ts.map +1 -0
- package/lib/__tests__/syntax.js +92 -0
- package/lib/json/__tests__/decode.d.ts +2 -0
- package/lib/json/__tests__/decode.d.ts.map +1 -0
- package/lib/json/__tests__/decode.js +38 -0
- package/lib/json/__tests__/encode.d.ts +2 -0
- package/lib/json/__tests__/encode.d.ts.map +1 -0
- package/lib/json/__tests__/encode.js +26 -0
- package/lib/models/__tests__/token.d.ts +2 -0
- package/lib/models/__tests__/token.d.ts.map +1 -0
- package/lib/models/__tests__/token.js +18 -0
- package/lib/parse/__tests__/mergeTokens.d.ts +2 -0
- package/lib/parse/__tests__/mergeTokens.d.ts.map +1 -0
- package/lib/parse/__tests__/mergeTokens.js +51 -0
- package/lib/parse/textToUnstyledTokens.d.ts.map +1 -1
- package/lib/parse/textToUnstyledTokens.js +1 -2
- package/package.json +15 -16
- package/syntaxes/markdown/__tests__/normalizeTeX.spec.js +34 -0
- package/syntaxes/markdown/__tests__/specs/amps_and_angles_encoding.html +17 -0
- package/syntaxes/markdown/__tests__/specs/amps_and_angles_encoding.md +21 -0
- package/syntaxes/markdown/__tests__/specs/auto_links.html +18 -0
- package/syntaxes/markdown/__tests__/specs/auto_links.md +13 -0
- package/syntaxes/markdown/__tests__/specs/autolink_lines.html +3 -0
- package/syntaxes/markdown/__tests__/specs/autolink_lines.md +2 -0
- package/syntaxes/markdown/__tests__/specs/backslash_escapes.html +118 -0
- package/syntaxes/markdown/__tests__/specs/backslash_escapes.md +120 -0
- package/syntaxes/markdown/__tests__/specs/blockquote_list_item.html +3 -0
- package/syntaxes/markdown/__tests__/specs/blockquote_list_item.md +4 -0
- package/syntaxes/markdown/__tests__/specs/blockquotes_with_code_blocks.html +15 -0
- package/syntaxes/markdown/__tests__/specs/blockquotes_with_code_blocks.md +11 -0
- package/syntaxes/markdown/__tests__/specs/case_insensitive_refs.html +1 -0
- package/syntaxes/markdown/__tests__/specs/case_insensitive_refs.md +3 -0
- package/syntaxes/markdown/__tests__/specs/code_blocks.html +18 -0
- package/syntaxes/markdown/__tests__/specs/code_blocks.md +14 -0
- package/syntaxes/markdown/__tests__/specs/code_blocks_indent.html +13 -0
- package/syntaxes/markdown/__tests__/specs/code_blocks_indent.md +14 -0
- package/syntaxes/markdown/__tests__/specs/code_spans.html +6 -0
- package/syntaxes/markdown/__tests__/specs/code_spans.md +6 -0
- package/syntaxes/markdown/__tests__/specs/def_blocks.html +30 -0
- package/syntaxes/markdown/__tests__/specs/def_blocks.md +21 -0
- package/syntaxes/markdown/__tests__/specs/double_link.html +5 -0
- package/syntaxes/markdown/__tests__/specs/double_link.md +5 -0
- package/syntaxes/markdown/__tests__/specs/escaped_angles.html +1 -0
- package/syntaxes/markdown/__tests__/specs/escaped_angles.md +1 -0
- package/syntaxes/markdown/__tests__/specs/footnotes.html +4 -0
- package/syntaxes/markdown/__tests__/specs/footnotes.md +3 -0
- package/syntaxes/markdown/__tests__/specs/gfm_break.breaks.html +3 -0
- package/syntaxes/markdown/__tests__/specs/gfm_break.breaks.md +3 -0
- package/syntaxes/markdown/__tests__/specs/gfm_code.html +5 -0
- package/syntaxes/markdown/__tests__/specs/gfm_code.md +16 -0
- package/syntaxes/markdown/__tests__/specs/gfm_code_hr_list.html +52 -0
- package/syntaxes/markdown/__tests__/specs/gfm_code_hr_list.md +53 -0
- package/syntaxes/markdown/__tests__/specs/gfm_del.html +1 -0
- package/syntaxes/markdown/__tests__/specs/gfm_del.md +1 -0
- package/syntaxes/markdown/__tests__/specs/gfm_em.html +1 -0
- package/syntaxes/markdown/__tests__/specs/gfm_em.md +1 -0
- package/syntaxes/markdown/__tests__/specs/gfm_links.html +2 -0
- package/syntaxes/markdown/__tests__/specs/gfm_links.md +1 -0
- package/syntaxes/markdown/__tests__/specs/gfm_tables.html +37 -0
- package/syntaxes/markdown/__tests__/specs/gfm_tables.md +21 -0
- package/syntaxes/markdown/__tests__/specs/hard_wrapped_paragraphs_with_list_like_lines.nogfm.html +10 -0
- package/syntaxes/markdown/__tests__/specs/hard_wrapped_paragraphs_with_list_like_lines.nogfm.md +8 -0
- package/syntaxes/markdown/__tests__/specs/horizontal_rules.html +71 -0
- package/syntaxes/markdown/__tests__/specs/horizontal_rules.md +67 -0
- package/syntaxes/markdown/__tests__/specs/hr_list_break.html +10 -0
- package/syntaxes/markdown/__tests__/specs/hr_list_break.md +6 -0
- package/syntaxes/markdown/__tests__/specs/image.html +5 -0
- package/syntaxes/markdown/__tests__/specs/image.md +3 -0
- package/syntaxes/markdown/__tests__/specs/inline_html.html +6 -0
- package/syntaxes/markdown/__tests__/specs/inline_html.md +6 -0
- package/syntaxes/markdown/__tests__/specs/inline_html_advanced.html +15 -0
- package/syntaxes/markdown/__tests__/specs/inline_html_advanced.md +15 -0
- package/syntaxes/markdown/__tests__/specs/inline_html_comments.html +13 -0
- package/syntaxes/markdown/__tests__/specs/inline_html_comments.md +13 -0
- package/syntaxes/markdown/__tests__/specs/inline_html_script.html +3 -0
- package/syntaxes/markdown/__tests__/specs/inline_html_script.md +3 -0
- package/syntaxes/markdown/__tests__/specs/inline_html_simple.html +72 -0
- package/syntaxes/markdown/__tests__/specs/inline_html_simple.md +69 -0
- package/syntaxes/markdown/__tests__/specs/lazy_blockquotes.html +4 -0
- package/syntaxes/markdown/__tests__/specs/lazy_blockquotes.md +2 -0
- package/syntaxes/markdown/__tests__/specs/links_inline_style.html +15 -0
- package/syntaxes/markdown/__tests__/specs/links_inline_style.md +15 -0
- package/syntaxes/markdown/__tests__/specs/links_reference_style.html +52 -0
- package/syntaxes/markdown/__tests__/specs/links_reference_style.md +71 -0
- package/syntaxes/markdown/__tests__/specs/links_shortcut_references.html +9 -0
- package/syntaxes/markdown/__tests__/specs/links_shortcut_references.md +20 -0
- package/syntaxes/markdown/__tests__/specs/list_item_text.html +1 -0
- package/syntaxes/markdown/__tests__/specs/list_item_text.md +5 -0
- package/syntaxes/markdown/__tests__/specs/literal_quotes_in_titles.html +3 -0
- package/syntaxes/markdown/__tests__/specs/literal_quotes_in_titles.md +7 -0
- package/syntaxes/markdown/__tests__/specs/loose_lists.html +62 -0
- package/syntaxes/markdown/__tests__/specs/loose_lists.md +59 -0
- package/syntaxes/markdown/__tests__/specs/main.html +71 -0
- package/syntaxes/markdown/__tests__/specs/main.md +58 -0
- package/syntaxes/markdown/__tests__/specs/markdown_documentation_basics.html +314 -0
- package/syntaxes/markdown/__tests__/specs/markdown_documentation_basics.md +306 -0
- package/syntaxes/markdown/__tests__/specs/markdown_documentation_syntax.html +942 -0
- package/syntaxes/markdown/__tests__/specs/markdown_documentation_syntax.md +888 -0
- package/syntaxes/markdown/__tests__/specs/nested_blockquotes.html +9 -0
- package/syntaxes/markdown/__tests__/specs/nested_blockquotes.md +5 -0
- package/syntaxes/markdown/__tests__/specs/nested_code.html +1 -0
- package/syntaxes/markdown/__tests__/specs/nested_code.md +1 -0
- package/syntaxes/markdown/__tests__/specs/nested_em.html +3 -0
- package/syntaxes/markdown/__tests__/specs/nested_em.md +3 -0
- package/syntaxes/markdown/__tests__/specs/nested_square_link.html +1 -0
- package/syntaxes/markdown/__tests__/specs/nested_square_link.md +1 -0
- package/syntaxes/markdown/__tests__/specs/not_a_link.html +1 -0
- package/syntaxes/markdown/__tests__/specs/not_a_link.md +1 -0
- package/syntaxes/markdown/__tests__/specs/ordered_and_unordered_lists.html +148 -0
- package/syntaxes/markdown/__tests__/specs/ordered_and_unordered_lists.md +131 -0
- package/syntaxes/markdown/__tests__/specs/ref_paren.html +1 -0
- package/syntaxes/markdown/__tests__/specs/ref_paren.md +3 -0
- package/syntaxes/markdown/__tests__/specs/same_bullet.html +5 -0
- package/syntaxes/markdown/__tests__/specs/same_bullet.md +3 -0
- package/syntaxes/markdown/__tests__/specs/simple_paragraph.html +1 -0
- package/syntaxes/markdown/__tests__/specs/simple_paragraph.md +1 -0
- package/syntaxes/markdown/__tests__/specs/strong_and_em_together.html +7 -0
- package/syntaxes/markdown/__tests__/specs/strong_and_em_together.md +7 -0
- package/syntaxes/markdown/__tests__/specs/table_pipe.html +5 -0
- package/syntaxes/markdown/__tests__/specs/table_pipe.md +4 -0
- package/syntaxes/markdown/__tests__/specs/tabs.html +25 -0
- package/syntaxes/markdown/__tests__/specs/tabs.md +21 -0
- package/syntaxes/markdown/__tests__/specs/tidyness.html +8 -0
- package/syntaxes/markdown/__tests__/specs/tidyness.md +5 -0
- package/syntaxes/markdown/__tests__/specs/toplevel_paragraphs.gfm.html +34 -0
- package/syntaxes/markdown/__tests__/specs/toplevel_paragraphs.gfm.md +37 -0
- package/syntaxes/markdown/__tests__/specs/tricky_list.html +23 -0
- package/syntaxes/markdown/__tests__/specs/tricky_list.md +15 -0
- package/syntaxes/markdown/__tests__/specs.js +74 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p><code>hi ther `` ok ```</code></p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
````` hi ther `` ok ``` `````
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p><a href="/url">the <code>]</code> character</a></p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[the `]` character](/url)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p>[test](not a link)</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
\[test](not a link)
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<h2>Unordered</h2>
|
|
2
|
+
|
|
3
|
+
<p>Asterisks tight:</p>
|
|
4
|
+
|
|
5
|
+
<ul>
|
|
6
|
+
<li>asterisk 1</li>
|
|
7
|
+
<li>asterisk 2</li>
|
|
8
|
+
<li>asterisk 3</li>
|
|
9
|
+
</ul>
|
|
10
|
+
|
|
11
|
+
<p>Asterisks loose:</p>
|
|
12
|
+
|
|
13
|
+
<ul>
|
|
14
|
+
<li><p>asterisk 1</p></li>
|
|
15
|
+
<li><p>asterisk 2</p></li>
|
|
16
|
+
<li><p>asterisk 3</p></li>
|
|
17
|
+
</ul>
|
|
18
|
+
|
|
19
|
+
<hr>
|
|
20
|
+
|
|
21
|
+
<p>Pluses tight:</p>
|
|
22
|
+
|
|
23
|
+
<ul>
|
|
24
|
+
<li>Plus 1</li>
|
|
25
|
+
<li>Plus 2</li>
|
|
26
|
+
<li>Plus 3</li>
|
|
27
|
+
</ul>
|
|
28
|
+
|
|
29
|
+
<p>Pluses loose:</p>
|
|
30
|
+
|
|
31
|
+
<ul>
|
|
32
|
+
<li><p>Plus 1</p></li>
|
|
33
|
+
<li><p>Plus 2</p></li>
|
|
34
|
+
<li><p>Plus 3</p></li>
|
|
35
|
+
</ul>
|
|
36
|
+
|
|
37
|
+
<hr>
|
|
38
|
+
|
|
39
|
+
<p>Minuses tight:</p>
|
|
40
|
+
|
|
41
|
+
<ul>
|
|
42
|
+
<li>Minus 1</li>
|
|
43
|
+
<li>Minus 2</li>
|
|
44
|
+
<li>Minus 3</li>
|
|
45
|
+
</ul>
|
|
46
|
+
|
|
47
|
+
<p>Minuses loose:</p>
|
|
48
|
+
|
|
49
|
+
<ul>
|
|
50
|
+
<li><p>Minus 1</p></li>
|
|
51
|
+
<li><p>Minus 2</p></li>
|
|
52
|
+
<li><p>Minus 3</p></li>
|
|
53
|
+
</ul>
|
|
54
|
+
|
|
55
|
+
<h2>Ordered</h2>
|
|
56
|
+
|
|
57
|
+
<p>Tight:</p>
|
|
58
|
+
|
|
59
|
+
<ol>
|
|
60
|
+
<li>First</li>
|
|
61
|
+
<li>Second</li>
|
|
62
|
+
<li>Third</li>
|
|
63
|
+
</ol>
|
|
64
|
+
|
|
65
|
+
<p>and:</p>
|
|
66
|
+
|
|
67
|
+
<ol>
|
|
68
|
+
<li>One</li>
|
|
69
|
+
<li>Two</li>
|
|
70
|
+
<li>Three</li>
|
|
71
|
+
</ol>
|
|
72
|
+
|
|
73
|
+
<p>Loose using tabs:</p>
|
|
74
|
+
|
|
75
|
+
<ol>
|
|
76
|
+
<li><p>First</p></li>
|
|
77
|
+
<li><p>Second</p></li>
|
|
78
|
+
<li><p>Third</p></li>
|
|
79
|
+
</ol>
|
|
80
|
+
|
|
81
|
+
<p>and using spaces:</p>
|
|
82
|
+
|
|
83
|
+
<ol>
|
|
84
|
+
<li><p>One</p></li>
|
|
85
|
+
<li><p>Two</p></li>
|
|
86
|
+
<li><p>Three</p></li>
|
|
87
|
+
</ol>
|
|
88
|
+
|
|
89
|
+
<p>Multiple paragraphs:</p>
|
|
90
|
+
|
|
91
|
+
<ol>
|
|
92
|
+
<li><p>Item 1, graf one.</p>
|
|
93
|
+
|
|
94
|
+
<p>Item 2. graf two. The quick brown fox jumped over the lazy dog's
|
|
95
|
+
back.</p></li>
|
|
96
|
+
<li><p>Item 2.</p></li>
|
|
97
|
+
<li><p>Item 3.</p></li>
|
|
98
|
+
</ol>
|
|
99
|
+
|
|
100
|
+
<h2>Nested</h2>
|
|
101
|
+
|
|
102
|
+
<ul>
|
|
103
|
+
<li>Tab
|
|
104
|
+
<ul>
|
|
105
|
+
<li>Tab
|
|
106
|
+
<ul>
|
|
107
|
+
<li>Tab</li>
|
|
108
|
+
</ul></li>
|
|
109
|
+
</ul></li>
|
|
110
|
+
</ul>
|
|
111
|
+
|
|
112
|
+
<p>Here's another:</p>
|
|
113
|
+
|
|
114
|
+
<ol>
|
|
115
|
+
<li>First</li>
|
|
116
|
+
<li>Second:
|
|
117
|
+
<ul>
|
|
118
|
+
<li>Fee</li>
|
|
119
|
+
<li>Fie</li>
|
|
120
|
+
<li>Foe</li>
|
|
121
|
+
</ul></li>
|
|
122
|
+
<li>Third</li>
|
|
123
|
+
</ol>
|
|
124
|
+
|
|
125
|
+
<p>Same thing but with paragraphs:</p>
|
|
126
|
+
|
|
127
|
+
<ol>
|
|
128
|
+
<li><p>First</p></li>
|
|
129
|
+
<li><p>Second:</p>
|
|
130
|
+
|
|
131
|
+
<ul>
|
|
132
|
+
<li>Fee</li>
|
|
133
|
+
<li>Fie</li>
|
|
134
|
+
<li>Foe</li>
|
|
135
|
+
</ul></li>
|
|
136
|
+
<li><p>Third</p></li>
|
|
137
|
+
</ol>
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
<p>This was an error in Markdown 1.0.1:</p>
|
|
141
|
+
|
|
142
|
+
<ul>
|
|
143
|
+
<li><p>this</p>
|
|
144
|
+
|
|
145
|
+
<ul><li>sub</li></ul>
|
|
146
|
+
|
|
147
|
+
<p>that</p></li>
|
|
148
|
+
</ul>
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
## Unordered
|
|
2
|
+
|
|
3
|
+
Asterisks tight:
|
|
4
|
+
|
|
5
|
+
* asterisk 1
|
|
6
|
+
* asterisk 2
|
|
7
|
+
* asterisk 3
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Asterisks loose:
|
|
11
|
+
|
|
12
|
+
* asterisk 1
|
|
13
|
+
|
|
14
|
+
* asterisk 2
|
|
15
|
+
|
|
16
|
+
* asterisk 3
|
|
17
|
+
|
|
18
|
+
* * *
|
|
19
|
+
|
|
20
|
+
Pluses tight:
|
|
21
|
+
|
|
22
|
+
+ Plus 1
|
|
23
|
+
+ Plus 2
|
|
24
|
+
+ Plus 3
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Pluses loose:
|
|
28
|
+
|
|
29
|
+
+ Plus 1
|
|
30
|
+
|
|
31
|
+
+ Plus 2
|
|
32
|
+
|
|
33
|
+
+ Plus 3
|
|
34
|
+
|
|
35
|
+
* * *
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
Minuses tight:
|
|
39
|
+
|
|
40
|
+
- Minus 1
|
|
41
|
+
- Minus 2
|
|
42
|
+
- Minus 3
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
Minuses loose:
|
|
46
|
+
|
|
47
|
+
- Minus 1
|
|
48
|
+
|
|
49
|
+
- Minus 2
|
|
50
|
+
|
|
51
|
+
- Minus 3
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## Ordered
|
|
55
|
+
|
|
56
|
+
Tight:
|
|
57
|
+
|
|
58
|
+
1. First
|
|
59
|
+
2. Second
|
|
60
|
+
3. Third
|
|
61
|
+
|
|
62
|
+
and:
|
|
63
|
+
|
|
64
|
+
1. One
|
|
65
|
+
2. Two
|
|
66
|
+
3. Three
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
Loose using tabs:
|
|
70
|
+
|
|
71
|
+
1. First
|
|
72
|
+
|
|
73
|
+
2. Second
|
|
74
|
+
|
|
75
|
+
3. Third
|
|
76
|
+
|
|
77
|
+
and using spaces:
|
|
78
|
+
|
|
79
|
+
1. One
|
|
80
|
+
|
|
81
|
+
2. Two
|
|
82
|
+
|
|
83
|
+
3. Three
|
|
84
|
+
|
|
85
|
+
Multiple paragraphs:
|
|
86
|
+
|
|
87
|
+
1. Item 1, graf one.
|
|
88
|
+
|
|
89
|
+
Item 2. graf two. The quick brown fox jumped over the lazy dog's
|
|
90
|
+
back.
|
|
91
|
+
|
|
92
|
+
2. Item 2.
|
|
93
|
+
|
|
94
|
+
3. Item 3.
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## Nested
|
|
99
|
+
|
|
100
|
+
* Tab
|
|
101
|
+
* Tab
|
|
102
|
+
* Tab
|
|
103
|
+
|
|
104
|
+
Here's another:
|
|
105
|
+
|
|
106
|
+
1. First
|
|
107
|
+
2. Second:
|
|
108
|
+
* Fee
|
|
109
|
+
* Fie
|
|
110
|
+
* Foe
|
|
111
|
+
3. Third
|
|
112
|
+
|
|
113
|
+
Same thing but with paragraphs:
|
|
114
|
+
|
|
115
|
+
1. First
|
|
116
|
+
|
|
117
|
+
2. Second:
|
|
118
|
+
* Fee
|
|
119
|
+
* Fie
|
|
120
|
+
* Foe
|
|
121
|
+
|
|
122
|
+
3. Third
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
This was an error in Markdown 1.0.1:
|
|
126
|
+
|
|
127
|
+
* this
|
|
128
|
+
|
|
129
|
+
* sub
|
|
130
|
+
|
|
131
|
+
that
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p><a href="/url" title="there">hi</a></p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p>Just a simple paragraph.</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Just a simple paragraph.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<ul>
|
|
2
|
+
<li><p>this is a list item
|
|
3
|
+
indented with tabs</p></li>
|
|
4
|
+
<li><p>this is a list item
|
|
5
|
+
indented with spaces</p></li>
|
|
6
|
+
</ul>
|
|
7
|
+
|
|
8
|
+
<p>Code:</p>
|
|
9
|
+
|
|
10
|
+
<pre><code>this code block is indented by one tab
|
|
11
|
+
</code></pre>
|
|
12
|
+
|
|
13
|
+
<p>And:</p>
|
|
14
|
+
|
|
15
|
+
<pre><code> this code block is indented by two tabs
|
|
16
|
+
</code></pre>
|
|
17
|
+
|
|
18
|
+
<p>And:</p>
|
|
19
|
+
|
|
20
|
+
<pre><code>+ this is an example list item
|
|
21
|
+
indented with tabs
|
|
22
|
+
|
|
23
|
+
+ this is an example list item
|
|
24
|
+
indented with spaces
|
|
25
|
+
</code></pre>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
+ this is a list item
|
|
2
|
+
indented with tabs
|
|
3
|
+
|
|
4
|
+
+ this is a list item
|
|
5
|
+
indented with spaces
|
|
6
|
+
|
|
7
|
+
Code:
|
|
8
|
+
|
|
9
|
+
this code block is indented by one tab
|
|
10
|
+
|
|
11
|
+
And:
|
|
12
|
+
|
|
13
|
+
this code block is indented by two tabs
|
|
14
|
+
|
|
15
|
+
And:
|
|
16
|
+
|
|
17
|
+
+ this is an example list item
|
|
18
|
+
indented with tabs
|
|
19
|
+
|
|
20
|
+
+ this is an example list item
|
|
21
|
+
indented with spaces
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<p>hello world
|
|
2
|
+
how are you
|
|
3
|
+
how are you</p>
|
|
4
|
+
|
|
5
|
+
<p>hello world</p>
|
|
6
|
+
<pre><code>how are you</code></pre>
|
|
7
|
+
|
|
8
|
+
<p>hello world</p>
|
|
9
|
+
<hr>
|
|
10
|
+
|
|
11
|
+
<p>hello world</p>
|
|
12
|
+
<h1>how are you</h1>
|
|
13
|
+
|
|
14
|
+
<p>hello world</p>
|
|
15
|
+
<h1>how are you</h1>
|
|
16
|
+
|
|
17
|
+
<p>hello world</p>
|
|
18
|
+
<blockquote><p>how are you</p></blockquote>
|
|
19
|
+
|
|
20
|
+
<p>hello world</p>
|
|
21
|
+
<ul><li>how are you</li></ul>
|
|
22
|
+
|
|
23
|
+
<p>hello world</p>
|
|
24
|
+
<div>how are you</div>
|
|
25
|
+
|
|
26
|
+
<p>hello world
|
|
27
|
+
<span>how are you</span></p>
|
|
28
|
+
|
|
29
|
+
<p>hello <a href="/are/you">world</a>
|
|
30
|
+
</p>
|
|
31
|
+
|
|
32
|
+
<div>hello</div>
|
|
33
|
+
|
|
34
|
+
<p><span>hello</span></p>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
hello world
|
|
2
|
+
how are you
|
|
3
|
+
how are you
|
|
4
|
+
|
|
5
|
+
hello world
|
|
6
|
+
```
|
|
7
|
+
how are you
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
hello world
|
|
11
|
+
* * *
|
|
12
|
+
|
|
13
|
+
hello world
|
|
14
|
+
# how are you
|
|
15
|
+
|
|
16
|
+
hello world
|
|
17
|
+
how are you
|
|
18
|
+
===========
|
|
19
|
+
|
|
20
|
+
hello world
|
|
21
|
+
> how are you
|
|
22
|
+
|
|
23
|
+
hello world
|
|
24
|
+
* how are you
|
|
25
|
+
|
|
26
|
+
hello world
|
|
27
|
+
<div>how are you</div>
|
|
28
|
+
|
|
29
|
+
hello world
|
|
30
|
+
<span>how are you</span>
|
|
31
|
+
|
|
32
|
+
hello [world][how]
|
|
33
|
+
[how]: /are/you
|
|
34
|
+
|
|
35
|
+
<div>hello</div>
|
|
36
|
+
|
|
37
|
+
<span>hello</span>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<p><strong>hello</strong> <em>world</em></p>
|
|
2
|
+
|
|
3
|
+
<ul>
|
|
4
|
+
<li>hello world</li>
|
|
5
|
+
</ul>
|
|
6
|
+
|
|
7
|
+
<p><strong>hello</strong> <em>world</em></p>
|
|
8
|
+
|
|
9
|
+
<ul>
|
|
10
|
+
<li>hello world</li>
|
|
11
|
+
</ul>
|
|
12
|
+
|
|
13
|
+
<p><strong>hello</strong> <em>world</em></p>
|
|
14
|
+
|
|
15
|
+
<ul>
|
|
16
|
+
<li>Hello world</li>
|
|
17
|
+
</ul>
|
|
18
|
+
|
|
19
|
+
<p><strong>hello</strong> <em>world</em></p>
|
|
20
|
+
|
|
21
|
+
<ul>
|
|
22
|
+
<li>hello world</li>
|
|
23
|
+
</ul>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const JSDOM = require("jsdom").JSDOM;
|
|
4
|
+
const assert = require("assert");
|
|
5
|
+
|
|
6
|
+
const MarkupIt = require("../../..").Markup;
|
|
7
|
+
const markdownSyntax = require("../");
|
|
8
|
+
const htmlSyntax = require("../../html");
|
|
9
|
+
|
|
10
|
+
const FIXTURES = path.resolve(__dirname, "specs");
|
|
11
|
+
|
|
12
|
+
const markdown = new MarkupIt(markdownSyntax);
|
|
13
|
+
const html = new MarkupIt(htmlSyntax);
|
|
14
|
+
|
|
15
|
+
const assertHTMLEqual = (aHTML, bHTML) => {
|
|
16
|
+
const aDOM = new JSDOM(aHTML);
|
|
17
|
+
const bDOM = new JSDOM(bHTML);
|
|
18
|
+
assert.strictEqual(aDOM.innerHTML, bDOM.innerHTML);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
describe("Markdown Specs", () => {
|
|
22
|
+
const files = fs.readdirSync(FIXTURES);
|
|
23
|
+
|
|
24
|
+
describe("MD -> HTML", () => {
|
|
25
|
+
files.forEach((file) => {
|
|
26
|
+
if (path.extname(file) !== ".md") return;
|
|
27
|
+
|
|
28
|
+
it(file, () => {
|
|
29
|
+
const fixture = readFixture(file);
|
|
30
|
+
testMdToHtml(fixture);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe("MD -> MD", () => {
|
|
36
|
+
files.forEach((file) => {
|
|
37
|
+
if (path.extname(file) !== ".md") return;
|
|
38
|
+
|
|
39
|
+
it(file, () => {
|
|
40
|
+
const fixture = readFixture(file);
|
|
41
|
+
testMdIdempotence(fixture);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
function testMdToHtml(fixture) {
|
|
48
|
+
const content = markdown.toContent(fixture.sourceMd);
|
|
49
|
+
const resultHtml = html.toText(content);
|
|
50
|
+
|
|
51
|
+
assertHTMLEqual(resultHtml, fixture.sourceHtml);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function testMdIdempotence(fixture) {
|
|
55
|
+
const content1 = markdown.toContent(fixture.sourceMd);
|
|
56
|
+
const backToMd = markdown.toText(content1);
|
|
57
|
+
const content2 = markdown.toContent(backToMd);
|
|
58
|
+
|
|
59
|
+
const resultHtml1 = html.toText(content1);
|
|
60
|
+
const resultHtml2 = html.toText(content2);
|
|
61
|
+
assertHTMLEqual(resultHtml1, resultHtml2);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function readFixture(filename) {
|
|
65
|
+
const htmlFilePath = `${path.basename(filename, ".md")}.html`;
|
|
66
|
+
|
|
67
|
+
const sourceMd = fs.readFileSync(path.resolve(FIXTURES, filename), "utf8");
|
|
68
|
+
const sourceHtml = fs.readFileSync(path.resolve(FIXTURES, htmlFilePath), "utf8");
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
sourceMd: sourceMd,
|
|
72
|
+
sourceHtml: sourceHtml,
|
|
73
|
+
};
|
|
74
|
+
}
|