safe-mdx 0.0.2 → 0.0.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.
@@ -2,6 +2,7 @@ import React from 'react'
2
2
  import dedent from 'dedent'
3
3
  import { test, expect } from 'vitest'
4
4
  import { MdastToJsx } from './safe-mdx'
5
+ import { renderToStaticMarkup } from 'react-dom/server'
5
6
  void React
6
7
 
7
8
  const components = {
@@ -13,8 +14,9 @@ const components = {
13
14
  function render(code) {
14
15
  const visitor = new MdastToJsx({ code, components })
15
16
  const result = visitor.run()
17
+ const html = renderToStaticMarkup(result)
16
18
  // console.log(JSON.stringify(result, null, 2))
17
- return { result, errors: visitor.errors || [] }
19
+ return { result, errors: visitor.errors || [], html }
18
20
  }
19
21
 
20
22
  test('basic', () => {
@@ -27,6 +29,7 @@ test('basic', () => {
27
29
  ).toMatchInlineSnapshot(`
28
30
  {
29
31
  "errors": [],
32
+ "html": "<h1>Hello</h1><p>i am a paragraph</p>",
30
33
  "result": <React.Fragment>
31
34
  <h1>
32
35
  Hello
@@ -38,6 +41,135 @@ test('basic', () => {
38
41
  }
39
42
  `)
40
43
  })
44
+ test('table', () => {
45
+ expect(
46
+ render(dedent`
47
+ # Hello
48
+
49
+ | Tables | Are | Cool |
50
+ | ------------- |:-------------:| -----:|
51
+ | col 3 is | right-aligned | $1600 |
52
+ | col 2 is | centered | $12 |
53
+ `),
54
+ ).toMatchInlineSnapshot(`
55
+ {
56
+ "errors": [],
57
+ "html": "<h1>Hello</h1><table><thead><tr class=""><td class="">Tables</td><td class="">Are</td><td class="">Cool</td></tr></thead><tbody><tr class=""><td class="">col 3 is</td><td class="">right-aligned</td><td class="">$1600</td></tr><tr class=""><td class="">col 2 is</td><td class="">centered</td><td class="">$12</td></tr></tbody></table>",
58
+ "result": <React.Fragment>
59
+ <h1>
60
+ Hello
61
+ </h1>
62
+ <table>
63
+ <thead>
64
+ <tr
65
+ className=""
66
+ >
67
+ <td
68
+ className=""
69
+ >
70
+ Tables
71
+ </td>
72
+ <td
73
+ className=""
74
+ >
75
+ Are
76
+ </td>
77
+ <td
78
+ className=""
79
+ >
80
+ Cool
81
+ </td>
82
+ </tr>
83
+ </thead>
84
+ <tbody>
85
+ <tr
86
+ className=""
87
+ >
88
+ <td
89
+ className=""
90
+ >
91
+ col 3 is
92
+ </td>
93
+ <td
94
+ className=""
95
+ >
96
+ right-aligned
97
+ </td>
98
+ <td
99
+ className=""
100
+ >
101
+ $1600
102
+ </td>
103
+ </tr>
104
+ <tr
105
+ className=""
106
+ >
107
+ <td
108
+ className=""
109
+ >
110
+ col 2 is
111
+ </td>
112
+ <td
113
+ className=""
114
+ >
115
+ centered
116
+ </td>
117
+ <td
118
+ className=""
119
+ >
120
+ $12
121
+ </td>
122
+ </tr>
123
+ </tbody>
124
+ </table>
125
+ </React.Fragment>,
126
+ }
127
+ `)
128
+ })
129
+ test('table, only head', () => {
130
+ expect(
131
+ render(dedent`
132
+ # Hello
133
+
134
+ | Tables | Are | Cool |
135
+ | ------------- |:-------------:| -----:|
136
+
137
+ `),
138
+ ).toMatchInlineSnapshot(`
139
+ {
140
+ "errors": [],
141
+ "html": "<h1>Hello</h1><table><thead><tr class=""><td class="">Tables</td><td class="">Are</td><td class="">Cool</td></tr></thead></table>",
142
+ "result": <React.Fragment>
143
+ <h1>
144
+ Hello
145
+ </h1>
146
+ <table>
147
+ <thead>
148
+ <tr
149
+ className=""
150
+ >
151
+ <td
152
+ className=""
153
+ >
154
+ Tables
155
+ </td>
156
+ <td
157
+ className=""
158
+ >
159
+ Are
160
+ </td>
161
+ <td
162
+ className=""
163
+ >
164
+ Cool
165
+ </td>
166
+ </tr>
167
+ </thead>
168
+ </table>
169
+ </React.Fragment>,
170
+ }
171
+ `)
172
+ })
41
173
 
42
174
  test('inline jsx', () => {
43
175
  expect(
@@ -47,6 +179,7 @@ test('inline jsx', () => {
47
179
  ).toMatchInlineSnapshot(`
48
180
  {
49
181
  "errors": [],
182
+ "html": "<p><h1>hello</h1></p>",
50
183
  "result": <React.Fragment>
51
184
  <p>
52
185
  <Heading
@@ -70,6 +203,7 @@ test('block jsx', () => {
70
203
  ).toMatchInlineSnapshot(`
71
204
  {
72
205
  "errors": [],
206
+ "html": "<h1><blockquote><p>hello</p></blockquote></h1>",
73
207
  "result": <React.Fragment>
74
208
  <Heading
75
209
  level={2}
@@ -84,6 +218,32 @@ test('block jsx', () => {
84
218
  }
85
219
  `)
86
220
  })
221
+ test('complex jsx, self closing tags', () => {
222
+ expect(
223
+ render(dedent`
224
+ # hello <br />
225
+
226
+ <br />
227
+
228
+ content
229
+ `),
230
+ ).toMatchInlineSnapshot(`
231
+ {
232
+ "errors": [],
233
+ "html": "<h1>hello <br/></h1><br/><p>content</p>",
234
+ "result": <React.Fragment>
235
+ <h1>
236
+ hello
237
+ <br />
238
+ </h1>
239
+ <br />
240
+ <p>
241
+ content
242
+ </p>
243
+ </React.Fragment>,
244
+ }
245
+ `)
246
+ })
87
247
 
88
248
  test('missing components are ignored', () => {
89
249
  expect(
@@ -97,6 +257,7 @@ test('missing components are ignored', () => {
97
257
  "message": "Unsupported jsx component MissingComponent",
98
258
  },
99
259
  ],
260
+ "html": "",
100
261
  "result": <React.Fragment />,
101
262
  }
102
263
  `)
@@ -141,14 +302,15 @@ test('props parsing', () => {
141
302
  "message": "Expressions in jsx props are not supported (...{ spread: true })",
142
303
  },
143
304
  ],
305
+ "html": "<h1><p>hi</p></h1>",
144
306
  "result": <React.Fragment>
145
307
  <Heading
146
308
  backTick="some \${expr} value"
147
309
  boolean={false}
148
- doublequote="a \\" string"
310
+ doublequote="a " string"
149
311
  null={null}
150
312
  num={2}
151
- quote="a \\" string"
313
+ quote="a " string"
152
314
  someJson={
153
315
  {
154
316
  "a": 1,
@@ -173,6 +335,7 @@ test('breaks', () => {
173
335
  ).toMatchInlineSnapshot(`
174
336
  {
175
337
  "errors": [],
338
+ "html": "<p>To have a line break without a paragraph, you will need to use two trailing spaces.<br/>Note that this line is separate, but within the same paragraph.<br/>(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)</p>",
176
339
  "result": <React.Fragment>
177
340
  <p>
178
341
  To have a line break without a paragraph, you will need to use two trailing spaces.
@@ -215,7 +378,7 @@ test('kitchen sink', () => {
215
378
 
216
379
  ## Headers
217
380
 
218
- \`\`\`no-highlight
381
+
219
382
  # H1
220
383
  ## H2
221
384
  ### H3
@@ -230,7 +393,7 @@ test('kitchen sink', () => {
230
393
 
231
394
  Alt-H2
232
395
  ------
233
- \`\`\`
396
+
234
397
 
235
398
  # H1
236
399
  ## H2
@@ -608,6 +771,112 @@ test('kitchen sink', () => {
608
771
  "message": "Unsupported jsx component dl",
609
772
  },
610
773
  ],
774
+ "html": "<h1>Markdown Kitchen Sink</h1><p>This file is <a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet" title="">https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet</a> plus a few fixes and additions. Used by <a href="https://github.com/obedm503/bootmark" title="">obedm503/bootmark</a> to <a href="https://obedm503.github.io/bootmark/docs/markdown-cheatsheet.html" title="">demonstrate</a> it&#x27;s styling features.</p><p>This is intended as a quick reference and showcase. For more complete info, see <a href="http://daringfireball.net/projects/markdown/" title="">John Gruber&#x27;s original spec</a> and the <a href="http://github.github.com/github-flavored-markdown/" title="">Github-flavored Markdown info page</a>.</p><p>Note that there is also a <a href="./Markdown-Here-Cheatsheet" title="">Cheatsheet specific to Markdown Here</a> if that&#x27;s what you&#x27;re looking for. You can also check out <a href="./Other-Markdown-Tools" title="">more Markdown tools</a>.</p><h5>Table of Contents</h5><p><a href="#headers" title="">Headers</a><br/><a href="#emphasis" title="">Emphasis</a><br/><a href="#lists" title="">Lists</a><br/><a href="#links" title="">Links</a><br/><a href="#images" title="">Images</a><br/><a href="#code" title="">Code and Syntax Highlighting</a><br/><a href="#tables" title="">Tables</a><br/><a href="#blockquotes" title="">Blockquotes</a><br/><a href="#html" title="">Inline HTML</a><br/><a href="#hr" title="">Horizontal Rule</a><br/><a href="#lines" title="">Line Breaks</a><br/><a href="#videos" title="">YouTube Videos</a></p><a name="headers"></a><h2>Headers</h2><h1>H1</h1><h2>H2</h2><h3>H3</h3><h4>H4</h4><h5>H5</h5><h6>H6</h6><p>Alternatively, for H1 and H2, an underline-ish style:</p><h1>Alt-H1</h1><h2>Alt-H2</h2><h1>H1</h1><h2>H2</h2><h3>H3</h3><h4>H4</h4><h5>H5</h5><h6>H6</h6><p>Alternatively, for H1 and H2, an underline-ish style:</p><h1>Alt-H1</h1><h2>Alt-H2</h2><a name="emphasis"></a><h2>Emphasis</h2><pre><code>Emphasis, aka italics, with *asterisks* or _underscores_.
775
+
776
+ Strong emphasis, aka bold, with **asterisks** or __underscores__.
777
+
778
+ Combined emphasis with **asterisks and _underscores_**.
779
+
780
+ Strikethrough uses two tildes. ~~Scratch this.~~</code></pre><p>Emphasis, aka italics, with <em>asterisks</em> or <em>underscores</em>.</p><p>Strong emphasis, aka bold, with <strong>asterisks</strong> or <strong>underscores</strong>.</p><p>Combined emphasis with <strong>asterisks and <em>underscores</em></strong>.</p><p>Strikethrough uses two tildes. <del>Scratch this.</del></p><a name="lists"></a><h2>Lists</h2><p>(In this example, leading and trailing spaces are shown with with dots: ⋅)</p><pre><code>1. First ordered list item
781
+ 2. Another item
782
+ ⋅⋅* Unordered sub-list.
783
+ 1. Actual numbers don&#x27;t matter, just that it&#x27;s a number
784
+ ⋅⋅1. Ordered sub-list
785
+ 4. And another item.
786
+
787
+ ⋅⋅⋅You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we&#x27;ll use three here to also align the raw Markdown).
788
+
789
+ ⋅⋅⋅To have a line break without a paragraph, you will need to use two trailing spaces.⋅⋅
790
+ ⋅⋅⋅Note that this line is separate, but within the same paragraph.⋅⋅
791
+ ⋅⋅⋅(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
792
+
793
+ * Unordered list can use asterisks
794
+ - Or minuses
795
+ + Or pluses</code></pre><ol start="1"><li><p>First ordered list item</p></li><li><p>Another item</p></li></ol><ul><li><p>Unordered sub-list.</p></li></ul><ol start="1"><li><p>Actual numbers don&#x27;t matter, just that it&#x27;s a number</p></li><li><p>Ordered sub-list</p></li><li><p>And another item.</p><p>You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we&#x27;ll use three here to also align the raw Markdown).</p><p>To have a line break without a paragraph, you will need to use two trailing spaces.<br/>Note that this line is separate, but within the same paragraph.<br/>(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)</p></li></ol><ul><li><p>Unordered list can use asterisks</p></li></ul><ul><li><p>Or minuses</p></li></ul><ul><li><p>Or pluses</p></li></ul><a name="links"></a><h2>Links</h2><p>There are two ways to create links.</p><pre><code>[I&#x27;m an inline-style link](https://www.google.com)
796
+
797
+ [I&#x27;m an inline-style link with title](https://www.google.com &quot;Google&#x27;s Homepage&quot;)
798
+
799
+ [I&#x27;m a reference-style link][Arbitrary case-insensitive reference text]
800
+
801
+ [I&#x27;m a relative reference to a repository file](../blob/master/LICENSE)
802
+
803
+ [You can use numbers for reference-style link definitions][1]
804
+
805
+ Or leave it empty and use the [link text itself].
806
+
807
+ URLs and URLs in angle brackets will automatically get turned into links.
808
+ http://www.example.com and sometimes
809
+ example.com (but not on Github, for example).
810
+
811
+ Some text to show that the reference links can follow later.
812
+
813
+ [arbitrary case-insensitive reference text]: https://www.mozilla.org
814
+ [1]: http://slashdot.org
815
+ [link text itself]: http://www.reddit.com</code></pre><p><a href="https://www.google.com" title="">I&#x27;m an inline-style link</a></p><p><a href="https://www.google.com" title="Google&#x27;s Homepage">I&#x27;m an inline-style link with title</a></p><p><a href="https://www.mozilla.org">I&#x27;m a reference-style link</a></p><p><a href="../blob/master/LICENSE" title="">I&#x27;m a relative reference to a repository file</a></p><p><a href="http://slashdot.org">You can use numbers for reference-style link definitions</a></p><p>Or leave it empty and use the <a href="http://www.reddit.com">link text itself</a>.</p><p>URLs and URLs in angle brackets will automatically get turned into links.
816
+ <a href="http://www.example.com" title="">http://www.example.com</a> and sometimes
817
+ example.com (but not on Github, for example).</p><p>Some text to show that the reference links can follow later.</p><a name="images"></a><h2>Images</h2><pre><code>Here&#x27;s our logo (hover to see the title text):
818
+
819
+ Inline-style:
820
+ ![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png &quot;Logo Title Text 1&quot;)
821
+
822
+ Reference-style:
823
+ ![alt text][logo]
824
+
825
+ [logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png &quot;Logo Title Text 2&quot;</code></pre><p>Here&#x27;s our logo (hover to see the title text):</p><p>Inline-style:
826
+ <img src="https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png" alt="alt text" title="Logo Title Text 1"/></p><p>Reference-style:
827
+ </p><a name="code"></a><h2>Code and Syntax Highlighting</h2><p>Code blocks are part of the Markdown spec, but syntax highlighting isn&#x27;t. However, many renderers -- like Github&#x27;s and <em>Markdown Here</em> -- support syntax highlighting. Which languages are supported and how those language names should be written will vary from renderer to renderer. <em>Markdown Here</em> supports highlighting for dozens of languages (and not-really-languages, like diffs and HTTP headers); to see the complete list, and how to write the language names, see the <a href="http://softwaremaniacs.org/media/soft/highlight/test.html" title="">highlight.js demo page</a>.</p><pre><code>Inline \`code\` has \`back-ticks around\` it.</code></pre><p>Inline <code>code</code> has <code>back-ticks around</code> it.</p><p>Blocks of code are either fenced by lines with three back-ticks <code>\`\`\`</code>, or are indented with four spaces. I recommend only using the fenced code blocks -- they&#x27;re easier and only they support syntax highlighting.</p><pre><code>var s = &quot;JavaScript syntax highlighting&quot;;
828
+ alert(s);</code></pre><pre><code>s = &quot;Python syntax highlighting&quot;
829
+ print s</code></pre><pre><code>No language indicated, so no syntax highlighting.
830
+ But let&#x27;s throw in a &amp;lt;b&amp;gt;tag&amp;lt;/b&amp;gt;.</code></pre><pre><code>var s = &quot;JavaScript syntax highlighting&quot;;
831
+ alert(s);</code></pre><pre><code>s = &quot;Python syntax highlighting&quot;
832
+ print s</code></pre><pre><code>No language indicated, so no syntax highlighting in Markdown Here (varies on Github).
833
+ But let&#x27;s throw in a &lt;b&gt;tag&lt;/b&gt;.</code></pre><a name="tables"></a><h2>Tables</h2><p>Tables aren&#x27;t part of the core Markdown spec, but they are part of GFM and <em>Markdown Here</em> supports them. They are an easy way of adding tables to your email -- a task that would otherwise require copy-pasting from another application.</p><pre><code>Colons can be used to align columns.
834
+
835
+ | Tables | Are | Cool |
836
+ | ------------- |:-------------:| -----:|
837
+ | col 3 is | right-aligned | $1600 |
838
+ | col 2 is | centered | $12 |
839
+ | zebra stripes | are neat | $1 |
840
+
841
+ There must be at least 3 dashes separating each header cell.
842
+ The outer pipes (|) are optional, and you don&#x27;t need to make the
843
+ raw Markdown line up prettily. You can also use inline Markdown.
844
+
845
+ Markdown | Less | Pretty
846
+ --- | --- | ---
847
+ *Still* | \`renders\` | **nicely**
848
+ 1 | 2 | 3</code></pre><p>Colons can be used to align columns.</p><table><thead><tr class=""><td class="">Tables</td><td class="">Are</td><td class="">Cool</td></tr></thead><tbody><tr class=""><td class="">col 3 is</td><td class="">right-aligned</td><td class="">$1600</td></tr><tr class=""><td class="">col 2 is</td><td class="">centered</td><td class="">$12</td></tr><tr class=""><td class="">zebra stripes</td><td class="">are neat</td><td class="">$1</td></tr></tbody></table><p>There must be at least 3 dashes separating each header cell. The outer pipes (|) are optional, and you don&#x27;t need to make the raw Markdown line up prettily. You can also use inline Markdown.</p><table><thead><tr class=""><td class="">Markdown</td><td class="">Less</td><td class="">Pretty</td></tr></thead><tbody><tr class=""><td class=""><em>Still</em></td><td class=""><code>renders</code></td><td class=""><strong>nicely</strong></td></tr><tr class=""><td class="">1</td><td class="">2</td><td class="">3</td></tr></tbody></table><a name="blockquotes"></a><h2>Blockquotes</h2><pre><code>&gt; Blockquotes are very handy in email to emulate reply text.
849
+ &gt; This line is part of the same quote.
850
+
851
+ Quote break.
852
+
853
+ &gt; This is a very long line that will still be quoted properly when it wraps. Oh boy let&#x27;s keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote. </code></pre><blockquote><p>Blockquotes are very handy in email to emulate reply text.
854
+ This line is part of the same quote.</p></blockquote><p>Quote break.</p><blockquote><p>This is a very long line that will still be quoted properly when it wraps. Oh boy let&#x27;s keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can <em>put</em> <strong>Markdown</strong> into a blockquote.</p></blockquote><a name="html"></a><h2>Inline HTML</h2><p>You can also use raw HTML in your Markdown, and it&#x27;ll mostly work pretty well.</p><pre><code>&lt;dl&gt;
855
+ &lt;dt&gt;Definition list&lt;/dt&gt;
856
+ &lt;dd&gt;Is something people use sometimes.&lt;/dd&gt;
857
+
858
+ &lt;dt&gt;Markdown in HTML&lt;/dt&gt;
859
+ &lt;dd&gt;Does *not* work **very** well. Use HTML &lt;em&gt;tags&lt;/em&gt;.&lt;/dd&gt;
860
+ &lt;/dl&gt;</code></pre><a name="hr"></a><h2>Horizontal Rule</h2><pre><code>Three or more...
861
+
862
+ ---
863
+
864
+ Hyphens
865
+
866
+ ***
867
+
868
+ Asterisks
869
+
870
+ ___
871
+
872
+ Underscores</code></pre><p>Three or more...</p><hr/><p>Hyphens</p><hr/><p>Asterisks</p><hr/><p>Underscores</p><a name="lines"></a><h2>Line Breaks</h2><p>My basic recommendation for learning how line breaks work is to experiment and discover -- hit &lt;Enter&gt; once (i.e., insert one newline), then hit it twice (i.e., insert two newlines), see what happens. You&#x27;ll soon learn to get what you want. &quot;Markdown Toggle&quot; is your friend.</p><p>Here are some things to try out:</p><pre><code>Here&#x27;s a line for us to start with.
873
+
874
+ This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
875
+
876
+ This line is also a separate paragraph, but...
877
+ This line is only separated by a single newline, so it&#x27;s a separate line in the *same paragraph*.</code></pre><p>Here&#x27;s a line for us to start with.</p><p>This line is separated from the one above by two newlines, so it will be a <em>separate paragraph</em>.</p><p>This line is also begins a separate paragraph, but...<br/>This line is only separated by a single newline, so it&#x27;s a separate line in the <em>same paragraph</em>.</p><p>(Technical note: <em>Markdown Here</em> uses GFM line breaks, so there&#x27;s no need to use MD&#x27;s two-space line breaks.)</p><a name="videos"></a><h2>YouTube Videos</h2><p>They can&#x27;t be added directly but you can add an image with a link to the video like this:</p><pre><code>&lt;a href=&quot;http://www.youtube.com/watch?feature=player_embedded&amp;v=YOUTUBE_VIDEO_ID_HERE
878
+ &quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg&quot;
879
+ alt=&quot;IMAGE ALT TEXT HERE&quot; width=&quot;240&quot; height=&quot;180&quot; border=&quot;10&quot; /&gt;&lt;/a&gt;</code></pre><p>Or, in pure Markdown, but losing the image sizing and border:</p><pre><code>[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg)](http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE)</code></pre>",
611
880
  "result": <React.Fragment>
612
881
  <h1>
613
882
  Markdown Kitchen Sink
@@ -764,24 +1033,33 @@ test('kitchen sink', () => {
764
1033
  <h2>
765
1034
  Headers
766
1035
  </h2>
767
- <pre>
768
- <code>
769
- # H1
770
- ## H2
771
- ### H3
772
- #### H4
773
- ##### H5
774
- ###### H6
775
-
776
- Alternatively, for H1 and H2, an underline-ish style:
777
-
778
- Alt-H1
779
- ======
780
-
781
- Alt-H2
782
- ------
783
- </code>
784
- </pre>
1036
+ <h1>
1037
+ H1
1038
+ </h1>
1039
+ <h2>
1040
+ H2
1041
+ </h2>
1042
+ <h3>
1043
+ H3
1044
+ </h3>
1045
+ <h4>
1046
+ H4
1047
+ </h4>
1048
+ <h5>
1049
+ H5
1050
+ </h5>
1051
+ <h6>
1052
+ H6
1053
+ </h6>
1054
+ <p>
1055
+ Alternatively, for H1 and H2, an underline-ish style:
1056
+ </p>
1057
+ <h1>
1058
+ Alt-H1
1059
+ </h1>
1060
+ <h2>
1061
+ Alt-H2
1062
+ </h2>
785
1063
  <h1>
786
1064
  H1
787
1065
  </h1>
@@ -1215,150 +1493,158 @@ test('kitchen sink', () => {
1215
1493
  Colons can be used to align columns.
1216
1494
  </p>
1217
1495
  <table>
1218
- <tr
1219
- className=""
1220
- >
1221
- <td
1222
- className=""
1223
- >
1224
- Tables
1225
- </td>
1226
- <td
1227
- className=""
1228
- >
1229
- Are
1230
- </td>
1231
- <td
1232
- className=""
1233
- >
1234
- Cool
1235
- </td>
1236
- </tr>
1237
- <tr
1238
- className=""
1239
- >
1240
- <td
1241
- className=""
1242
- >
1243
- col 3 is
1244
- </td>
1245
- <td
1246
- className=""
1247
- >
1248
- right-aligned
1249
- </td>
1250
- <td
1251
- className=""
1252
- >
1253
- $1600
1254
- </td>
1255
- </tr>
1256
- <tr
1257
- className=""
1258
- >
1259
- <td
1260
- className=""
1261
- >
1262
- col 2 is
1263
- </td>
1264
- <td
1265
- className=""
1266
- >
1267
- centered
1268
- </td>
1269
- <td
1496
+ <thead>
1497
+ <tr
1270
1498
  className=""
1271
1499
  >
1272
- $12
1273
- </td>
1274
- </tr>
1275
- <tr
1276
- className=""
1277
- >
1278
- <td
1500
+ <td
1501
+ className=""
1502
+ >
1503
+ Tables
1504
+ </td>
1505
+ <td
1506
+ className=""
1507
+ >
1508
+ Are
1509
+ </td>
1510
+ <td
1511
+ className=""
1512
+ >
1513
+ Cool
1514
+ </td>
1515
+ </tr>
1516
+ </thead>
1517
+ <tbody>
1518
+ <tr
1279
1519
  className=""
1280
1520
  >
1281
- zebra stripes
1282
- </td>
1283
- <td
1521
+ <td
1522
+ className=""
1523
+ >
1524
+ col 3 is
1525
+ </td>
1526
+ <td
1527
+ className=""
1528
+ >
1529
+ right-aligned
1530
+ </td>
1531
+ <td
1532
+ className=""
1533
+ >
1534
+ $1600
1535
+ </td>
1536
+ </tr>
1537
+ <tr
1284
1538
  className=""
1285
1539
  >
1286
- are neat
1287
- </td>
1288
- <td
1540
+ <td
1541
+ className=""
1542
+ >
1543
+ col 2 is
1544
+ </td>
1545
+ <td
1546
+ className=""
1547
+ >
1548
+ centered
1549
+ </td>
1550
+ <td
1551
+ className=""
1552
+ >
1553
+ $12
1554
+ </td>
1555
+ </tr>
1556
+ <tr
1289
1557
  className=""
1290
1558
  >
1291
- $1
1292
- </td>
1293
- </tr>
1559
+ <td
1560
+ className=""
1561
+ >
1562
+ zebra stripes
1563
+ </td>
1564
+ <td
1565
+ className=""
1566
+ >
1567
+ are neat
1568
+ </td>
1569
+ <td
1570
+ className=""
1571
+ >
1572
+ $1
1573
+ </td>
1574
+ </tr>
1575
+ </tbody>
1294
1576
  </table>
1295
1577
  <p>
1296
1578
  There must be at least 3 dashes separating each header cell. The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.
1297
1579
  </p>
1298
1580
  <table>
1299
- <tr
1300
- className=""
1301
- >
1302
- <td
1303
- className=""
1304
- >
1305
- Markdown
1306
- </td>
1307
- <td
1308
- className=""
1309
- >
1310
- Less
1311
- </td>
1312
- <td
1313
- className=""
1314
- >
1315
- Pretty
1316
- </td>
1317
- </tr>
1318
- <tr
1319
- className=""
1320
- >
1321
- <td
1322
- className=""
1323
- >
1324
- <em>
1325
- Still
1326
- </em>
1327
- </td>
1328
- <td
1329
- className=""
1330
- >
1331
- <code>
1332
- renders
1333
- </code>
1334
- </td>
1335
- <td
1336
- className=""
1337
- >
1338
- <strong>
1339
- nicely
1340
- </strong>
1341
- </td>
1342
- </tr>
1343
- <tr
1344
- className=""
1345
- >
1346
- <td
1581
+ <thead>
1582
+ <tr
1347
1583
  className=""
1348
1584
  >
1349
- 1
1350
- </td>
1351
- <td
1585
+ <td
1586
+ className=""
1587
+ >
1588
+ Markdown
1589
+ </td>
1590
+ <td
1591
+ className=""
1592
+ >
1593
+ Less
1594
+ </td>
1595
+ <td
1596
+ className=""
1597
+ >
1598
+ Pretty
1599
+ </td>
1600
+ </tr>
1601
+ </thead>
1602
+ <tbody>
1603
+ <tr
1352
1604
  className=""
1353
1605
  >
1354
- 2
1355
- </td>
1356
- <td
1606
+ <td
1607
+ className=""
1608
+ >
1609
+ <em>
1610
+ Still
1611
+ </em>
1612
+ </td>
1613
+ <td
1614
+ className=""
1615
+ >
1616
+ <code>
1617
+ renders
1618
+ </code>
1619
+ </td>
1620
+ <td
1621
+ className=""
1622
+ >
1623
+ <strong>
1624
+ nicely
1625
+ </strong>
1626
+ </td>
1627
+ </tr>
1628
+ <tr
1357
1629
  className=""
1358
1630
  >
1359
- 3
1360
- </td>
1361
- </tr>
1631
+ <td
1632
+ className=""
1633
+ >
1634
+ 1
1635
+ </td>
1636
+ <td
1637
+ className=""
1638
+ >
1639
+ 2
1640
+ </td>
1641
+ <td
1642
+ className=""
1643
+ >
1644
+ 3
1645
+ </td>
1646
+ </tr>
1647
+ </tbody>
1362
1648
  </table>
1363
1649
  <a
1364
1650
  name="blockquotes"