Markdown parser, done right. 100% CommonMark support, extensions, syntax plugins & high speed
https://markdown-it.github.io/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
1.4 KiB
81 lines
1.4 KiB
|
|
An example from php markdown readme:
|
|
|
|
.
|
|
*[HTML]: Hyper Text Markup Language
|
|
*[W3C]: World Wide Web Consortium
|
|
The HTML specification
|
|
is maintained by the W3C.
|
|
.
|
|
<p>The <abbr title="Hyper Text Markup Language">HTML</abbr> specification
|
|
is maintained by the <abbr title="World Wide Web Consortium">W3C</abbr>.</p>
|
|
.
|
|
|
|
They can contain arbitrary markup (see pandoc implementation):
|
|
|
|
.
|
|
*[`\]:`]: foo
|
|
\`]:\`
|
|
.
|
|
<p><abbr title="foo">`]:`</abbr></p>
|
|
.
|
|
|
|
No empty abbreviations:
|
|
|
|
.
|
|
*[foo]:
|
|
foo
|
|
.
|
|
<p>*[foo]:
|
|
foo</p>
|
|
.
|
|
|
|
Intersecting abbreviations (first should match):
|
|
|
|
.
|
|
*[Bar Foo]: 123
|
|
*[Foo Bar]: 456
|
|
|
|
Foo Bar Foo
|
|
|
|
Bar Foo Bar
|
|
.
|
|
<p><abbr title="456">Foo Bar</abbr> Foo</p>
|
|
<p><abbr title="123">Bar Foo</abbr> Bar</p>
|
|
.
|
|
|
|
Don't bother with nested abbreviations (yet?):
|
|
|
|
.
|
|
*[JS]: javascript
|
|
*[HTTP]: hyper text blah blah
|
|
*[JS HTTP]: is awesome
|
|
JS HTTP is a collection of low-level javascript HTTP-related modules
|
|
.
|
|
<p><abbr title="is awesome">JS HTTP</abbr> is a collection of low-level javascript <abbr title="hyper text blah blah">HTTP</abbr>-related modules</p>
|
|
.
|
|
|
|
Mixing up abbreviations and references:
|
|
|
|
.
|
|
*[foo]: 123
|
|
[bar]: 456
|
|
*[baz]: 789
|
|
[quux]: 012
|
|
and a paragraph continuation
|
|
|
|
foo [bar] baz [quux]
|
|
.
|
|
<p>and a paragraph continuation</p>
|
|
<p><abbr title="123">foo</abbr> <a href="456">bar</a> <abbr title="789">baz</abbr> <a href="012">quux</a></p>
|
|
.
|
|
|
|
Don't match the middle of the string:
|
|
|
|
.
|
|
*[foo]: blah
|
|
*[bar]: blah
|
|
foobar
|
|
.
|
|
<p>foobar</p>
|
|
.
|
|
|