safe-mdx 0.0.5 → 0.1.0

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.
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import React from 'react';
3
2
  import dedent from 'dedent';
4
- import { test, expect } from 'vitest';
5
- import { MdastToJsx } from './safe-mdx.js';
3
+ import React from 'react';
6
4
  import { renderToStaticMarkup } from 'react-dom/server';
5
+ import { expect, test } from 'vitest';
6
+ import { mdastBfs, MdastToJsx, mdxParse } from './safe-mdx.js';
7
7
  void React;
8
8
  const components = {
9
9
  Heading({ level, children }) {
@@ -17,15 +17,162 @@ function render(code) {
17
17
  // console.log(JSON.stringify(result, null, 2))
18
18
  return { result, errors: visitor.errors || [], html };
19
19
  }
20
+ import { htmlToJsx } from 'html-to-jsx-transform';
21
+ test('htmlToJsx', () => {
22
+ expect(htmlToJsx('<p x="y">')).toMatchInlineSnapshot(`"<p x="y" />"`);
23
+ expect(htmlToJsx('<p>text</p>')).toMatchInlineSnapshot(`"<p>text</p>"`);
24
+ expect(htmlToJsx('before <p>text</p>')).toMatchInlineSnapshot(`"<>before <p>text</p></>"`);
25
+ expect(htmlToJsx('<nonexisting>text</nonexisting>')).toMatchInlineSnapshot(`"<nonexisting>text</nonexisting>"`);
26
+ });
27
+ test('markdown inside jsx', () => {
28
+ const code = dedent `
29
+ # Hello
30
+
31
+ <Heading prop="value">
32
+ Component *children*
33
+ </Heading>
34
+
35
+ <figure>
36
+ some *bold* content
37
+ </figure>
38
+
39
+ `;
40
+ expect(render(code)).toMatchInlineSnapshot(`
41
+ {
42
+ "errors": [],
43
+ "html": "<h1>Hello</h1><h1><p>Component <em>children</em></p></h1><figure><p>some <em>bold</em> content</p></figure>",
44
+ "result": <React.Fragment>
45
+ <h1>
46
+ Hello
47
+ </h1>
48
+ <Heading
49
+ prop="value"
50
+ >
51
+ <p>
52
+ Component
53
+ <em>
54
+ children
55
+ </em>
56
+ </p>
57
+ </Heading>
58
+ <figure>
59
+ <p>
60
+ some
61
+ <em>
62
+ bold
63
+ </em>
64
+ content
65
+ </p>
66
+ </figure>
67
+ </React.Fragment>,
68
+ }
69
+ `);
70
+ });
71
+ test('remark and jsx does not wrap in p', () => {
72
+ const code = dedent `
73
+ ---
74
+ title: createSearchParams
75
+ ---
76
+
77
+ # Hello
78
+
79
+ i am a paragraph
80
+
81
+ <Heading>heading</Heading>
82
+
83
+ sone \`inline code\`
84
+
85
+ \`\`\`tsx
86
+ some code
87
+ \`\`\`
88
+
89
+ what
90
+ `;
91
+ const mdast = mdxParse(code);
92
+ mdastBfs(mdast, (x) => {
93
+ delete x.position;
94
+ });
95
+ expect(mdast).toMatchInlineSnapshot(`
96
+ {
97
+ "children": [
98
+ {
99
+ "type": "yaml",
100
+ "value": "title: createSearchParams",
101
+ },
102
+ {
103
+ "children": [
104
+ {
105
+ "type": "text",
106
+ "value": "Hello",
107
+ },
108
+ ],
109
+ "depth": 1,
110
+ "type": "heading",
111
+ },
112
+ {
113
+ "children": [
114
+ {
115
+ "type": "text",
116
+ "value": "i am a paragraph",
117
+ },
118
+ ],
119
+ "type": "paragraph",
120
+ },
121
+ {
122
+ "attributes": [],
123
+ "children": [
124
+ {
125
+ "type": "text",
126
+ "value": "heading",
127
+ },
128
+ ],
129
+ "name": "Heading",
130
+ "type": "mdxJsxFlowElement",
131
+ },
132
+ {
133
+ "children": [
134
+ {
135
+ "type": "text",
136
+ "value": "sone ",
137
+ },
138
+ {
139
+ "type": "inlineCode",
140
+ "value": "inline code",
141
+ },
142
+ ],
143
+ "type": "paragraph",
144
+ },
145
+ {
146
+ "lang": "tsx",
147
+ "meta": null,
148
+ "type": "code",
149
+ "value": "some code",
150
+ },
151
+ {
152
+ "children": [
153
+ {
154
+ "type": "text",
155
+ "value": "what",
156
+ },
157
+ ],
158
+ "type": "paragraph",
159
+ },
160
+ ],
161
+ "type": "root",
162
+ }
163
+ `);
164
+ });
20
165
  test('basic', () => {
21
166
  expect(render(dedent `
22
167
  # Hello
23
168
 
24
169
  i am a paragraph
170
+
171
+ <Heading>heading</Heading>
25
172
  `)).toMatchInlineSnapshot(`
26
173
  {
27
174
  "errors": [],
28
- "html": "<h1>Hello</h1><p>i am a paragraph</p>",
175
+ "html": "<h1>Hello</h1><p>i am a paragraph</p><h1>heading</h1>",
29
176
  "result": <React.Fragment>
30
177
  <h1>
31
178
  Hello
@@ -33,6 +180,9 @@ test('basic', () => {
33
180
  <p>
34
181
  i am a paragraph
35
182
  </p>
183
+ <Heading>
184
+ heading
185
+ </Heading>
36
186
  </React.Fragment>,
37
187
  }
38
188
  `);
@@ -42,7 +192,7 @@ test('frontmatter', () => {
42
192
  ---
43
193
  hello: 5
44
194
  ---
45
-
195
+
46
196
  # Hello
47
197
 
48
198
  i am a paragraph
@@ -150,7 +300,7 @@ test('table, only head', () => {
150
300
 
151
301
  | Tables | Are | Cool |
152
302
  | ------------- |:-------------:| -----:|
153
-
303
+
154
304
  `)).toMatchInlineSnapshot(`
155
305
  {
156
306
  "errors": [],
@@ -192,15 +342,13 @@ test('inline jsx', () => {
192
342
  `)).toMatchInlineSnapshot(`
193
343
  {
194
344
  "errors": [],
195
- "html": "<p><h1>hello</h1></p>",
345
+ "html": "<h1>hello</h1>",
196
346
  "result": <React.Fragment>
197
- <p>
198
- <Heading
199
- level={2}
200
- >
201
- hello
202
- </Heading>
203
- </p>
347
+ <Heading
348
+ level={2}
349
+ >
350
+ hello
351
+ </Heading>
204
352
  </React.Fragment>,
205
353
  }
206
354
  `);
@@ -269,7 +417,7 @@ test('missing components are ignored', () => {
269
417
  });
270
418
  test('props parsing', () => {
271
419
  expect(render(dedent `
272
- <Heading
420
+ <Heading
273
421
  num={2}
274
422
  doublequote={"a \" string"}
275
423
  quote={'a \' string'}
@@ -301,7 +449,7 @@ test('props parsing', () => {
301
449
  "message": "Expressions in jsx props are not supported (jsx={<SomeComponent />})",
302
450
  },
303
451
  {
304
- "message": "Expressions in jsx props are not supported (...{ spread: true })",
452
+ "message": "Expressions in jsx props are not supported (...{ spread: true })",
305
453
  },
306
454
  ],
307
455
  "html": "<h1><p>hi</p></h1>",
@@ -329,20 +477,20 @@ test('props parsing', () => {
329
477
  });
330
478
  test('breaks', () => {
331
479
  expect(render(dedent `
332
- To have a line break without a paragraph, you will need to use two trailing spaces.
333
- Note that this line is separate, but within the same paragraph.
480
+ To have a line break without a paragraph, you will need to use two trailing spaces.
481
+ Note that this line is separate, but within the same paragraph.
334
482
  (This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
335
483
  `)).toMatchInlineSnapshot(`
336
484
  {
337
485
  "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>",
486
+ "html": "<p>To have a line break without a paragraph, you will need to use two trailing spaces.
487
+ Note that this line is separate, but within the same paragraph.
488
+ (This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)</p>",
339
489
  "result": <React.Fragment>
340
490
  <p>
341
491
  To have a line break without a paragraph, you will need to use two trailing spaces.
342
- <br />
343
- Note that this line is separate, but within the same paragraph.
344
- <br />
345
- (This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
492
+ Note that this line is separate, but within the same paragraph.
493
+ (This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
346
494
  </p>
347
495
  </React.Fragment>,
348
496
  }
@@ -353,410 +501,410 @@ test('kitchen sink', () => {
353
501
  expect(render(dedent `
354
502
  # Markdown Kitchen Sink
355
503
  This file is https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet plus a few fixes and additions. Used by [obedm503/bootmark](https://github.com/obedm503/bootmark) to [demonstrate](https://obedm503.github.io/bootmark/docs/markdown-cheatsheet.html) it's styling features.
356
-
504
+
357
505
  This is intended as a quick reference and showcase. For more complete info, see [John Gruber's original spec](http://daringfireball.net/projects/markdown/) and the [Github-flavored Markdown info page](http://github.github.com/github-flavored-markdown/).
358
-
506
+
359
507
  Note that there is also a [Cheatsheet specific to Markdown Here](./Markdown-Here-Cheatsheet) if that's what you're looking for. You can also check out [more Markdown tools](./Other-Markdown-Tools).
360
-
361
- ##### Table of Contents
362
- [Headers](#headers)
363
- [Emphasis](#emphasis)
364
- [Lists](#lists)
365
- [Links](#links)
366
- [Images](#images)
367
- [Code and Syntax Highlighting](#code)
368
- [Tables](#tables)
369
- [Blockquotes](#blockquotes)
370
- [Inline HTML](#html)
371
- [Horizontal Rule](#hr)
372
- [Line Breaks](#lines)
373
- [YouTube Videos](#videos)
374
-
508
+
509
+ ##### Table of Contents
510
+ [Headers](#headers)
511
+ [Emphasis](#emphasis)
512
+ [Lists](#lists)
513
+ [Links](#links)
514
+ [Images](#images)
515
+ [Code and Syntax Highlighting](#code)
516
+ [Tables](#tables)
517
+ [Blockquotes](#blockquotes)
518
+ [Inline HTML](#html)
519
+ [Horizontal Rule](#hr)
520
+ [Line Breaks](#lines)
521
+ [YouTube Videos](#videos)
522
+
375
523
  <a name="headers"></a>
376
-
524
+
377
525
  ## Headers
378
-
379
-
526
+
527
+
380
528
  # H1
381
529
  ## H2
382
530
  ### H3
383
531
  #### H4
384
532
  ##### H5
385
533
  ###### H6
386
-
534
+
387
535
  Alternatively, for H1 and H2, an underline-ish style:
388
-
536
+
389
537
  Alt-H1
390
538
  ======
391
-
539
+
392
540
  Alt-H2
393
541
  ------
394
-
395
-
542
+
543
+
396
544
  # H1
397
545
  ## H2
398
546
  ### H3
399
547
  #### H4
400
548
  ##### H5
401
549
  ###### H6
402
-
550
+
403
551
  Alternatively, for H1 and H2, an underline-ish style:
404
-
552
+
405
553
  Alt-H1
406
554
  ======
407
-
555
+
408
556
  Alt-H2
409
557
  ------
410
-
558
+
411
559
  <a name="emphasis"></a>
412
-
560
+
413
561
  ## Emphasis
414
-
562
+
415
563
  \`\`\`no-highlight
416
564
  Emphasis, aka italics, with *asterisks* or _underscores_.
417
-
565
+
418
566
  Strong emphasis, aka bold, with **asterisks** or __underscores__.
419
-
567
+
420
568
  Combined emphasis with **asterisks and _underscores_**.
421
-
569
+
422
570
  Strikethrough uses two tildes. ~~Scratch this.~~
423
571
  \`\`\`
424
-
572
+
425
573
  Emphasis, aka italics, with *asterisks* or _underscores_.
426
-
574
+
427
575
  Strong emphasis, aka bold, with **asterisks** or __underscores__.
428
-
576
+
429
577
  Combined emphasis with **asterisks and _underscores_**.
430
-
578
+
431
579
  Strikethrough uses two tildes. ~~Scratch this.~~
432
-
433
-
580
+
581
+
434
582
  <a name="lists"></a>
435
-
583
+
436
584
  ## Lists
437
-
585
+
438
586
  (In this example, leading and trailing spaces are shown with with dots: ⋅)
439
-
587
+
440
588
  \`\`\`no-highlight
441
589
  1. First ordered list item
442
590
  2. Another item
443
- ⋅⋅* Unordered sub-list.
591
+ ⋅⋅* Unordered sub-list.
444
592
  1. Actual numbers don't matter, just that it's a number
445
593
  ⋅⋅1. Ordered sub-list
446
594
  4. And another item.
447
-
595
+
448
596
  ⋅⋅⋅You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown).
449
-
597
+
450
598
  ⋅⋅⋅To have a line break without a paragraph, you will need to use two trailing spaces.⋅⋅
451
599
  ⋅⋅⋅Note that this line is separate, but within the same paragraph.⋅⋅
452
600
  ⋅⋅⋅(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
453
-
601
+
454
602
  * Unordered list can use asterisks
455
603
  - Or minuses
456
604
  + Or pluses
457
605
  \`\`\`
458
-
606
+
459
607
  1. First ordered list item
460
608
  2. Another item
461
- * Unordered sub-list.
609
+ * Unordered sub-list.
462
610
  1. Actual numbers don't matter, just that it's a number
463
611
  1. Ordered sub-list
464
612
  4. And another item.
465
-
613
+
466
614
  You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown).
467
-
468
- To have a line break without a paragraph, you will need to use two trailing spaces.
469
- Note that this line is separate, but within the same paragraph.
615
+
616
+ To have a line break without a paragraph, you will need to use two trailing spaces.
617
+ Note that this line is separate, but within the same paragraph.
470
618
  (This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
471
-
619
+
472
620
  * Unordered list can use asterisks
473
621
  - Or minuses
474
622
  + Or pluses
475
-
623
+
476
624
  <a name="links"></a>
477
-
625
+
478
626
  ## Links
479
-
627
+
480
628
  There are two ways to create links.
481
-
629
+
482
630
  \`\`\`no-highlight
483
631
  [I'm an inline-style link](https://www.google.com)
484
-
632
+
485
633
  [I'm an inline-style link with title](https://www.google.com "Google's Homepage")
486
-
634
+
487
635
  [I'm a reference-style link][Arbitrary case-insensitive reference text]
488
-
636
+
489
637
  [I'm a relative reference to a repository file](../blob/master/LICENSE)
490
-
638
+
491
639
  [You can use numbers for reference-style link definitions][1]
492
-
640
+
493
641
  Or leave it empty and use the [link text itself].
494
-
495
- URLs and URLs in angle brackets will automatically get turned into links.
496
- http://www.example.com and sometimes
642
+
643
+ URLs and URLs in angle brackets will automatically get turned into links.
644
+ http://www.example.com and sometimes
497
645
  example.com (but not on Github, for example).
498
-
646
+
499
647
  Some text to show that the reference links can follow later.
500
-
648
+
501
649
  [arbitrary case-insensitive reference text]: https://www.mozilla.org
502
650
  [1]: http://slashdot.org
503
651
  [link text itself]: http://www.reddit.com
504
652
  \`\`\`
505
-
653
+
506
654
  [I'm an inline-style link](https://www.google.com)
507
-
655
+
508
656
  [I'm an inline-style link with title](https://www.google.com "Google's Homepage")
509
-
657
+
510
658
  [I'm a reference-style link][Arbitrary case-insensitive reference text]
511
-
659
+
512
660
  [I'm a relative reference to a repository file](../blob/master/LICENSE)
513
-
661
+
514
662
  [You can use numbers for reference-style link definitions][1]
515
-
663
+
516
664
  Or leave it empty and use the [link text itself].
517
-
518
- URLs and URLs in angle brackets will automatically get turned into links.
519
- http://www.example.com and sometimes
665
+
666
+ URLs and URLs in angle brackets will automatically get turned into links.
667
+ http://www.example.com and sometimes
520
668
  example.com (but not on Github, for example).
521
-
669
+
522
670
  Some text to show that the reference links can follow later.
523
-
671
+
524
672
  [arbitrary case-insensitive reference text]: https://www.mozilla.org
525
673
  [1]: http://slashdot.org
526
674
  [link text itself]: http://www.reddit.com
527
-
675
+
528
676
  <a name="images"></a>
529
-
677
+
530
678
  ## Images
531
-
679
+
532
680
  \`\`\`no-highlight
533
681
  Here's our logo (hover to see the title text):
534
-
535
- Inline-style:
682
+
683
+ Inline-style:
536
684
  ![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1")
537
-
538
- Reference-style:
685
+
686
+ Reference-style:
539
687
  ![alt text][logo]
540
-
688
+
541
689
  [logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"
542
690
  \`\`\`
543
-
691
+
544
692
  Here's our logo (hover to see the title text):
545
-
546
- Inline-style:
693
+
694
+ Inline-style:
547
695
  ![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1")
548
-
549
- Reference-style:
696
+
697
+ Reference-style:
550
698
  ![alt text][logo]
551
-
699
+
552
700
  [logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"
553
-
701
+
554
702
  <a name="code"></a>
555
-
703
+
556
704
  ## Code and Syntax Highlighting
557
-
705
+
558
706
  Code blocks are part of the Markdown spec, but syntax highlighting isn't. However, many renderers -- like Github's and *Markdown Here* -- support syntax highlighting. Which languages are supported and how those language names should be written will vary from renderer to renderer. *Markdown Here* 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 [highlight.js demo page](http://softwaremaniacs.org/media/soft/highlight/test.html).
559
-
707
+
560
708
  \`\`\`no-highlight
561
709
  Inline \`code\` has \`back-ticks around\` it.
562
710
  \`\`\`
563
-
711
+
564
712
  Inline \`code\` has \`back-ticks around\` it.
565
-
713
+
566
714
  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're easier and only they support syntax highlighting.
567
-
715
+
568
716
  \`\`\`javascript
569
717
  var s = "JavaScript syntax highlighting";
570
718
  alert(s);
571
719
  \`\`\`
572
-
720
+
573
721
  \`\`\`python
574
722
  s = "Python syntax highlighting"
575
723
  print s
576
724
  \`\`\`
577
-
725
+
578
726
  \`\`\`
579
- No language indicated, so no syntax highlighting.
727
+ No language indicated, so no syntax highlighting.
580
728
  But let's throw in a &lt;b&gt;tag&lt;/b&gt;.
581
729
  \`\`\`
582
-
583
-
584
-
585
-
730
+
731
+
732
+
733
+
586
734
  \`\`\`javascript
587
735
  var s = "JavaScript syntax highlighting";
588
736
  alert(s);
589
737
  \`\`\`
590
-
738
+
591
739
  \`\`\`python
592
740
  s = "Python syntax highlighting"
593
741
  print s
594
742
  \`\`\`
595
-
743
+
596
744
  \`\`\`
597
- No language indicated, so no syntax highlighting in Markdown Here (varies on Github).
745
+ No language indicated, so no syntax highlighting in Markdown Here (varies on Github).
598
746
  But let's throw in a <b>tag</b>.
599
747
  \`\`\`
600
-
601
-
748
+
749
+
602
750
  <a name="tables"></a>
603
-
751
+
604
752
  ## Tables
605
-
753
+
606
754
  Tables aren't part of the core Markdown spec, but they are part of GFM and *Markdown Here* supports them. They are an easy way of adding tables to your email -- a task that would otherwise require copy-pasting from another application.
607
-
755
+
608
756
  \`\`\`no-highlight
609
757
  Colons can be used to align columns.
610
-
758
+
611
759
  | Tables | Are | Cool |
612
760
  | ------------- |:-------------:| -----:|
613
761
  | col 3 is | right-aligned | $1600 |
614
762
  | col 2 is | centered | $12 |
615
763
  | zebra stripes | are neat | $1 |
616
-
764
+
617
765
  There must be at least 3 dashes separating each header cell.
618
- The outer pipes (|) are optional, and you don't need to make the
766
+ The outer pipes (|) are optional, and you don't need to make the
619
767
  raw Markdown line up prettily. You can also use inline Markdown.
620
-
768
+
621
769
  Markdown | Less | Pretty
622
770
  --- | --- | ---
623
771
  *Still* | \`renders\` | **nicely**
624
772
  1 | 2 | 3
625
773
  \`\`\`
626
-
774
+
627
775
  Colons can be used to align columns.
628
-
776
+
629
777
  | Tables | Are | Cool |
630
778
  | ------------- |:-------------:| -----:|
631
779
  | col 3 is | right-aligned | $1600 |
632
780
  | col 2 is | centered | $12 |
633
781
  | zebra stripes | are neat | $1 |
634
-
782
+
635
783
  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.
636
-
784
+
637
785
  Markdown | Less | Pretty
638
786
  --- | --- | ---
639
787
  *Still* | \`renders\` | **nicely**
640
788
  1 | 2 | 3
641
-
789
+
642
790
  <a name="blockquotes"></a>
643
-
791
+
644
792
  ## Blockquotes
645
-
793
+
646
794
  \`\`\`no-highlight
647
795
  > Blockquotes are very handy in email to emulate reply text.
648
796
  > This line is part of the same quote.
649
-
797
+
650
798
  Quote break.
651
-
652
- > This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote.
799
+
800
+ > This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote.
653
801
  \`\`\`
654
-
802
+
655
803
  > Blockquotes are very handy in email to emulate reply text.
656
804
  > This line is part of the same quote.
657
-
805
+
658
806
  Quote break.
659
-
660
- > This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote.
661
-
807
+
808
+ > This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote.
809
+
662
810
  <a name="html"></a>
663
-
811
+
664
812
  ## Inline HTML
665
-
666
- You can also use raw HTML in your Markdown, and it'll mostly work pretty well.
667
-
813
+
814
+ You can also use raw HTML in your Markdown, and it'll mostly work pretty well.
815
+
668
816
  \`\`\`no-highlight
669
817
  <dl>
670
818
  <dt>Definition list</dt>
671
819
  <dd>Is something people use sometimes.</dd>
672
-
820
+
673
821
  <dt>Markdown in HTML</dt>
674
822
  <dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
675
823
  </dl>
676
824
  \`\`\`
677
-
825
+
678
826
  <dl>
679
827
  <dt>Definition list</dt>
680
828
  <dd>Is something people use sometimes.</dd>
681
-
829
+
682
830
  <dt>Markdown in HTML</dt>
683
831
  <dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
684
832
  </dl>
685
-
833
+
686
834
  <a name="hr"></a>
687
-
835
+
688
836
  ## Horizontal Rule
689
-
837
+
690
838
  \`\`\`
691
839
  Three or more...
692
-
840
+
693
841
  ---
694
-
842
+
695
843
  Hyphens
696
-
844
+
697
845
  ***
698
-
846
+
699
847
  Asterisks
700
-
848
+
701
849
  ___
702
-
850
+
703
851
  Underscores
704
852
  \`\`\`
705
-
853
+
706
854
  Three or more...
707
-
855
+
708
856
  ---
709
-
857
+
710
858
  Hyphens
711
-
859
+
712
860
  ***
713
-
861
+
714
862
  Asterisks
715
-
863
+
716
864
  ___
717
-
865
+
718
866
  Underscores
719
-
867
+
720
868
  <a name="lines"></a>
721
-
869
+
722
870
  ## Line Breaks
723
-
724
- 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'll soon learn to get what you want. "Markdown Toggle" is your friend.
725
-
871
+
872
+ 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'll soon learn to get what you want. "Markdown Toggle" is your friend.
873
+
726
874
  Here are some things to try out:
727
-
875
+
728
876
  \`\`\`
729
877
  Here's a line for us to start with.
730
-
878
+
731
879
  This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
732
-
880
+
733
881
  This line is also a separate paragraph, but...
734
882
  This line is only separated by a single newline, so it's a separate line in the *same paragraph*.
735
883
  \`\`\`
736
-
884
+
737
885
  Here's a line for us to start with.
738
-
886
+
739
887
  This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
740
-
741
- This line is also begins a separate paragraph, but...
888
+
889
+ This line is also begins a separate paragraph, but...
742
890
  This line is only separated by a single newline, so it's a separate line in the *same paragraph*.
743
-
891
+
744
892
  (Technical note: *Markdown Here* uses GFM line breaks, so there's no need to use MD's two-space line breaks.)
745
-
893
+
746
894
  <a name="videos"></a>
747
-
895
+
748
896
  ## YouTube Videos
749
-
897
+
750
898
  They can't be added directly but you can add an image with a link to the video like this:
751
-
899
+
752
900
  \`\`\`no-highlight
753
901
  <a href="http://www.youtube.com/watch?feature=player_embedded&v=YOUTUBE_VIDEO_ID_HERE
754
- " target="_blank"><img src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"
902
+ " target="_blank"><img src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"
755
903
  alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /></a>
756
904
  \`\`\`
757
-
905
+
758
906
  Or, in pure Markdown, but losing the image sizing and border:
759
-
907
+
760
908
  \`\`\`no-highlight
761
909
  [![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)
762
910
  \`\`\`
@@ -765,10 +913,48 @@ test('kitchen sink', () => {
765
913
  {
766
914
  "errors": [
767
915
  {
768
- "message": "Unsupported jsx component dl",
916
+ "message": "Unsupported language no-highlight",
917
+ },
918
+ {
919
+ "message": "Unsupported language no-highlight",
920
+ },
921
+ {
922
+ "message": "Unsupported language no-highlight",
923
+ },
924
+ {
925
+ "message": "Unsupported language no-highlight",
926
+ },
927
+ {
928
+ "message": "Unsupported language no-highlight",
929
+ },
930
+ {
931
+ "message": "Unsupported language no-highlight",
932
+ },
933
+ {
934
+ "message": "Unsupported language no-highlight",
935
+ },
936
+ {
937
+ "message": "Unsupported language no-highlight",
938
+ },
939
+ {
940
+ "message": "Unsupported language no-highlight",
941
+ },
942
+ {
943
+ "message": "Unsupported language no-highlight",
769
944
  },
770
945
  ],
771
- "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_.
946
+ "html": "<link rel="preload" as="image" href="https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png"/><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>
947
+ <a href="#emphasis" title="">Emphasis</a>
948
+ <a href="#lists" title="">Lists</a>
949
+ <a href="#links" title="">Links</a>
950
+ <a href="#images" title="">Images</a>
951
+ <a href="#code" title="">Code and Syntax Highlighting</a>
952
+ <a href="#tables" title="">Tables</a>
953
+ <a href="#blockquotes" title="">Blockquotes</a>
954
+ <a href="#html" title="">Inline HTML</a>
955
+ <a href="#hr" title="">Horizontal Rule</a>
956
+ <a href="#lines" title="">Line Breaks</a>
957
+ <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_.
772
958
 
773
959
  Strong emphasis, aka bold, with **asterisks** or __underscores__.
774
960
 
@@ -776,7 +962,7 @@ test('kitchen sink', () => {
776
962
 
777
963
  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
778
964
  2. Another item
779
- ⋅⋅* Unordered sub-list.
965
+ ⋅⋅* Unordered sub-list.
780
966
  1. Actual numbers don&#x27;t matter, just that it&#x27;s a number
781
967
  ⋅⋅1. Ordered sub-list
782
968
  4. And another item.
@@ -789,7 +975,9 @@ test('kitchen sink', () => {
789
975
 
790
976
  * Unordered list can use asterisks
791
977
  - Or minuses
792
- + 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)
978
+ + 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.
979
+ Note that this line is separate, but within the same paragraph.
980
+ (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)
793
981
 
794
982
  [I&#x27;m an inline-style link with title](https://www.google.com &quot;Google&#x27;s Homepage&quot;)
795
983
 
@@ -801,8 +989,8 @@ test('kitchen sink', () => {
801
989
 
802
990
  Or leave it empty and use the [link text itself].
803
991
 
804
- URLs and URLs in angle brackets will automatically get turned into links.
805
- http://www.example.com and sometimes
992
+ URLs and URLs in angle brackets will automatically get turned into links.
993
+ http://www.example.com and sometimes
806
994
  example.com (but not on Github, for example).
807
995
 
808
996
  Some text to show that the reference links can follow later.
@@ -813,20 +1001,20 @@ test('kitchen sink', () => {
813
1001
  <a href="http://www.example.com" title="">http://www.example.com</a> and sometimes
814
1002
  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):
815
1003
 
816
- Inline-style:
1004
+ Inline-style:
817
1005
  ![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png &quot;Logo Title Text 1&quot;)
818
1006
 
819
- Reference-style:
1007
+ Reference-style:
820
1008
  ![alt text][logo]
821
1009
 
822
1010
  [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:
823
1011
  <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:
824
- </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;;
825
- alert(s);</code></pre><pre><code>s = &quot;Python syntax highlighting&quot;
826
- print s</code></pre><pre><code>No language indicated, so no syntax highlighting.
827
- 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;;
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 in Markdown Here (varies on Github).
1012
+ </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 class="language-javascript">var s = &quot;JavaScript syntax highlighting&quot;;
1013
+ alert(s);</code></pre><pre><code class="language-python">s = &quot;Python syntax highlighting&quot;
1014
+ print s</code></pre><pre><code>No language indicated, so no syntax highlighting.
1015
+ But let&#x27;s throw in a &amp;lt;b&amp;gt;tag&amp;lt;/b&amp;gt;.</code></pre><pre><code class="language-javascript">var s = &quot;JavaScript syntax highlighting&quot;;
1016
+ alert(s);</code></pre><pre><code class="language-python">s = &quot;Python syntax highlighting&quot;
1017
+ print s</code></pre><pre><code>No language indicated, so no syntax highlighting in Markdown Here (varies on Github).
830
1018
  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.
831
1019
 
832
1020
  | Tables | Are | Cool |
@@ -836,7 +1024,7 @@ test('kitchen sink', () => {
836
1024
  | zebra stripes | are neat | $1 |
837
1025
 
838
1026
  There must be at least 3 dashes separating each header cell.
839
- The outer pipes (|) are optional, and you don&#x27;t need to make the
1027
+ The outer pipes (|) are optional, and you don&#x27;t need to make the
840
1028
  raw Markdown line up prettily. You can also use inline Markdown.
841
1029
 
842
1030
  Markdown | Less | Pretty
@@ -847,14 +1035,14 @@ test('kitchen sink', () => {
847
1035
 
848
1036
  Quote break.
849
1037
 
850
- &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.
1038
+ &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.
851
1039
  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;
852
1040
  &lt;dt&gt;Definition list&lt;/dt&gt;
853
1041
  &lt;dd&gt;Is something people use sometimes.&lt;/dd&gt;
854
1042
 
855
1043
  &lt;dt&gt;Markdown in HTML&lt;/dt&gt;
856
1044
  &lt;dd&gt;Does *not* work **very** well. Use HTML &lt;em&gt;tags&lt;/em&gt;.&lt;/dd&gt;
857
- &lt;/dl&gt;</code></pre><a name="hr"></a><h2>Horizontal Rule</h2><pre><code>Three or more...
1045
+ &lt;/dl&gt;</code></pre><dl><dt>Definition list</dt><dd>Is something people use sometimes.</dd><dt>Markdown in HTML</dt><dd>Does <em>not</em> work <strong>very</strong> well. Use HTML <em>tags</em>.</dd></dl><a name="hr"></a><h2>Horizontal Rule</h2><pre><code>Three or more...
858
1046
 
859
1047
  ---
860
1048
 
@@ -871,8 +1059,9 @@ test('kitchen sink', () => {
871
1059
  This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
872
1060
 
873
1061
  This line is also a separate paragraph, but...
874
- 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
875
- &quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg&quot;
1062
+ 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...
1063
+ 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
1064
+ &quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg&quot;
876
1065
  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>",
877
1066
  "result": <React.Fragment>
878
1067
  <h1>
@@ -946,77 +1135,88 @@ test('kitchen sink', () => {
946
1135
  >
947
1136
  Headers
948
1137
  </a>
949
- <br />
1138
+
1139
+
950
1140
  <a
951
1141
  href="#emphasis"
952
1142
  title=""
953
1143
  >
954
1144
  Emphasis
955
1145
  </a>
956
- <br />
1146
+
1147
+
957
1148
  <a
958
1149
  href="#lists"
959
1150
  title=""
960
1151
  >
961
1152
  Lists
962
1153
  </a>
963
- <br />
1154
+
1155
+
964
1156
  <a
965
1157
  href="#links"
966
1158
  title=""
967
1159
  >
968
1160
  Links
969
1161
  </a>
970
- <br />
1162
+
1163
+
971
1164
  <a
972
1165
  href="#images"
973
1166
  title=""
974
1167
  >
975
1168
  Images
976
1169
  </a>
977
- <br />
1170
+
1171
+
978
1172
  <a
979
1173
  href="#code"
980
1174
  title=""
981
1175
  >
982
1176
  Code and Syntax Highlighting
983
1177
  </a>
984
- <br />
1178
+
1179
+
985
1180
  <a
986
1181
  href="#tables"
987
1182
  title=""
988
1183
  >
989
1184
  Tables
990
1185
  </a>
991
- <br />
1186
+
1187
+
992
1188
  <a
993
1189
  href="#blockquotes"
994
1190
  title=""
995
1191
  >
996
1192
  Blockquotes
997
1193
  </a>
998
- <br />
1194
+
1195
+
999
1196
  <a
1000
1197
  href="#html"
1001
1198
  title=""
1002
1199
  >
1003
1200
  Inline HTML
1004
1201
  </a>
1005
- <br />
1202
+
1203
+
1006
1204
  <a
1007
1205
  href="#hr"
1008
1206
  title=""
1009
1207
  >
1010
1208
  Horizontal Rule
1011
1209
  </a>
1012
- <br />
1210
+
1211
+
1013
1212
  <a
1014
1213
  href="#lines"
1015
1214
  title=""
1016
1215
  >
1017
1216
  Line Breaks
1018
1217
  </a>
1019
- <br />
1218
+
1219
+
1020
1220
  <a
1021
1221
  href="#videos"
1022
1222
  title=""
@@ -1152,7 +1352,7 @@ test('kitchen sink', () => {
1152
1352
  <code>
1153
1353
  1. First ordered list item
1154
1354
  2. Another item
1155
- ⋅⋅* Unordered sub-list.
1355
+ ⋅⋅* Unordered sub-list.
1156
1356
  1. Actual numbers don't matter, just that it's a number
1157
1357
  ⋅⋅1. Ordered sub-list
1158
1358
  4. And another item.
@@ -1211,10 +1411,8 @@ test('kitchen sink', () => {
1211
1411
  </p>
1212
1412
  <p>
1213
1413
  To have a line break without a paragraph, you will need to use two trailing spaces.
1214
- <br />
1215
- Note that this line is separate, but within the same paragraph.
1216
- <br />
1217
- (This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
1414
+ Note that this line is separate, but within the same paragraph.
1415
+ (This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
1218
1416
  </p>
1219
1417
  </li>
1220
1418
  </ol>
@@ -1262,8 +1460,8 @@ test('kitchen sink', () => {
1262
1460
 
1263
1461
  Or leave it empty and use the [link text itself].
1264
1462
 
1265
- URLs and URLs in angle brackets will automatically get turned into links.
1266
- http://www.example.com and sometimes
1463
+ URLs and URLs in angle brackets will automatically get turned into links.
1464
+ http://www.example.com and sometimes
1267
1465
  example.com (but not on Github, for example).
1268
1466
 
1269
1467
  Some text to show that the reference links can follow later.
@@ -1345,10 +1543,10 @@ test('kitchen sink', () => {
1345
1543
  <code>
1346
1544
  Here's our logo (hover to see the title text):
1347
1545
 
1348
- Inline-style:
1546
+ Inline-style:
1349
1547
  ![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1")
1350
1548
 
1351
- Reference-style:
1549
+ Reference-style:
1352
1550
  ![alt text][logo]
1353
1551
 
1354
1552
  [logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"
@@ -1418,38 +1616,46 @@ test('kitchen sink', () => {
1418
1616
  , or are indented with four spaces. I recommend only using the fenced code blocks -- they're easier and only they support syntax highlighting.
1419
1617
  </p>
1420
1618
  <pre>
1421
- <code>
1619
+ <code
1620
+ className="language-javascript"
1621
+ >
1422
1622
  var s = "JavaScript syntax highlighting";
1423
1623
  alert(s);
1424
1624
  </code>
1425
1625
  </pre>
1426
1626
  <pre>
1427
- <code>
1627
+ <code
1628
+ className="language-python"
1629
+ >
1428
1630
  s = "Python syntax highlighting"
1429
1631
  print s
1430
1632
  </code>
1431
1633
  </pre>
1432
1634
  <pre>
1433
1635
  <code>
1434
- No language indicated, so no syntax highlighting.
1636
+ No language indicated, so no syntax highlighting.
1435
1637
  But let's throw in a &lt;b&gt;tag&lt;/b&gt;.
1436
1638
  </code>
1437
1639
  </pre>
1438
1640
  <pre>
1439
- <code>
1641
+ <code
1642
+ className="language-javascript"
1643
+ >
1440
1644
  var s = "JavaScript syntax highlighting";
1441
1645
  alert(s);
1442
1646
  </code>
1443
1647
  </pre>
1444
1648
  <pre>
1445
- <code>
1649
+ <code
1650
+ className="language-python"
1651
+ >
1446
1652
  s = "Python syntax highlighting"
1447
1653
  print s
1448
1654
  </code>
1449
1655
  </pre>
1450
1656
  <pre>
1451
1657
  <code>
1452
- No language indicated, so no syntax highlighting in Markdown Here (varies on Github).
1658
+ No language indicated, so no syntax highlighting in Markdown Here (varies on Github).
1453
1659
  But let's throw in a &lt;b&gt;tag&lt;/b&gt;.
1454
1660
  </code>
1455
1661
  </pre>
@@ -1477,7 +1683,7 @@ test('kitchen sink', () => {
1477
1683
  | zebra stripes | are neat | $1 |
1478
1684
 
1479
1685
  There must be at least 3 dashes separating each header cell.
1480
- The outer pipes (|) are optional, and you don't need to make the
1686
+ The outer pipes (|) are optional, and you don't need to make the
1481
1687
  raw Markdown line up prettily. You can also use inline Markdown.
1482
1688
 
1483
1689
  Markdown | Less | Pretty
@@ -1656,7 +1862,7 @@ test('kitchen sink', () => {
1656
1862
 
1657
1863
  Quote break.
1658
1864
 
1659
- &gt; This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote.
1865
+ &gt; This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote.
1660
1866
  </code>
1661
1867
  </pre>
1662
1868
  <blockquote>
@@ -1701,6 +1907,32 @@ test('kitchen sink', () => {
1701
1907
  &lt;/dl&gt;
1702
1908
  </code>
1703
1909
  </pre>
1910
+ <dl>
1911
+ <dt>
1912
+ Definition list
1913
+ </dt>
1914
+ <dd>
1915
+ Is something people use sometimes.
1916
+ </dd>
1917
+ <dt>
1918
+ Markdown in HTML
1919
+ </dt>
1920
+ <dd>
1921
+ Does
1922
+ <em>
1923
+ not
1924
+ </em>
1925
+ work
1926
+ <strong>
1927
+ very
1928
+ </strong>
1929
+ well. Use HTML
1930
+ <em>
1931
+ tags
1932
+ </em>
1933
+ .
1934
+ </dd>
1935
+ </dl>
1704
1936
  <a
1705
1937
  name="hr"
1706
1938
  />
@@ -1773,8 +2005,7 @@ test('kitchen sink', () => {
1773
2005
  </p>
1774
2006
  <p>
1775
2007
  This line is also begins a separate paragraph, but...
1776
- <br />
1777
- This line is only separated by a single newline, so it's a separate line in the
2008
+ This line is only separated by a single newline, so it's a separate line in the
1778
2009
  <em>
1779
2010
  same paragraph
1780
2011
  </em>
@@ -1799,7 +2030,7 @@ test('kitchen sink', () => {
1799
2030
  <pre>
1800
2031
  <code>
1801
2032
  &lt;a href="http://www.youtube.com/watch?feature=player_embedded&v=YOUTUBE_VIDEO_ID_HERE
1802
- " target="_blank"&gt;&lt;img src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"
2033
+ " target="_blank"&gt;&lt;img src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"
1803
2034
  alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /&gt;&lt;/a&gt;
1804
2035
  </code>
1805
2036
  </pre>
@@ -1815,4 +2046,180 @@ test('kitchen sink', () => {
1815
2046
  }
1816
2047
  `);
1817
2048
  });
2049
+ test('code block rendering', () => {
2050
+ const code = dedent `
2051
+ `;
2052
+ expect(render(dedent `
2053
+ \`\`\`typescript
2054
+ const x = 1;
2055
+ \`\`\`
2056
+
2057
+ \`\`\`invalid-language
2058
+ const y = 2;
2059
+ \`\`\`
2060
+ `)).toMatchInlineSnapshot(`
2061
+ {
2062
+ "errors": [
2063
+ {
2064
+ "message": "Unsupported language invalid-language",
2065
+ },
2066
+ ],
2067
+ "html": "<pre><code class="language-typescript">const x = 1;</code></pre><pre><code>const y = 2;</code></pre>",
2068
+ "result": <React.Fragment>
2069
+ <pre>
2070
+ <code
2071
+ className="language-typescript"
2072
+ >
2073
+ const x = 1;
2074
+ </code>
2075
+ </pre>
2076
+ <pre>
2077
+ <code>
2078
+ const y = 2;
2079
+ </code>
2080
+ </pre>
2081
+ </React.Fragment>,
2082
+ }
2083
+ `);
2084
+ });
2085
+ test('code is not wrapped by p', () => {
2086
+ const code = `
2087
+ ---
2088
+ title: createSearchParams
2089
+ ---
2090
+
2091
+ # createSearchParams
2092
+
2093
+ [MODES: framework, data, declarative]
2094
+
2095
+ ## Summary
2096
+
2097
+ [Reference Documentation ↗](https://api.reactrouter.com/v7/functions/react_router.createSearchParams.html)
2098
+
2099
+ Creates a URLSearchParams object using the given initializer.
2100
+
2101
+ This is identical to \`new URLSearchParams(init)\` except it also
2102
+ supports arrays as values in the object form of the initializer
2103
+ instead of just strings. This is convenient when you need multiple
2104
+ values for a given key, but don't want to use an array initializer.
2105
+
2106
+ For example, instead of:
2107
+
2108
+ \`\`\`tsx
2109
+ let searchParams = new URLSearchParams([
2110
+ ["sort", "name"],
2111
+ ["sort", "price"],
2112
+ ]);
2113
+ \`\`\`
2114
+
2115
+ you can do:
2116
+
2117
+ \`\`\`
2118
+ let searchParams = createSearchParams({
2119
+ sort: ['name', 'price']
2120
+ });
2121
+ \`\`\`
2122
+
2123
+ ## Signature
2124
+
2125
+ \`\`\`tsx
2126
+ createSearchParams(init): URLSearchParams
2127
+ \`\`\`
2128
+
2129
+ ## Params
2130
+
2131
+ ### init
2132
+
2133
+ [modes: framework, data, declarative]
2134
+
2135
+ _No documentation_
2136
+
2137
+ `;
2138
+ const jsx = render(code);
2139
+ expect(jsx.result).toMatchInlineSnapshot(`
2140
+ <React.Fragment>
2141
+ <hr />
2142
+ <h2>
2143
+ title: createSearchParams
2144
+ </h2>
2145
+ <h1>
2146
+ createSearchParams
2147
+ </h1>
2148
+ <p>
2149
+ [MODES: framework, data, declarative]
2150
+ </p>
2151
+ <h2>
2152
+ Summary
2153
+ </h2>
2154
+ <p>
2155
+ <a
2156
+ href="https://api.reactrouter.com/v7/functions/react_router.createSearchParams.html"
2157
+ title=""
2158
+ >
2159
+ Reference Documentation ↗
2160
+ </a>
2161
+ </p>
2162
+ <p>
2163
+ Creates a URLSearchParams object using the given initializer.
2164
+ </p>
2165
+ <p>
2166
+ This is identical to
2167
+ <code>
2168
+ new URLSearchParams(init)
2169
+ </code>
2170
+ except it also
2171
+ supports arrays as values in the object form of the initializer
2172
+ instead of just strings. This is convenient when you need multiple
2173
+ values for a given key, but don't want to use an array initializer.
2174
+ </p>
2175
+ <p>
2176
+ For example, instead of:
2177
+ </p>
2178
+ <pre>
2179
+ <code
2180
+ className="language-tsx"
2181
+ >
2182
+ let searchParams = new URLSearchParams([
2183
+ ["sort", "name"],
2184
+ ["sort", "price"],
2185
+ ]);
2186
+ </code>
2187
+ </pre>
2188
+ <p>
2189
+ you can do:
2190
+ </p>
2191
+ <pre>
2192
+ <code>
2193
+ let searchParams = createSearchParams({
2194
+ sort: ['name', 'price']
2195
+ });
2196
+ </code>
2197
+ </pre>
2198
+ <h2>
2199
+ Signature
2200
+ </h2>
2201
+ <pre>
2202
+ <code
2203
+ className="language-tsx"
2204
+ >
2205
+ createSearchParams(init): URLSearchParams
2206
+ </code>
2207
+ </pre>
2208
+ <h2>
2209
+ Params
2210
+ </h2>
2211
+ <h3>
2212
+ init
2213
+ </h3>
2214
+ <p>
2215
+ [modes: framework, data, declarative]
2216
+ </p>
2217
+ <p>
2218
+ <em>
2219
+ No documentation
2220
+ </em>
2221
+ </p>
2222
+ </React.Fragment>
2223
+ `);
2224
+ });
1818
2225
  //# sourceMappingURL=safe-mdx.test.js.map