safe-mdx 0.0.6 → 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.
- package/LICENSE +21 -0
- package/README.md +46 -14
- package/dist/safe-mdx.d.ts +29 -6
- package/dist/safe-mdx.d.ts.map +1 -1
- package/dist/safe-mdx.js +132 -35
- package/dist/safe-mdx.js.map +1 -1
- package/dist/safe-mdx.test.js +503 -234
- package/dist/safe-mdx.test.js.map +1 -1
- package/package.json +8 -8
- package/src/safe-mdx.test.tsx +512 -236
- package/src/safe-mdx.tsx +231 -40
- package/dist/plugins.d.ts +0 -12
- package/dist/plugins.d.ts.map +0 -1
- package/dist/plugins.js +0 -68
- package/dist/plugins.js.map +0 -1
- package/src/plugins.ts +0 -87
package/dist/safe-mdx.test.js
CHANGED
|
@@ -17,15 +17,76 @@ 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
|
+
});
|
|
20
71
|
test('remark and jsx does not wrap in p', () => {
|
|
21
72
|
const code = dedent `
|
|
73
|
+
---
|
|
74
|
+
title: createSearchParams
|
|
75
|
+
---
|
|
76
|
+
|
|
22
77
|
# Hello
|
|
23
78
|
|
|
24
79
|
i am a paragraph
|
|
25
80
|
|
|
26
81
|
<Heading>heading</Heading>
|
|
27
82
|
|
|
28
|
-
|
|
83
|
+
sone \`inline code\`
|
|
84
|
+
|
|
85
|
+
\`\`\`tsx
|
|
86
|
+
some code
|
|
87
|
+
\`\`\`
|
|
88
|
+
|
|
89
|
+
what
|
|
29
90
|
`;
|
|
30
91
|
const mdast = mdxParse(code);
|
|
31
92
|
mdastBfs(mdast, (x) => {
|
|
@@ -34,6 +95,10 @@ test('remark and jsx does not wrap in p', () => {
|
|
|
34
95
|
expect(mdast).toMatchInlineSnapshot(`
|
|
35
96
|
{
|
|
36
97
|
"children": [
|
|
98
|
+
{
|
|
99
|
+
"type": "yaml",
|
|
100
|
+
"value": "title: createSearchParams",
|
|
101
|
+
},
|
|
37
102
|
{
|
|
38
103
|
"children": [
|
|
39
104
|
{
|
|
@@ -68,7 +133,26 @@ test('remark and jsx does not wrap in p', () => {
|
|
|
68
133
|
"children": [
|
|
69
134
|
{
|
|
70
135
|
"type": "text",
|
|
71
|
-
"value": "
|
|
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",
|
|
72
156
|
},
|
|
73
157
|
],
|
|
74
158
|
"type": "paragraph",
|
|
@@ -108,7 +192,7 @@ test('frontmatter', () => {
|
|
|
108
192
|
---
|
|
109
193
|
hello: 5
|
|
110
194
|
---
|
|
111
|
-
|
|
195
|
+
|
|
112
196
|
# Hello
|
|
113
197
|
|
|
114
198
|
i am a paragraph
|
|
@@ -216,7 +300,7 @@ test('table, only head', () => {
|
|
|
216
300
|
|
|
217
301
|
| Tables | Are | Cool |
|
|
218
302
|
| ------------- |:-------------:| -----:|
|
|
219
|
-
|
|
303
|
+
|
|
220
304
|
`)).toMatchInlineSnapshot(`
|
|
221
305
|
{
|
|
222
306
|
"errors": [],
|
|
@@ -333,7 +417,7 @@ test('missing components are ignored', () => {
|
|
|
333
417
|
});
|
|
334
418
|
test('props parsing', () => {
|
|
335
419
|
expect(render(dedent `
|
|
336
|
-
<Heading
|
|
420
|
+
<Heading
|
|
337
421
|
num={2}
|
|
338
422
|
doublequote={"a \" string"}
|
|
339
423
|
quote={'a \' string'}
|
|
@@ -365,7 +449,7 @@ test('props parsing', () => {
|
|
|
365
449
|
"message": "Expressions in jsx props are not supported (jsx={<SomeComponent />})",
|
|
366
450
|
},
|
|
367
451
|
{
|
|
368
|
-
"message": "Expressions in jsx props are not supported (...{
|
|
452
|
+
"message": "Expressions in jsx props are not supported (...{ spread: true })",
|
|
369
453
|
},
|
|
370
454
|
],
|
|
371
455
|
"html": "<h1><p>hi</p></h1>",
|
|
@@ -393,20 +477,20 @@ test('props parsing', () => {
|
|
|
393
477
|
});
|
|
394
478
|
test('breaks', () => {
|
|
395
479
|
expect(render(dedent `
|
|
396
|
-
To have a line break without a paragraph, you will need to use two trailing spaces.
|
|
397
|
-
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.
|
|
398
482
|
(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
|
|
399
483
|
`)).toMatchInlineSnapshot(`
|
|
400
484
|
{
|
|
401
485
|
"errors": [],
|
|
402
|
-
"html": "<p>To have a line break without a paragraph, you will need to use two trailing spaces
|
|
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>",
|
|
403
489
|
"result": <React.Fragment>
|
|
404
490
|
<p>
|
|
405
491
|
To have a line break without a paragraph, you will need to use two trailing spaces.
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
<br />
|
|
409
|
-
(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.)
|
|
410
494
|
</p>
|
|
411
495
|
</React.Fragment>,
|
|
412
496
|
}
|
|
@@ -417,410 +501,410 @@ test('kitchen sink', () => {
|
|
|
417
501
|
expect(render(dedent `
|
|
418
502
|
# Markdown Kitchen Sink
|
|
419
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.
|
|
420
|
-
|
|
504
|
+
|
|
421
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/).
|
|
422
|
-
|
|
506
|
+
|
|
423
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).
|
|
424
|
-
|
|
425
|
-
##### Table of Contents
|
|
426
|
-
[Headers](#headers)
|
|
427
|
-
[Emphasis](#emphasis)
|
|
428
|
-
[Lists](#lists)
|
|
429
|
-
[Links](#links)
|
|
430
|
-
[Images](#images)
|
|
431
|
-
[Code and Syntax Highlighting](#code)
|
|
432
|
-
[Tables](#tables)
|
|
433
|
-
[Blockquotes](#blockquotes)
|
|
434
|
-
[Inline HTML](#html)
|
|
435
|
-
[Horizontal Rule](#hr)
|
|
436
|
-
[Line Breaks](#lines)
|
|
437
|
-
[YouTube Videos](#videos)
|
|
438
|
-
|
|
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
|
+
|
|
439
523
|
<a name="headers"></a>
|
|
440
|
-
|
|
524
|
+
|
|
441
525
|
## Headers
|
|
442
|
-
|
|
443
|
-
|
|
526
|
+
|
|
527
|
+
|
|
444
528
|
# H1
|
|
445
529
|
## H2
|
|
446
530
|
### H3
|
|
447
531
|
#### H4
|
|
448
532
|
##### H5
|
|
449
533
|
###### H6
|
|
450
|
-
|
|
534
|
+
|
|
451
535
|
Alternatively, for H1 and H2, an underline-ish style:
|
|
452
|
-
|
|
536
|
+
|
|
453
537
|
Alt-H1
|
|
454
538
|
======
|
|
455
|
-
|
|
539
|
+
|
|
456
540
|
Alt-H2
|
|
457
541
|
------
|
|
458
|
-
|
|
459
|
-
|
|
542
|
+
|
|
543
|
+
|
|
460
544
|
# H1
|
|
461
545
|
## H2
|
|
462
546
|
### H3
|
|
463
547
|
#### H4
|
|
464
548
|
##### H5
|
|
465
549
|
###### H6
|
|
466
|
-
|
|
550
|
+
|
|
467
551
|
Alternatively, for H1 and H2, an underline-ish style:
|
|
468
|
-
|
|
552
|
+
|
|
469
553
|
Alt-H1
|
|
470
554
|
======
|
|
471
|
-
|
|
555
|
+
|
|
472
556
|
Alt-H2
|
|
473
557
|
------
|
|
474
|
-
|
|
558
|
+
|
|
475
559
|
<a name="emphasis"></a>
|
|
476
|
-
|
|
560
|
+
|
|
477
561
|
## Emphasis
|
|
478
|
-
|
|
562
|
+
|
|
479
563
|
\`\`\`no-highlight
|
|
480
564
|
Emphasis, aka italics, with *asterisks* or _underscores_.
|
|
481
|
-
|
|
565
|
+
|
|
482
566
|
Strong emphasis, aka bold, with **asterisks** or __underscores__.
|
|
483
|
-
|
|
567
|
+
|
|
484
568
|
Combined emphasis with **asterisks and _underscores_**.
|
|
485
|
-
|
|
569
|
+
|
|
486
570
|
Strikethrough uses two tildes. ~~Scratch this.~~
|
|
487
571
|
\`\`\`
|
|
488
|
-
|
|
572
|
+
|
|
489
573
|
Emphasis, aka italics, with *asterisks* or _underscores_.
|
|
490
|
-
|
|
574
|
+
|
|
491
575
|
Strong emphasis, aka bold, with **asterisks** or __underscores__.
|
|
492
|
-
|
|
576
|
+
|
|
493
577
|
Combined emphasis with **asterisks and _underscores_**.
|
|
494
|
-
|
|
578
|
+
|
|
495
579
|
Strikethrough uses two tildes. ~~Scratch this.~~
|
|
496
|
-
|
|
497
|
-
|
|
580
|
+
|
|
581
|
+
|
|
498
582
|
<a name="lists"></a>
|
|
499
|
-
|
|
583
|
+
|
|
500
584
|
## Lists
|
|
501
|
-
|
|
585
|
+
|
|
502
586
|
(In this example, leading and trailing spaces are shown with with dots: ⋅)
|
|
503
|
-
|
|
587
|
+
|
|
504
588
|
\`\`\`no-highlight
|
|
505
589
|
1. First ordered list item
|
|
506
590
|
2. Another item
|
|
507
|
-
⋅⋅* Unordered sub-list.
|
|
591
|
+
⋅⋅* Unordered sub-list.
|
|
508
592
|
1. Actual numbers don't matter, just that it's a number
|
|
509
593
|
⋅⋅1. Ordered sub-list
|
|
510
594
|
4. And another item.
|
|
511
|
-
|
|
595
|
+
|
|
512
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).
|
|
513
|
-
|
|
597
|
+
|
|
514
598
|
⋅⋅⋅To have a line break without a paragraph, you will need to use two trailing spaces.⋅⋅
|
|
515
599
|
⋅⋅⋅Note that this line is separate, but within the same paragraph.⋅⋅
|
|
516
600
|
⋅⋅⋅(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
|
|
517
|
-
|
|
601
|
+
|
|
518
602
|
* Unordered list can use asterisks
|
|
519
603
|
- Or minuses
|
|
520
604
|
+ Or pluses
|
|
521
605
|
\`\`\`
|
|
522
|
-
|
|
606
|
+
|
|
523
607
|
1. First ordered list item
|
|
524
608
|
2. Another item
|
|
525
|
-
* Unordered sub-list.
|
|
609
|
+
* Unordered sub-list.
|
|
526
610
|
1. Actual numbers don't matter, just that it's a number
|
|
527
611
|
1. Ordered sub-list
|
|
528
612
|
4. And another item.
|
|
529
|
-
|
|
613
|
+
|
|
530
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).
|
|
531
|
-
|
|
532
|
-
To have a line break without a paragraph, you will need to use two trailing spaces.
|
|
533
|
-
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.
|
|
534
618
|
(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
|
|
535
|
-
|
|
619
|
+
|
|
536
620
|
* Unordered list can use asterisks
|
|
537
621
|
- Or minuses
|
|
538
622
|
+ Or pluses
|
|
539
|
-
|
|
623
|
+
|
|
540
624
|
<a name="links"></a>
|
|
541
|
-
|
|
625
|
+
|
|
542
626
|
## Links
|
|
543
|
-
|
|
627
|
+
|
|
544
628
|
There are two ways to create links.
|
|
545
|
-
|
|
629
|
+
|
|
546
630
|
\`\`\`no-highlight
|
|
547
631
|
[I'm an inline-style link](https://www.google.com)
|
|
548
|
-
|
|
632
|
+
|
|
549
633
|
[I'm an inline-style link with title](https://www.google.com "Google's Homepage")
|
|
550
|
-
|
|
634
|
+
|
|
551
635
|
[I'm a reference-style link][Arbitrary case-insensitive reference text]
|
|
552
|
-
|
|
636
|
+
|
|
553
637
|
[I'm a relative reference to a repository file](../blob/master/LICENSE)
|
|
554
|
-
|
|
638
|
+
|
|
555
639
|
[You can use numbers for reference-style link definitions][1]
|
|
556
|
-
|
|
640
|
+
|
|
557
641
|
Or leave it empty and use the [link text itself].
|
|
558
|
-
|
|
559
|
-
URLs and URLs in angle brackets will automatically get turned into links.
|
|
560
|
-
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
|
|
561
645
|
example.com (but not on Github, for example).
|
|
562
|
-
|
|
646
|
+
|
|
563
647
|
Some text to show that the reference links can follow later.
|
|
564
|
-
|
|
648
|
+
|
|
565
649
|
[arbitrary case-insensitive reference text]: https://www.mozilla.org
|
|
566
650
|
[1]: http://slashdot.org
|
|
567
651
|
[link text itself]: http://www.reddit.com
|
|
568
652
|
\`\`\`
|
|
569
|
-
|
|
653
|
+
|
|
570
654
|
[I'm an inline-style link](https://www.google.com)
|
|
571
|
-
|
|
655
|
+
|
|
572
656
|
[I'm an inline-style link with title](https://www.google.com "Google's Homepage")
|
|
573
|
-
|
|
657
|
+
|
|
574
658
|
[I'm a reference-style link][Arbitrary case-insensitive reference text]
|
|
575
|
-
|
|
659
|
+
|
|
576
660
|
[I'm a relative reference to a repository file](../blob/master/LICENSE)
|
|
577
|
-
|
|
661
|
+
|
|
578
662
|
[You can use numbers for reference-style link definitions][1]
|
|
579
|
-
|
|
663
|
+
|
|
580
664
|
Or leave it empty and use the [link text itself].
|
|
581
|
-
|
|
582
|
-
URLs and URLs in angle brackets will automatically get turned into links.
|
|
583
|
-
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
|
|
584
668
|
example.com (but not on Github, for example).
|
|
585
|
-
|
|
669
|
+
|
|
586
670
|
Some text to show that the reference links can follow later.
|
|
587
|
-
|
|
671
|
+
|
|
588
672
|
[arbitrary case-insensitive reference text]: https://www.mozilla.org
|
|
589
673
|
[1]: http://slashdot.org
|
|
590
674
|
[link text itself]: http://www.reddit.com
|
|
591
|
-
|
|
675
|
+
|
|
592
676
|
<a name="images"></a>
|
|
593
|
-
|
|
677
|
+
|
|
594
678
|
## Images
|
|
595
|
-
|
|
679
|
+
|
|
596
680
|
\`\`\`no-highlight
|
|
597
681
|
Here's our logo (hover to see the title text):
|
|
598
|
-
|
|
599
|
-
Inline-style:
|
|
682
|
+
|
|
683
|
+
Inline-style:
|
|
600
684
|

|
|
601
|
-
|
|
602
|
-
Reference-style:
|
|
685
|
+
|
|
686
|
+
Reference-style:
|
|
603
687
|
![alt text][logo]
|
|
604
|
-
|
|
688
|
+
|
|
605
689
|
[logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"
|
|
606
690
|
\`\`\`
|
|
607
|
-
|
|
691
|
+
|
|
608
692
|
Here's our logo (hover to see the title text):
|
|
609
|
-
|
|
610
|
-
Inline-style:
|
|
693
|
+
|
|
694
|
+
Inline-style:
|
|
611
695
|

|
|
612
|
-
|
|
613
|
-
Reference-style:
|
|
696
|
+
|
|
697
|
+
Reference-style:
|
|
614
698
|
![alt text][logo]
|
|
615
|
-
|
|
699
|
+
|
|
616
700
|
[logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"
|
|
617
|
-
|
|
701
|
+
|
|
618
702
|
<a name="code"></a>
|
|
619
|
-
|
|
703
|
+
|
|
620
704
|
## Code and Syntax Highlighting
|
|
621
|
-
|
|
705
|
+
|
|
622
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).
|
|
623
|
-
|
|
707
|
+
|
|
624
708
|
\`\`\`no-highlight
|
|
625
709
|
Inline \`code\` has \`back-ticks around\` it.
|
|
626
710
|
\`\`\`
|
|
627
|
-
|
|
711
|
+
|
|
628
712
|
Inline \`code\` has \`back-ticks around\` it.
|
|
629
|
-
|
|
713
|
+
|
|
630
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.
|
|
631
|
-
|
|
715
|
+
|
|
632
716
|
\`\`\`javascript
|
|
633
717
|
var s = "JavaScript syntax highlighting";
|
|
634
718
|
alert(s);
|
|
635
719
|
\`\`\`
|
|
636
|
-
|
|
720
|
+
|
|
637
721
|
\`\`\`python
|
|
638
722
|
s = "Python syntax highlighting"
|
|
639
723
|
print s
|
|
640
724
|
\`\`\`
|
|
641
|
-
|
|
725
|
+
|
|
642
726
|
\`\`\`
|
|
643
|
-
No language indicated, so no syntax highlighting.
|
|
727
|
+
No language indicated, so no syntax highlighting.
|
|
644
728
|
But let's throw in a <b>tag</b>.
|
|
645
729
|
\`\`\`
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
|
|
650
734
|
\`\`\`javascript
|
|
651
735
|
var s = "JavaScript syntax highlighting";
|
|
652
736
|
alert(s);
|
|
653
737
|
\`\`\`
|
|
654
|
-
|
|
738
|
+
|
|
655
739
|
\`\`\`python
|
|
656
740
|
s = "Python syntax highlighting"
|
|
657
741
|
print s
|
|
658
742
|
\`\`\`
|
|
659
|
-
|
|
743
|
+
|
|
660
744
|
\`\`\`
|
|
661
|
-
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).
|
|
662
746
|
But let's throw in a <b>tag</b>.
|
|
663
747
|
\`\`\`
|
|
664
|
-
|
|
665
|
-
|
|
748
|
+
|
|
749
|
+
|
|
666
750
|
<a name="tables"></a>
|
|
667
|
-
|
|
751
|
+
|
|
668
752
|
## Tables
|
|
669
|
-
|
|
753
|
+
|
|
670
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.
|
|
671
|
-
|
|
755
|
+
|
|
672
756
|
\`\`\`no-highlight
|
|
673
757
|
Colons can be used to align columns.
|
|
674
|
-
|
|
758
|
+
|
|
675
759
|
| Tables | Are | Cool |
|
|
676
760
|
| ------------- |:-------------:| -----:|
|
|
677
761
|
| col 3 is | right-aligned | $1600 |
|
|
678
762
|
| col 2 is | centered | $12 |
|
|
679
763
|
| zebra stripes | are neat | $1 |
|
|
680
|
-
|
|
764
|
+
|
|
681
765
|
There must be at least 3 dashes separating each header cell.
|
|
682
|
-
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
|
|
683
767
|
raw Markdown line up prettily. You can also use inline Markdown.
|
|
684
|
-
|
|
768
|
+
|
|
685
769
|
Markdown | Less | Pretty
|
|
686
770
|
--- | --- | ---
|
|
687
771
|
*Still* | \`renders\` | **nicely**
|
|
688
772
|
1 | 2 | 3
|
|
689
773
|
\`\`\`
|
|
690
|
-
|
|
774
|
+
|
|
691
775
|
Colons can be used to align columns.
|
|
692
|
-
|
|
776
|
+
|
|
693
777
|
| Tables | Are | Cool |
|
|
694
778
|
| ------------- |:-------------:| -----:|
|
|
695
779
|
| col 3 is | right-aligned | $1600 |
|
|
696
780
|
| col 2 is | centered | $12 |
|
|
697
781
|
| zebra stripes | are neat | $1 |
|
|
698
|
-
|
|
782
|
+
|
|
699
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.
|
|
700
|
-
|
|
784
|
+
|
|
701
785
|
Markdown | Less | Pretty
|
|
702
786
|
--- | --- | ---
|
|
703
787
|
*Still* | \`renders\` | **nicely**
|
|
704
788
|
1 | 2 | 3
|
|
705
|
-
|
|
789
|
+
|
|
706
790
|
<a name="blockquotes"></a>
|
|
707
|
-
|
|
791
|
+
|
|
708
792
|
## Blockquotes
|
|
709
|
-
|
|
793
|
+
|
|
710
794
|
\`\`\`no-highlight
|
|
711
795
|
> Blockquotes are very handy in email to emulate reply text.
|
|
712
796
|
> This line is part of the same quote.
|
|
713
|
-
|
|
797
|
+
|
|
714
798
|
Quote break.
|
|
715
|
-
|
|
716
|
-
> 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.
|
|
717
801
|
\`\`\`
|
|
718
|
-
|
|
802
|
+
|
|
719
803
|
> Blockquotes are very handy in email to emulate reply text.
|
|
720
804
|
> This line is part of the same quote.
|
|
721
|
-
|
|
805
|
+
|
|
722
806
|
Quote break.
|
|
723
|
-
|
|
724
|
-
> 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.
|
|
725
|
-
|
|
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
|
+
|
|
726
810
|
<a name="html"></a>
|
|
727
|
-
|
|
811
|
+
|
|
728
812
|
## Inline HTML
|
|
729
|
-
|
|
730
|
-
You can also use raw HTML in your Markdown, and it'll mostly work pretty well.
|
|
731
|
-
|
|
813
|
+
|
|
814
|
+
You can also use raw HTML in your Markdown, and it'll mostly work pretty well.
|
|
815
|
+
|
|
732
816
|
\`\`\`no-highlight
|
|
733
817
|
<dl>
|
|
734
818
|
<dt>Definition list</dt>
|
|
735
819
|
<dd>Is something people use sometimes.</dd>
|
|
736
|
-
|
|
820
|
+
|
|
737
821
|
<dt>Markdown in HTML</dt>
|
|
738
822
|
<dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
|
|
739
823
|
</dl>
|
|
740
824
|
\`\`\`
|
|
741
|
-
|
|
825
|
+
|
|
742
826
|
<dl>
|
|
743
827
|
<dt>Definition list</dt>
|
|
744
828
|
<dd>Is something people use sometimes.</dd>
|
|
745
|
-
|
|
829
|
+
|
|
746
830
|
<dt>Markdown in HTML</dt>
|
|
747
831
|
<dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
|
|
748
832
|
</dl>
|
|
749
|
-
|
|
833
|
+
|
|
750
834
|
<a name="hr"></a>
|
|
751
|
-
|
|
835
|
+
|
|
752
836
|
## Horizontal Rule
|
|
753
|
-
|
|
837
|
+
|
|
754
838
|
\`\`\`
|
|
755
839
|
Three or more...
|
|
756
|
-
|
|
840
|
+
|
|
757
841
|
---
|
|
758
|
-
|
|
842
|
+
|
|
759
843
|
Hyphens
|
|
760
|
-
|
|
844
|
+
|
|
761
845
|
***
|
|
762
|
-
|
|
846
|
+
|
|
763
847
|
Asterisks
|
|
764
|
-
|
|
848
|
+
|
|
765
849
|
___
|
|
766
|
-
|
|
850
|
+
|
|
767
851
|
Underscores
|
|
768
852
|
\`\`\`
|
|
769
|
-
|
|
853
|
+
|
|
770
854
|
Three or more...
|
|
771
|
-
|
|
855
|
+
|
|
772
856
|
---
|
|
773
|
-
|
|
857
|
+
|
|
774
858
|
Hyphens
|
|
775
|
-
|
|
859
|
+
|
|
776
860
|
***
|
|
777
|
-
|
|
861
|
+
|
|
778
862
|
Asterisks
|
|
779
|
-
|
|
863
|
+
|
|
780
864
|
___
|
|
781
|
-
|
|
865
|
+
|
|
782
866
|
Underscores
|
|
783
|
-
|
|
867
|
+
|
|
784
868
|
<a name="lines"></a>
|
|
785
|
-
|
|
869
|
+
|
|
786
870
|
## Line Breaks
|
|
787
|
-
|
|
788
|
-
My basic recommendation for learning how line breaks work is to experiment and discover -- hit <Enter> 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.
|
|
789
|
-
|
|
871
|
+
|
|
872
|
+
My basic recommendation for learning how line breaks work is to experiment and discover -- hit <Enter> 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
|
+
|
|
790
874
|
Here are some things to try out:
|
|
791
|
-
|
|
875
|
+
|
|
792
876
|
\`\`\`
|
|
793
877
|
Here's a line for us to start with.
|
|
794
|
-
|
|
878
|
+
|
|
795
879
|
This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
|
|
796
|
-
|
|
880
|
+
|
|
797
881
|
This line is also a separate paragraph, but...
|
|
798
882
|
This line is only separated by a single newline, so it's a separate line in the *same paragraph*.
|
|
799
883
|
\`\`\`
|
|
800
|
-
|
|
884
|
+
|
|
801
885
|
Here's a line for us to start with.
|
|
802
|
-
|
|
886
|
+
|
|
803
887
|
This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
|
|
804
|
-
|
|
805
|
-
This line is also begins a separate paragraph, but...
|
|
888
|
+
|
|
889
|
+
This line is also begins a separate paragraph, but...
|
|
806
890
|
This line is only separated by a single newline, so it's a separate line in the *same paragraph*.
|
|
807
|
-
|
|
891
|
+
|
|
808
892
|
(Technical note: *Markdown Here* uses GFM line breaks, so there's no need to use MD's two-space line breaks.)
|
|
809
|
-
|
|
893
|
+
|
|
810
894
|
<a name="videos"></a>
|
|
811
|
-
|
|
895
|
+
|
|
812
896
|
## YouTube Videos
|
|
813
|
-
|
|
897
|
+
|
|
814
898
|
They can't be added directly but you can add an image with a link to the video like this:
|
|
815
|
-
|
|
899
|
+
|
|
816
900
|
\`\`\`no-highlight
|
|
817
901
|
<a href="http://www.youtube.com/watch?feature=player_embedded&v=YOUTUBE_VIDEO_ID_HERE
|
|
818
|
-
" 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"
|
|
819
903
|
alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /></a>
|
|
820
904
|
\`\`\`
|
|
821
|
-
|
|
905
|
+
|
|
822
906
|
Or, in pure Markdown, but losing the image sizing and border:
|
|
823
|
-
|
|
907
|
+
|
|
824
908
|
\`\`\`no-highlight
|
|
825
909
|
[](http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE)
|
|
826
910
|
\`\`\`
|
|
@@ -852,9 +936,6 @@ test('kitchen sink', () => {
|
|
|
852
936
|
{
|
|
853
937
|
"message": "Unsupported language no-highlight",
|
|
854
938
|
},
|
|
855
|
-
{
|
|
856
|
-
"message": "Unsupported jsx component dl",
|
|
857
|
-
},
|
|
858
939
|
{
|
|
859
940
|
"message": "Unsupported language no-highlight",
|
|
860
941
|
},
|
|
@@ -862,7 +943,18 @@ test('kitchen sink', () => {
|
|
|
862
943
|
"message": "Unsupported language no-highlight",
|
|
863
944
|
},
|
|
864
945
|
],
|
|
865
|
-
"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'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'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's what you'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
|
|
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'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'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's what you'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_.
|
|
866
958
|
|
|
867
959
|
Strong emphasis, aka bold, with **asterisks** or __underscores__.
|
|
868
960
|
|
|
@@ -870,7 +962,7 @@ test('kitchen sink', () => {
|
|
|
870
962
|
|
|
871
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
|
|
872
964
|
2. Another item
|
|
873
|
-
⋅⋅* Unordered sub-list.
|
|
965
|
+
⋅⋅* Unordered sub-list.
|
|
874
966
|
1. Actual numbers don't matter, just that it's a number
|
|
875
967
|
⋅⋅1. Ordered sub-list
|
|
876
968
|
4. And another item.
|
|
@@ -883,7 +975,9 @@ test('kitchen sink', () => {
|
|
|
883
975
|
|
|
884
976
|
* Unordered list can use asterisks
|
|
885
977
|
- Or minuses
|
|
886
|
-
+ 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't matter, just that it'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'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
|
|
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't matter, just that it'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'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'm an inline-style link](https://www.google.com)
|
|
887
981
|
|
|
888
982
|
[I'm an inline-style link with title](https://www.google.com "Google's Homepage")
|
|
889
983
|
|
|
@@ -895,8 +989,8 @@ test('kitchen sink', () => {
|
|
|
895
989
|
|
|
896
990
|
Or leave it empty and use the [link text itself].
|
|
897
991
|
|
|
898
|
-
URLs and URLs in angle brackets will automatically get turned into links.
|
|
899
|
-
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
|
|
900
994
|
example.com (but not on Github, for example).
|
|
901
995
|
|
|
902
996
|
Some text to show that the reference links can follow later.
|
|
@@ -907,20 +1001,20 @@ test('kitchen sink', () => {
|
|
|
907
1001
|
<a href="http://www.example.com" title="">http://www.example.com</a> and sometimes
|
|
908
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's our logo (hover to see the title text):
|
|
909
1003
|
|
|
910
|
-
Inline-style:
|
|
1004
|
+
Inline-style:
|
|
911
1005
|

|
|
912
1006
|
|
|
913
|
-
Reference-style:
|
|
1007
|
+
Reference-style:
|
|
914
1008
|
![alt text][logo]
|
|
915
1009
|
|
|
916
1010
|
[logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"</code></pre><p>Here's our logo (hover to see the title text):</p><p>Inline-style:
|
|
917
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:
|
|
918
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't. However, many renderers -- like Github'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're easier and only they support syntax highlighting.</p><pre><code class="language-javascript">var s = "JavaScript syntax highlighting";
|
|
919
1013
|
alert(s);</code></pre><pre><code class="language-python">s = "Python syntax highlighting"
|
|
920
|
-
print s</code></pre><pre><code>No language indicated, so no syntax highlighting.
|
|
1014
|
+
print s</code></pre><pre><code>No language indicated, so no syntax highlighting.
|
|
921
1015
|
But let's throw in a &lt;b&gt;tag&lt;/b&gt;.</code></pre><pre><code class="language-javascript">var s = "JavaScript syntax highlighting";
|
|
922
1016
|
alert(s);</code></pre><pre><code class="language-python">s = "Python syntax highlighting"
|
|
923
|
-
print s</code></pre><pre><code>No language indicated, so no syntax highlighting in Markdown Here (varies on Github).
|
|
1017
|
+
print s</code></pre><pre><code>No language indicated, so no syntax highlighting in Markdown Here (varies on Github).
|
|
924
1018
|
But let's throw in a <b>tag</b>.</code></pre><a name="tables"></a><h2>Tables</h2><p>Tables aren'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.
|
|
925
1019
|
|
|
926
1020
|
| Tables | Are | Cool |
|
|
@@ -930,7 +1024,7 @@ test('kitchen sink', () => {
|
|
|
930
1024
|
| zebra stripes | are neat | $1 |
|
|
931
1025
|
|
|
932
1026
|
There must be at least 3 dashes separating each header cell.
|
|
933
|
-
The outer pipes (|) are optional, and you don't need to make the
|
|
1027
|
+
The outer pipes (|) are optional, and you don't need to make the
|
|
934
1028
|
raw Markdown line up prettily. You can also use inline Markdown.
|
|
935
1029
|
|
|
936
1030
|
Markdown | Less | Pretty
|
|
@@ -941,14 +1035,14 @@ test('kitchen sink', () => {
|
|
|
941
1035
|
|
|
942
1036
|
Quote break.
|
|
943
1037
|
|
|
944
|
-
> 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
|
|
1038
|
+
> 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.</code></pre><blockquote><p>Blockquotes are very handy in email to emulate reply text.
|
|
945
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'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'll mostly work pretty well.</p><pre><code><dl>
|
|
946
1040
|
<dt>Definition list</dt>
|
|
947
1041
|
<dd>Is something people use sometimes.</dd>
|
|
948
1042
|
|
|
949
1043
|
<dt>Markdown in HTML</dt>
|
|
950
1044
|
<dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
|
|
951
|
-
</dl></code></pre><a name="hr"></a><h2>Horizontal Rule</h2><pre><code>Three or more...
|
|
1045
|
+
</dl></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...
|
|
952
1046
|
|
|
953
1047
|
---
|
|
954
1048
|
|
|
@@ -965,8 +1059,9 @@ test('kitchen sink', () => {
|
|
|
965
1059
|
This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
|
|
966
1060
|
|
|
967
1061
|
This line is also a separate paragraph, but...
|
|
968
|
-
This line is only separated by a single newline, so it's a separate line in the *same paragraph*.</code></pre><p>Here'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
|
|
969
|
-
|
|
1062
|
+
This line is only separated by a single newline, so it's a separate line in the *same paragraph*.</code></pre><p>Here'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's a separate line in the <em>same paragraph</em>.</p><p>(Technical note: <em>Markdown Here</em> uses GFM line breaks, so there's no need to use MD's two-space line breaks.)</p><a name="videos"></a><h2>YouTube Videos</h2><p>They can't be added directly but you can add an image with a link to the video like this:</p><pre><code><a href="http://www.youtube.com/watch?feature=player_embedded&v=YOUTUBE_VIDEO_ID_HERE
|
|
1064
|
+
" target="_blank"><img src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"
|
|
970
1065
|
alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /></a></code></pre><p>Or, in pure Markdown, but losing the image sizing and border:</p><pre><code>[](http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE)</code></pre>",
|
|
971
1066
|
"result": <React.Fragment>
|
|
972
1067
|
<h1>
|
|
@@ -1040,77 +1135,88 @@ test('kitchen sink', () => {
|
|
|
1040
1135
|
>
|
|
1041
1136
|
Headers
|
|
1042
1137
|
</a>
|
|
1043
|
-
|
|
1138
|
+
|
|
1139
|
+
|
|
1044
1140
|
<a
|
|
1045
1141
|
href="#emphasis"
|
|
1046
1142
|
title=""
|
|
1047
1143
|
>
|
|
1048
1144
|
Emphasis
|
|
1049
1145
|
</a>
|
|
1050
|
-
|
|
1146
|
+
|
|
1147
|
+
|
|
1051
1148
|
<a
|
|
1052
1149
|
href="#lists"
|
|
1053
1150
|
title=""
|
|
1054
1151
|
>
|
|
1055
1152
|
Lists
|
|
1056
1153
|
</a>
|
|
1057
|
-
|
|
1154
|
+
|
|
1155
|
+
|
|
1058
1156
|
<a
|
|
1059
1157
|
href="#links"
|
|
1060
1158
|
title=""
|
|
1061
1159
|
>
|
|
1062
1160
|
Links
|
|
1063
1161
|
</a>
|
|
1064
|
-
|
|
1162
|
+
|
|
1163
|
+
|
|
1065
1164
|
<a
|
|
1066
1165
|
href="#images"
|
|
1067
1166
|
title=""
|
|
1068
1167
|
>
|
|
1069
1168
|
Images
|
|
1070
1169
|
</a>
|
|
1071
|
-
|
|
1170
|
+
|
|
1171
|
+
|
|
1072
1172
|
<a
|
|
1073
1173
|
href="#code"
|
|
1074
1174
|
title=""
|
|
1075
1175
|
>
|
|
1076
1176
|
Code and Syntax Highlighting
|
|
1077
1177
|
</a>
|
|
1078
|
-
|
|
1178
|
+
|
|
1179
|
+
|
|
1079
1180
|
<a
|
|
1080
1181
|
href="#tables"
|
|
1081
1182
|
title=""
|
|
1082
1183
|
>
|
|
1083
1184
|
Tables
|
|
1084
1185
|
</a>
|
|
1085
|
-
|
|
1186
|
+
|
|
1187
|
+
|
|
1086
1188
|
<a
|
|
1087
1189
|
href="#blockquotes"
|
|
1088
1190
|
title=""
|
|
1089
1191
|
>
|
|
1090
1192
|
Blockquotes
|
|
1091
1193
|
</a>
|
|
1092
|
-
|
|
1194
|
+
|
|
1195
|
+
|
|
1093
1196
|
<a
|
|
1094
1197
|
href="#html"
|
|
1095
1198
|
title=""
|
|
1096
1199
|
>
|
|
1097
1200
|
Inline HTML
|
|
1098
1201
|
</a>
|
|
1099
|
-
|
|
1202
|
+
|
|
1203
|
+
|
|
1100
1204
|
<a
|
|
1101
1205
|
href="#hr"
|
|
1102
1206
|
title=""
|
|
1103
1207
|
>
|
|
1104
1208
|
Horizontal Rule
|
|
1105
1209
|
</a>
|
|
1106
|
-
|
|
1210
|
+
|
|
1211
|
+
|
|
1107
1212
|
<a
|
|
1108
1213
|
href="#lines"
|
|
1109
1214
|
title=""
|
|
1110
1215
|
>
|
|
1111
1216
|
Line Breaks
|
|
1112
1217
|
</a>
|
|
1113
|
-
|
|
1218
|
+
|
|
1219
|
+
|
|
1114
1220
|
<a
|
|
1115
1221
|
href="#videos"
|
|
1116
1222
|
title=""
|
|
@@ -1246,7 +1352,7 @@ test('kitchen sink', () => {
|
|
|
1246
1352
|
<code>
|
|
1247
1353
|
1. First ordered list item
|
|
1248
1354
|
2. Another item
|
|
1249
|
-
⋅⋅* Unordered sub-list.
|
|
1355
|
+
⋅⋅* Unordered sub-list.
|
|
1250
1356
|
1. Actual numbers don't matter, just that it's a number
|
|
1251
1357
|
⋅⋅1. Ordered sub-list
|
|
1252
1358
|
4. And another item.
|
|
@@ -1305,10 +1411,8 @@ test('kitchen sink', () => {
|
|
|
1305
1411
|
</p>
|
|
1306
1412
|
<p>
|
|
1307
1413
|
To have a line break without a paragraph, you will need to use two trailing spaces.
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
<br />
|
|
1311
|
-
(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.)
|
|
1312
1416
|
</p>
|
|
1313
1417
|
</li>
|
|
1314
1418
|
</ol>
|
|
@@ -1356,8 +1460,8 @@ test('kitchen sink', () => {
|
|
|
1356
1460
|
|
|
1357
1461
|
Or leave it empty and use the [link text itself].
|
|
1358
1462
|
|
|
1359
|
-
URLs and URLs in angle brackets will automatically get turned into links.
|
|
1360
|
-
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
|
|
1361
1465
|
example.com (but not on Github, for example).
|
|
1362
1466
|
|
|
1363
1467
|
Some text to show that the reference links can follow later.
|
|
@@ -1439,10 +1543,10 @@ test('kitchen sink', () => {
|
|
|
1439
1543
|
<code>
|
|
1440
1544
|
Here's our logo (hover to see the title text):
|
|
1441
1545
|
|
|
1442
|
-
Inline-style:
|
|
1546
|
+
Inline-style:
|
|
1443
1547
|

|
|
1444
1548
|
|
|
1445
|
-
Reference-style:
|
|
1549
|
+
Reference-style:
|
|
1446
1550
|
![alt text][logo]
|
|
1447
1551
|
|
|
1448
1552
|
[logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"
|
|
@@ -1529,7 +1633,7 @@ test('kitchen sink', () => {
|
|
|
1529
1633
|
</pre>
|
|
1530
1634
|
<pre>
|
|
1531
1635
|
<code>
|
|
1532
|
-
No language indicated, so no syntax highlighting.
|
|
1636
|
+
No language indicated, so no syntax highlighting.
|
|
1533
1637
|
But let's throw in a <b>tag</b>.
|
|
1534
1638
|
</code>
|
|
1535
1639
|
</pre>
|
|
@@ -1551,7 +1655,7 @@ test('kitchen sink', () => {
|
|
|
1551
1655
|
</pre>
|
|
1552
1656
|
<pre>
|
|
1553
1657
|
<code>
|
|
1554
|
-
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).
|
|
1555
1659
|
But let's throw in a <b>tag</b>.
|
|
1556
1660
|
</code>
|
|
1557
1661
|
</pre>
|
|
@@ -1579,7 +1683,7 @@ test('kitchen sink', () => {
|
|
|
1579
1683
|
| zebra stripes | are neat | $1 |
|
|
1580
1684
|
|
|
1581
1685
|
There must be at least 3 dashes separating each header cell.
|
|
1582
|
-
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
|
|
1583
1687
|
raw Markdown line up prettily. You can also use inline Markdown.
|
|
1584
1688
|
|
|
1585
1689
|
Markdown | Less | Pretty
|
|
@@ -1758,7 +1862,7 @@ test('kitchen sink', () => {
|
|
|
1758
1862
|
|
|
1759
1863
|
Quote break.
|
|
1760
1864
|
|
|
1761
|
-
> 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
|
+
> 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.
|
|
1762
1866
|
</code>
|
|
1763
1867
|
</pre>
|
|
1764
1868
|
<blockquote>
|
|
@@ -1803,6 +1907,32 @@ test('kitchen sink', () => {
|
|
|
1803
1907
|
</dl>
|
|
1804
1908
|
</code>
|
|
1805
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>
|
|
1806
1936
|
<a
|
|
1807
1937
|
name="hr"
|
|
1808
1938
|
/>
|
|
@@ -1875,8 +2005,7 @@ test('kitchen sink', () => {
|
|
|
1875
2005
|
</p>
|
|
1876
2006
|
<p>
|
|
1877
2007
|
This line is also begins a separate paragraph, but...
|
|
1878
|
-
|
|
1879
|
-
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
|
|
1880
2009
|
<em>
|
|
1881
2010
|
same paragraph
|
|
1882
2011
|
</em>
|
|
@@ -1901,7 +2030,7 @@ test('kitchen sink', () => {
|
|
|
1901
2030
|
<pre>
|
|
1902
2031
|
<code>
|
|
1903
2032
|
<a href="http://www.youtube.com/watch?feature=player_embedded&v=YOUTUBE_VIDEO_ID_HERE
|
|
1904
|
-
" target="_blank"><img src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"
|
|
2033
|
+
" target="_blank"><img src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"
|
|
1905
2034
|
alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /></a>
|
|
1906
2035
|
</code>
|
|
1907
2036
|
</pre>
|
|
@@ -1953,4 +2082,144 @@ test('code block rendering', () => {
|
|
|
1953
2082
|
}
|
|
1954
2083
|
`);
|
|
1955
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
|
+
});
|
|
1956
2225
|
//# sourceMappingURL=safe-mdx.test.js.map
|