diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:23:02 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:23:02 +0000 |
commit | 943e3dc057eca53e68ddec51529bd6a1279ebd8e (patch) | |
tree | 61fb7bac619a56dfbcdcbdb7b0d4d6535fc36fe9 /tests | |
parent | Initial commit. (diff) | |
download | myst-parser-943e3dc057eca53e68ddec51529bd6a1279ebd8e.tar.xz myst-parser-943e3dc057eca53e68ddec51529bd6a1279ebd8e.zip |
Adding upstream version 0.18.1.upstream/0.18.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests')
136 files changed, 15924 insertions, 0 deletions
diff --git a/tests/test_cli.py b/tests/test_cli.py new file mode 100644 index 0000000..4725f93 --- /dev/null +++ b/tests/test_cli.py @@ -0,0 +1,15 @@ +from unittest import mock + +from myst_parser.cli import print_anchors + + +def test_print_anchors(): + from io import StringIO + + in_stream = StringIO("# a\n\n## b\n\ntext") + out_stream = StringIO() + with mock.patch("sys.stdin", in_stream): + with mock.patch("sys.stdout", out_stream): + print_anchors(["-l", "1"]) + out_stream.seek(0) + assert out_stream.read().strip() == '<h1 id="a"></h1>' diff --git a/tests/test_commonmark/commonmark.json b/tests/test_commonmark/commonmark.json new file mode 100644 index 0000000..222fee4 --- /dev/null +++ b/tests/test_commonmark/commonmark.json @@ -0,0 +1,5194 @@ +[ + { + "markdown": "\tfoo\tbaz\t\tbim\n", + "html": "<pre><code>foo\tbaz\t\tbim\n</code></pre>\n", + "example": 1, + "start_line": 352, + "end_line": 357, + "section": "Tabs" + }, + { + "markdown": " \tfoo\tbaz\t\tbim\n", + "html": "<pre><code>foo\tbaz\t\tbim\n</code></pre>\n", + "example": 2, + "start_line": 359, + "end_line": 364, + "section": "Tabs" + }, + { + "markdown": " a\ta\n ὐ\ta\n", + "html": "<pre><code>a\ta\nὐ\ta\n</code></pre>\n", + "example": 3, + "start_line": 366, + "end_line": 373, + "section": "Tabs" + }, + { + "markdown": " - foo\n\n\tbar\n", + "html": "<ul>\n<li>\n<p>foo</p>\n<p>bar</p>\n</li>\n</ul>\n", + "example": 4, + "start_line": 379, + "end_line": 390, + "section": "Tabs" + }, + { + "markdown": "- foo\n\n\t\tbar\n", + "html": "<ul>\n<li>\n<p>foo</p>\n<pre><code> bar\n</code></pre>\n</li>\n</ul>\n", + "example": 5, + "start_line": 392, + "end_line": 404, + "section": "Tabs" + }, + { + "markdown": ">\t\tfoo\n", + "html": "<blockquote>\n<pre><code> foo\n</code></pre>\n</blockquote>\n", + "example": 6, + "start_line": 415, + "end_line": 422, + "section": "Tabs" + }, + { + "markdown": "-\t\tfoo\n", + "html": "<ul>\n<li>\n<pre><code> foo\n</code></pre>\n</li>\n</ul>\n", + "example": 7, + "start_line": 424, + "end_line": 433, + "section": "Tabs" + }, + { + "markdown": " foo\n\tbar\n", + "html": "<pre><code>foo\nbar\n</code></pre>\n", + "example": 8, + "start_line": 436, + "end_line": 443, + "section": "Tabs" + }, + { + "markdown": " - foo\n - bar\n\t - baz\n", + "html": "<ul>\n<li>foo\n<ul>\n<li>bar\n<ul>\n<li>baz</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n", + "example": 9, + "start_line": 445, + "end_line": 461, + "section": "Tabs" + }, + { + "markdown": "#\tFoo\n", + "html": "<h1>Foo</h1>\n", + "example": 10, + "start_line": 463, + "end_line": 467, + "section": "Tabs" + }, + { + "markdown": "*\t*\t*\t\n", + "html": "<hr />\n", + "example": 11, + "start_line": 469, + "end_line": 473, + "section": "Tabs" + }, + { + "markdown": "- `one\n- two`\n", + "html": "<ul>\n<li>`one</li>\n<li>two`</li>\n</ul>\n", + "example": 12, + "start_line": 496, + "end_line": 504, + "section": "Precedence" + }, + { + "markdown": "***\n---\n___\n", + "html": "<hr />\n<hr />\n<hr />\n", + "example": 13, + "start_line": 535, + "end_line": 543, + "section": "Thematic breaks" + }, + { + "markdown": "+++\n", + "html": "<p>+++</p>\n", + "example": 14, + "start_line": 548, + "end_line": 552, + "section": "Thematic breaks" + }, + { + "markdown": "===\n", + "html": "<p>===</p>\n", + "example": 15, + "start_line": 555, + "end_line": 559, + "section": "Thematic breaks" + }, + { + "markdown": "--\n**\n__\n", + "html": "<p>--\n**\n__</p>\n", + "example": 16, + "start_line": 564, + "end_line": 572, + "section": "Thematic breaks" + }, + { + "markdown": " ***\n ***\n ***\n", + "html": "<hr />\n<hr />\n<hr />\n", + "example": 17, + "start_line": 577, + "end_line": 585, + "section": "Thematic breaks" + }, + { + "markdown": " ***\n", + "html": "<pre><code>***\n</code></pre>\n", + "example": 18, + "start_line": 590, + "end_line": 595, + "section": "Thematic breaks" + }, + { + "markdown": "Foo\n ***\n", + "html": "<p>Foo\n***</p>\n", + "example": 19, + "start_line": 598, + "end_line": 604, + "section": "Thematic breaks" + }, + { + "markdown": "_____________________________________\n", + "html": "<hr />\n", + "example": 20, + "start_line": 609, + "end_line": 613, + "section": "Thematic breaks" + }, + { + "markdown": " - - -\n", + "html": "<hr />\n", + "example": 21, + "start_line": 618, + "end_line": 622, + "section": "Thematic breaks" + }, + { + "markdown": " ** * ** * ** * **\n", + "html": "<hr />\n", + "example": 22, + "start_line": 625, + "end_line": 629, + "section": "Thematic breaks" + }, + { + "markdown": "- - - -\n", + "html": "<hr />\n", + "example": 23, + "start_line": 632, + "end_line": 636, + "section": "Thematic breaks" + }, + { + "markdown": "- - - - \n", + "html": "<hr />\n", + "example": 24, + "start_line": 641, + "end_line": 645, + "section": "Thematic breaks" + }, + { + "markdown": "_ _ _ _ a\n\na------\n\n---a---\n", + "html": "<p>_ _ _ _ a</p>\n<p>a------</p>\n<p>---a---</p>\n", + "example": 25, + "start_line": 650, + "end_line": 660, + "section": "Thematic breaks" + }, + { + "markdown": " *-*\n", + "html": "<p><em>-</em></p>\n", + "example": 26, + "start_line": 666, + "end_line": 670, + "section": "Thematic breaks" + }, + { + "markdown": "- foo\n***\n- bar\n", + "html": "<ul>\n<li>foo</li>\n</ul>\n<hr />\n<ul>\n<li>bar</li>\n</ul>\n", + "example": 27, + "start_line": 675, + "end_line": 687, + "section": "Thematic breaks" + }, + { + "markdown": "Foo\n***\nbar\n", + "html": "<p>Foo</p>\n<hr />\n<p>bar</p>\n", + "example": 28, + "start_line": 692, + "end_line": 700, + "section": "Thematic breaks" + }, + { + "markdown": "Foo\n---\nbar\n", + "html": "<h2>Foo</h2>\n<p>bar</p>\n", + "example": 29, + "start_line": 709, + "end_line": 716, + "section": "Thematic breaks" + }, + { + "markdown": "* Foo\n* * *\n* Bar\n", + "html": "<ul>\n<li>Foo</li>\n</ul>\n<hr />\n<ul>\n<li>Bar</li>\n</ul>\n", + "example": 30, + "start_line": 722, + "end_line": 734, + "section": "Thematic breaks" + }, + { + "markdown": "- Foo\n- * * *\n", + "html": "<ul>\n<li>Foo</li>\n<li>\n<hr />\n</li>\n</ul>\n", + "example": 31, + "start_line": 739, + "end_line": 749, + "section": "Thematic breaks" + }, + { + "markdown": "# foo\n## foo\n### foo\n#### foo\n##### foo\n###### foo\n", + "html": "<h1>foo</h1>\n<h2>foo</h2>\n<h3>foo</h3>\n<h4>foo</h4>\n<h5>foo</h5>\n<h6>foo</h6>\n", + "example": 32, + "start_line": 768, + "end_line": 782, + "section": "ATX headings" + }, + { + "markdown": "####### foo\n", + "html": "<p>####### foo</p>\n", + "example": 33, + "start_line": 787, + "end_line": 791, + "section": "ATX headings" + }, + { + "markdown": "#5 bolt\n\n#hashtag\n", + "html": "<p>#5 bolt</p>\n<p>#hashtag</p>\n", + "example": 34, + "start_line": 802, + "end_line": 809, + "section": "ATX headings" + }, + { + "markdown": "\\## foo\n", + "html": "<p>## foo</p>\n", + "example": 35, + "start_line": 814, + "end_line": 818, + "section": "ATX headings" + }, + { + "markdown": "# foo *bar* \\*baz\\*\n", + "html": "<h1>foo <em>bar</em> *baz*</h1>\n", + "example": 36, + "start_line": 823, + "end_line": 827, + "section": "ATX headings" + }, + { + "markdown": "# foo \n", + "html": "<h1>foo</h1>\n", + "example": 37, + "start_line": 832, + "end_line": 836, + "section": "ATX headings" + }, + { + "markdown": " ### foo\n ## foo\n # foo\n", + "html": "<h3>foo</h3>\n<h2>foo</h2>\n<h1>foo</h1>\n", + "example": 38, + "start_line": 841, + "end_line": 849, + "section": "ATX headings" + }, + { + "markdown": " # foo\n", + "html": "<pre><code># foo\n</code></pre>\n", + "example": 39, + "start_line": 854, + "end_line": 859, + "section": "ATX headings" + }, + { + "markdown": "foo\n # bar\n", + "html": "<p>foo\n# bar</p>\n", + "example": 40, + "start_line": 862, + "end_line": 868, + "section": "ATX headings" + }, + { + "markdown": "## foo ##\n ### bar ###\n", + "html": "<h2>foo</h2>\n<h3>bar</h3>\n", + "example": 41, + "start_line": 873, + "end_line": 879, + "section": "ATX headings" + }, + { + "markdown": "# foo ##################################\n##### foo ##\n", + "html": "<h1>foo</h1>\n<h5>foo</h5>\n", + "example": 42, + "start_line": 884, + "end_line": 890, + "section": "ATX headings" + }, + { + "markdown": "### foo ### \n", + "html": "<h3>foo</h3>\n", + "example": 43, + "start_line": 895, + "end_line": 899, + "section": "ATX headings" + }, + { + "markdown": "### foo ### b\n", + "html": "<h3>foo ### b</h3>\n", + "example": 44, + "start_line": 906, + "end_line": 910, + "section": "ATX headings" + }, + { + "markdown": "# foo#\n", + "html": "<h1>foo#</h1>\n", + "example": 45, + "start_line": 915, + "end_line": 919, + "section": "ATX headings" + }, + { + "markdown": "### foo \\###\n## foo #\\##\n# foo \\#\n", + "html": "<h3>foo ###</h3>\n<h2>foo ###</h2>\n<h1>foo #</h1>\n", + "example": 46, + "start_line": 925, + "end_line": 933, + "section": "ATX headings" + }, + { + "markdown": "****\n## foo\n****\n", + "html": "<hr />\n<h2>foo</h2>\n<hr />\n", + "example": 47, + "start_line": 939, + "end_line": 947, + "section": "ATX headings" + }, + { + "markdown": "Foo bar\n# baz\nBar foo\n", + "html": "<p>Foo bar</p>\n<h1>baz</h1>\n<p>Bar foo</p>\n", + "example": 48, + "start_line": 950, + "end_line": 958, + "section": "ATX headings" + }, + { + "markdown": "## \n#\n### ###\n", + "html": "<h2></h2>\n<h1></h1>\n<h3></h3>\n", + "example": 49, + "start_line": 963, + "end_line": 971, + "section": "ATX headings" + }, + { + "markdown": "Foo *bar*\n=========\n\nFoo *bar*\n---------\n", + "html": "<h1>Foo <em>bar</em></h1>\n<h2>Foo <em>bar</em></h2>\n", + "example": 50, + "start_line": 1006, + "end_line": 1015, + "section": "Setext headings" + }, + { + "markdown": "Foo *bar\nbaz*\n====\n", + "html": "<h1>Foo <em>bar\nbaz</em></h1>\n", + "example": 51, + "start_line": 1020, + "end_line": 1027, + "section": "Setext headings" + }, + { + "markdown": " Foo *bar\nbaz*\t\n====\n", + "html": "<h1>Foo <em>bar\nbaz</em></h1>\n", + "example": 52, + "start_line": 1034, + "end_line": 1041, + "section": "Setext headings" + }, + { + "markdown": "Foo\n-------------------------\n\nFoo\n=\n", + "html": "<h2>Foo</h2>\n<h1>Foo</h1>\n", + "example": 53, + "start_line": 1046, + "end_line": 1055, + "section": "Setext headings" + }, + { + "markdown": " Foo\n---\n\n Foo\n-----\n\n Foo\n ===\n", + "html": "<h2>Foo</h2>\n<h2>Foo</h2>\n<h1>Foo</h1>\n", + "example": 54, + "start_line": 1061, + "end_line": 1074, + "section": "Setext headings" + }, + { + "markdown": " Foo\n ---\n\n Foo\n---\n", + "html": "<pre><code>Foo\n---\n\nFoo\n</code></pre>\n<hr />\n", + "example": 55, + "start_line": 1079, + "end_line": 1092, + "section": "Setext headings" + }, + { + "markdown": "Foo\n ---- \n", + "html": "<h2>Foo</h2>\n", + "example": 56, + "start_line": 1098, + "end_line": 1103, + "section": "Setext headings" + }, + { + "markdown": "Foo\n ---\n", + "html": "<p>Foo\n---</p>\n", + "example": 57, + "start_line": 1108, + "end_line": 1114, + "section": "Setext headings" + }, + { + "markdown": "Foo\n= =\n\nFoo\n--- -\n", + "html": "<p>Foo\n= =</p>\n<p>Foo</p>\n<hr />\n", + "example": 58, + "start_line": 1119, + "end_line": 1130, + "section": "Setext headings" + }, + { + "markdown": "Foo \n-----\n", + "html": "<h2>Foo</h2>\n", + "example": 59, + "start_line": 1135, + "end_line": 1140, + "section": "Setext headings" + }, + { + "markdown": "Foo\\\n----\n", + "html": "<h2>Foo\\</h2>\n", + "example": 60, + "start_line": 1145, + "end_line": 1150, + "section": "Setext headings" + }, + { + "markdown": "`Foo\n----\n`\n\n<a title=\"a lot\n---\nof dashes\"/>\n", + "html": "<h2>`Foo</h2>\n<p>`</p>\n<h2><a title="a lot</h2>\n<p>of dashes"/></p>\n", + "example": 61, + "start_line": 1156, + "end_line": 1169, + "section": "Setext headings" + }, + { + "markdown": "> Foo\n---\n", + "html": "<blockquote>\n<p>Foo</p>\n</blockquote>\n<hr />\n", + "example": 62, + "start_line": 1175, + "end_line": 1183, + "section": "Setext headings" + }, + { + "markdown": "> foo\nbar\n===\n", + "html": "<blockquote>\n<p>foo\nbar\n===</p>\n</blockquote>\n", + "example": 63, + "start_line": 1186, + "end_line": 1196, + "section": "Setext headings" + }, + { + "markdown": "- Foo\n---\n", + "html": "<ul>\n<li>Foo</li>\n</ul>\n<hr />\n", + "example": 64, + "start_line": 1199, + "end_line": 1207, + "section": "Setext headings" + }, + { + "markdown": "Foo\nBar\n---\n", + "html": "<h2>Foo\nBar</h2>\n", + "example": 65, + "start_line": 1214, + "end_line": 1221, + "section": "Setext headings" + }, + { + "markdown": "---\nFoo\n---\nBar\n---\nBaz\n", + "html": "<hr />\n<h2>Foo</h2>\n<h2>Bar</h2>\n<p>Baz</p>\n", + "example": 66, + "start_line": 1227, + "end_line": 1239, + "section": "Setext headings" + }, + { + "markdown": "\n====\n", + "html": "<p>====</p>\n", + "example": 67, + "start_line": 1244, + "end_line": 1249, + "section": "Setext headings" + }, + { + "markdown": "---\n---\n", + "html": "<hr />\n<hr />\n", + "example": 68, + "start_line": 1256, + "end_line": 1262, + "section": "Setext headings" + }, + { + "markdown": "- foo\n-----\n", + "html": "<ul>\n<li>foo</li>\n</ul>\n<hr />\n", + "example": 69, + "start_line": 1265, + "end_line": 1273, + "section": "Setext headings" + }, + { + "markdown": " foo\n---\n", + "html": "<pre><code>foo\n</code></pre>\n<hr />\n", + "example": 70, + "start_line": 1276, + "end_line": 1283, + "section": "Setext headings" + }, + { + "markdown": "> foo\n-----\n", + "html": "<blockquote>\n<p>foo</p>\n</blockquote>\n<hr />\n", + "example": 71, + "start_line": 1286, + "end_line": 1294, + "section": "Setext headings" + }, + { + "markdown": "\\> foo\n------\n", + "html": "<h2>> foo</h2>\n", + "example": 72, + "start_line": 1300, + "end_line": 1305, + "section": "Setext headings" + }, + { + "markdown": "Foo\n\nbar\n---\nbaz\n", + "html": "<p>Foo</p>\n<h2>bar</h2>\n<p>baz</p>\n", + "example": 73, + "start_line": 1331, + "end_line": 1341, + "section": "Setext headings" + }, + { + "markdown": "Foo\nbar\n\n---\n\nbaz\n", + "html": "<p>Foo\nbar</p>\n<hr />\n<p>baz</p>\n", + "example": 74, + "start_line": 1347, + "end_line": 1359, + "section": "Setext headings" + }, + { + "markdown": "Foo\nbar\n* * *\nbaz\n", + "html": "<p>Foo\nbar</p>\n<hr />\n<p>baz</p>\n", + "example": 75, + "start_line": 1365, + "end_line": 1375, + "section": "Setext headings" + }, + { + "markdown": "Foo\nbar\n\\---\nbaz\n", + "html": "<p>Foo\nbar\n---\nbaz</p>\n", + "example": 76, + "start_line": 1380, + "end_line": 1390, + "section": "Setext headings" + }, + { + "markdown": " a simple\n indented code block\n", + "html": "<pre><code>a simple\n indented code block\n</code></pre>\n", + "example": 77, + "start_line": 1408, + "end_line": 1415, + "section": "Indented code blocks" + }, + { + "markdown": " - foo\n\n bar\n", + "html": "<ul>\n<li>\n<p>foo</p>\n<p>bar</p>\n</li>\n</ul>\n", + "example": 78, + "start_line": 1422, + "end_line": 1433, + "section": "Indented code blocks" + }, + { + "markdown": "1. foo\n\n - bar\n", + "html": "<ol>\n<li>\n<p>foo</p>\n<ul>\n<li>bar</li>\n</ul>\n</li>\n</ol>\n", + "example": 79, + "start_line": 1436, + "end_line": 1449, + "section": "Indented code blocks" + }, + { + "markdown": " <a/>\n *hi*\n\n - one\n", + "html": "<pre><code><a/>\n*hi*\n\n- one\n</code></pre>\n", + "example": 80, + "start_line": 1456, + "end_line": 1467, + "section": "Indented code blocks" + }, + { + "markdown": " chunk1\n\n chunk2\n \n \n \n chunk3\n", + "html": "<pre><code>chunk1\n\nchunk2\n\n\n\nchunk3\n</code></pre>\n", + "example": 81, + "start_line": 1472, + "end_line": 1489, + "section": "Indented code blocks" + }, + { + "markdown": " chunk1\n \n chunk2\n", + "html": "<pre><code>chunk1\n \n chunk2\n</code></pre>\n", + "example": 82, + "start_line": 1495, + "end_line": 1504, + "section": "Indented code blocks" + }, + { + "markdown": "Foo\n bar\n\n", + "html": "<p>Foo\nbar</p>\n", + "example": 83, + "start_line": 1510, + "end_line": 1517, + "section": "Indented code blocks" + }, + { + "markdown": " foo\nbar\n", + "html": "<pre><code>foo\n</code></pre>\n<p>bar</p>\n", + "example": 84, + "start_line": 1524, + "end_line": 1531, + "section": "Indented code blocks" + }, + { + "markdown": "# Heading\n foo\nHeading\n------\n foo\n----\n", + "html": "<h1>Heading</h1>\n<pre><code>foo\n</code></pre>\n<h2>Heading</h2>\n<pre><code>foo\n</code></pre>\n<hr />\n", + "example": 85, + "start_line": 1537, + "end_line": 1552, + "section": "Indented code blocks" + }, + { + "markdown": " foo\n bar\n", + "html": "<pre><code> foo\nbar\n</code></pre>\n", + "example": 86, + "start_line": 1557, + "end_line": 1564, + "section": "Indented code blocks" + }, + { + "markdown": "\n \n foo\n \n\n", + "html": "<pre><code>foo\n</code></pre>\n", + "example": 87, + "start_line": 1570, + "end_line": 1579, + "section": "Indented code blocks" + }, + { + "markdown": " foo \n", + "html": "<pre><code>foo \n</code></pre>\n", + "example": 88, + "start_line": 1584, + "end_line": 1589, + "section": "Indented code blocks" + }, + { + "markdown": "```\n<\n >\n```\n", + "html": "<pre><code><\n >\n</code></pre>\n", + "example": 89, + "start_line": 1639, + "end_line": 1648, + "section": "Fenced code blocks" + }, + { + "markdown": "~~~\n<\n >\n~~~\n", + "html": "<pre><code><\n >\n</code></pre>\n", + "example": 90, + "start_line": 1653, + "end_line": 1662, + "section": "Fenced code blocks" + }, + { + "markdown": "``\nfoo\n``\n", + "html": "<p><code>foo</code></p>\n", + "example": 91, + "start_line": 1666, + "end_line": 1672, + "section": "Fenced code blocks" + }, + { + "markdown": "```\naaa\n~~~\n```\n", + "html": "<pre><code>aaa\n~~~\n</code></pre>\n", + "example": 92, + "start_line": 1677, + "end_line": 1686, + "section": "Fenced code blocks" + }, + { + "markdown": "~~~\naaa\n```\n~~~\n", + "html": "<pre><code>aaa\n```\n</code></pre>\n", + "example": 93, + "start_line": 1689, + "end_line": 1698, + "section": "Fenced code blocks" + }, + { + "markdown": "````\naaa\n```\n``````\n", + "html": "<pre><code>aaa\n```\n</code></pre>\n", + "example": 94, + "start_line": 1703, + "end_line": 1712, + "section": "Fenced code blocks" + }, + { + "markdown": "~~~~\naaa\n~~~\n~~~~\n", + "html": "<pre><code>aaa\n~~~\n</code></pre>\n", + "example": 95, + "start_line": 1715, + "end_line": 1724, + "section": "Fenced code blocks" + }, + { + "markdown": "```\n", + "html": "<pre><code></code></pre>\n", + "example": 96, + "start_line": 1730, + "end_line": 1734, + "section": "Fenced code blocks" + }, + { + "markdown": "`````\n\n```\naaa\n", + "html": "<pre><code>\n```\naaa\n</code></pre>\n", + "example": 97, + "start_line": 1737, + "end_line": 1747, + "section": "Fenced code blocks" + }, + { + "markdown": "> ```\n> aaa\n\nbbb\n", + "html": "<blockquote>\n<pre><code>aaa\n</code></pre>\n</blockquote>\n<p>bbb</p>\n", + "example": 98, + "start_line": 1750, + "end_line": 1761, + "section": "Fenced code blocks" + }, + { + "markdown": "```\n\n \n```\n", + "html": "<pre><code>\n \n</code></pre>\n", + "example": 99, + "start_line": 1766, + "end_line": 1775, + "section": "Fenced code blocks" + }, + { + "markdown": "```\n```\n", + "html": "<pre><code></code></pre>\n", + "example": 100, + "start_line": 1780, + "end_line": 1785, + "section": "Fenced code blocks" + }, + { + "markdown": " ```\n aaa\naaa\n```\n", + "html": "<pre><code>aaa\naaa\n</code></pre>\n", + "example": 101, + "start_line": 1792, + "end_line": 1801, + "section": "Fenced code blocks" + }, + { + "markdown": " ```\naaa\n aaa\naaa\n ```\n", + "html": "<pre><code>aaa\naaa\naaa\n</code></pre>\n", + "example": 102, + "start_line": 1804, + "end_line": 1815, + "section": "Fenced code blocks" + }, + { + "markdown": " ```\n aaa\n aaa\n aaa\n ```\n", + "html": "<pre><code>aaa\n aaa\naaa\n</code></pre>\n", + "example": 103, + "start_line": 1818, + "end_line": 1829, + "section": "Fenced code blocks" + }, + { + "markdown": " ```\n aaa\n ```\n", + "html": "<pre><code>```\naaa\n```\n</code></pre>\n", + "example": 104, + "start_line": 1834, + "end_line": 1843, + "section": "Fenced code blocks" + }, + { + "markdown": "```\naaa\n ```\n", + "html": "<pre><code>aaa\n</code></pre>\n", + "example": 105, + "start_line": 1849, + "end_line": 1856, + "section": "Fenced code blocks" + }, + { + "markdown": " ```\naaa\n ```\n", + "html": "<pre><code>aaa\n</code></pre>\n", + "example": 106, + "start_line": 1859, + "end_line": 1866, + "section": "Fenced code blocks" + }, + { + "markdown": "```\naaa\n ```\n", + "html": "<pre><code>aaa\n ```\n</code></pre>\n", + "example": 107, + "start_line": 1871, + "end_line": 1879, + "section": "Fenced code blocks" + }, + { + "markdown": "``` ```\naaa\n", + "html": "<p><code> </code>\naaa</p>\n", + "example": 108, + "start_line": 1885, + "end_line": 1891, + "section": "Fenced code blocks" + }, + { + "markdown": "~~~~~~\naaa\n~~~ ~~\n", + "html": "<pre><code>aaa\n~~~ ~~\n</code></pre>\n", + "example": 109, + "start_line": 1894, + "end_line": 1902, + "section": "Fenced code blocks" + }, + { + "markdown": "foo\n```\nbar\n```\nbaz\n", + "html": "<p>foo</p>\n<pre><code>bar\n</code></pre>\n<p>baz</p>\n", + "example": 110, + "start_line": 1908, + "end_line": 1919, + "section": "Fenced code blocks" + }, + { + "markdown": "foo\n---\n~~~\nbar\n~~~\n# baz\n", + "html": "<h2>foo</h2>\n<pre><code>bar\n</code></pre>\n<h1>baz</h1>\n", + "example": 111, + "start_line": 1925, + "end_line": 1937, + "section": "Fenced code blocks" + }, + { + "markdown": "```ruby\ndef foo(x)\n return 3\nend\n```\n", + "html": "<pre><code class=\"language-ruby\">def foo(x)\n return 3\nend\n</code></pre>\n", + "example": 112, + "start_line": 1947, + "end_line": 1958, + "section": "Fenced code blocks" + }, + { + "markdown": "~~~~ ruby startline=3 $%@#$\ndef foo(x)\n return 3\nend\n~~~~~~~\n", + "html": "<pre><code class=\"language-ruby\">def foo(x)\n return 3\nend\n</code></pre>\n", + "example": 113, + "start_line": 1961, + "end_line": 1972, + "section": "Fenced code blocks" + }, + { + "markdown": "````;\n````\n", + "html": "<pre><code class=\"language-;\"></code></pre>\n", + "example": 114, + "start_line": 1975, + "end_line": 1980, + "section": "Fenced code blocks" + }, + { + "markdown": "``` aa ```\nfoo\n", + "html": "<p><code>aa</code>\nfoo</p>\n", + "example": 115, + "start_line": 1985, + "end_line": 1991, + "section": "Fenced code blocks" + }, + { + "markdown": "~~~ aa ``` ~~~\nfoo\n~~~\n", + "html": "<pre><code class=\"language-aa\">foo\n</code></pre>\n", + "example": 116, + "start_line": 1996, + "end_line": 2003, + "section": "Fenced code blocks" + }, + { + "markdown": "```\n``` aaa\n```\n", + "html": "<pre><code>``` aaa\n</code></pre>\n", + "example": 117, + "start_line": 2008, + "end_line": 2015, + "section": "Fenced code blocks" + }, + { + "markdown": "<table><tr><td>\n<pre>\n**Hello**,\n\n_world_.\n</pre>\n</td></tr></table>\n", + "html": "<table><tr><td>\n<pre>\n**Hello**,\n<p><em>world</em>.\n</pre></p>\n</td></tr></table>\n", + "example": 118, + "start_line": 2087, + "end_line": 2102, + "section": "HTML blocks" + }, + { + "markdown": "<table>\n <tr>\n <td>\n hi\n </td>\n </tr>\n</table>\n\nokay.\n", + "html": "<table>\n <tr>\n <td>\n hi\n </td>\n </tr>\n</table>\n<p>okay.</p>\n", + "example": 119, + "start_line": 2116, + "end_line": 2135, + "section": "HTML blocks" + }, + { + "markdown": " <div>\n *hello*\n <foo><a>\n", + "html": " <div>\n *hello*\n <foo><a>\n", + "example": 120, + "start_line": 2138, + "end_line": 2146, + "section": "HTML blocks" + }, + { + "markdown": "</div>\n*foo*\n", + "html": "</div>\n*foo*\n", + "example": 121, + "start_line": 2151, + "end_line": 2157, + "section": "HTML blocks" + }, + { + "markdown": "<DIV CLASS=\"foo\">\n\n*Markdown*\n\n</DIV>\n", + "html": "<DIV CLASS=\"foo\">\n<p><em>Markdown</em></p>\n</DIV>\n", + "example": 122, + "start_line": 2162, + "end_line": 2172, + "section": "HTML blocks" + }, + { + "markdown": "<div id=\"foo\"\n class=\"bar\">\n</div>\n", + "html": "<div id=\"foo\"\n class=\"bar\">\n</div>\n", + "example": 123, + "start_line": 2178, + "end_line": 2186, + "section": "HTML blocks" + }, + { + "markdown": "<div id=\"foo\" class=\"bar\n baz\">\n</div>\n", + "html": "<div id=\"foo\" class=\"bar\n baz\">\n</div>\n", + "example": 124, + "start_line": 2189, + "end_line": 2197, + "section": "HTML blocks" + }, + { + "markdown": "<div>\n*foo*\n\n*bar*\n", + "html": "<div>\n*foo*\n<p><em>bar</em></p>\n", + "example": 125, + "start_line": 2201, + "end_line": 2210, + "section": "HTML blocks" + }, + { + "markdown": "<div id=\"foo\"\n*hi*\n", + "html": "<div id=\"foo\"\n*hi*\n", + "example": 126, + "start_line": 2217, + "end_line": 2223, + "section": "HTML blocks" + }, + { + "markdown": "<div class\nfoo\n", + "html": "<div class\nfoo\n", + "example": 127, + "start_line": 2226, + "end_line": 2232, + "section": "HTML blocks" + }, + { + "markdown": "<div *???-&&&-<---\n*foo*\n", + "html": "<div *???-&&&-<---\n*foo*\n", + "example": 128, + "start_line": 2238, + "end_line": 2244, + "section": "HTML blocks" + }, + { + "markdown": "<div><a href=\"bar\">*foo*</a></div>\n", + "html": "<div><a href=\"bar\">*foo*</a></div>\n", + "example": 129, + "start_line": 2250, + "end_line": 2254, + "section": "HTML blocks" + }, + { + "markdown": "<table><tr><td>\nfoo\n</td></tr></table>\n", + "html": "<table><tr><td>\nfoo\n</td></tr></table>\n", + "example": 130, + "start_line": 2257, + "end_line": 2265, + "section": "HTML blocks" + }, + { + "markdown": "<div></div>\n``` c\nint x = 33;\n```\n", + "html": "<div></div>\n``` c\nint x = 33;\n```\n", + "example": 131, + "start_line": 2274, + "end_line": 2284, + "section": "HTML blocks" + }, + { + "markdown": "<a href=\"foo\">\n*bar*\n</a>\n", + "html": "<a href=\"foo\">\n*bar*\n</a>\n", + "example": 132, + "start_line": 2291, + "end_line": 2299, + "section": "HTML blocks" + }, + { + "markdown": "<Warning>\n*bar*\n</Warning>\n", + "html": "<Warning>\n*bar*\n</Warning>\n", + "example": 133, + "start_line": 2304, + "end_line": 2312, + "section": "HTML blocks" + }, + { + "markdown": "<i class=\"foo\">\n*bar*\n</i>\n", + "html": "<i class=\"foo\">\n*bar*\n</i>\n", + "example": 134, + "start_line": 2315, + "end_line": 2323, + "section": "HTML blocks" + }, + { + "markdown": "</ins>\n*bar*\n", + "html": "</ins>\n*bar*\n", + "example": 135, + "start_line": 2326, + "end_line": 2332, + "section": "HTML blocks" + }, + { + "markdown": "<del>\n*foo*\n</del>\n", + "html": "<del>\n*foo*\n</del>\n", + "example": 136, + "start_line": 2341, + "end_line": 2349, + "section": "HTML blocks" + }, + { + "markdown": "<del>\n\n*foo*\n\n</del>\n", + "html": "<del>\n<p><em>foo</em></p>\n</del>\n", + "example": 137, + "start_line": 2356, + "end_line": 2366, + "section": "HTML blocks" + }, + { + "markdown": "<del>*foo*</del>\n", + "html": "<p><del><em>foo</em></del></p>\n", + "example": 138, + "start_line": 2374, + "end_line": 2378, + "section": "HTML blocks" + }, + { + "markdown": "<pre language=\"haskell\"><code>\nimport Text.HTML.TagSoup\n\nmain :: IO ()\nmain = print $ parseTags tags\n</code></pre>\nokay\n", + "html": "<pre language=\"haskell\"><code>\nimport Text.HTML.TagSoup\n\nmain :: IO ()\nmain = print $ parseTags tags\n</code></pre>\n<p>okay</p>\n", + "example": 139, + "start_line": 2390, + "end_line": 2406, + "section": "HTML blocks" + }, + { + "markdown": "<script type=\"text/javascript\">\n// JavaScript example\n\ndocument.getElementById(\"demo\").innerHTML = \"Hello JavaScript!\";\n</script>\nokay\n", + "html": "<script type=\"text/javascript\">\n// JavaScript example\n\ndocument.getElementById(\"demo\").innerHTML = \"Hello JavaScript!\";\n</script>\n<p>okay</p>\n", + "example": 140, + "start_line": 2411, + "end_line": 2425, + "section": "HTML blocks" + }, + { + "markdown": "<style\n type=\"text/css\">\nh1 {color:red;}\n\np {color:blue;}\n</style>\nokay\n", + "html": "<style\n type=\"text/css\">\nh1 {color:red;}\n\np {color:blue;}\n</style>\n<p>okay</p>\n", + "example": 141, + "start_line": 2430, + "end_line": 2446, + "section": "HTML blocks" + }, + { + "markdown": "<style\n type=\"text/css\">\n\nfoo\n", + "html": "<style\n type=\"text/css\">\n\nfoo\n", + "example": 142, + "start_line": 2453, + "end_line": 2463, + "section": "HTML blocks" + }, + { + "markdown": "> <div>\n> foo\n\nbar\n", + "html": "<blockquote>\n<div>\nfoo\n</blockquote>\n<p>bar</p>\n", + "example": 143, + "start_line": 2466, + "end_line": 2477, + "section": "HTML blocks" + }, + { + "markdown": "- <div>\n- foo\n", + "html": "<ul>\n<li>\n<div>\n</li>\n<li>foo</li>\n</ul>\n", + "example": 144, + "start_line": 2480, + "end_line": 2490, + "section": "HTML blocks" + }, + { + "markdown": "<style>p{color:red;}</style>\n*foo*\n", + "html": "<style>p{color:red;}</style>\n<p><em>foo</em></p>\n", + "example": 145, + "start_line": 2495, + "end_line": 2501, + "section": "HTML blocks" + }, + { + "markdown": "<!-- foo -->*bar*\n*baz*\n", + "html": "<!-- foo -->*bar*\n<p><em>baz</em></p>\n", + "example": 146, + "start_line": 2504, + "end_line": 2510, + "section": "HTML blocks" + }, + { + "markdown": "<script>\nfoo\n</script>1. *bar*\n", + "html": "<script>\nfoo\n</script>1. *bar*\n", + "example": 147, + "start_line": 2516, + "end_line": 2524, + "section": "HTML blocks" + }, + { + "markdown": "<!-- Foo\n\nbar\n baz -->\nokay\n", + "html": "<!-- Foo\n\nbar\n baz -->\n<p>okay</p>\n", + "example": 148, + "start_line": 2529, + "end_line": 2541, + "section": "HTML blocks" + }, + { + "markdown": "<?php\n\n echo '>';\n\n?>\nokay\n", + "html": "<?php\n\n echo '>';\n\n?>\n<p>okay</p>\n", + "example": 149, + "start_line": 2547, + "end_line": 2561, + "section": "HTML blocks" + }, + { + "markdown": "<!DOCTYPE html>\n", + "html": "<!DOCTYPE html>\n", + "example": 150, + "start_line": 2566, + "end_line": 2570, + "section": "HTML blocks" + }, + { + "markdown": "<![CDATA[\nfunction matchwo(a,b)\n{\n if (a < b && a < 0) then {\n return 1;\n\n } else {\n\n return 0;\n }\n}\n]]>\nokay\n", + "html": "<![CDATA[\nfunction matchwo(a,b)\n{\n if (a < b && a < 0) then {\n return 1;\n\n } else {\n\n return 0;\n }\n}\n]]>\n<p>okay</p>\n", + "example": 151, + "start_line": 2575, + "end_line": 2603, + "section": "HTML blocks" + }, + { + "markdown": " <!-- foo -->\n\n <!-- foo -->\n", + "html": " <!-- foo -->\n<pre><code><!-- foo -->\n</code></pre>\n", + "example": 152, + "start_line": 2608, + "end_line": 2616, + "section": "HTML blocks" + }, + { + "markdown": " <div>\n\n <div>\n", + "html": " <div>\n<pre><code><div>\n</code></pre>\n", + "example": 153, + "start_line": 2619, + "end_line": 2627, + "section": "HTML blocks" + }, + { + "markdown": "Foo\n<div>\nbar\n</div>\n", + "html": "<p>Foo</p>\n<div>\nbar\n</div>\n", + "example": 154, + "start_line": 2633, + "end_line": 2643, + "section": "HTML blocks" + }, + { + "markdown": "<div>\nbar\n</div>\n*foo*\n", + "html": "<div>\nbar\n</div>\n*foo*\n", + "example": 155, + "start_line": 2650, + "end_line": 2660, + "section": "HTML blocks" + }, + { + "markdown": "Foo\n<a href=\"bar\">\nbaz\n", + "html": "<p>Foo\n<a href=\"bar\">\nbaz</p>\n", + "example": 156, + "start_line": 2665, + "end_line": 2673, + "section": "HTML blocks" + }, + { + "markdown": "<div>\n\n*Emphasized* text.\n\n</div>\n", + "html": "<div>\n<p><em>Emphasized</em> text.</p>\n</div>\n", + "example": 157, + "start_line": 2706, + "end_line": 2716, + "section": "HTML blocks" + }, + { + "markdown": "<div>\n*Emphasized* text.\n</div>\n", + "html": "<div>\n*Emphasized* text.\n</div>\n", + "example": 158, + "start_line": 2719, + "end_line": 2727, + "section": "HTML blocks" + }, + { + "markdown": "<table>\n\n<tr>\n\n<td>\nHi\n</td>\n\n</tr>\n\n</table>\n", + "html": "<table>\n<tr>\n<td>\nHi\n</td>\n</tr>\n</table>\n", + "example": 159, + "start_line": 2741, + "end_line": 2761, + "section": "HTML blocks" + }, + { + "markdown": "<table>\n\n <tr>\n\n <td>\n Hi\n </td>\n\n </tr>\n\n</table>\n", + "html": "<table>\n <tr>\n<pre><code><td>\n Hi\n</td>\n</code></pre>\n </tr>\n</table>\n", + "example": 160, + "start_line": 2768, + "end_line": 2789, + "section": "HTML blocks" + }, + { + "markdown": "[foo]: /url \"title\"\n\n[foo]\n", + "html": "<p><a href=\"/url\" title=\"title\">foo</a></p>\n", + "example": 161, + "start_line": 2816, + "end_line": 2822, + "section": "Link reference definitions" + }, + { + "markdown": " [foo]: \n /url \n 'the title' \n\n[foo]\n", + "html": "<p><a href=\"/url\" title=\"the title\">foo</a></p>\n", + "example": 162, + "start_line": 2825, + "end_line": 2833, + "section": "Link reference definitions" + }, + { + "markdown": "[Foo*bar\\]]:my_(url) 'title (with parens)'\n\n[Foo*bar\\]]\n", + "html": "<p><a href=\"my_(url)\" title=\"title (with parens)\">Foo*bar]</a></p>\n", + "example": 163, + "start_line": 2836, + "end_line": 2842, + "section": "Link reference definitions" + }, + { + "markdown": "[Foo bar]:\n<my url>\n'title'\n\n[Foo bar]\n", + "html": "<p><a href=\"my%20url\" title=\"title\">Foo bar</a></p>\n", + "example": 164, + "start_line": 2845, + "end_line": 2853, + "section": "Link reference definitions" + }, + { + "markdown": "[foo]: /url '\ntitle\nline1\nline2\n'\n\n[foo]\n", + "html": "<p><a href=\"/url\" title=\"\ntitle\nline1\nline2\n\">foo</a></p>\n", + "example": 165, + "start_line": 2858, + "end_line": 2872, + "section": "Link reference definitions" + }, + { + "markdown": "[foo]: /url 'title\n\nwith blank line'\n\n[foo]\n", + "html": "<p>[foo]: /url 'title</p>\n<p>with blank line'</p>\n<p>[foo]</p>\n", + "example": 166, + "start_line": 2877, + "end_line": 2887, + "section": "Link reference definitions" + }, + { + "markdown": "[foo]:\n/url\n\n[foo]\n", + "html": "<p><a href=\"/url\">foo</a></p>\n", + "example": 167, + "start_line": 2892, + "end_line": 2899, + "section": "Link reference definitions" + }, + { + "markdown": "[foo]:\n\n[foo]\n", + "html": "<p>[foo]:</p>\n<p>[foo]</p>\n", + "example": 168, + "start_line": 2904, + "end_line": 2911, + "section": "Link reference definitions" + }, + { + "markdown": "[foo]: <>\n\n[foo]\n", + "html": "<p><a href=\"\">foo</a></p>\n", + "example": 169, + "start_line": 2916, + "end_line": 2922, + "section": "Link reference definitions" + }, + { + "markdown": "[foo]: <bar>(baz)\n\n[foo]\n", + "html": "<p>[foo]: <bar>(baz)</p>\n<p>[foo]</p>\n", + "example": 170, + "start_line": 2927, + "end_line": 2934, + "section": "Link reference definitions" + }, + { + "markdown": "[foo]: /url\\bar\\*baz \"foo\\\"bar\\baz\"\n\n[foo]\n", + "html": "<p><a href=\"/url%5Cbar*baz\" title=\"foo"bar\\baz\">foo</a></p>\n", + "example": 171, + "start_line": 2940, + "end_line": 2946, + "section": "Link reference definitions" + }, + { + "markdown": "[foo]\n\n[foo]: url\n", + "html": "<p><a href=\"url\">foo</a></p>\n", + "example": 172, + "start_line": 2951, + "end_line": 2957, + "section": "Link reference definitions" + }, + { + "markdown": "[foo]\n\n[foo]: first\n[foo]: second\n", + "html": "<p><a href=\"first\">foo</a></p>\n", + "example": 173, + "start_line": 2963, + "end_line": 2970, + "section": "Link reference definitions" + }, + { + "markdown": "[FOO]: /url\n\n[Foo]\n", + "html": "<p><a href=\"/url\">Foo</a></p>\n", + "example": 174, + "start_line": 2976, + "end_line": 2982, + "section": "Link reference definitions" + }, + { + "markdown": "[ΑΓΩ]: /φου\n\n[αγω]\n", + "html": "<p><a href=\"/%CF%86%CE%BF%CF%85\">αγω</a></p>\n", + "example": 175, + "start_line": 2985, + "end_line": 2991, + "section": "Link reference definitions" + }, + { + "markdown": "[foo]: /url\n", + "html": "", + "example": 176, + "start_line": 2997, + "end_line": 3000, + "section": "Link reference definitions" + }, + { + "markdown": "[\nfoo\n]: /url\nbar\n", + "html": "<p>bar</p>\n", + "example": 177, + "start_line": 3005, + "end_line": 3012, + "section": "Link reference definitions" + }, + { + "markdown": "[foo]: /url \"title\" ok\n", + "html": "<p>[foo]: /url "title" ok</p>\n", + "example": 178, + "start_line": 3018, + "end_line": 3022, + "section": "Link reference definitions" + }, + { + "markdown": "[foo]: /url\n\"title\" ok\n", + "html": "<p>"title" ok</p>\n", + "example": 179, + "start_line": 3027, + "end_line": 3032, + "section": "Link reference definitions" + }, + { + "markdown": " [foo]: /url \"title\"\n\n[foo]\n", + "html": "<pre><code>[foo]: /url "title"\n</code></pre>\n<p>[foo]</p>\n", + "example": 180, + "start_line": 3038, + "end_line": 3046, + "section": "Link reference definitions" + }, + { + "markdown": "```\n[foo]: /url\n```\n\n[foo]\n", + "html": "<pre><code>[foo]: /url\n</code></pre>\n<p>[foo]</p>\n", + "example": 181, + "start_line": 3052, + "end_line": 3062, + "section": "Link reference definitions" + }, + { + "markdown": "Foo\n[bar]: /baz\n\n[bar]\n", + "html": "<p>Foo\n[bar]: /baz</p>\n<p>[bar]</p>\n", + "example": 182, + "start_line": 3067, + "end_line": 3076, + "section": "Link reference definitions" + }, + { + "markdown": "# [Foo]\n[foo]: /url\n> bar\n", + "html": "<h1><a href=\"/url\">Foo</a></h1>\n<blockquote>\n<p>bar</p>\n</blockquote>\n", + "example": 183, + "start_line": 3082, + "end_line": 3091, + "section": "Link reference definitions" + }, + { + "markdown": "[foo]: /url\nbar\n===\n[foo]\n", + "html": "<h1>bar</h1>\n<p><a href=\"/url\">foo</a></p>\n", + "example": 184, + "start_line": 3093, + "end_line": 3101, + "section": "Link reference definitions" + }, + { + "markdown": "[foo]: /url\n===\n[foo]\n", + "html": "<p>===\n<a href=\"/url\">foo</a></p>\n", + "example": 185, + "start_line": 3103, + "end_line": 3110, + "section": "Link reference definitions" + }, + { + "markdown": "[foo]: /foo-url \"foo\"\n[bar]: /bar-url\n \"bar\"\n[baz]: /baz-url\n\n[foo],\n[bar],\n[baz]\n", + "html": "<p><a href=\"/foo-url\" title=\"foo\">foo</a>,\n<a href=\"/bar-url\" title=\"bar\">bar</a>,\n<a href=\"/baz-url\">baz</a></p>\n", + "example": 186, + "start_line": 3116, + "end_line": 3129, + "section": "Link reference definitions" + }, + { + "markdown": "[foo]\n\n> [foo]: /url\n", + "html": "<p><a href=\"/url\">foo</a></p>\n<blockquote>\n</blockquote>\n", + "example": 187, + "start_line": 3137, + "end_line": 3145, + "section": "Link reference definitions" + }, + { + "markdown": "[foo]: /url\n", + "html": "", + "example": 188, + "start_line": 3154, + "end_line": 3157, + "section": "Link reference definitions" + }, + { + "markdown": "aaa\n\nbbb\n", + "html": "<p>aaa</p>\n<p>bbb</p>\n", + "example": 189, + "start_line": 3171, + "end_line": 3178, + "section": "Paragraphs" + }, + { + "markdown": "aaa\nbbb\n\nccc\nddd\n", + "html": "<p>aaa\nbbb</p>\n<p>ccc\nddd</p>\n", + "example": 190, + "start_line": 3183, + "end_line": 3194, + "section": "Paragraphs" + }, + { + "markdown": "aaa\n\n\nbbb\n", + "html": "<p>aaa</p>\n<p>bbb</p>\n", + "example": 191, + "start_line": 3199, + "end_line": 3207, + "section": "Paragraphs" + }, + { + "markdown": " aaa\n bbb\n", + "html": "<p>aaa\nbbb</p>\n", + "example": 192, + "start_line": 3212, + "end_line": 3218, + "section": "Paragraphs" + }, + { + "markdown": "aaa\n bbb\n ccc\n", + "html": "<p>aaa\nbbb\nccc</p>\n", + "example": 193, + "start_line": 3224, + "end_line": 3232, + "section": "Paragraphs" + }, + { + "markdown": " aaa\nbbb\n", + "html": "<p>aaa\nbbb</p>\n", + "example": 194, + "start_line": 3238, + "end_line": 3244, + "section": "Paragraphs" + }, + { + "markdown": " aaa\nbbb\n", + "html": "<pre><code>aaa\n</code></pre>\n<p>bbb</p>\n", + "example": 195, + "start_line": 3247, + "end_line": 3254, + "section": "Paragraphs" + }, + { + "markdown": "aaa \nbbb \n", + "html": "<p>aaa<br />\nbbb</p>\n", + "example": 196, + "start_line": 3261, + "end_line": 3267, + "section": "Paragraphs" + }, + { + "markdown": " \n\naaa\n \n\n# aaa\n\n \n", + "html": "<p>aaa</p>\n<h1>aaa</h1>\n", + "example": 197, + "start_line": 3278, + "end_line": 3290, + "section": "Blank lines" + }, + { + "markdown": "> # Foo\n> bar\n> baz\n", + "html": "<blockquote>\n<h1>Foo</h1>\n<p>bar\nbaz</p>\n</blockquote>\n", + "example": 198, + "start_line": 3344, + "end_line": 3354, + "section": "Block quotes" + }, + { + "markdown": "># Foo\n>bar\n> baz\n", + "html": "<blockquote>\n<h1>Foo</h1>\n<p>bar\nbaz</p>\n</blockquote>\n", + "example": 199, + "start_line": 3359, + "end_line": 3369, + "section": "Block quotes" + }, + { + "markdown": " > # Foo\n > bar\n > baz\n", + "html": "<blockquote>\n<h1>Foo</h1>\n<p>bar\nbaz</p>\n</blockquote>\n", + "example": 200, + "start_line": 3374, + "end_line": 3384, + "section": "Block quotes" + }, + { + "markdown": " > # Foo\n > bar\n > baz\n", + "html": "<pre><code>> # Foo\n> bar\n> baz\n</code></pre>\n", + "example": 201, + "start_line": 3389, + "end_line": 3398, + "section": "Block quotes" + }, + { + "markdown": "> # Foo\n> bar\nbaz\n", + "html": "<blockquote>\n<h1>Foo</h1>\n<p>bar\nbaz</p>\n</blockquote>\n", + "example": 202, + "start_line": 3404, + "end_line": 3414, + "section": "Block quotes" + }, + { + "markdown": "> bar\nbaz\n> foo\n", + "html": "<blockquote>\n<p>bar\nbaz\nfoo</p>\n</blockquote>\n", + "example": 203, + "start_line": 3420, + "end_line": 3430, + "section": "Block quotes" + }, + { + "markdown": "> foo\n---\n", + "html": "<blockquote>\n<p>foo</p>\n</blockquote>\n<hr />\n", + "example": 204, + "start_line": 3444, + "end_line": 3452, + "section": "Block quotes" + }, + { + "markdown": "> - foo\n- bar\n", + "html": "<blockquote>\n<ul>\n<li>foo</li>\n</ul>\n</blockquote>\n<ul>\n<li>bar</li>\n</ul>\n", + "example": 205, + "start_line": 3464, + "end_line": 3476, + "section": "Block quotes" + }, + { + "markdown": "> foo\n bar\n", + "html": "<blockquote>\n<pre><code>foo\n</code></pre>\n</blockquote>\n<pre><code>bar\n</code></pre>\n", + "example": 206, + "start_line": 3482, + "end_line": 3492, + "section": "Block quotes" + }, + { + "markdown": "> ```\nfoo\n```\n", + "html": "<blockquote>\n<pre><code></code></pre>\n</blockquote>\n<p>foo</p>\n<pre><code></code></pre>\n", + "example": 207, + "start_line": 3495, + "end_line": 3505, + "section": "Block quotes" + }, + { + "markdown": "> foo\n - bar\n", + "html": "<blockquote>\n<p>foo\n- bar</p>\n</blockquote>\n", + "example": 208, + "start_line": 3511, + "end_line": 3519, + "section": "Block quotes" + }, + { + "markdown": ">\n", + "html": "<blockquote>\n</blockquote>\n", + "example": 209, + "start_line": 3535, + "end_line": 3540, + "section": "Block quotes" + }, + { + "markdown": ">\n> \n> \n", + "html": "<blockquote>\n</blockquote>\n", + "example": 210, + "start_line": 3543, + "end_line": 3550, + "section": "Block quotes" + }, + { + "markdown": ">\n> foo\n> \n", + "html": "<blockquote>\n<p>foo</p>\n</blockquote>\n", + "example": 211, + "start_line": 3555, + "end_line": 3563, + "section": "Block quotes" + }, + { + "markdown": "> foo\n\n> bar\n", + "html": "<blockquote>\n<p>foo</p>\n</blockquote>\n<blockquote>\n<p>bar</p>\n</blockquote>\n", + "example": 212, + "start_line": 3568, + "end_line": 3579, + "section": "Block quotes" + }, + { + "markdown": "> foo\n> bar\n", + "html": "<blockquote>\n<p>foo\nbar</p>\n</blockquote>\n", + "example": 213, + "start_line": 3590, + "end_line": 3598, + "section": "Block quotes" + }, + { + "markdown": "> foo\n>\n> bar\n", + "html": "<blockquote>\n<p>foo</p>\n<p>bar</p>\n</blockquote>\n", + "example": 214, + "start_line": 3603, + "end_line": 3612, + "section": "Block quotes" + }, + { + "markdown": "foo\n> bar\n", + "html": "<p>foo</p>\n<blockquote>\n<p>bar</p>\n</blockquote>\n", + "example": 215, + "start_line": 3617, + "end_line": 3625, + "section": "Block quotes" + }, + { + "markdown": "> aaa\n***\n> bbb\n", + "html": "<blockquote>\n<p>aaa</p>\n</blockquote>\n<hr />\n<blockquote>\n<p>bbb</p>\n</blockquote>\n", + "example": 216, + "start_line": 3631, + "end_line": 3643, + "section": "Block quotes" + }, + { + "markdown": "> bar\nbaz\n", + "html": "<blockquote>\n<p>bar\nbaz</p>\n</blockquote>\n", + "example": 217, + "start_line": 3649, + "end_line": 3657, + "section": "Block quotes" + }, + { + "markdown": "> bar\n\nbaz\n", + "html": "<blockquote>\n<p>bar</p>\n</blockquote>\n<p>baz</p>\n", + "example": 218, + "start_line": 3660, + "end_line": 3669, + "section": "Block quotes" + }, + { + "markdown": "> bar\n>\nbaz\n", + "html": "<blockquote>\n<p>bar</p>\n</blockquote>\n<p>baz</p>\n", + "example": 219, + "start_line": 3672, + "end_line": 3681, + "section": "Block quotes" + }, + { + "markdown": "> > > foo\nbar\n", + "html": "<blockquote>\n<blockquote>\n<blockquote>\n<p>foo\nbar</p>\n</blockquote>\n</blockquote>\n</blockquote>\n", + "example": 220, + "start_line": 3688, + "end_line": 3700, + "section": "Block quotes" + }, + { + "markdown": ">>> foo\n> bar\n>>baz\n", + "html": "<blockquote>\n<blockquote>\n<blockquote>\n<p>foo\nbar\nbaz</p>\n</blockquote>\n</blockquote>\n</blockquote>\n", + "example": 221, + "start_line": 3703, + "end_line": 3717, + "section": "Block quotes" + }, + { + "markdown": "> code\n\n> not code\n", + "html": "<blockquote>\n<pre><code>code\n</code></pre>\n</blockquote>\n<blockquote>\n<p>not code</p>\n</blockquote>\n", + "example": 222, + "start_line": 3725, + "end_line": 3737, + "section": "Block quotes" + }, + { + "markdown": "A paragraph\nwith two lines.\n\n indented code\n\n> A block quote.\n", + "html": "<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n", + "example": 223, + "start_line": 3779, + "end_line": 3794, + "section": "List items" + }, + { + "markdown": "1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.\n", + "html": "<ol>\n<li>\n<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n</li>\n</ol>\n", + "example": 224, + "start_line": 3801, + "end_line": 3820, + "section": "List items" + }, + { + "markdown": "- one\n\n two\n", + "html": "<ul>\n<li>one</li>\n</ul>\n<p>two</p>\n", + "example": 225, + "start_line": 3834, + "end_line": 3843, + "section": "List items" + }, + { + "markdown": "- one\n\n two\n", + "html": "<ul>\n<li>\n<p>one</p>\n<p>two</p>\n</li>\n</ul>\n", + "example": 226, + "start_line": 3846, + "end_line": 3857, + "section": "List items" + }, + { + "markdown": " - one\n\n two\n", + "html": "<ul>\n<li>one</li>\n</ul>\n<pre><code> two\n</code></pre>\n", + "example": 227, + "start_line": 3860, + "end_line": 3870, + "section": "List items" + }, + { + "markdown": " - one\n\n two\n", + "html": "<ul>\n<li>\n<p>one</p>\n<p>two</p>\n</li>\n</ul>\n", + "example": 228, + "start_line": 3873, + "end_line": 3884, + "section": "List items" + }, + { + "markdown": " > > 1. one\n>>\n>> two\n", + "html": "<blockquote>\n<blockquote>\n<ol>\n<li>\n<p>one</p>\n<p>two</p>\n</li>\n</ol>\n</blockquote>\n</blockquote>\n", + "example": 229, + "start_line": 3895, + "end_line": 3910, + "section": "List items" + }, + { + "markdown": ">>- one\n>>\n > > two\n", + "html": "<blockquote>\n<blockquote>\n<ul>\n<li>one</li>\n</ul>\n<p>two</p>\n</blockquote>\n</blockquote>\n", + "example": 230, + "start_line": 3922, + "end_line": 3935, + "section": "List items" + }, + { + "markdown": "-one\n\n2.two\n", + "html": "<p>-one</p>\n<p>2.two</p>\n", + "example": 231, + "start_line": 3941, + "end_line": 3948, + "section": "List items" + }, + { + "markdown": "- foo\n\n\n bar\n", + "html": "<ul>\n<li>\n<p>foo</p>\n<p>bar</p>\n</li>\n</ul>\n", + "example": 232, + "start_line": 3954, + "end_line": 3966, + "section": "List items" + }, + { + "markdown": "1. foo\n\n ```\n bar\n ```\n\n baz\n\n > bam\n", + "html": "<ol>\n<li>\n<p>foo</p>\n<pre><code>bar\n</code></pre>\n<p>baz</p>\n<blockquote>\n<p>bam</p>\n</blockquote>\n</li>\n</ol>\n", + "example": 233, + "start_line": 3971, + "end_line": 3993, + "section": "List items" + }, + { + "markdown": "- Foo\n\n bar\n\n\n baz\n", + "html": "<ul>\n<li>\n<p>Foo</p>\n<pre><code>bar\n\n\nbaz\n</code></pre>\n</li>\n</ul>\n", + "example": 234, + "start_line": 3999, + "end_line": 4017, + "section": "List items" + }, + { + "markdown": "123456789. ok\n", + "html": "<ol start=\"123456789\">\n<li>ok</li>\n</ol>\n", + "example": 235, + "start_line": 4021, + "end_line": 4027, + "section": "List items" + }, + { + "markdown": "1234567890. not ok\n", + "html": "<p>1234567890. not ok</p>\n", + "example": 236, + "start_line": 4030, + "end_line": 4034, + "section": "List items" + }, + { + "markdown": "0. ok\n", + "html": "<ol start=\"0\">\n<li>ok</li>\n</ol>\n", + "example": 237, + "start_line": 4039, + "end_line": 4045, + "section": "List items" + }, + { + "markdown": "003. ok\n", + "html": "<ol start=\"3\">\n<li>ok</li>\n</ol>\n", + "example": 238, + "start_line": 4048, + "end_line": 4054, + "section": "List items" + }, + { + "markdown": "-1. not ok\n", + "html": "<p>-1. not ok</p>\n", + "example": 239, + "start_line": 4059, + "end_line": 4063, + "section": "List items" + }, + { + "markdown": "- foo\n\n bar\n", + "html": "<ul>\n<li>\n<p>foo</p>\n<pre><code>bar\n</code></pre>\n</li>\n</ul>\n", + "example": 240, + "start_line": 4082, + "end_line": 4094, + "section": "List items" + }, + { + "markdown": " 10. foo\n\n bar\n", + "html": "<ol start=\"10\">\n<li>\n<p>foo</p>\n<pre><code>bar\n</code></pre>\n</li>\n</ol>\n", + "example": 241, + "start_line": 4099, + "end_line": 4111, + "section": "List items" + }, + { + "markdown": " indented code\n\nparagraph\n\n more code\n", + "html": "<pre><code>indented code\n</code></pre>\n<p>paragraph</p>\n<pre><code>more code\n</code></pre>\n", + "example": 242, + "start_line": 4118, + "end_line": 4130, + "section": "List items" + }, + { + "markdown": "1. indented code\n\n paragraph\n\n more code\n", + "html": "<ol>\n<li>\n<pre><code>indented code\n</code></pre>\n<p>paragraph</p>\n<pre><code>more code\n</code></pre>\n</li>\n</ol>\n", + "example": 243, + "start_line": 4133, + "end_line": 4149, + "section": "List items" + }, + { + "markdown": "1. indented code\n\n paragraph\n\n more code\n", + "html": "<ol>\n<li>\n<pre><code> indented code\n</code></pre>\n<p>paragraph</p>\n<pre><code>more code\n</code></pre>\n</li>\n</ol>\n", + "example": 244, + "start_line": 4155, + "end_line": 4171, + "section": "List items" + }, + { + "markdown": " foo\n\nbar\n", + "html": "<p>foo</p>\n<p>bar</p>\n", + "example": 245, + "start_line": 4182, + "end_line": 4189, + "section": "List items" + }, + { + "markdown": "- foo\n\n bar\n", + "html": "<ul>\n<li>foo</li>\n</ul>\n<p>bar</p>\n", + "example": 246, + "start_line": 4192, + "end_line": 4201, + "section": "List items" + }, + { + "markdown": "- foo\n\n bar\n", + "html": "<ul>\n<li>\n<p>foo</p>\n<p>bar</p>\n</li>\n</ul>\n", + "example": 247, + "start_line": 4209, + "end_line": 4220, + "section": "List items" + }, + { + "markdown": "-\n foo\n-\n ```\n bar\n ```\n-\n baz\n", + "html": "<ul>\n<li>foo</li>\n<li>\n<pre><code>bar\n</code></pre>\n</li>\n<li>\n<pre><code>baz\n</code></pre>\n</li>\n</ul>\n", + "example": 248, + "start_line": 4237, + "end_line": 4258, + "section": "List items" + }, + { + "markdown": "- \n foo\n", + "html": "<ul>\n<li>foo</li>\n</ul>\n", + "example": 249, + "start_line": 4263, + "end_line": 4270, + "section": "List items" + }, + { + "markdown": "-\n\n foo\n", + "html": "<ul>\n<li></li>\n</ul>\n<p>foo</p>\n", + "example": 250, + "start_line": 4277, + "end_line": 4286, + "section": "List items" + }, + { + "markdown": "- foo\n-\n- bar\n", + "html": "<ul>\n<li>foo</li>\n<li></li>\n<li>bar</li>\n</ul>\n", + "example": 251, + "start_line": 4291, + "end_line": 4301, + "section": "List items" + }, + { + "markdown": "- foo\n- \n- bar\n", + "html": "<ul>\n<li>foo</li>\n<li></li>\n<li>bar</li>\n</ul>\n", + "example": 252, + "start_line": 4306, + "end_line": 4316, + "section": "List items" + }, + { + "markdown": "1. foo\n2.\n3. bar\n", + "html": "<ol>\n<li>foo</li>\n<li></li>\n<li>bar</li>\n</ol>\n", + "example": 253, + "start_line": 4321, + "end_line": 4331, + "section": "List items" + }, + { + "markdown": "*\n", + "html": "<ul>\n<li></li>\n</ul>\n", + "example": 254, + "start_line": 4336, + "end_line": 4342, + "section": "List items" + }, + { + "markdown": "foo\n*\n\nfoo\n1.\n", + "html": "<p>foo\n*</p>\n<p>foo\n1.</p>\n", + "example": 255, + "start_line": 4346, + "end_line": 4357, + "section": "List items" + }, + { + "markdown": " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.\n", + "html": "<ol>\n<li>\n<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n</li>\n</ol>\n", + "example": 256, + "start_line": 4368, + "end_line": 4387, + "section": "List items" + }, + { + "markdown": " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.\n", + "html": "<ol>\n<li>\n<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n</li>\n</ol>\n", + "example": 257, + "start_line": 4392, + "end_line": 4411, + "section": "List items" + }, + { + "markdown": " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.\n", + "html": "<ol>\n<li>\n<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n</li>\n</ol>\n", + "example": 258, + "start_line": 4416, + "end_line": 4435, + "section": "List items" + }, + { + "markdown": " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.\n", + "html": "<pre><code>1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.\n</code></pre>\n", + "example": 259, + "start_line": 4440, + "end_line": 4455, + "section": "List items" + }, + { + "markdown": " 1. A paragraph\nwith two lines.\n\n indented code\n\n > A block quote.\n", + "html": "<ol>\n<li>\n<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n</li>\n</ol>\n", + "example": 260, + "start_line": 4470, + "end_line": 4489, + "section": "List items" + }, + { + "markdown": " 1. A paragraph\n with two lines.\n", + "html": "<ol>\n<li>A paragraph\nwith two lines.</li>\n</ol>\n", + "example": 261, + "start_line": 4494, + "end_line": 4502, + "section": "List items" + }, + { + "markdown": "> 1. > Blockquote\ncontinued here.\n", + "html": "<blockquote>\n<ol>\n<li>\n<blockquote>\n<p>Blockquote\ncontinued here.</p>\n</blockquote>\n</li>\n</ol>\n</blockquote>\n", + "example": 262, + "start_line": 4507, + "end_line": 4521, + "section": "List items" + }, + { + "markdown": "> 1. > Blockquote\n> continued here.\n", + "html": "<blockquote>\n<ol>\n<li>\n<blockquote>\n<p>Blockquote\ncontinued here.</p>\n</blockquote>\n</li>\n</ol>\n</blockquote>\n", + "example": 263, + "start_line": 4524, + "end_line": 4538, + "section": "List items" + }, + { + "markdown": "- foo\n - bar\n - baz\n - boo\n", + "html": "<ul>\n<li>foo\n<ul>\n<li>bar\n<ul>\n<li>baz\n<ul>\n<li>boo</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n", + "example": 264, + "start_line": 4552, + "end_line": 4573, + "section": "List items" + }, + { + "markdown": "- foo\n - bar\n - baz\n - boo\n", + "html": "<ul>\n<li>foo</li>\n<li>bar</li>\n<li>baz</li>\n<li>boo</li>\n</ul>\n", + "example": 265, + "start_line": 4578, + "end_line": 4590, + "section": "List items" + }, + { + "markdown": "10) foo\n - bar\n", + "html": "<ol start=\"10\">\n<li>foo\n<ul>\n<li>bar</li>\n</ul>\n</li>\n</ol>\n", + "example": 266, + "start_line": 4595, + "end_line": 4606, + "section": "List items" + }, + { + "markdown": "10) foo\n - bar\n", + "html": "<ol start=\"10\">\n<li>foo</li>\n</ol>\n<ul>\n<li>bar</li>\n</ul>\n", + "example": 267, + "start_line": 4611, + "end_line": 4621, + "section": "List items" + }, + { + "markdown": "- - foo\n", + "html": "<ul>\n<li>\n<ul>\n<li>foo</li>\n</ul>\n</li>\n</ul>\n", + "example": 268, + "start_line": 4626, + "end_line": 4636, + "section": "List items" + }, + { + "markdown": "1. - 2. foo\n", + "html": "<ol>\n<li>\n<ul>\n<li>\n<ol start=\"2\">\n<li>foo</li>\n</ol>\n</li>\n</ul>\n</li>\n</ol>\n", + "example": 269, + "start_line": 4639, + "end_line": 4653, + "section": "List items" + }, + { + "markdown": "- # Foo\n- Bar\n ---\n baz\n", + "html": "<ul>\n<li>\n<h1>Foo</h1>\n</li>\n<li>\n<h2>Bar</h2>\nbaz</li>\n</ul>\n", + "example": 270, + "start_line": 4658, + "end_line": 4672, + "section": "List items" + }, + { + "markdown": "- foo\n- bar\n+ baz\n", + "html": "<ul>\n<li>foo</li>\n<li>bar</li>\n</ul>\n<ul>\n<li>baz</li>\n</ul>\n", + "example": 271, + "start_line": 4894, + "end_line": 4906, + "section": "Lists" + }, + { + "markdown": "1. foo\n2. bar\n3) baz\n", + "html": "<ol>\n<li>foo</li>\n<li>bar</li>\n</ol>\n<ol start=\"3\">\n<li>baz</li>\n</ol>\n", + "example": 272, + "start_line": 4909, + "end_line": 4921, + "section": "Lists" + }, + { + "markdown": "Foo\n- bar\n- baz\n", + "html": "<p>Foo</p>\n<ul>\n<li>bar</li>\n<li>baz</li>\n</ul>\n", + "example": 273, + "start_line": 4928, + "end_line": 4938, + "section": "Lists" + }, + { + "markdown": "The number of windows in my house is\n14. The number of doors is 6.\n", + "html": "<p>The number of windows in my house is\n14. The number of doors is 6.</p>\n", + "example": 274, + "start_line": 5005, + "end_line": 5011, + "section": "Lists" + }, + { + "markdown": "The number of windows in my house is\n1. The number of doors is 6.\n", + "html": "<p>The number of windows in my house is</p>\n<ol>\n<li>The number of doors is 6.</li>\n</ol>\n", + "example": 275, + "start_line": 5015, + "end_line": 5023, + "section": "Lists" + }, + { + "markdown": "- foo\n\n- bar\n\n\n- baz\n", + "html": "<ul>\n<li>\n<p>foo</p>\n</li>\n<li>\n<p>bar</p>\n</li>\n<li>\n<p>baz</p>\n</li>\n</ul>\n", + "example": 276, + "start_line": 5029, + "end_line": 5048, + "section": "Lists" + }, + { + "markdown": "- foo\n - bar\n - baz\n\n\n bim\n", + "html": "<ul>\n<li>foo\n<ul>\n<li>bar\n<ul>\n<li>\n<p>baz</p>\n<p>bim</p>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n", + "example": 277, + "start_line": 5050, + "end_line": 5072, + "section": "Lists" + }, + { + "markdown": "- foo\n- bar\n\n<!-- -->\n\n- baz\n- bim\n", + "html": "<ul>\n<li>foo</li>\n<li>bar</li>\n</ul>\n<!-- -->\n<ul>\n<li>baz</li>\n<li>bim</li>\n</ul>\n", + "example": 278, + "start_line": 5080, + "end_line": 5098, + "section": "Lists" + }, + { + "markdown": "- foo\n\n notcode\n\n- foo\n\n<!-- -->\n\n code\n", + "html": "<ul>\n<li>\n<p>foo</p>\n<p>notcode</p>\n</li>\n<li>\n<p>foo</p>\n</li>\n</ul>\n<!-- -->\n<pre><code>code\n</code></pre>\n", + "example": 279, + "start_line": 5101, + "end_line": 5124, + "section": "Lists" + }, + { + "markdown": "- a\n - b\n - c\n - d\n - e\n - f\n- g\n", + "html": "<ul>\n<li>a</li>\n<li>b</li>\n<li>c</li>\n<li>d</li>\n<li>e</li>\n<li>f</li>\n<li>g</li>\n</ul>\n", + "example": 280, + "start_line": 5132, + "end_line": 5150, + "section": "Lists" + }, + { + "markdown": "1. a\n\n 2. b\n\n 3. c\n", + "html": "<ol>\n<li>\n<p>a</p>\n</li>\n<li>\n<p>b</p>\n</li>\n<li>\n<p>c</p>\n</li>\n</ol>\n", + "example": 281, + "start_line": 5153, + "end_line": 5171, + "section": "Lists" + }, + { + "markdown": "- a\n - b\n - c\n - d\n - e\n", + "html": "<ul>\n<li>a</li>\n<li>b</li>\n<li>c</li>\n<li>d\n- e</li>\n</ul>\n", + "example": 282, + "start_line": 5177, + "end_line": 5191, + "section": "Lists" + }, + { + "markdown": "1. a\n\n 2. b\n\n 3. c\n", + "html": "<ol>\n<li>\n<p>a</p>\n</li>\n<li>\n<p>b</p>\n</li>\n</ol>\n<pre><code>3. c\n</code></pre>\n", + "example": 283, + "start_line": 5197, + "end_line": 5214, + "section": "Lists" + }, + { + "markdown": "- a\n- b\n\n- c\n", + "html": "<ul>\n<li>\n<p>a</p>\n</li>\n<li>\n<p>b</p>\n</li>\n<li>\n<p>c</p>\n</li>\n</ul>\n", + "example": 284, + "start_line": 5220, + "end_line": 5237, + "section": "Lists" + }, + { + "markdown": "* a\n*\n\n* c\n", + "html": "<ul>\n<li>\n<p>a</p>\n</li>\n<li></li>\n<li>\n<p>c</p>\n</li>\n</ul>\n", + "example": 285, + "start_line": 5242, + "end_line": 5257, + "section": "Lists" + }, + { + "markdown": "- a\n- b\n\n c\n- d\n", + "html": "<ul>\n<li>\n<p>a</p>\n</li>\n<li>\n<p>b</p>\n<p>c</p>\n</li>\n<li>\n<p>d</p>\n</li>\n</ul>\n", + "example": 286, + "start_line": 5264, + "end_line": 5283, + "section": "Lists" + }, + { + "markdown": "- a\n- b\n\n [ref]: /url\n- d\n", + "html": "<ul>\n<li>\n<p>a</p>\n</li>\n<li>\n<p>b</p>\n</li>\n<li>\n<p>d</p>\n</li>\n</ul>\n", + "example": 287, + "start_line": 5286, + "end_line": 5304, + "section": "Lists" + }, + { + "markdown": "- a\n- ```\n b\n\n\n ```\n- c\n", + "html": "<ul>\n<li>a</li>\n<li>\n<pre><code>b\n\n\n</code></pre>\n</li>\n<li>c</li>\n</ul>\n", + "example": 288, + "start_line": 5309, + "end_line": 5328, + "section": "Lists" + }, + { + "markdown": "- a\n - b\n\n c\n- d\n", + "html": "<ul>\n<li>a\n<ul>\n<li>\n<p>b</p>\n<p>c</p>\n</li>\n</ul>\n</li>\n<li>d</li>\n</ul>\n", + "example": 289, + "start_line": 5335, + "end_line": 5353, + "section": "Lists" + }, + { + "markdown": "* a\n > b\n >\n* c\n", + "html": "<ul>\n<li>a\n<blockquote>\n<p>b</p>\n</blockquote>\n</li>\n<li>c</li>\n</ul>\n", + "example": 290, + "start_line": 5359, + "end_line": 5373, + "section": "Lists" + }, + { + "markdown": "- a\n > b\n ```\n c\n ```\n- d\n", + "html": "<ul>\n<li>a\n<blockquote>\n<p>b</p>\n</blockquote>\n<pre><code>c\n</code></pre>\n</li>\n<li>d</li>\n</ul>\n", + "example": 291, + "start_line": 5379, + "end_line": 5397, + "section": "Lists" + }, + { + "markdown": "- a\n", + "html": "<ul>\n<li>a</li>\n</ul>\n", + "example": 292, + "start_line": 5402, + "end_line": 5408, + "section": "Lists" + }, + { + "markdown": "- a\n - b\n", + "html": "<ul>\n<li>a\n<ul>\n<li>b</li>\n</ul>\n</li>\n</ul>\n", + "example": 293, + "start_line": 5411, + "end_line": 5422, + "section": "Lists" + }, + { + "markdown": "1. ```\n foo\n ```\n\n bar\n", + "html": "<ol>\n<li>\n<pre><code>foo\n</code></pre>\n<p>bar</p>\n</li>\n</ol>\n", + "example": 294, + "start_line": 5428, + "end_line": 5442, + "section": "Lists" + }, + { + "markdown": "* foo\n * bar\n\n baz\n", + "html": "<ul>\n<li>\n<p>foo</p>\n<ul>\n<li>bar</li>\n</ul>\n<p>baz</p>\n</li>\n</ul>\n", + "example": 295, + "start_line": 5447, + "end_line": 5462, + "section": "Lists" + }, + { + "markdown": "- a\n - b\n - c\n\n- d\n - e\n - f\n", + "html": "<ul>\n<li>\n<p>a</p>\n<ul>\n<li>b</li>\n<li>c</li>\n</ul>\n</li>\n<li>\n<p>d</p>\n<ul>\n<li>e</li>\n<li>f</li>\n</ul>\n</li>\n</ul>\n", + "example": 296, + "start_line": 5465, + "end_line": 5490, + "section": "Lists" + }, + { + "markdown": "`hi`lo`\n", + "html": "<p><code>hi</code>lo`</p>\n", + "example": 297, + "start_line": 5499, + "end_line": 5503, + "section": "Inlines" + }, + { + "markdown": "\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\`\\{\\|\\}\\~\n", + "html": "<p>!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~</p>\n", + "example": 298, + "start_line": 5513, + "end_line": 5517, + "section": "Backslash escapes" + }, + { + "markdown": "\\\t\\A\\a\\ \\3\\φ\\«\n", + "html": "<p>\\\t\\A\\a\\ \\3\\φ\\«</p>\n", + "example": 299, + "start_line": 5523, + "end_line": 5527, + "section": "Backslash escapes" + }, + { + "markdown": "\\*not emphasized*\n\\<br/> not a tag\n\\[not a link](/foo)\n\\`not code`\n1\\. not a list\n\\* not a list\n\\# not a heading\n\\[foo]: /url \"not a reference\"\n\\ö not a character entity\n", + "html": "<p>*not emphasized*\n<br/> not a tag\n[not a link](/foo)\n`not code`\n1. not a list\n* not a list\n# not a heading\n[foo]: /url "not a reference"\n&ouml; not a character entity</p>\n", + "example": 300, + "start_line": 5533, + "end_line": 5553, + "section": "Backslash escapes" + }, + { + "markdown": "\\\\*emphasis*\n", + "html": "<p>\\<em>emphasis</em></p>\n", + "example": 301, + "start_line": 5558, + "end_line": 5562, + "section": "Backslash escapes" + }, + { + "markdown": "foo\\\nbar\n", + "html": "<p>foo<br />\nbar</p>\n", + "example": 302, + "start_line": 5567, + "end_line": 5573, + "section": "Backslash escapes" + }, + { + "markdown": "`` \\[\\` ``\n", + "html": "<p><code>\\[\\`</code></p>\n", + "example": 303, + "start_line": 5579, + "end_line": 5583, + "section": "Backslash escapes" + }, + { + "markdown": " \\[\\]\n", + "html": "<pre><code>\\[\\]\n</code></pre>\n", + "example": 304, + "start_line": 5586, + "end_line": 5591, + "section": "Backslash escapes" + }, + { + "markdown": "~~~\n\\[\\]\n~~~\n", + "html": "<pre><code>\\[\\]\n</code></pre>\n", + "example": 305, + "start_line": 5594, + "end_line": 5601, + "section": "Backslash escapes" + }, + { + "markdown": "<http://example.com?find=\\*>\n", + "html": "<p><a href=\"http://example.com?find=%5C*\">http://example.com?find=\\*</a></p>\n", + "example": 306, + "start_line": 5604, + "end_line": 5608, + "section": "Backslash escapes" + }, + { + "markdown": "<a href=\"/bar\\/)\">\n", + "html": "<a href=\"/bar\\/)\">\n", + "example": 307, + "start_line": 5611, + "end_line": 5615, + "section": "Backslash escapes" + }, + { + "markdown": "[foo](/bar\\* \"ti\\*tle\")\n", + "html": "<p><a href=\"/bar*\" title=\"ti*tle\">foo</a></p>\n", + "example": 308, + "start_line": 5621, + "end_line": 5625, + "section": "Backslash escapes" + }, + { + "markdown": "[foo]\n\n[foo]: /bar\\* \"ti\\*tle\"\n", + "html": "<p><a href=\"/bar*\" title=\"ti*tle\">foo</a></p>\n", + "example": 309, + "start_line": 5628, + "end_line": 5634, + "section": "Backslash escapes" + }, + { + "markdown": "``` foo\\+bar\nfoo\n```\n", + "html": "<pre><code class=\"language-foo+bar\">foo\n</code></pre>\n", + "example": 310, + "start_line": 5637, + "end_line": 5644, + "section": "Backslash escapes" + }, + { + "markdown": " & © Æ Ď\n¾ ℋ ⅆ\n∲ ≧̸\n", + "html": "<p> & © Æ Ď\n¾ ℋ ⅆ\n∲ ≧̸</p>\n", + "example": 311, + "start_line": 5674, + "end_line": 5682, + "section": "Entity and numeric character references" + }, + { + "markdown": "# Ӓ Ϡ �\n", + "html": "<p># Ӓ Ϡ �</p>\n", + "example": 312, + "start_line": 5693, + "end_line": 5697, + "section": "Entity and numeric character references" + }, + { + "markdown": "" ആ ಫ\n", + "html": "<p>" ആ ಫ</p>\n", + "example": 313, + "start_line": 5706, + "end_line": 5710, + "section": "Entity and numeric character references" + }, + { + "markdown": "  &x; &#; &#x;\n�\n&#abcdef0;\n&ThisIsNotDefined; &hi?;\n", + "html": "<p>&nbsp &x; &#; &#x;\n&#987654321;\n&#abcdef0;\n&ThisIsNotDefined; &hi?;</p>\n", + "example": 314, + "start_line": 5715, + "end_line": 5725, + "section": "Entity and numeric character references" + }, + { + "markdown": "©\n", + "html": "<p>&copy</p>\n", + "example": 315, + "start_line": 5732, + "end_line": 5736, + "section": "Entity and numeric character references" + }, + { + "markdown": "&MadeUpEntity;\n", + "html": "<p>&MadeUpEntity;</p>\n", + "example": 316, + "start_line": 5742, + "end_line": 5746, + "section": "Entity and numeric character references" + }, + { + "markdown": "<a href=\"öö.html\">\n", + "html": "<a href=\"öö.html\">\n", + "example": 317, + "start_line": 5753, + "end_line": 5757, + "section": "Entity and numeric character references" + }, + { + "markdown": "[foo](/föö \"föö\")\n", + "html": "<p><a href=\"/f%C3%B6%C3%B6\" title=\"föö\">foo</a></p>\n", + "example": 318, + "start_line": 5760, + "end_line": 5764, + "section": "Entity and numeric character references" + }, + { + "markdown": "[foo]\n\n[foo]: /föö \"föö\"\n", + "html": "<p><a href=\"/f%C3%B6%C3%B6\" title=\"föö\">foo</a></p>\n", + "example": 319, + "start_line": 5767, + "end_line": 5773, + "section": "Entity and numeric character references" + }, + { + "markdown": "``` föö\nfoo\n```\n", + "html": "<pre><code class=\"language-föö\">foo\n</code></pre>\n", + "example": 320, + "start_line": 5776, + "end_line": 5783, + "section": "Entity and numeric character references" + }, + { + "markdown": "`föö`\n", + "html": "<p><code>f&ouml;&ouml;</code></p>\n", + "example": 321, + "start_line": 5789, + "end_line": 5793, + "section": "Entity and numeric character references" + }, + { + "markdown": " föfö\n", + "html": "<pre><code>f&ouml;f&ouml;\n</code></pre>\n", + "example": 322, + "start_line": 5796, + "end_line": 5801, + "section": "Entity and numeric character references" + }, + { + "markdown": "*foo*\n*foo*\n", + "html": "<p>*foo*\n<em>foo</em></p>\n", + "example": 323, + "start_line": 5808, + "end_line": 5814, + "section": "Entity and numeric character references" + }, + { + "markdown": "* foo\n\n* foo\n", + "html": "<p>* foo</p>\n<ul>\n<li>foo</li>\n</ul>\n", + "example": 324, + "start_line": 5816, + "end_line": 5825, + "section": "Entity and numeric character references" + }, + { + "markdown": "foo bar\n", + "html": "<p>foo\n\nbar</p>\n", + "example": 325, + "start_line": 5827, + "end_line": 5833, + "section": "Entity and numeric character references" + }, + { + "markdown": "	foo\n", + "html": "<p>\tfoo</p>\n", + "example": 326, + "start_line": 5835, + "end_line": 5839, + "section": "Entity and numeric character references" + }, + { + "markdown": "[a](url "tit")\n", + "html": "<p>[a](url "tit")</p>\n", + "example": 327, + "start_line": 5842, + "end_line": 5846, + "section": "Entity and numeric character references" + }, + { + "markdown": "`foo`\n", + "html": "<p><code>foo</code></p>\n", + "example": 328, + "start_line": 5870, + "end_line": 5874, + "section": "Code spans" + }, + { + "markdown": "`` foo ` bar ``\n", + "html": "<p><code>foo ` bar</code></p>\n", + "example": 329, + "start_line": 5881, + "end_line": 5885, + "section": "Code spans" + }, + { + "markdown": "` `` `\n", + "html": "<p><code>``</code></p>\n", + "example": 330, + "start_line": 5891, + "end_line": 5895, + "section": "Code spans" + }, + { + "markdown": "` `` `\n", + "html": "<p><code> `` </code></p>\n", + "example": 331, + "start_line": 5899, + "end_line": 5903, + "section": "Code spans" + }, + { + "markdown": "` a`\n", + "html": "<p><code> a</code></p>\n", + "example": 332, + "start_line": 5908, + "end_line": 5912, + "section": "Code spans" + }, + { + "markdown": "` b `\n", + "html": "<p><code> b </code></p>\n", + "example": 333, + "start_line": 5917, + "end_line": 5921, + "section": "Code spans" + }, + { + "markdown": "` `\n` `\n", + "html": "<p><code> </code>\n<code> </code></p>\n", + "example": 334, + "start_line": 5925, + "end_line": 5931, + "section": "Code spans" + }, + { + "markdown": "``\nfoo\nbar \nbaz\n``\n", + "html": "<p><code>foo bar baz</code></p>\n", + "example": 335, + "start_line": 5936, + "end_line": 5944, + "section": "Code spans" + }, + { + "markdown": "``\nfoo \n``\n", + "html": "<p><code>foo </code></p>\n", + "example": 336, + "start_line": 5946, + "end_line": 5952, + "section": "Code spans" + }, + { + "markdown": "`foo bar \nbaz`\n", + "html": "<p><code>foo bar baz</code></p>\n", + "example": 337, + "start_line": 5957, + "end_line": 5962, + "section": "Code spans" + }, + { + "markdown": "`foo\\`bar`\n", + "html": "<p><code>foo\\</code>bar`</p>\n", + "example": 338, + "start_line": 5974, + "end_line": 5978, + "section": "Code spans" + }, + { + "markdown": "``foo`bar``\n", + "html": "<p><code>foo`bar</code></p>\n", + "example": 339, + "start_line": 5985, + "end_line": 5989, + "section": "Code spans" + }, + { + "markdown": "` foo `` bar `\n", + "html": "<p><code>foo `` bar</code></p>\n", + "example": 340, + "start_line": 5991, + "end_line": 5995, + "section": "Code spans" + }, + { + "markdown": "*foo`*`\n", + "html": "<p>*foo<code>*</code></p>\n", + "example": 341, + "start_line": 6003, + "end_line": 6007, + "section": "Code spans" + }, + { + "markdown": "[not a `link](/foo`)\n", + "html": "<p>[not a <code>link](/foo</code>)</p>\n", + "example": 342, + "start_line": 6012, + "end_line": 6016, + "section": "Code spans" + }, + { + "markdown": "`<a href=\"`\">`\n", + "html": "<p><code><a href="</code>">`</p>\n", + "example": 343, + "start_line": 6022, + "end_line": 6026, + "section": "Code spans" + }, + { + "markdown": "<a href=\"`\">`\n", + "html": "<p><a href=\"`\">`</p>\n", + "example": 344, + "start_line": 6031, + "end_line": 6035, + "section": "Code spans" + }, + { + "markdown": "`<http://foo.bar.`baz>`\n", + "html": "<p><code><http://foo.bar.</code>baz>`</p>\n", + "example": 345, + "start_line": 6040, + "end_line": 6044, + "section": "Code spans" + }, + { + "markdown": "<http://foo.bar.`baz>`\n", + "html": "<p><a href=\"http://foo.bar.%60baz\">http://foo.bar.`baz</a>`</p>\n", + "example": 346, + "start_line": 6049, + "end_line": 6053, + "section": "Code spans" + }, + { + "markdown": "```foo``\n", + "html": "<p>```foo``</p>\n", + "example": 347, + "start_line": 6059, + "end_line": 6063, + "section": "Code spans" + }, + { + "markdown": "`foo\n", + "html": "<p>`foo</p>\n", + "example": 348, + "start_line": 6066, + "end_line": 6070, + "section": "Code spans" + }, + { + "markdown": "`foo``bar``\n", + "html": "<p>`foo<code>bar</code></p>\n", + "example": 349, + "start_line": 6075, + "end_line": 6079, + "section": "Code spans" + }, + { + "markdown": "*foo bar*\n", + "html": "<p><em>foo bar</em></p>\n", + "example": 350, + "start_line": 6292, + "end_line": 6296, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "a * foo bar*\n", + "html": "<p>a * foo bar*</p>\n", + "example": 351, + "start_line": 6302, + "end_line": 6306, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "a*\"foo\"*\n", + "html": "<p>a*"foo"*</p>\n", + "example": 352, + "start_line": 6313, + "end_line": 6317, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "* a *\n", + "html": "<p>* a *</p>\n", + "example": 353, + "start_line": 6322, + "end_line": 6326, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo*bar*\n", + "html": "<p>foo<em>bar</em></p>\n", + "example": 354, + "start_line": 6331, + "end_line": 6335, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "5*6*78\n", + "html": "<p>5<em>6</em>78</p>\n", + "example": 355, + "start_line": 6338, + "end_line": 6342, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_foo bar_\n", + "html": "<p><em>foo bar</em></p>\n", + "example": 356, + "start_line": 6347, + "end_line": 6351, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_ foo bar_\n", + "html": "<p>_ foo bar_</p>\n", + "example": 357, + "start_line": 6357, + "end_line": 6361, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "a_\"foo\"_\n", + "html": "<p>a_"foo"_</p>\n", + "example": 358, + "start_line": 6367, + "end_line": 6371, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo_bar_\n", + "html": "<p>foo_bar_</p>\n", + "example": 359, + "start_line": 6376, + "end_line": 6380, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "5_6_78\n", + "html": "<p>5_6_78</p>\n", + "example": 360, + "start_line": 6383, + "end_line": 6387, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "пристаням_стремятся_\n", + "html": "<p>пристаням_стремятся_</p>\n", + "example": 361, + "start_line": 6390, + "end_line": 6394, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "aa_\"bb\"_cc\n", + "html": "<p>aa_"bb"_cc</p>\n", + "example": 362, + "start_line": 6400, + "end_line": 6404, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo-_(bar)_\n", + "html": "<p>foo-<em>(bar)</em></p>\n", + "example": 363, + "start_line": 6411, + "end_line": 6415, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_foo*\n", + "html": "<p>_foo*</p>\n", + "example": 364, + "start_line": 6423, + "end_line": 6427, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*foo bar *\n", + "html": "<p>*foo bar *</p>\n", + "example": 365, + "start_line": 6433, + "end_line": 6437, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*foo bar\n*\n", + "html": "<p>*foo bar\n*</p>\n", + "example": 366, + "start_line": 6442, + "end_line": 6448, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*(*foo)\n", + "html": "<p>*(*foo)</p>\n", + "example": 367, + "start_line": 6455, + "end_line": 6459, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*(*foo*)*\n", + "html": "<p><em>(<em>foo</em>)</em></p>\n", + "example": 368, + "start_line": 6465, + "end_line": 6469, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*foo*bar\n", + "html": "<p><em>foo</em>bar</p>\n", + "example": 369, + "start_line": 6474, + "end_line": 6478, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_foo bar _\n", + "html": "<p>_foo bar _</p>\n", + "example": 370, + "start_line": 6487, + "end_line": 6491, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_(_foo)\n", + "html": "<p>_(_foo)</p>\n", + "example": 371, + "start_line": 6497, + "end_line": 6501, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_(_foo_)_\n", + "html": "<p><em>(<em>foo</em>)</em></p>\n", + "example": 372, + "start_line": 6506, + "end_line": 6510, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_foo_bar\n", + "html": "<p>_foo_bar</p>\n", + "example": 373, + "start_line": 6515, + "end_line": 6519, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_пристаням_стремятся\n", + "html": "<p>_пристаням_стремятся</p>\n", + "example": 374, + "start_line": 6522, + "end_line": 6526, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_foo_bar_baz_\n", + "html": "<p><em>foo_bar_baz</em></p>\n", + "example": 375, + "start_line": 6529, + "end_line": 6533, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_(bar)_.\n", + "html": "<p><em>(bar)</em>.</p>\n", + "example": 376, + "start_line": 6540, + "end_line": 6544, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**foo bar**\n", + "html": "<p><strong>foo bar</strong></p>\n", + "example": 377, + "start_line": 6549, + "end_line": 6553, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "** foo bar**\n", + "html": "<p>** foo bar**</p>\n", + "example": 378, + "start_line": 6559, + "end_line": 6563, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "a**\"foo\"**\n", + "html": "<p>a**"foo"**</p>\n", + "example": 379, + "start_line": 6570, + "end_line": 6574, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo**bar**\n", + "html": "<p>foo<strong>bar</strong></p>\n", + "example": 380, + "start_line": 6579, + "end_line": 6583, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__foo bar__\n", + "html": "<p><strong>foo bar</strong></p>\n", + "example": 381, + "start_line": 6588, + "end_line": 6592, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__ foo bar__\n", + "html": "<p>__ foo bar__</p>\n", + "example": 382, + "start_line": 6598, + "end_line": 6602, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__\nfoo bar__\n", + "html": "<p>__\nfoo bar__</p>\n", + "example": 383, + "start_line": 6606, + "end_line": 6612, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "a__\"foo\"__\n", + "html": "<p>a__"foo"__</p>\n", + "example": 384, + "start_line": 6618, + "end_line": 6622, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo__bar__\n", + "html": "<p>foo__bar__</p>\n", + "example": 385, + "start_line": 6627, + "end_line": 6631, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "5__6__78\n", + "html": "<p>5__6__78</p>\n", + "example": 386, + "start_line": 6634, + "end_line": 6638, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "пристаням__стремятся__\n", + "html": "<p>пристаням__стремятся__</p>\n", + "example": 387, + "start_line": 6641, + "end_line": 6645, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__foo, __bar__, baz__\n", + "html": "<p><strong>foo, <strong>bar</strong>, baz</strong></p>\n", + "example": 388, + "start_line": 6648, + "end_line": 6652, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo-__(bar)__\n", + "html": "<p>foo-<strong>(bar)</strong></p>\n", + "example": 389, + "start_line": 6659, + "end_line": 6663, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**foo bar **\n", + "html": "<p>**foo bar **</p>\n", + "example": 390, + "start_line": 6672, + "end_line": 6676, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**(**foo)\n", + "html": "<p>**(**foo)</p>\n", + "example": 391, + "start_line": 6685, + "end_line": 6689, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*(**foo**)*\n", + "html": "<p><em>(<strong>foo</strong>)</em></p>\n", + "example": 392, + "start_line": 6695, + "end_line": 6699, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**Gomphocarpus (*Gomphocarpus physocarpus*, syn.\n*Asclepias physocarpa*)**\n", + "html": "<p><strong>Gomphocarpus (<em>Gomphocarpus physocarpus</em>, syn.\n<em>Asclepias physocarpa</em>)</strong></p>\n", + "example": 393, + "start_line": 6702, + "end_line": 6708, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**foo \"*bar*\" foo**\n", + "html": "<p><strong>foo "<em>bar</em>" foo</strong></p>\n", + "example": 394, + "start_line": 6711, + "end_line": 6715, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**foo**bar\n", + "html": "<p><strong>foo</strong>bar</p>\n", + "example": 395, + "start_line": 6720, + "end_line": 6724, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__foo bar __\n", + "html": "<p>__foo bar __</p>\n", + "example": 396, + "start_line": 6732, + "end_line": 6736, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__(__foo)\n", + "html": "<p>__(__foo)</p>\n", + "example": 397, + "start_line": 6742, + "end_line": 6746, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_(__foo__)_\n", + "html": "<p><em>(<strong>foo</strong>)</em></p>\n", + "example": 398, + "start_line": 6752, + "end_line": 6756, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__foo__bar\n", + "html": "<p>__foo__bar</p>\n", + "example": 399, + "start_line": 6761, + "end_line": 6765, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__пристаням__стремятся\n", + "html": "<p>__пристаням__стремятся</p>\n", + "example": 400, + "start_line": 6768, + "end_line": 6772, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__foo__bar__baz__\n", + "html": "<p><strong>foo__bar__baz</strong></p>\n", + "example": 401, + "start_line": 6775, + "end_line": 6779, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__(bar)__.\n", + "html": "<p><strong>(bar)</strong>.</p>\n", + "example": 402, + "start_line": 6786, + "end_line": 6790, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*foo [bar](/url)*\n", + "html": "<p><em>foo <a href=\"/url\">bar</a></em></p>\n", + "example": 403, + "start_line": 6798, + "end_line": 6802, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*foo\nbar*\n", + "html": "<p><em>foo\nbar</em></p>\n", + "example": 404, + "start_line": 6805, + "end_line": 6811, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_foo __bar__ baz_\n", + "html": "<p><em>foo <strong>bar</strong> baz</em></p>\n", + "example": 405, + "start_line": 6817, + "end_line": 6821, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_foo _bar_ baz_\n", + "html": "<p><em>foo <em>bar</em> baz</em></p>\n", + "example": 406, + "start_line": 6824, + "end_line": 6828, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__foo_ bar_\n", + "html": "<p><em><em>foo</em> bar</em></p>\n", + "example": 407, + "start_line": 6831, + "end_line": 6835, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*foo *bar**\n", + "html": "<p><em>foo <em>bar</em></em></p>\n", + "example": 408, + "start_line": 6838, + "end_line": 6842, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*foo **bar** baz*\n", + "html": "<p><em>foo <strong>bar</strong> baz</em></p>\n", + "example": 409, + "start_line": 6845, + "end_line": 6849, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*foo**bar**baz*\n", + "html": "<p><em>foo<strong>bar</strong>baz</em></p>\n", + "example": 410, + "start_line": 6851, + "end_line": 6855, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*foo**bar*\n", + "html": "<p><em>foo**bar</em></p>\n", + "example": 411, + "start_line": 6875, + "end_line": 6879, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "***foo** bar*\n", + "html": "<p><em><strong>foo</strong> bar</em></p>\n", + "example": 412, + "start_line": 6888, + "end_line": 6892, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*foo **bar***\n", + "html": "<p><em>foo <strong>bar</strong></em></p>\n", + "example": 413, + "start_line": 6895, + "end_line": 6899, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*foo**bar***\n", + "html": "<p><em>foo<strong>bar</strong></em></p>\n", + "example": 414, + "start_line": 6902, + "end_line": 6906, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo***bar***baz\n", + "html": "<p>foo<em><strong>bar</strong></em>baz</p>\n", + "example": 415, + "start_line": 6913, + "end_line": 6917, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo******bar*********baz\n", + "html": "<p>foo<strong><strong><strong>bar</strong></strong></strong>***baz</p>\n", + "example": 416, + "start_line": 6919, + "end_line": 6923, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*foo **bar *baz* bim** bop*\n", + "html": "<p><em>foo <strong>bar <em>baz</em> bim</strong> bop</em></p>\n", + "example": 417, + "start_line": 6928, + "end_line": 6932, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*foo [*bar*](/url)*\n", + "html": "<p><em>foo <a href=\"/url\"><em>bar</em></a></em></p>\n", + "example": 418, + "start_line": 6935, + "end_line": 6939, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "** is not an empty emphasis\n", + "html": "<p>** is not an empty emphasis</p>\n", + "example": 419, + "start_line": 6944, + "end_line": 6948, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**** is not an empty strong emphasis\n", + "html": "<p>**** is not an empty strong emphasis</p>\n", + "example": 420, + "start_line": 6951, + "end_line": 6955, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**foo [bar](/url)**\n", + "html": "<p><strong>foo <a href=\"/url\">bar</a></strong></p>\n", + "example": 421, + "start_line": 6964, + "end_line": 6968, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**foo\nbar**\n", + "html": "<p><strong>foo\nbar</strong></p>\n", + "example": 422, + "start_line": 6971, + "end_line": 6977, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__foo _bar_ baz__\n", + "html": "<p><strong>foo <em>bar</em> baz</strong></p>\n", + "example": 423, + "start_line": 6983, + "end_line": 6987, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__foo __bar__ baz__\n", + "html": "<p><strong>foo <strong>bar</strong> baz</strong></p>\n", + "example": 424, + "start_line": 6990, + "end_line": 6994, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "____foo__ bar__\n", + "html": "<p><strong><strong>foo</strong> bar</strong></p>\n", + "example": 425, + "start_line": 6997, + "end_line": 7001, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**foo **bar****\n", + "html": "<p><strong>foo <strong>bar</strong></strong></p>\n", + "example": 426, + "start_line": 7004, + "end_line": 7008, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**foo *bar* baz**\n", + "html": "<p><strong>foo <em>bar</em> baz</strong></p>\n", + "example": 427, + "start_line": 7011, + "end_line": 7015, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**foo*bar*baz**\n", + "html": "<p><strong>foo<em>bar</em>baz</strong></p>\n", + "example": 428, + "start_line": 7018, + "end_line": 7022, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "***foo* bar**\n", + "html": "<p><strong><em>foo</em> bar</strong></p>\n", + "example": 429, + "start_line": 7025, + "end_line": 7029, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**foo *bar***\n", + "html": "<p><strong>foo <em>bar</em></strong></p>\n", + "example": 430, + "start_line": 7032, + "end_line": 7036, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**foo *bar **baz**\nbim* bop**\n", + "html": "<p><strong>foo <em>bar <strong>baz</strong>\nbim</em> bop</strong></p>\n", + "example": 431, + "start_line": 7041, + "end_line": 7047, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**foo [*bar*](/url)**\n", + "html": "<p><strong>foo <a href=\"/url\"><em>bar</em></a></strong></p>\n", + "example": 432, + "start_line": 7050, + "end_line": 7054, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__ is not an empty emphasis\n", + "html": "<p>__ is not an empty emphasis</p>\n", + "example": 433, + "start_line": 7059, + "end_line": 7063, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "____ is not an empty strong emphasis\n", + "html": "<p>____ is not an empty strong emphasis</p>\n", + "example": 434, + "start_line": 7066, + "end_line": 7070, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo ***\n", + "html": "<p>foo ***</p>\n", + "example": 435, + "start_line": 7076, + "end_line": 7080, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo *\\**\n", + "html": "<p>foo <em>*</em></p>\n", + "example": 436, + "start_line": 7083, + "end_line": 7087, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo *_*\n", + "html": "<p>foo <em>_</em></p>\n", + "example": 437, + "start_line": 7090, + "end_line": 7094, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo *****\n", + "html": "<p>foo *****</p>\n", + "example": 438, + "start_line": 7097, + "end_line": 7101, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo **\\***\n", + "html": "<p>foo <strong>*</strong></p>\n", + "example": 439, + "start_line": 7104, + "end_line": 7108, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo **_**\n", + "html": "<p>foo <strong>_</strong></p>\n", + "example": 440, + "start_line": 7111, + "end_line": 7115, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**foo*\n", + "html": "<p>*<em>foo</em></p>\n", + "example": 441, + "start_line": 7122, + "end_line": 7126, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*foo**\n", + "html": "<p><em>foo</em>*</p>\n", + "example": 442, + "start_line": 7129, + "end_line": 7133, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "***foo**\n", + "html": "<p>*<strong>foo</strong></p>\n", + "example": 443, + "start_line": 7136, + "end_line": 7140, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "****foo*\n", + "html": "<p>***<em>foo</em></p>\n", + "example": 444, + "start_line": 7143, + "end_line": 7147, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**foo***\n", + "html": "<p><strong>foo</strong>*</p>\n", + "example": 445, + "start_line": 7150, + "end_line": 7154, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*foo****\n", + "html": "<p><em>foo</em>***</p>\n", + "example": 446, + "start_line": 7157, + "end_line": 7161, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo ___\n", + "html": "<p>foo ___</p>\n", + "example": 447, + "start_line": 7167, + "end_line": 7171, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo _\\__\n", + "html": "<p>foo <em>_</em></p>\n", + "example": 448, + "start_line": 7174, + "end_line": 7178, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo _*_\n", + "html": "<p>foo <em>*</em></p>\n", + "example": 449, + "start_line": 7181, + "end_line": 7185, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo _____\n", + "html": "<p>foo _____</p>\n", + "example": 450, + "start_line": 7188, + "end_line": 7192, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo __\\___\n", + "html": "<p>foo <strong>_</strong></p>\n", + "example": 451, + "start_line": 7195, + "end_line": 7199, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "foo __*__\n", + "html": "<p>foo <strong>*</strong></p>\n", + "example": 452, + "start_line": 7202, + "end_line": 7206, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__foo_\n", + "html": "<p>_<em>foo</em></p>\n", + "example": 453, + "start_line": 7209, + "end_line": 7213, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_foo__\n", + "html": "<p><em>foo</em>_</p>\n", + "example": 454, + "start_line": 7220, + "end_line": 7224, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "___foo__\n", + "html": "<p>_<strong>foo</strong></p>\n", + "example": 455, + "start_line": 7227, + "end_line": 7231, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "____foo_\n", + "html": "<p>___<em>foo</em></p>\n", + "example": 456, + "start_line": 7234, + "end_line": 7238, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__foo___\n", + "html": "<p><strong>foo</strong>_</p>\n", + "example": 457, + "start_line": 7241, + "end_line": 7245, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_foo____\n", + "html": "<p><em>foo</em>___</p>\n", + "example": 458, + "start_line": 7248, + "end_line": 7252, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**foo**\n", + "html": "<p><strong>foo</strong></p>\n", + "example": 459, + "start_line": 7258, + "end_line": 7262, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*_foo_*\n", + "html": "<p><em><em>foo</em></em></p>\n", + "example": 460, + "start_line": 7265, + "end_line": 7269, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__foo__\n", + "html": "<p><strong>foo</strong></p>\n", + "example": 461, + "start_line": 7272, + "end_line": 7276, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_*foo*_\n", + "html": "<p><em><em>foo</em></em></p>\n", + "example": 462, + "start_line": 7279, + "end_line": 7283, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "****foo****\n", + "html": "<p><strong><strong>foo</strong></strong></p>\n", + "example": 463, + "start_line": 7289, + "end_line": 7293, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "____foo____\n", + "html": "<p><strong><strong>foo</strong></strong></p>\n", + "example": 464, + "start_line": 7296, + "end_line": 7300, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "******foo******\n", + "html": "<p><strong><strong><strong>foo</strong></strong></strong></p>\n", + "example": 465, + "start_line": 7307, + "end_line": 7311, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "***foo***\n", + "html": "<p><em><strong>foo</strong></em></p>\n", + "example": 466, + "start_line": 7316, + "end_line": 7320, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_____foo_____\n", + "html": "<p><em><strong><strong>foo</strong></strong></em></p>\n", + "example": 467, + "start_line": 7323, + "end_line": 7327, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*foo _bar* baz_\n", + "html": "<p><em>foo _bar</em> baz_</p>\n", + "example": 468, + "start_line": 7332, + "end_line": 7336, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*foo __bar *baz bim__ bam*\n", + "html": "<p><em>foo <strong>bar *baz bim</strong> bam</em></p>\n", + "example": 469, + "start_line": 7339, + "end_line": 7343, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**foo **bar baz**\n", + "html": "<p>**foo <strong>bar baz</strong></p>\n", + "example": 470, + "start_line": 7348, + "end_line": 7352, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*foo *bar baz*\n", + "html": "<p>*foo <em>bar baz</em></p>\n", + "example": 471, + "start_line": 7355, + "end_line": 7359, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*[bar*](/url)\n", + "html": "<p>*<a href=\"/url\">bar*</a></p>\n", + "example": 472, + "start_line": 7364, + "end_line": 7368, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_foo [bar_](/url)\n", + "html": "<p>_foo <a href=\"/url\">bar_</a></p>\n", + "example": 473, + "start_line": 7371, + "end_line": 7375, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*<img src=\"foo\" title=\"*\"/>\n", + "html": "<p>*<img src=\"foo\" title=\"*\"/></p>\n", + "example": 474, + "start_line": 7378, + "end_line": 7382, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**<a href=\"**\">\n", + "html": "<p>**<a href=\"**\"></p>\n", + "example": 475, + "start_line": 7385, + "end_line": 7389, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__<a href=\"__\">\n", + "html": "<p>__<a href=\"__\"></p>\n", + "example": 476, + "start_line": 7392, + "end_line": 7396, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "*a `*`*\n", + "html": "<p><em>a <code>*</code></em></p>\n", + "example": 477, + "start_line": 7399, + "end_line": 7403, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "_a `_`_\n", + "html": "<p><em>a <code>_</code></em></p>\n", + "example": 478, + "start_line": 7406, + "end_line": 7410, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "**a<http://foo.bar/?q=**>\n", + "html": "<p>**a<a href=\"http://foo.bar/?q=**\">http://foo.bar/?q=**</a></p>\n", + "example": 479, + "start_line": 7413, + "end_line": 7417, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "__a<http://foo.bar/?q=__>\n", + "html": "<p>__a<a href=\"http://foo.bar/?q=__\">http://foo.bar/?q=__</a></p>\n", + "example": 480, + "start_line": 7420, + "end_line": 7424, + "section": "Emphasis and strong emphasis" + }, + { + "markdown": "[link](/uri \"title\")\n", + "html": "<p><a href=\"/uri\" title=\"title\">link</a></p>\n", + "example": 481, + "start_line": 7503, + "end_line": 7507, + "section": "Links" + }, + { + "markdown": "[link](/uri)\n", + "html": "<p><a href=\"/uri\">link</a></p>\n", + "example": 482, + "start_line": 7512, + "end_line": 7516, + "section": "Links" + }, + { + "markdown": "[link]()\n", + "html": "<p><a href=\"\">link</a></p>\n", + "example": 483, + "start_line": 7521, + "end_line": 7525, + "section": "Links" + }, + { + "markdown": "[link](<>)\n", + "html": "<p><a href=\"\">link</a></p>\n", + "example": 484, + "start_line": 7528, + "end_line": 7532, + "section": "Links" + }, + { + "markdown": "[link](/my uri)\n", + "html": "<p>[link](/my uri)</p>\n", + "example": 485, + "start_line": 7537, + "end_line": 7541, + "section": "Links" + }, + { + "markdown": "[link](</my uri>)\n", + "html": "<p><a href=\"/my%20uri\">link</a></p>\n", + "example": 486, + "start_line": 7543, + "end_line": 7547, + "section": "Links" + }, + { + "markdown": "[link](foo\nbar)\n", + "html": "<p>[link](foo\nbar)</p>\n", + "example": 487, + "start_line": 7552, + "end_line": 7558, + "section": "Links" + }, + { + "markdown": "[link](<foo\nbar>)\n", + "html": "<p>[link](<foo\nbar>)</p>\n", + "example": 488, + "start_line": 7560, + "end_line": 7566, + "section": "Links" + }, + { + "markdown": "[a](<b)c>)\n", + "html": "<p><a href=\"b)c\">a</a></p>\n", + "example": 489, + "start_line": 7571, + "end_line": 7575, + "section": "Links" + }, + { + "markdown": "[link](<foo\\>)\n", + "html": "<p>[link](<foo>)</p>\n", + "example": 490, + "start_line": 7579, + "end_line": 7583, + "section": "Links" + }, + { + "markdown": "[a](<b)c\n[a](<b)c>\n[a](<b>c)\n", + "html": "<p>[a](<b)c\n[a](<b)c>\n[a](<b>c)</p>\n", + "example": 491, + "start_line": 7588, + "end_line": 7596, + "section": "Links" + }, + { + "markdown": "[link](\\(foo\\))\n", + "html": "<p><a href=\"(foo)\">link</a></p>\n", + "example": 492, + "start_line": 7600, + "end_line": 7604, + "section": "Links" + }, + { + "markdown": "[link](foo(and(bar)))\n", + "html": "<p><a href=\"foo(and(bar))\">link</a></p>\n", + "example": 493, + "start_line": 7609, + "end_line": 7613, + "section": "Links" + }, + { + "markdown": "[link](foo\\(and\\(bar\\))\n", + "html": "<p><a href=\"foo(and(bar)\">link</a></p>\n", + "example": 494, + "start_line": 7618, + "end_line": 7622, + "section": "Links" + }, + { + "markdown": "[link](<foo(and(bar)>)\n", + "html": "<p><a href=\"foo(and(bar)\">link</a></p>\n", + "example": 495, + "start_line": 7625, + "end_line": 7629, + "section": "Links" + }, + { + "markdown": "[link](foo\\)\\:)\n", + "html": "<p><a href=\"foo):\">link</a></p>\n", + "example": 496, + "start_line": 7635, + "end_line": 7639, + "section": "Links" + }, + { + "markdown": "[link](#fragment)\n\n[link](http://example.com#fragment)\n\n[link](http://example.com?foo=3#frag)\n", + "html": "<p><a href=\"#fragment\">link</a></p>\n<p><a href=\"http://example.com#fragment\">link</a></p>\n<p><a href=\"http://example.com?foo=3#frag\">link</a></p>\n", + "example": 497, + "start_line": 7644, + "end_line": 7654, + "section": "Links" + }, + { + "markdown": "[link](foo\\bar)\n", + "html": "<p><a href=\"foo%5Cbar\">link</a></p>\n", + "example": 498, + "start_line": 7660, + "end_line": 7664, + "section": "Links" + }, + { + "markdown": "[link](foo%20bä)\n", + "html": "<p><a href=\"foo%20b%C3%A4\">link</a></p>\n", + "example": 499, + "start_line": 7676, + "end_line": 7680, + "section": "Links" + }, + { + "markdown": "[link](\"title\")\n", + "html": "<p><a href=\"%22title%22\">link</a></p>\n", + "example": 500, + "start_line": 7687, + "end_line": 7691, + "section": "Links" + }, + { + "markdown": "[link](/url \"title\")\n[link](/url 'title')\n[link](/url (title))\n", + "html": "<p><a href=\"/url\" title=\"title\">link</a>\n<a href=\"/url\" title=\"title\">link</a>\n<a href=\"/url\" title=\"title\">link</a></p>\n", + "example": 501, + "start_line": 7696, + "end_line": 7704, + "section": "Links" + }, + { + "markdown": "[link](/url \"title \\\""\")\n", + "html": "<p><a href=\"/url\" title=\"title ""\">link</a></p>\n", + "example": 502, + "start_line": 7710, + "end_line": 7714, + "section": "Links" + }, + { + "markdown": "[link](/url \"title\")\n", + "html": "<p><a href=\"/url%C2%A0%22title%22\">link</a></p>\n", + "example": 503, + "start_line": 7720, + "end_line": 7724, + "section": "Links" + }, + { + "markdown": "[link](/url \"title \"and\" title\")\n", + "html": "<p>[link](/url "title "and" title")</p>\n", + "example": 504, + "start_line": 7729, + "end_line": 7733, + "section": "Links" + }, + { + "markdown": "[link](/url 'title \"and\" title')\n", + "html": "<p><a href=\"/url\" title=\"title "and" title\">link</a></p>\n", + "example": 505, + "start_line": 7738, + "end_line": 7742, + "section": "Links" + }, + { + "markdown": "[link]( /uri\n \"title\" )\n", + "html": "<p><a href=\"/uri\" title=\"title\">link</a></p>\n", + "example": 506, + "start_line": 7762, + "end_line": 7767, + "section": "Links" + }, + { + "markdown": "[link] (/uri)\n", + "html": "<p>[link] (/uri)</p>\n", + "example": 507, + "start_line": 7773, + "end_line": 7777, + "section": "Links" + }, + { + "markdown": "[link [foo [bar]]](/uri)\n", + "html": "<p><a href=\"/uri\">link [foo [bar]]</a></p>\n", + "example": 508, + "start_line": 7783, + "end_line": 7787, + "section": "Links" + }, + { + "markdown": "[link] bar](/uri)\n", + "html": "<p>[link] bar](/uri)</p>\n", + "example": 509, + "start_line": 7790, + "end_line": 7794, + "section": "Links" + }, + { + "markdown": "[link [bar](/uri)\n", + "html": "<p>[link <a href=\"/uri\">bar</a></p>\n", + "example": 510, + "start_line": 7797, + "end_line": 7801, + "section": "Links" + }, + { + "markdown": "[link \\[bar](/uri)\n", + "html": "<p><a href=\"/uri\">link [bar</a></p>\n", + "example": 511, + "start_line": 7804, + "end_line": 7808, + "section": "Links" + }, + { + "markdown": "[link *foo **bar** `#`*](/uri)\n", + "html": "<p><a href=\"/uri\">link <em>foo <strong>bar</strong> <code>#</code></em></a></p>\n", + "example": 512, + "start_line": 7813, + "end_line": 7817, + "section": "Links" + }, + { + "markdown": "[![moon](moon.jpg)](/uri)\n", + "html": "<p><a href=\"/uri\"><img src=\"moon.jpg\" alt=\"moon\" /></a></p>\n", + "example": 513, + "start_line": 7820, + "end_line": 7824, + "section": "Links" + }, + { + "markdown": "[foo [bar](/uri)](/uri)\n", + "html": "<p>[foo <a href=\"/uri\">bar</a>](/uri)</p>\n", + "example": 514, + "start_line": 7829, + "end_line": 7833, + "section": "Links" + }, + { + "markdown": "[foo *[bar [baz](/uri)](/uri)*](/uri)\n", + "html": "<p>[foo <em>[bar <a href=\"/uri\">baz</a>](/uri)</em>](/uri)</p>\n", + "example": 515, + "start_line": 7836, + "end_line": 7840, + "section": "Links" + }, + { + "markdown": "![[[foo](uri1)](uri2)](uri3)\n", + "html": "<p><img src=\"uri3\" alt=\"[foo](uri2)\" /></p>\n", + "example": 516, + "start_line": 7843, + "end_line": 7847, + "section": "Links" + }, + { + "markdown": "*[foo*](/uri)\n", + "html": "<p>*<a href=\"/uri\">foo*</a></p>\n", + "example": 517, + "start_line": 7853, + "end_line": 7857, + "section": "Links" + }, + { + "markdown": "[foo *bar](baz*)\n", + "html": "<p><a href=\"baz*\">foo *bar</a></p>\n", + "example": 518, + "start_line": 7860, + "end_line": 7864, + "section": "Links" + }, + { + "markdown": "*foo [bar* baz]\n", + "html": "<p><em>foo [bar</em> baz]</p>\n", + "example": 519, + "start_line": 7870, + "end_line": 7874, + "section": "Links" + }, + { + "markdown": "[foo <bar attr=\"](baz)\">\n", + "html": "<p>[foo <bar attr=\"](baz)\"></p>\n", + "example": 520, + "start_line": 7880, + "end_line": 7884, + "section": "Links" + }, + { + "markdown": "[foo`](/uri)`\n", + "html": "<p>[foo<code>](/uri)</code></p>\n", + "example": 521, + "start_line": 7887, + "end_line": 7891, + "section": "Links" + }, + { + "markdown": "[foo<http://example.com/?search=](uri)>\n", + "html": "<p>[foo<a href=\"http://example.com/?search=%5D(uri)\">http://example.com/?search=](uri)</a></p>\n", + "example": 522, + "start_line": 7894, + "end_line": 7898, + "section": "Links" + }, + { + "markdown": "[foo][bar]\n\n[bar]: /url \"title\"\n", + "html": "<p><a href=\"/url\" title=\"title\">foo</a></p>\n", + "example": 523, + "start_line": 7932, + "end_line": 7938, + "section": "Links" + }, + { + "markdown": "[link [foo [bar]]][ref]\n\n[ref]: /uri\n", + "html": "<p><a href=\"/uri\">link [foo [bar]]</a></p>\n", + "example": 524, + "start_line": 7947, + "end_line": 7953, + "section": "Links" + }, + { + "markdown": "[link \\[bar][ref]\n\n[ref]: /uri\n", + "html": "<p><a href=\"/uri\">link [bar</a></p>\n", + "example": 525, + "start_line": 7956, + "end_line": 7962, + "section": "Links" + }, + { + "markdown": "[link *foo **bar** `#`*][ref]\n\n[ref]: /uri\n", + "html": "<p><a href=\"/uri\">link <em>foo <strong>bar</strong> <code>#</code></em></a></p>\n", + "example": 526, + "start_line": 7967, + "end_line": 7973, + "section": "Links" + }, + { + "markdown": "[![moon](moon.jpg)][ref]\n\n[ref]: /uri\n", + "html": "<p><a href=\"/uri\"><img src=\"moon.jpg\" alt=\"moon\" /></a></p>\n", + "example": 527, + "start_line": 7976, + "end_line": 7982, + "section": "Links" + }, + { + "markdown": "[foo [bar](/uri)][ref]\n\n[ref]: /uri\n", + "html": "<p>[foo <a href=\"/uri\">bar</a>]<a href=\"/uri\">ref</a></p>\n", + "example": 528, + "start_line": 7987, + "end_line": 7993, + "section": "Links" + }, + { + "markdown": "[foo *bar [baz][ref]*][ref]\n\n[ref]: /uri\n", + "html": "<p>[foo <em>bar <a href=\"/uri\">baz</a></em>]<a href=\"/uri\">ref</a></p>\n", + "example": 529, + "start_line": 7996, + "end_line": 8002, + "section": "Links" + }, + { + "markdown": "*[foo*][ref]\n\n[ref]: /uri\n", + "html": "<p>*<a href=\"/uri\">foo*</a></p>\n", + "example": 530, + "start_line": 8011, + "end_line": 8017, + "section": "Links" + }, + { + "markdown": "[foo *bar][ref]\n\n[ref]: /uri\n", + "html": "<p><a href=\"/uri\">foo *bar</a></p>\n", + "example": 531, + "start_line": 8020, + "end_line": 8026, + "section": "Links" + }, + { + "markdown": "[foo <bar attr=\"][ref]\">\n\n[ref]: /uri\n", + "html": "<p>[foo <bar attr=\"][ref]\"></p>\n", + "example": 532, + "start_line": 8032, + "end_line": 8038, + "section": "Links" + }, + { + "markdown": "[foo`][ref]`\n\n[ref]: /uri\n", + "html": "<p>[foo<code>][ref]</code></p>\n", + "example": 533, + "start_line": 8041, + "end_line": 8047, + "section": "Links" + }, + { + "markdown": "[foo<http://example.com/?search=][ref]>\n\n[ref]: /uri\n", + "html": "<p>[foo<a href=\"http://example.com/?search=%5D%5Bref%5D\">http://example.com/?search=][ref]</a></p>\n", + "example": 534, + "start_line": 8050, + "end_line": 8056, + "section": "Links" + }, + { + "markdown": "[foo][BaR]\n\n[bar]: /url \"title\"\n", + "html": "<p><a href=\"/url\" title=\"title\">foo</a></p>\n", + "example": 535, + "start_line": 8061, + "end_line": 8067, + "section": "Links" + }, + { + "markdown": "[Толпой][Толпой] is a Russian word.\n\n[ТОЛПОЙ]: /url\n", + "html": "<p><a href=\"/url\">Толпой</a> is a Russian word.</p>\n", + "example": 536, + "start_line": 8072, + "end_line": 8078, + "section": "Links" + }, + { + "markdown": "[Foo\n bar]: /url\n\n[Baz][Foo bar]\n", + "html": "<p><a href=\"/url\">Baz</a></p>\n", + "example": 537, + "start_line": 8084, + "end_line": 8091, + "section": "Links" + }, + { + "markdown": "[foo] [bar]\n\n[bar]: /url \"title\"\n", + "html": "<p>[foo] <a href=\"/url\" title=\"title\">bar</a></p>\n", + "example": 538, + "start_line": 8097, + "end_line": 8103, + "section": "Links" + }, + { + "markdown": "[foo]\n[bar]\n\n[bar]: /url \"title\"\n", + "html": "<p>[foo]\n<a href=\"/url\" title=\"title\">bar</a></p>\n", + "example": 539, + "start_line": 8106, + "end_line": 8114, + "section": "Links" + }, + { + "markdown": "[foo]: /url1\n\n[foo]: /url2\n\n[bar][foo]\n", + "html": "<p><a href=\"/url1\">bar</a></p>\n", + "example": 540, + "start_line": 8147, + "end_line": 8155, + "section": "Links" + }, + { + "markdown": "[bar][foo\\!]\n\n[foo!]: /url\n", + "html": "<p>[bar][foo!]</p>\n", + "example": 541, + "start_line": 8162, + "end_line": 8168, + "section": "Links" + }, + { + "markdown": "[foo][ref[]\n\n[ref[]: /uri\n", + "html": "<p>[foo][ref[]</p>\n<p>[ref[]: /uri</p>\n", + "example": 542, + "start_line": 8174, + "end_line": 8181, + "section": "Links" + }, + { + "markdown": "[foo][ref[bar]]\n\n[ref[bar]]: /uri\n", + "html": "<p>[foo][ref[bar]]</p>\n<p>[ref[bar]]: /uri</p>\n", + "example": 543, + "start_line": 8184, + "end_line": 8191, + "section": "Links" + }, + { + "markdown": "[[[foo]]]\n\n[[[foo]]]: /url\n", + "html": "<p>[[[foo]]]</p>\n<p>[[[foo]]]: /url</p>\n", + "example": 544, + "start_line": 8194, + "end_line": 8201, + "section": "Links" + }, + { + "markdown": "[foo][ref\\[]\n\n[ref\\[]: /uri\n", + "html": "<p><a href=\"/uri\">foo</a></p>\n", + "example": 545, + "start_line": 8204, + "end_line": 8210, + "section": "Links" + }, + { + "markdown": "[bar\\\\]: /uri\n\n[bar\\\\]\n", + "html": "<p><a href=\"/uri\">bar\\</a></p>\n", + "example": 546, + "start_line": 8215, + "end_line": 8221, + "section": "Links" + }, + { + "markdown": "[]\n\n[]: /uri\n", + "html": "<p>[]</p>\n<p>[]: /uri</p>\n", + "example": 547, + "start_line": 8226, + "end_line": 8233, + "section": "Links" + }, + { + "markdown": "[\n ]\n\n[\n ]: /uri\n", + "html": "<p>[\n]</p>\n<p>[\n]: /uri</p>\n", + "example": 548, + "start_line": 8236, + "end_line": 8247, + "section": "Links" + }, + { + "markdown": "[foo][]\n\n[foo]: /url \"title\"\n", + "html": "<p><a href=\"/url\" title=\"title\">foo</a></p>\n", + "example": 549, + "start_line": 8259, + "end_line": 8265, + "section": "Links" + }, + { + "markdown": "[*foo* bar][]\n\n[*foo* bar]: /url \"title\"\n", + "html": "<p><a href=\"/url\" title=\"title\"><em>foo</em> bar</a></p>\n", + "example": 550, + "start_line": 8268, + "end_line": 8274, + "section": "Links" + }, + { + "markdown": "[Foo][]\n\n[foo]: /url \"title\"\n", + "html": "<p><a href=\"/url\" title=\"title\">Foo</a></p>\n", + "example": 551, + "start_line": 8279, + "end_line": 8285, + "section": "Links" + }, + { + "markdown": "[foo] \n[]\n\n[foo]: /url \"title\"\n", + "html": "<p><a href=\"/url\" title=\"title\">foo</a>\n[]</p>\n", + "example": 552, + "start_line": 8292, + "end_line": 8300, + "section": "Links" + }, + { + "markdown": "[foo]\n\n[foo]: /url \"title\"\n", + "html": "<p><a href=\"/url\" title=\"title\">foo</a></p>\n", + "example": 553, + "start_line": 8312, + "end_line": 8318, + "section": "Links" + }, + { + "markdown": "[*foo* bar]\n\n[*foo* bar]: /url \"title\"\n", + "html": "<p><a href=\"/url\" title=\"title\"><em>foo</em> bar</a></p>\n", + "example": 554, + "start_line": 8321, + "end_line": 8327, + "section": "Links" + }, + { + "markdown": "[[*foo* bar]]\n\n[*foo* bar]: /url \"title\"\n", + "html": "<p>[<a href=\"/url\" title=\"title\"><em>foo</em> bar</a>]</p>\n", + "example": 555, + "start_line": 8330, + "end_line": 8336, + "section": "Links" + }, + { + "markdown": "[[bar [foo]\n\n[foo]: /url\n", + "html": "<p>[[bar <a href=\"/url\">foo</a></p>\n", + "example": 556, + "start_line": 8339, + "end_line": 8345, + "section": "Links" + }, + { + "markdown": "[Foo]\n\n[foo]: /url \"title\"\n", + "html": "<p><a href=\"/url\" title=\"title\">Foo</a></p>\n", + "example": 557, + "start_line": 8350, + "end_line": 8356, + "section": "Links" + }, + { + "markdown": "[foo] bar\n\n[foo]: /url\n", + "html": "<p><a href=\"/url\">foo</a> bar</p>\n", + "example": 558, + "start_line": 8361, + "end_line": 8367, + "section": "Links" + }, + { + "markdown": "\\[foo]\n\n[foo]: /url \"title\"\n", + "html": "<p>[foo]</p>\n", + "example": 559, + "start_line": 8373, + "end_line": 8379, + "section": "Links" + }, + { + "markdown": "[foo*]: /url\n\n*[foo*]\n", + "html": "<p>*<a href=\"/url\">foo*</a></p>\n", + "example": 560, + "start_line": 8385, + "end_line": 8391, + "section": "Links" + }, + { + "markdown": "[foo][bar]\n\n[foo]: /url1\n[bar]: /url2\n", + "html": "<p><a href=\"/url2\">foo</a></p>\n", + "example": 561, + "start_line": 8397, + "end_line": 8404, + "section": "Links" + }, + { + "markdown": "[foo][]\n\n[foo]: /url1\n", + "html": "<p><a href=\"/url1\">foo</a></p>\n", + "example": 562, + "start_line": 8406, + "end_line": 8412, + "section": "Links" + }, + { + "markdown": "[foo]()\n\n[foo]: /url1\n", + "html": "<p><a href=\"\">foo</a></p>\n", + "example": 563, + "start_line": 8416, + "end_line": 8422, + "section": "Links" + }, + { + "markdown": "[foo](not a link)\n\n[foo]: /url1\n", + "html": "<p><a href=\"/url1\">foo</a>(not a link)</p>\n", + "example": 564, + "start_line": 8424, + "end_line": 8430, + "section": "Links" + }, + { + "markdown": "[foo][bar][baz]\n\n[baz]: /url\n", + "html": "<p>[foo]<a href=\"/url\">bar</a></p>\n", + "example": 565, + "start_line": 8435, + "end_line": 8441, + "section": "Links" + }, + { + "markdown": "[foo][bar][baz]\n\n[baz]: /url1\n[bar]: /url2\n", + "html": "<p><a href=\"/url2\">foo</a><a href=\"/url1\">baz</a></p>\n", + "example": 566, + "start_line": 8447, + "end_line": 8454, + "section": "Links" + }, + { + "markdown": "[foo][bar][baz]\n\n[baz]: /url1\n[foo]: /url2\n", + "html": "<p>[foo]<a href=\"/url1\">bar</a></p>\n", + "example": 567, + "start_line": 8460, + "end_line": 8467, + "section": "Links" + }, + { + "markdown": "![foo](/url \"title\")\n", + "html": "<p><img src=\"/url\" alt=\"foo\" title=\"title\" /></p>\n", + "example": 568, + "start_line": 8483, + "end_line": 8487, + "section": "Images" + }, + { + "markdown": "![foo *bar*]\n\n[foo *bar*]: train.jpg \"train & tracks\"\n", + "html": "<p><img src=\"train.jpg\" alt=\"foo bar\" title=\"train & tracks\" /></p>\n", + "example": 569, + "start_line": 8490, + "end_line": 8496, + "section": "Images" + }, + { + "markdown": "![foo ![bar](/url)](/url2)\n", + "html": "<p><img src=\"/url2\" alt=\"foo bar\" /></p>\n", + "example": 570, + "start_line": 8499, + "end_line": 8503, + "section": "Images" + }, + { + "markdown": "![foo [bar](/url)](/url2)\n", + "html": "<p><img src=\"/url2\" alt=\"foo bar\" /></p>\n", + "example": 571, + "start_line": 8506, + "end_line": 8510, + "section": "Images" + }, + { + "markdown": "![foo *bar*][]\n\n[foo *bar*]: train.jpg \"train & tracks\"\n", + "html": "<p><img src=\"train.jpg\" alt=\"foo bar\" title=\"train & tracks\" /></p>\n", + "example": 572, + "start_line": 8520, + "end_line": 8526, + "section": "Images" + }, + { + "markdown": "![foo *bar*][foobar]\n\n[FOOBAR]: train.jpg \"train & tracks\"\n", + "html": "<p><img src=\"train.jpg\" alt=\"foo bar\" title=\"train & tracks\" /></p>\n", + "example": 573, + "start_line": 8529, + "end_line": 8535, + "section": "Images" + }, + { + "markdown": "![foo](train.jpg)\n", + "html": "<p><img src=\"train.jpg\" alt=\"foo\" /></p>\n", + "example": 574, + "start_line": 8538, + "end_line": 8542, + "section": "Images" + }, + { + "markdown": "My ![foo bar](/path/to/train.jpg \"title\" )\n", + "html": "<p>My <img src=\"/path/to/train.jpg\" alt=\"foo bar\" title=\"title\" /></p>\n", + "example": 575, + "start_line": 8545, + "end_line": 8549, + "section": "Images" + }, + { + "markdown": "![foo](<url>)\n", + "html": "<p><img src=\"url\" alt=\"foo\" /></p>\n", + "example": 576, + "start_line": 8552, + "end_line": 8556, + "section": "Images" + }, + { + "markdown": "![](/url)\n", + "html": "<p><img src=\"/url\" alt=\"\" /></p>\n", + "example": 577, + "start_line": 8559, + "end_line": 8563, + "section": "Images" + }, + { + "markdown": "![foo][bar]\n\n[bar]: /url\n", + "html": "<p><img src=\"/url\" alt=\"foo\" /></p>\n", + "example": 578, + "start_line": 8568, + "end_line": 8574, + "section": "Images" + }, + { + "markdown": "![foo][bar]\n\n[BAR]: /url\n", + "html": "<p><img src=\"/url\" alt=\"foo\" /></p>\n", + "example": 579, + "start_line": 8577, + "end_line": 8583, + "section": "Images" + }, + { + "markdown": "![foo][]\n\n[foo]: /url \"title\"\n", + "html": "<p><img src=\"/url\" alt=\"foo\" title=\"title\" /></p>\n", + "example": 580, + "start_line": 8588, + "end_line": 8594, + "section": "Images" + }, + { + "markdown": "![*foo* bar][]\n\n[*foo* bar]: /url \"title\"\n", + "html": "<p><img src=\"/url\" alt=\"foo bar\" title=\"title\" /></p>\n", + "example": 581, + "start_line": 8597, + "end_line": 8603, + "section": "Images" + }, + { + "markdown": "![Foo][]\n\n[foo]: /url \"title\"\n", + "html": "<p><img src=\"/url\" alt=\"Foo\" title=\"title\" /></p>\n", + "example": 582, + "start_line": 8608, + "end_line": 8614, + "section": "Images" + }, + { + "markdown": "![foo] \n[]\n\n[foo]: /url \"title\"\n", + "html": "<p><img src=\"/url\" alt=\"foo\" title=\"title\" />\n[]</p>\n", + "example": 583, + "start_line": 8620, + "end_line": 8628, + "section": "Images" + }, + { + "markdown": "![foo]\n\n[foo]: /url \"title\"\n", + "html": "<p><img src=\"/url\" alt=\"foo\" title=\"title\" /></p>\n", + "example": 584, + "start_line": 8633, + "end_line": 8639, + "section": "Images" + }, + { + "markdown": "![*foo* bar]\n\n[*foo* bar]: /url \"title\"\n", + "html": "<p><img src=\"/url\" alt=\"foo bar\" title=\"title\" /></p>\n", + "example": 585, + "start_line": 8642, + "end_line": 8648, + "section": "Images" + }, + { + "markdown": "![[foo]]\n\n[[foo]]: /url \"title\"\n", + "html": "<p>![[foo]]</p>\n<p>[[foo]]: /url "title"</p>\n", + "example": 586, + "start_line": 8653, + "end_line": 8660, + "section": "Images" + }, + { + "markdown": "![Foo]\n\n[foo]: /url \"title\"\n", + "html": "<p><img src=\"/url\" alt=\"Foo\" title=\"title\" /></p>\n", + "example": 587, + "start_line": 8665, + "end_line": 8671, + "section": "Images" + }, + { + "markdown": "!\\[foo]\n\n[foo]: /url \"title\"\n", + "html": "<p>![foo]</p>\n", + "example": 588, + "start_line": 8677, + "end_line": 8683, + "section": "Images" + }, + { + "markdown": "\\![foo]\n\n[foo]: /url \"title\"\n", + "html": "<p>!<a href=\"/url\" title=\"title\">foo</a></p>\n", + "example": 589, + "start_line": 8689, + "end_line": 8695, + "section": "Images" + }, + { + "markdown": "<http://foo.bar.baz>\n", + "html": "<p><a href=\"http://foo.bar.baz\">http://foo.bar.baz</a></p>\n", + "example": 590, + "start_line": 8722, + "end_line": 8726, + "section": "Autolinks" + }, + { + "markdown": "<http://foo.bar.baz/test?q=hello&id=22&boolean>\n", + "html": "<p><a href=\"http://foo.bar.baz/test?q=hello&id=22&boolean\">http://foo.bar.baz/test?q=hello&id=22&boolean</a></p>\n", + "example": 591, + "start_line": 8729, + "end_line": 8733, + "section": "Autolinks" + }, + { + "markdown": "<irc://foo.bar:2233/baz>\n", + "html": "<p><a href=\"irc://foo.bar:2233/baz\">irc://foo.bar:2233/baz</a></p>\n", + "example": 592, + "start_line": 8736, + "end_line": 8740, + "section": "Autolinks" + }, + { + "markdown": "<MAILTO:FOO@BAR.BAZ>\n", + "html": "<p><a href=\"MAILTO:FOO@BAR.BAZ\">MAILTO:FOO@BAR.BAZ</a></p>\n", + "example": 593, + "start_line": 8745, + "end_line": 8749, + "section": "Autolinks" + }, + { + "markdown": "<a+b+c:d>\n", + "html": "<p><a href=\"a+b+c:d\">a+b+c:d</a></p>\n", + "example": 594, + "start_line": 8757, + "end_line": 8761, + "section": "Autolinks" + }, + { + "markdown": "<made-up-scheme://foo,bar>\n", + "html": "<p><a href=\"made-up-scheme://foo,bar\">made-up-scheme://foo,bar</a></p>\n", + "example": 595, + "start_line": 8764, + "end_line": 8768, + "section": "Autolinks" + }, + { + "markdown": "<http://../>\n", + "html": "<p><a href=\"http://../\">http://../</a></p>\n", + "example": 596, + "start_line": 8771, + "end_line": 8775, + "section": "Autolinks" + }, + { + "markdown": "<localhost:5001/foo>\n", + "html": "<p><a href=\"localhost:5001/foo\">localhost:5001/foo</a></p>\n", + "example": 597, + "start_line": 8778, + "end_line": 8782, + "section": "Autolinks" + }, + { + "markdown": "<http://foo.bar/baz bim>\n", + "html": "<p><http://foo.bar/baz bim></p>\n", + "example": 598, + "start_line": 8787, + "end_line": 8791, + "section": "Autolinks" + }, + { + "markdown": "<http://example.com/\\[\\>\n", + "html": "<p><a href=\"http://example.com/%5C%5B%5C\">http://example.com/\\[\\</a></p>\n", + "example": 599, + "start_line": 8796, + "end_line": 8800, + "section": "Autolinks" + }, + { + "markdown": "<foo@bar.example.com>\n", + "html": "<p><a href=\"mailto:foo@bar.example.com\">foo@bar.example.com</a></p>\n", + "example": 600, + "start_line": 8818, + "end_line": 8822, + "section": "Autolinks" + }, + { + "markdown": "<foo+special@Bar.baz-bar0.com>\n", + "html": "<p><a href=\"mailto:foo+special@Bar.baz-bar0.com\">foo+special@Bar.baz-bar0.com</a></p>\n", + "example": 601, + "start_line": 8825, + "end_line": 8829, + "section": "Autolinks" + }, + { + "markdown": "<foo\\+@bar.example.com>\n", + "html": "<p><foo+@bar.example.com></p>\n", + "example": 602, + "start_line": 8834, + "end_line": 8838, + "section": "Autolinks" + }, + { + "markdown": "<>\n", + "html": "<p><></p>\n", + "example": 603, + "start_line": 8843, + "end_line": 8847, + "section": "Autolinks" + }, + { + "markdown": "< http://foo.bar >\n", + "html": "<p>< http://foo.bar ></p>\n", + "example": 604, + "start_line": 8850, + "end_line": 8854, + "section": "Autolinks" + }, + { + "markdown": "<m:abc>\n", + "html": "<p><m:abc></p>\n", + "example": 605, + "start_line": 8857, + "end_line": 8861, + "section": "Autolinks" + }, + { + "markdown": "<foo.bar.baz>\n", + "html": "<p><foo.bar.baz></p>\n", + "example": 606, + "start_line": 8864, + "end_line": 8868, + "section": "Autolinks" + }, + { + "markdown": "http://example.com\n", + "html": "<p>http://example.com</p>\n", + "example": 607, + "start_line": 8871, + "end_line": 8875, + "section": "Autolinks" + }, + { + "markdown": "foo@bar.example.com\n", + "html": "<p>foo@bar.example.com</p>\n", + "example": 608, + "start_line": 8878, + "end_line": 8882, + "section": "Autolinks" + }, + { + "markdown": "<a><bab><c2c>\n", + "html": "<p><a><bab><c2c></p>\n", + "example": 609, + "start_line": 8960, + "end_line": 8964, + "section": "Raw HTML" + }, + { + "markdown": "<a/><b2/>\n", + "html": "<p><a/><b2/></p>\n", + "example": 610, + "start_line": 8969, + "end_line": 8973, + "section": "Raw HTML" + }, + { + "markdown": "<a /><b2\ndata=\"foo\" >\n", + "html": "<p><a /><b2\ndata=\"foo\" ></p>\n", + "example": 611, + "start_line": 8978, + "end_line": 8984, + "section": "Raw HTML" + }, + { + "markdown": "<a foo=\"bar\" bam = 'baz <em>\"</em>'\n_boolean zoop:33=zoop:33 />\n", + "html": "<p><a foo=\"bar\" bam = 'baz <em>\"</em>'\n_boolean zoop:33=zoop:33 /></p>\n", + "example": 612, + "start_line": 8989, + "end_line": 8995, + "section": "Raw HTML" + }, + { + "markdown": "Foo <responsive-image src=\"foo.jpg\" />\n", + "html": "<p>Foo <responsive-image src=\"foo.jpg\" /></p>\n", + "example": 613, + "start_line": 9000, + "end_line": 9004, + "section": "Raw HTML" + }, + { + "markdown": "<33> <__>\n", + "html": "<p><33> <__></p>\n", + "example": 614, + "start_line": 9009, + "end_line": 9013, + "section": "Raw HTML" + }, + { + "markdown": "<a h*#ref=\"hi\">\n", + "html": "<p><a h*#ref="hi"></p>\n", + "example": 615, + "start_line": 9018, + "end_line": 9022, + "section": "Raw HTML" + }, + { + "markdown": "<a href=\"hi'> <a href=hi'>\n", + "html": "<p><a href="hi'> <a href=hi'></p>\n", + "example": 616, + "start_line": 9027, + "end_line": 9031, + "section": "Raw HTML" + }, + { + "markdown": "< a><\nfoo><bar/ >\n<foo bar=baz\nbim!bop />\n", + "html": "<p>< a><\nfoo><bar/ >\n<foo bar=baz\nbim!bop /></p>\n", + "example": 617, + "start_line": 9036, + "end_line": 9046, + "section": "Raw HTML" + }, + { + "markdown": "<a href='bar'title=title>\n", + "html": "<p><a href='bar'title=title></p>\n", + "example": 618, + "start_line": 9051, + "end_line": 9055, + "section": "Raw HTML" + }, + { + "markdown": "</a></foo >\n", + "html": "<p></a></foo ></p>\n", + "example": 619, + "start_line": 9060, + "end_line": 9064, + "section": "Raw HTML" + }, + { + "markdown": "</a href=\"foo\">\n", + "html": "<p></a href="foo"></p>\n", + "example": 620, + "start_line": 9069, + "end_line": 9073, + "section": "Raw HTML" + }, + { + "markdown": "foo <!-- this is a\ncomment - with hyphen -->\n", + "html": "<p>foo <!-- this is a\ncomment - with hyphen --></p>\n", + "example": 621, + "start_line": 9078, + "end_line": 9084, + "section": "Raw HTML" + }, + { + "markdown": "foo <!-- not a comment -- two hyphens -->\n", + "html": "<p>foo <!-- not a comment -- two hyphens --></p>\n", + "example": 622, + "start_line": 9087, + "end_line": 9091, + "section": "Raw HTML" + }, + { + "markdown": "foo <!--> foo -->\n\nfoo <!-- foo--->\n", + "html": "<p>foo <!--> foo --></p>\n<p>foo <!-- foo---></p>\n", + "example": 623, + "start_line": 9096, + "end_line": 9103, + "section": "Raw HTML" + }, + { + "markdown": "foo <?php echo $a; ?>\n", + "html": "<p>foo <?php echo $a; ?></p>\n", + "example": 624, + "start_line": 9108, + "end_line": 9112, + "section": "Raw HTML" + }, + { + "markdown": "foo <!ELEMENT br EMPTY>\n", + "html": "<p>foo <!ELEMENT br EMPTY></p>\n", + "example": 625, + "start_line": 9117, + "end_line": 9121, + "section": "Raw HTML" + }, + { + "markdown": "foo <![CDATA[>&<]]>\n", + "html": "<p>foo <![CDATA[>&<]]></p>\n", + "example": 626, + "start_line": 9126, + "end_line": 9130, + "section": "Raw HTML" + }, + { + "markdown": "foo <a href=\"ö\">\n", + "html": "<p>foo <a href=\"ö\"></p>\n", + "example": 627, + "start_line": 9136, + "end_line": 9140, + "section": "Raw HTML" + }, + { + "markdown": "foo <a href=\"\\*\">\n", + "html": "<p>foo <a href=\"\\*\"></p>\n", + "example": 628, + "start_line": 9145, + "end_line": 9149, + "section": "Raw HTML" + }, + { + "markdown": "<a href=\"\\\"\">\n", + "html": "<p><a href="""></p>\n", + "example": 629, + "start_line": 9152, + "end_line": 9156, + "section": "Raw HTML" + }, + { + "markdown": "foo \nbaz\n", + "html": "<p>foo<br />\nbaz</p>\n", + "example": 630, + "start_line": 9166, + "end_line": 9172, + "section": "Hard line breaks" + }, + { + "markdown": "foo\\\nbaz\n", + "html": "<p>foo<br />\nbaz</p>\n", + "example": 631, + "start_line": 9178, + "end_line": 9184, + "section": "Hard line breaks" + }, + { + "markdown": "foo \nbaz\n", + "html": "<p>foo<br />\nbaz</p>\n", + "example": 632, + "start_line": 9189, + "end_line": 9195, + "section": "Hard line breaks" + }, + { + "markdown": "foo \n bar\n", + "html": "<p>foo<br />\nbar</p>\n", + "example": 633, + "start_line": 9200, + "end_line": 9206, + "section": "Hard line breaks" + }, + { + "markdown": "foo\\\n bar\n", + "html": "<p>foo<br />\nbar</p>\n", + "example": 634, + "start_line": 9209, + "end_line": 9215, + "section": "Hard line breaks" + }, + { + "markdown": "*foo \nbar*\n", + "html": "<p><em>foo<br />\nbar</em></p>\n", + "example": 635, + "start_line": 9221, + "end_line": 9227, + "section": "Hard line breaks" + }, + { + "markdown": "*foo\\\nbar*\n", + "html": "<p><em>foo<br />\nbar</em></p>\n", + "example": 636, + "start_line": 9230, + "end_line": 9236, + "section": "Hard line breaks" + }, + { + "markdown": "`code \nspan`\n", + "html": "<p><code>code span</code></p>\n", + "example": 637, + "start_line": 9241, + "end_line": 9246, + "section": "Hard line breaks" + }, + { + "markdown": "`code\\\nspan`\n", + "html": "<p><code>code\\ span</code></p>\n", + "example": 638, + "start_line": 9249, + "end_line": 9254, + "section": "Hard line breaks" + }, + { + "markdown": "<a href=\"foo \nbar\">\n", + "html": "<p><a href=\"foo \nbar\"></p>\n", + "example": 639, + "start_line": 9259, + "end_line": 9265, + "section": "Hard line breaks" + }, + { + "markdown": "<a href=\"foo\\\nbar\">\n", + "html": "<p><a href=\"foo\\\nbar\"></p>\n", + "example": 640, + "start_line": 9268, + "end_line": 9274, + "section": "Hard line breaks" + }, + { + "markdown": "foo\\\n", + "html": "<p>foo\\</p>\n", + "example": 641, + "start_line": 9281, + "end_line": 9285, + "section": "Hard line breaks" + }, + { + "markdown": "foo \n", + "html": "<p>foo</p>\n", + "example": 642, + "start_line": 9288, + "end_line": 9292, + "section": "Hard line breaks" + }, + { + "markdown": "### foo\\\n", + "html": "<h3>foo\\</h3>\n", + "example": 643, + "start_line": 9295, + "end_line": 9299, + "section": "Hard line breaks" + }, + { + "markdown": "### foo \n", + "html": "<h3>foo</h3>\n", + "example": 644, + "start_line": 9302, + "end_line": 9306, + "section": "Hard line breaks" + }, + { + "markdown": "foo\nbaz\n", + "html": "<p>foo\nbaz</p>\n", + "example": 645, + "start_line": 9317, + "end_line": 9323, + "section": "Soft line breaks" + }, + { + "markdown": "foo \n baz\n", + "html": "<p>foo\nbaz</p>\n", + "example": 646, + "start_line": 9329, + "end_line": 9335, + "section": "Soft line breaks" + }, + { + "markdown": "hello $.;'there\n", + "html": "<p>hello $.;'there</p>\n", + "example": 647, + "start_line": 9349, + "end_line": 9353, + "section": "Textual content" + }, + { + "markdown": "Foo χρῆν\n", + "html": "<p>Foo χρῆν</p>\n", + "example": 648, + "start_line": 9356, + "end_line": 9360, + "section": "Textual content" + }, + { + "markdown": "Multiple spaces\n", + "html": "<p>Multiple spaces</p>\n", + "example": 649, + "start_line": 9365, + "end_line": 9369, + "section": "Textual content" + } +]
\ No newline at end of file diff --git a/tests/test_commonmark/spec.sh b/tests/test_commonmark/spec.sh new file mode 100755 index 0000000..034fd86 --- /dev/null +++ b/tests/test_commonmark/spec.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -e + +REPO="https://github.com/commonmark/CommonMark.git" +VERSION="0.29" + +function main { + echo "Cloning from repo: $REPO..." + git clone --quiet $REPO + + echo "Using version $VERSION..." + cd "CommonMark" + git checkout --quiet $VERSION + + echo "Dumping tests file..." + python3 "test/spec_tests.py" --dump-tests > "../commonmark.json" + + echo "Cleaning up..." + cd .. + rm -rf CommonMark + + echo "Done." +} + +main diff --git a/tests/test_commonmark/test_commonmark.py b/tests/test_commonmark/test_commonmark.py new file mode 100644 index 0000000..3cee1eb --- /dev/null +++ b/tests/test_commonmark/test_commonmark.py @@ -0,0 +1,44 @@ +"""In this module tests are run against the full test set, +provided by https://github.com/commonmark/CommonMark.git. +""" +import json +import os + +import pytest +from markdown_it.renderer import RendererHTML + +from myst_parser.config.main import MdParserConfig +from myst_parser.parsers.mdit import create_md_parser + +with open( + os.path.join(os.path.dirname(__file__), "commonmark.json"), encoding="utf8" +) as fin: + tests = json.load(fin) + + +@pytest.mark.parametrize("entry", tests) +def test_commonmark(entry): + if entry["example"] == 14: + # This is just a test that +++ are not parsed as thematic breaks + pytest.skip("Expects '+++' to be unconverted (not block break).") + if entry["example"] in [66, 68]: + # Front matter is supported by numerous Markdown flavours, + # but not strictly CommonMark, + # see: https://talk.commonmark.org/t/metadata-in-documents/721/86 + pytest.skip( + "Thematic breaks on the first line conflict with front matter syntax" + ) + test_case = entry["markdown"] + md = create_md_parser(MdParserConfig(), RendererHTML) + output = md.render(test_case) + + if entry["example"] == 593: + # this doesn't have any bearing on the output + output = output.replace("mailto", "MAILTO") + if entry["example"] in [187, 209, 210]: + # this doesn't have any bearing on the output + output = output.replace( + "<blockquote></blockquote>", "<blockquote>\n</blockquote>" + ) + + assert output == entry["html"] diff --git a/tests/test_docutils.py b/tests/test_docutils.py new file mode 100644 index 0000000..f6f5d36 --- /dev/null +++ b/tests/test_docutils.py @@ -0,0 +1,116 @@ +import io +from dataclasses import dataclass, field, fields +from textwrap import dedent + +import pytest +from docutils import VersionInfo, __version_info__ +from typing_extensions import Literal + +from myst_parser.mdit_to_docutils.base import make_document +from myst_parser.parsers.docutils_ import ( + Parser, + attr_to_optparse_option, + cli_html, + cli_html5, + cli_latex, + cli_pseudoxml, + cli_xml, +) + + +def test_attr_to_optparse_option(): + @dataclass + class Config: + name: Literal["a"] = field(default="default") + + output = attr_to_optparse_option(fields(Config)[0], "default") + assert len(output) == 3 + + +def test_parser(): + """Test calling `Parser.parse` directly.""" + parser = Parser() + document = make_document(parser_cls=Parser) + parser.parse("something", document) + assert ( + document.pformat().strip() + == '<document source="notset">\n <paragraph>\n something' + ) + + +def test_cli_html(monkeypatch, capsys): + monkeypatch.setattr("sys.stdin", io.TextIOWrapper(io.BytesIO(b"text"))) + cli_html([]) + captured = capsys.readouterr() + assert not captured.err + assert "text" in captured.out + + +def test_cli_html5(monkeypatch, capsys): + monkeypatch.setattr("sys.stdin", io.TextIOWrapper(io.BytesIO(b"text"))) + cli_html5([]) + captured = capsys.readouterr() + assert not captured.err + assert "text" in captured.out + + +def test_cli_latex(monkeypatch, capsys): + monkeypatch.setattr("sys.stdin", io.TextIOWrapper(io.BytesIO(b"text"))) + cli_latex([]) + captured = capsys.readouterr() + assert not captured.err + assert "text" in captured.out + + +def test_cli_xml(monkeypatch, capsys): + monkeypatch.setattr("sys.stdin", io.TextIOWrapper(io.BytesIO(b"text"))) + cli_xml([]) + captured = capsys.readouterr() + assert not captured.err + assert "text" in captured.out + + +def test_cli_pseudoxml(monkeypatch, capsys): + monkeypatch.setattr("sys.stdin", io.TextIOWrapper(io.BytesIO(b"text"))) + cli_pseudoxml([]) + captured = capsys.readouterr() + assert not captured.err + assert "text" in captured.out + + +def test_help_text(): + """Test retrieving settings help text.""" + from docutils.frontend import OptionParser + + stream = io.StringIO() + OptionParser(components=(Parser,)).print_help(stream) + assert "MyST options" in stream.getvalue() + + +@pytest.mark.skipif( + __version_info__ < VersionInfo(0, 17, 0, "final", 0, True), + reason="parser option added in docutils 0.17", +) +def test_include_from_rst(tmp_path): + """Test including a MyST file from within an RST file.""" + from docutils.parsers.rst import Parser as RSTParser + + include_path = tmp_path.joinpath("include.md") + include_path.write_text("# Title") + + parser = RSTParser() + document = make_document(parser_cls=RSTParser) + parser.parse( + f".. include:: {include_path}\n :parser: myst_parser.docutils_", document + ) + assert ( + document.pformat().strip() + == dedent( + """\ + <document source="notset"> + <section ids="title" names="title"> + <title> + Title + """ + ).strip() + ) diff --git a/tests/test_html/html_ast.md b/tests/test_html/html_ast.md new file mode 100644 index 0000000..0abbdee --- /dev/null +++ b/tests/test_html/html_ast.md @@ -0,0 +1,124 @@ +tags +. +<html> +<head> +<title class="a b" other="x">Title of the document</title> +</head> +<body> +The content of the document...... +</body> +</html> +. +Root('') +Tag('html') +Data('\n') +Tag('head') +Data('\n') +Tag('title', {'class': 'a b', 'other': 'x'}) +Data('Title of the docu...') +Data('\n') +Data('\n') +Tag('body') +Data('\nThe content of t...') +Data('\n') +Data('\n') +. + +un-closed tags +. +<div class="a"> +<div class="b"> +. +Root('') +Tag('div', {'class': 'a'}) +Data('\n') +Tag('div', {'class': 'b'}) +Data('\n') +. + +xtag +. +<img src="img_girl.jpg" alt="Girl in a jacket" width="500" height="600"/> +. +Root('') +XTag('img', {'src': 'img_girl.jpg', 'alt': 'Girl in a jacket', 'width': '500', 'height': '600'}) +Data('\n') +. + +data +. +a +. +Root('') +Data('a\n') +. + +declaration +. +<!DOCTYPE html> +. +Root('') +Declaration('DOCTYPE html') +Data('\n') +. + +process information +. +<?xml-stylesheet ?> +. +Root('') +Pi('xml-stylesheet ?') +Data('\n') +. + +entities +. +& + +{ +. +Root('') +Entity('amp') +Data('\n\n') +Char('123') +Data('\n') +. + +comments +. +<!--This is a comment. Comments are not displayed in the browser +--> +. +Root('') +Comment('This is a comment...') +Data('\n') +. + +admonition +. +<div class="admonition tip alert alert-warning"> +<div class="admonition-title" style="font-weight: bold;">Tip</div> +parameter allows to get a deterministic results even if we +use some random process (i.e. data shuffling). +</div> +. +Root('') +Tag('div', {'class': 'admonition tip alert alert-warning'}) +Data('\n') +Tag('div', {'class': 'admonition-title', 'style': 'font-weight: bold;'}) +Data('Tip') +Data('\nparameter allows...') +Data('\n') +. + +image +. +<img src="img/fun-fish.png" alt="fishy" class="bg-primary mb-1" width="200px"> +<img src="img/fun-fish.png" alt="fishy" class="bg-primary mb-1" width="300px"> +. +Root('') +VoidTag('img', {'src': 'img/fun-fish.png', 'alt': 'fishy', 'class': 'bg-primary mb-1', 'width': '200px'}) +Data('\n') +VoidTag('img', {'src': 'img/fun-fish.png', 'alt': 'fishy', 'class': 'bg-primary mb-1', 'width': '300px'}) +Data('\n') +. diff --git a/tests/test_html/html_round_trip.md b/tests/test_html/html_round_trip.md new file mode 100644 index 0000000..c5ceb5c --- /dev/null +++ b/tests/test_html/html_round_trip.md @@ -0,0 +1,87 @@ +tags +. +<html> +<head> +<title class="a b" other="x">Title of the document</title> +</head> +<body> +The content of the document...... +</body> +</html> +. +<html> +<head> +<title class="a b" other="x">Title of the document</title> +</head> +<body> +The content of the document...... +</body> +</html> +. + +un-closed tags +. +<div class="a"> +<div class="b"> +. +<div class="a"> +<div class="b"> +</div></div> +. + +xtag +. + <img src="img_girl.jpg" alt="Girl in a jacket" width="500" height="600"/> +. + <img src="img_girl.jpg" alt="Girl in a jacket" width="500" height="600"/> +. + +data +. +a +. +a +. + +declaration +. +<!DOCTYPE html> +. +<!DOCTYPE html> +. + +process information +. +<?xml-stylesheet ?> +. +<?xml-stylesheet ?> +. + +entities +. +& + +{ +. +& + +{ +. + +comments +. +<!--This is a comment. Comments are not displayed in the browser +--> +. +<!--This is a comment. Comments are not displayed in the browser +--> +. + +image +. +<img src="img/fun-fish.png" alt="fishy" class="bg-primary mb-1" width="200px"> +<img src="img/fun-fish.png" alt="fishy" class="bg-primary mb-1" width="300px"> +. +<img src="img/fun-fish.png" alt="fishy" class="bg-primary mb-1" width="200px"> +<img src="img/fun-fish.png" alt="fishy" class="bg-primary mb-1" width="300px"> +. diff --git a/tests/test_html/html_to_nodes.md b/tests/test_html/html_to_nodes.md new file mode 100644 index 0000000..e118eb9 --- /dev/null +++ b/tests/test_html/html_to_nodes.md @@ -0,0 +1,199 @@ +empty +. + +. +<container> + <raw format="html" xml:space="preserve"> +. + +text +. +abc +. +<container> + <raw format="html" xml:space="preserve"> + abc +. + +normal HTML +. +<div></div> +. +<container> + <raw format="html" xml:space="preserve"> + <div></div> +. + +image no src +. +<img> +. +<container> + <system_message> + <paragraph> + error +. + +image +. +<img src="a"> +. +<container> + <Element first="a" name="image" position="0"> +. + +image unknown attribute +. +<img src="a" other="b"> +. +<container> + <Element first="a" name="image" position="0"> +. + +image known attributes +. +<img src="a" height="200px" class="a b" name="b" align="left"> +. +<container> + <Element first="a" name="image" position="0"> + :align: left + :class: a b + :height: 200px + :name: b +. + +multiple images +. +<img src="a"> +<img src="b"> +. +<container> + <Element first="a" name="image" position="0"> + <Element first="b" name="image" position="0"> +. + +admonition no close +. +<div class="admonition"> +. +<container> + <Element first="Note" name="admonition" position="0"> + :class: admonition +. + +admonition +. +<div class="admonition"> +</div> +. +<container> + <Element first="Note" name="admonition" position="0"> + :class: admonition +. + +admonition attributes +. +<div class="admonition tip" name="aname"> +</div> +. +<container> + <Element first="Note" name="admonition" position="0"> + :class: admonition tip + :name: aname +. + +admonition div-title +. +<div class="admonition tip"> +<div class="title">*Hallo*</div> +. +<container> + <Element first="*Hallo*" name="admonition" position="0"> + :class: admonition tip +. + +admonition p-title +. +<div class="admonition tip"> +<p class="title">*Hallo*</p> +. +<container> + <Element first="*Hallo*" name="admonition" position="0"> + :class: admonition tip +. + +admonition title+content +. +<div class="admonition"> +<div class="title">*Hallo*</div> +content +</div> +. +<container> + <Element first="*Hallo*" name="admonition" position="0"> + :class: admonition + + content +. + +admonition multiple +. +<div class="admonition"> +<div class="title">first</div> +content 1 +</div> +<div class="admonition"> +<div class="title">second</div> +content 2 +</div> +. +<container> + <Element first="first" name="admonition" position="0"> + :class: admonition + + content 1 + <Element first="second" name="admonition" position="0"> + :class: admonition + + content 2 +. + +admonition with paragraphs +. +<div class="admonition"> +<p>paragraph 1</p> +<p>paragraph 2</p> +</div> +. +<container> + <Element first="Note" name="admonition" position="0"> + :class: admonition + + paragraph 1 + + paragraph 2 +. + +nested +. +<div class="admonition"> +<p>Some **content**</p> + <div class="admonition tip"> + <div class="title">A *title*</div> + <p>Paragraph 1</p> + <p>Paragraph 2</p> + </div> +</div> +. +<container> + <Element first="Note" name="admonition" position="0"> + :class: admonition + + Some **content** + + <div class="admonition tip"> + <div class="title">A *title*</div> + <p>Paragraph 1</p> + <p>Paragraph 2</p> + </div> +. diff --git a/tests/test_html/test_html_to_nodes.py b/tests/test_html/test_html_to_nodes.py new file mode 100644 index 0000000..207a627 --- /dev/null +++ b/tests/test_html/test_html_to_nodes.py @@ -0,0 +1,35 @@ +from pathlib import Path +from unittest.mock import Mock + +import pytest +from docutils import nodes + +from myst_parser.config.main import MdParserConfig +from myst_parser.mdit_to_docutils.html_to_nodes import html_to_nodes + +FIXTURE_PATH = Path(__file__).parent + + +@pytest.fixture() +def mock_renderer(): + def _run_directive(name: str, first_line: str, content: str, position: int): + node = nodes.Element(name=name, first=first_line, position=position) + node += nodes.Text(content) + return [node] + + return Mock( + md_config=MdParserConfig(enable_extensions=["html_image", "html_admonition"]), + document={"source": "source"}, + reporter=Mock( + warning=Mock(return_value=nodes.system_message("warning")), + error=Mock(return_value=nodes.system_message("error")), + ), + run_directive=_run_directive, + ) + + +@pytest.mark.param_file(FIXTURE_PATH / "html_to_nodes.md") +def test_html_to_nodes(file_params, mock_renderer): + output = nodes.container() + output += html_to_nodes(file_params.content, line_number=0, renderer=mock_renderer) + file_params.assert_expected(output.pformat(), rstrip=True) diff --git a/tests/test_html/test_parse_html.py b/tests/test_html/test_parse_html.py new file mode 100644 index 0000000..3b4cdc1 --- /dev/null +++ b/tests/test_html/test_parse_html.py @@ -0,0 +1,41 @@ +from pathlib import Path + +import pytest + +from myst_parser.parsers.parse_html import tokenize_html + +FIXTURE_PATH = Path(__file__).parent + + +@pytest.mark.param_file(FIXTURE_PATH / "html_ast.md") +def test_html_ast(file_params): + tokens = "\n".join( + repr(t) for t in tokenize_html(file_params.content).walk(include_self=True) + ) + file_params.assert_expected(tokens, rstrip=True) + + +@pytest.mark.param_file(FIXTURE_PATH / "html_round_trip.md") +def test_html_round_trip(file_params): + ast = tokenize_html(file_params.content) + file_params.assert_expected(str(ast), rstrip=True) + + +def test_render_overrides(): + text = "<div><abc></abc></div>" + ast = tokenize_html(text) + + def _render_abc(element, *args, **kwargs): + return "hallo" + + output = ast.render(tag_overrides={"abc": _render_abc}) + assert output == "<div>hallo</div>" + + +def test_ast_find(): + text = ( + '<div class="a"><div class="c"><x/><y>z</y><div class="a b"></div></div></div>' + ) + ast = tokenize_html(text) + found = list(ast.find("div", classes=["a"])) + assert [e.attrs.classes for e in found] == [["a"], ["a", "b"]] diff --git a/tests/test_renderers/fixtures/amsmath.md b/tests/test_renderers/fixtures/amsmath.md new file mode 100644 index 0000000..fe3713e --- /dev/null +++ b/tests/test_renderers/fixtures/amsmath.md @@ -0,0 +1,52 @@ +Single Line: +. +\begin{equation} a \end{equation} +. +<document source="<src>/index.md"> + <target ids="equation-mock-uuid"> + <math_block classes="amsmath" docname="index" label="mock-uuid" nowrap="True" number="1" xml:space="preserve"> + \begin{equation} a \end{equation} +. + +Multi Line: +. +\begin{equation} +a +\end{equation} +. +<document source="<src>/index.md"> + <target ids="equation-mock-uuid"> + <math_block classes="amsmath" docname="index" label="mock-uuid" nowrap="True" number="1" xml:space="preserve"> + \begin{equation} + a + \end{equation} +. + +Multi Line no number: +. +\begin{equation*} +a +\end{equation*} +. +<document source="<src>/index.md"> + <math_block classes="amsmath" nowrap="True" number="True" xml:space="preserve"> + \begin{equation*} + a + \end{equation*} +. + +In list: +. +- \begin{equation} + a = 1 + \end{equation} +. +<document source="<src>/index.md"> + <bullet_list bullet="-"> + <list_item> + <target ids="equation-mock-uuid"> + <math_block classes="amsmath" docname="index" label="mock-uuid" nowrap="True" number="1" xml:space="preserve"> + \begin{equation} + a = 1 + \end{equation} +. diff --git a/tests/test_renderers/fixtures/containers.md b/tests/test_renderers/fixtures/containers.md new file mode 100644 index 0000000..f67bea8 --- /dev/null +++ b/tests/test_renderers/fixtures/containers.md @@ -0,0 +1,31 @@ +Basic note: +. +::: {note} +*hallo* +::: +. +<document source="<src>/index.md"> + <note> + <paragraph> + <emphasis> + hallo +. + +Admonition with options: +. +::: {admonition} A **title** +:class: other + +*hallo* +::: +. +<document source="<src>/index.md"> + <admonition classes="other"> + <title> + A + <strong> + title + <paragraph> + <emphasis> + hallo +. diff --git a/tests/test_renderers/fixtures/definition_lists.md b/tests/test_renderers/fixtures/definition_lists.md new file mode 100644 index 0000000..c064fa2 --- /dev/null +++ b/tests/test_renderers/fixtures/definition_lists.md @@ -0,0 +1,56 @@ +Simple: +. +Term **1** + +: Definition *1* + + second paragraph + +Term 2 + ~ Definition 2a + ~ Definition 2b + +Term 3 + : code block + + : > quote + + : other +. +<document source="<src>/index.md"> + <definition_list classes="simple myst"> + <definition_list_item> + <term> + Term + <strong> + 1 + <definition> + <paragraph> + Definition + <emphasis> + 1 + <paragraph> + second paragraph + <definition_list_item> + <term> + Term 2 + <definition> + <paragraph> + Definition 2a + <definition> + <paragraph> + Definition 2b + <definition_list_item> + <term> + Term 3 + <definition> + <literal_block language="none" xml:space="preserve"> + code block + <definition> + <block_quote> + <paragraph> + quote + <definition> + <paragraph> + other +. diff --git a/tests/test_renderers/fixtures/directive_options.md b/tests/test_renderers/fixtures/directive_options.md new file mode 100644 index 0000000..b9ae64a --- /dev/null +++ b/tests/test_renderers/fixtures/directive_options.md @@ -0,0 +1,159 @@ +Test Directive 1: +. +```{restructuredtext-test-directive} +``` +. +<document source="<src>/index.md"> + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=[], options={}, content: None +. + +Test Directive 2: +. +```{restructuredtext-test-directive} +foo +``` +. +<document source="<src>/index.md"> + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=[], options={}, content: + <literal_block xml:space="preserve"> + foo +. + +Test Directive 3: +. +```{restructuredtext-test-directive} foo +``` +. +<document source="<src>/index.md"> + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=['foo'], options={}, content: None +. + +Test Directive 4: +. +```{restructuredtext-test-directive} foo +bar +``` +. +<document source="<src>/index.md"> + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=['foo'], options={}, content: + <literal_block xml:space="preserve"> + bar +. + +Test Directive 5: +. +```{restructuredtext-test-directive} foo bar +``` +. +<document source="<src>/index.md"> + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=['foo bar'], options={}, content: None +. + +Test Directive 6: +. +```{restructuredtext-test-directive} foo bar +baz +``` +. +<document source="<src>/index.md"> + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=['foo bar'], options={}, content: + <literal_block xml:space="preserve"> + baz +. + +Test Directive 7: +. +```{restructuredtext-test-directive} + +foo +``` +. +<document source="<src>/index.md"> + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=[], options={}, content: + <literal_block xml:space="preserve"> + foo +. + +Test Directive Options 1: +. +```{restructuredtext-test-directive} +--- +option1: a +option2: b +--- +foo +``` +. +<document source="<src>/index.md"> + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=[], options={'option1': 'a', 'option2': 'b'}, content: + <literal_block xml:space="preserve"> + foo +. + +Test Directive Options 2: +. +```{restructuredtext-test-directive} +:option1: a +:option2: b +foo +``` +. +<document source="<src>/index.md"> + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=[], options={'option1': 'a', 'option2': 'b'}, content: + <literal_block xml:space="preserve"> + foo +. + +Test Directive Options Error: +. +```{restructuredtext-test-directive} +:option1 +:option2: b +foo +``` +. +<document source="<src>/index.md"> + <system_message level="3" line="1" source="<src>/index.md" type="ERROR"> + <paragraph> + Directive 'restructuredtext-test-directive': Invalid options YAML: mapping values are not allowed here + in "<unicode string>", line 2, column 8: + option2: b + ^ + <literal_block xml:space="preserve"> + :option1 + :option2: b + foo +. + +Unknown Directive: +. +```{unknown} +``` +. +<document source="<src>/index.md"> + <system_message level="3" line="1" source="<src>/index.md" type="ERROR"> + <paragraph> + Unknown directive type "unknown". + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + No directive entry for "unknown" in module "docutils.parsers.rst.languages.en". + Trying "unknown" as canonical directive name. +. diff --git a/tests/test_renderers/fixtures/directive_parsing.txt b/tests/test_renderers/fixtures/directive_parsing.txt new file mode 100644 index 0000000..35878bc --- /dev/null +++ b/tests/test_renderers/fixtures/directive_parsing.txt @@ -0,0 +1,141 @@ +note: content in first line only +. +```{note} a +``` +. +arguments: [] +body: +- a +content_offset: 0 +options: {} +. + +note: content in body only +. +```{note} +a +``` +. +arguments: [] +body: +- a +content_offset: 0 +options: {} +. + +note: content after option +. +```{note} +:class: name +a +``` +. +arguments: [] +body: +- a +content_offset: 1 +options: + class: + - name +. + +note: content after option with new line +. +```{note} +:class: name + +a +``` +. +arguments: [] +body: +- a +content_offset: 2 +options: + class: + - name +. + +note: content after yaml option +. +```{note} +--- +class: name +--- +a +``` +. +arguments: [] +body: +- a +content_offset: 3 +options: + class: + - name +. + +note: content in first line and body +. +```{note} first line +:class: tip + +body line +``` +. +arguments: [] +body: +- first line +- '' +- body line +content_offset: 1 +options: + class: + - tip +. + +admonition: no options, no new line +. +```{admonition} first line +body line +``` +. +arguments: +- first line +body: +- body line +content_offset: 0 +options: {} +. + +admonition: no options, new line +. +```{admonition} first line + +body line +``` +. +arguments: +- first line +body: +- body line +content_offset: 1 +options: {} +. + +admonition: with options +. +```{admonition} first line +:class: tip + +body line +``` +. +arguments: +- first line +body: +- body line +content_offset: 2 +options: + class: + - tip +. diff --git a/tests/test_renderers/fixtures/docutil_directives.md b/tests/test_renderers/fixtures/docutil_directives.md new file mode 100644 index 0000000..e15bf2e --- /dev/null +++ b/tests/test_renderers/fixtures/docutil_directives.md @@ -0,0 +1,436 @@ +-------------------------------- +[attention] (`docutils.parsers.rst.directives.admonitions.Attention`): +. +```{attention} + +a +``` +. +<document source="notset"> + <attention> + <paragraph> + a +. + +-------------------------------- +[caution] (`docutils.parsers.rst.directives.admonitions.Caution`): +. +```{caution} + +a +``` +. +<document source="notset"> + <caution> + <paragraph> + a +. + +-------------------------------- +[danger] (`docutils.parsers.rst.directives.admonitions.Danger`): +. +```{danger} + +a +``` +. +<document source="notset"> + <danger> + <paragraph> + a +. + +-------------------------------- +[error] (`docutils.parsers.rst.directives.admonitions.Error`): +. +```{error} + +a +``` +. +<document source="notset"> + <error> + <paragraph> + a +. + +-------------------------------- +[important] (`docutils.parsers.rst.directives.admonitions.Important`): +. +```{important} + +a +``` +. +<document source="notset"> + <important> + <paragraph> + a +. + +-------------------------------- +[note] (`docutils.parsers.rst.directives.admonitions.Note`): +. +```{note} + +a +``` +. +<document source="notset"> + <note> + <paragraph> + a +. + +-------------------------------- +[tip] (`docutils.parsers.rst.directives.admonitions.Tip`): +. +```{tip} + +a +``` +. +<document source="notset"> + <tip> + <paragraph> + a +. + +-------------------------------- +[hint] (`docutils.parsers.rst.directives.admonitions.Hint`): +. +```{hint} + +a +``` +. +<document source="notset"> + <hint> + <paragraph> + a +. + +-------------------------------- +[warning] (`docutils.parsers.rst.directives.admonitions.Warning`): +. +```{warning} + +a +``` +. +<document source="notset"> + <warning> + <paragraph> + a +. + +-------------------------------- +[admonition] (`docutils.parsers.rst.directives.admonitions.Admonition`): +. +```{admonition} myclass + +a +``` +. +<document source="notset"> + <admonition classes="admonition-myclass"> + <title> + myclass + <paragraph> + a +. + +-------------------------------- +[sidebar] (`docutils.parsers.rst.directives.body.Sidebar`): +. +```{sidebar} sidebar title + +a +``` +. +<document source="notset"> + <sidebar> + <title> + sidebar title + <paragraph> + a +. + +-------------------------------- +[topic] (`docutils.parsers.rst.directives.body.Topic`): +. +```{topic} Topic Title + +a +``` +. +<document source="notset"> + <topic> + <title> + Topic Title + <paragraph> + a +. + +-------------------------------- +[line-block] (`docutils.parsers.rst.directives.body.LineBlock`) SKIP: MockingError: MockState has not yet implemented attribute 'nest_line_block_lines' +. +```{line-block} + + +``` +. +<document source="notset"> +. + +-------------------------------- +[parsed-literal] (`docutils.parsers.rst.directives.body.ParsedLiteral`): +. +```{parsed-literal} + +a +``` +. +<document source="notset"> + <literal_block xml:space="preserve"> + a +. + +-------------------------------- +[rubric] (`docutils.parsers.rst.directives.body.Rubric`): +. +```{rubric} Rubric Title +``` +. +<document source="notset"> + <rubric> + Rubric Title +. + +-------------------------------- +[epigraph] (`docutils.parsers.rst.directives.body.Epigraph`): +. +```{epigraph} + +a + +-- attribution +``` +. +<document source="notset"> + <block_quote classes="epigraph"> + <paragraph> + a + <attribution> + attribution +. + +-------------------------------- +[highlights] (`docutils.parsers.rst.directives.body.Highlights`): +. +```{highlights} + +a + +-- attribution +``` +. +<document source="notset"> + <block_quote classes="highlights"> + <paragraph> + a + <attribution> + attribution +. + +-------------------------------- +[pull-quote] (`docutils.parsers.rst.directives.body.PullQuote`): +. +```{pull-quote} + +a + +-- attribution +``` +. +<document source="notset"> + <block_quote classes="pull-quote"> + <paragraph> + a + <attribution> + attribution +. + +-------------------------------- +[compound] (`docutils.parsers.rst.directives.body.Compound`): +. +```{compound} + +a +``` +. +<document source="notset"> + <compound> + <paragraph> + a +. + +-------------------------------- +[container] (`docutils.parsers.rst.directives.body.Container`): +. +```{container} + +a +``` +. +<document source="notset"> + <container> + <paragraph> + a +. + +-------------------------------- +[image] (`docutils.parsers.rst.directives.images.Image`): +. +```{image} path/to/image +:alt: abc +:name: name +``` +. +<document source="notset"> + <image alt="abc" ids="name" names="name" uri="path/to/image"> +. + +-------------------------------- +[raw] (`docutils.parsers.rst.directives.misc.Raw`): +. +```{raw} raw + +a +``` +. +<document source="notset"> + <raw format="raw" xml:space="preserve"> + a +. + +-------------------------------- +[class] (`docutils.parsers.rst.directives.misc.Class`): +. +```{class} myclass + +a +``` +. +<document source="notset"> + <paragraph classes="myclass"> + a +. + +-------------------------------- +[role] (`docutils.parsers.rst.directives.misc.Role`) + raw (`docutils.parsers.rst.roles.raw_role`): +. +```{role} raw-latex(raw) +:format: latex +``` + +{raw-latex}`\tag{content}` +. +<document source="notset"> + <paragraph> + <raw classes="raw-latex" format="latex" xml:space="preserve"> + \tag{content} +. + +-------------------------------- +[title] (`docutils.parsers.rst.directives.misc.Title`): +. +```{title} title +``` +. +<document source="notset" title="title"> +. + +-------------------------------- +[restructuredtext-test-directive] (`docutils.parsers.rst.directives.misc.TestDirective`): +. +```{restructuredtext-test-directive} +``` +. +<document source="notset"> + <system_message level="1" line="1" source="notset" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=[], options={}, content: None +. + +-------------------------------- +[contents] (`docutils.parsers.rst.directives.parts.Contents`): +. +```{contents} Contents +``` +. +<document source="notset"> + <topic classes="contents" ids="contents" names="contents"> + <title> + Contents + <pending> + .. internal attributes: + .transform: docutils.transforms.parts.Contents + .details: +. + +-------------------------------- +[sectnum] (`docutils.parsers.rst.directives.parts.Sectnum`): +. +```{sectnum} +``` +. +<document source="notset"> + <pending> + .. internal attributes: + .transform: docutils.transforms.parts.SectNum + .details: +. + +-------------------------------- +[header] (`docutils.parsers.rst.directives.parts.Header`): +. +```{header} + +a +``` +. +<document source="notset"> + <decoration> + <header> + <paragraph> + a +. + +-------------------------------- +[footer] (`docutils.parsers.rst.directives.parts.Footer`): +. +```{footer} + +a +``` +. +<document source="notset"> + <decoration> + <footer> + <paragraph> + a +. + +-------------------------------- +[target-notes] (`docutils.parsers.rst.directives.references.TargetNotes`): +. +```{target-notes} +``` +. +<document source="notset"> + <pending> + .. internal attributes: + .transform: docutils.transforms.references.TargetNotes + .details: +. diff --git a/tests/test_renderers/fixtures/docutil_roles.md b/tests/test_renderers/fixtures/docutil_roles.md new file mode 100644 index 0000000..51fa48d --- /dev/null +++ b/tests/test_renderers/fixtures/docutil_roles.md @@ -0,0 +1,131 @@ +-------------------------------- +[abbreviation] (`docutils.parsers.rst.roles.GenericRole`): +. +{abbreviation}`a` +. +<document source="notset"> + <paragraph> + <abbreviation> + a +. + +-------------------------------- +[acronym] (`docutils.parsers.rst.roles.GenericRole`): +. +{acronym}`a` +. +<document source="notset"> + <paragraph> + <acronym> + a +. + +-------------------------------- +[emphasis] (`docutils.parsers.rst.roles.GenericRole`): +. +{emphasis}`a` +. +<document source="notset"> + <paragraph> + <emphasis> + a +. + +-------------------------------- +[literal] (`docutils.parsers.rst.roles.GenericRole`): +. +{literal}`a` +. +<document source="notset"> + <paragraph> + <literal> + a +. + +-------------------------------- +[strong] (`docutils.parsers.rst.roles.GenericRole`): +. +{strong}`a` +. +<document source="notset"> + <paragraph> + <strong> + a +. + +-------------------------------- +[subscript] (`docutils.parsers.rst.roles.GenericRole`): +. +{subscript}`a` +. +<document source="notset"> + <paragraph> + <subscript> + a +. + +-------------------------------- +[superscript] (`docutils.parsers.rst.roles.GenericRole`): +. +{superscript}`a` +. +<document source="notset"> + <paragraph> + <superscript> + a +. + +-------------------------------- +[title-reference] (`docutils.parsers.rst.roles.GenericRole`): +. +{title-reference}`t` +. +<document source="notset"> + <paragraph> + <title_reference> + t +. + +-------------------------------- +[pep-reference] (`docutils.parsers.rst.roles.pep_reference_role`): +. +{pep-reference}`0` +. +<document source="notset"> + <paragraph> + <reference refuri="https://peps.python.org/pep-0000"> + PEP 0 +. + +-------------------------------- +[rfc-reference] (`docutils.parsers.rst.roles.rfc_reference_role`): +. +{rfc-reference}`1` +. +<document source="notset"> + <paragraph> + <reference refuri="https://tools.ietf.org/html/rfc1.html"> + RFC 1 +. + +-------------------------------- +[code] (`docutils.parsers.rst.roles.code_role`): +. +{code}`a` +. +<document source="notset"> + <paragraph> + <literal classes="code"> + a +. + +-------------------------------- +[math] (`docutils.parsers.rst.roles.math_role`): +. +{math}`a` +. +<document source="notset"> + <paragraph> + <math> + a +. diff --git a/tests/test_renderers/fixtures/docutil_syntax_elements.md b/tests/test_renderers/fixtures/docutil_syntax_elements.md new file mode 100644 index 0000000..9b59f3a --- /dev/null +++ b/tests/test_renderers/fixtures/docutil_syntax_elements.md @@ -0,0 +1,794 @@ +Raw +. +foo +. +<document source="notset"> + <paragraph> + foo +. + +Hard-break +. +foo\ +bar +. +<document source="notset"> + <paragraph> + foo + <raw format="html" xml:space="preserve"> + <br /> + <raw format="latex" xml:space="preserve"> + \\ + bar +. + +Strong: +. +**foo** +. +<document source="notset"> + <paragraph> + <strong> + foo +. + +Emphasis +. +*foo* +. +<document source="notset"> + <paragraph> + <emphasis> + foo +. + +Escaped Emphasis: +. +\*foo* +. +<document source="notset"> + <paragraph> + *foo* +. + +Mixed Inline +. +a *b* **c** `abc` \\* +. +<document source="notset"> + <paragraph> + a + <emphasis> + b + + <strong> + c + + <literal> + abc + \* +. + +Inline Code: +. +`foo` +. +<document source="notset"> + <paragraph> + <literal> + foo +. + +Heading: +. +# foo +. +<document source="notset"> + <section ids="foo" names="foo"> + <title> + foo +. + +Heading Levels: +. +# a +## b +### c +# d +. +<document source="notset"> + <section ids="a" names="a"> + <title> + a + <section ids="b" names="b"> + <title> + b + <section ids="c" names="c"> + <title> + c + <section ids="d" names="d"> + <title> + d +. + +Block Code: +. + foo +. +<document source="notset"> + <literal_block classes="code" xml:space="preserve"> + foo +. + +Fenced Code: +. +```sh +foo +``` +. +<document source="notset"> + <literal_block classes="code sh" xml:space="preserve"> + foo +. + +Fenced Code no language: +. +``` +foo +``` +. +<document source="notset"> + <literal_block classes="code" xml:space="preserve"> + foo +. + +Fenced Code no language with trailing whitespace: +. +``` +foo +``` +. +<document source="notset"> + <literal_block classes="code" xml:space="preserve"> + foo +. + +Image empty: +. +![]() +. +<document source="notset"> + <paragraph> + <image alt="" uri=""> +. + +Image with alt and title: +. +![alt](src "title") +. +<document source="notset"> + <paragraph> + <image alt="alt" title="title" uri="src"> +. + +Image with escapable html: +. +![alt](http://www.google<>.com) +. +<document source="notset"> + <paragraph> + <image alt="alt" uri="http://www.google%3C%3E.com"> +. + +Block Quote: +. +> *foo* +. +<document source="notset"> + <block_quote> + <paragraph> + <emphasis> + foo +. + +Bullet List: +. +- *foo* +* bar +. +<document source="notset"> + <bullet_list bullet="-"> + <list_item> + <paragraph> + <emphasis> + foo + <bullet_list bullet="*"> + <list_item> + <paragraph> + bar +. + +Nested Bullets +. +- a + - b + - c + - d +. +<document source="notset"> + <bullet_list bullet="-"> + <list_item> + <paragraph> + a + <bullet_list bullet="-"> + <list_item> + <paragraph> + b + <bullet_list bullet="-"> + <list_item> + <paragraph> + c + <list_item> + <paragraph> + d +. + +Enumerated List: +. +1. *foo* + +1) bar + +para + +10. starting +11. enumerator +. +<document source="notset"> + <enumerated_list enumtype="arabic" prefix="" suffix="."> + <list_item> + <paragraph> + <emphasis> + foo + <enumerated_list enumtype="arabic" prefix="" suffix=")"> + <list_item> + <paragraph> + bar + <paragraph> + para + <enumerated_list enumtype="arabic" prefix="" start="10" suffix="."> + <list_item> + <paragraph> + starting + <list_item> + <paragraph> + enumerator +. + +Nested Enumrated List: +. +1. a +2. b + 1. c +. +<document source="notset"> + <enumerated_list enumtype="arabic" prefix="" suffix="."> + <list_item> + <paragraph> + a + <list_item> + <paragraph> + b + <enumerated_list enumtype="arabic" prefix="" suffix="."> + <list_item> + <paragraph> + c +. + +Sphinx Role containing backtick: +. +{code}``a=1{`}`` +. +<document source="notset"> + <paragraph> + <literal classes="code"> + a=1{`} +. + +Target: +. +(target)= +. +<document source="notset"> + <target ids="target" names="target"> +. + +Target with whitespace: +. +(target with space)= +. +<document source="notset"> + <target ids="target-with-space" names="target\ with\ space"> +. + +Referencing: +. +(target)= + +Title +===== + +[alt1](target) + +[](target2) + +[alt2](https://www.google.com) + +[alt3](#target3) +. +<document source="notset"> + <target ids="target" names="target"> + <section ids="title" names="title"> + <title> + Title + <paragraph> + <reference refname="target"> + alt1 + <paragraph> + <reference refname="target2"> + <paragraph> + <reference refuri="https://www.google.com"> + alt2 + <paragraph> + <reference refname="#target3"> + alt3 +. + +Comments: +. +line 1 +% a comment +line 2 +. +<document source="notset"> + <paragraph> + line 1 + <comment xml:space="preserve"> + a comment + <paragraph> + line 2 +. + +Block Break: +. ++++ string +. +<document source="notset"> + <comment classes="block_break" xml:space="preserve"> + string +. + +Link Reference: +. +[name][key] + +[key]: https://www.google.com "a title" +. +<document source="notset"> + <paragraph> + <reference refuri="https://www.google.com" title="a title"> + name +. + +Link Reference short version: +. +[name] + +[name]: https://www.google.com "a title" +. +<document source="notset"> + <paragraph> + <reference refuri="https://www.google.com" title="a title"> + name +. + +Block Quotes: +. +```{epigraph} +a b*c* + +-- a**b** +``` +. +<document source="notset"> + <block_quote classes="epigraph"> + <paragraph> + a b + <emphasis> + c + <attribution> + a + <strong> + b +. + +Link Definition in directive: +. +```{note} +[a] +``` + +[a]: link +. +<document source="notset"> + <note> + <paragraph> + <reference refname="link"> + a +. + +Link Definition in nested directives: +. +```{note} +[ref1]: link +``` + +```{note} +[ref1] +[ref2] +``` + +```{note} +[ref2]: link +``` +. +<document source="notset"> + <note> + <note> + <paragraph> + <reference refname="link"> + ref1 + + [ref2] + <note> +. + +Footnotes: +. +[^a] + +[^a]: footnote*text* +. +<document source="notset"> + <paragraph> + <footnote_reference auto="1" ids="id1" refname="a"> + <transition classes="footnotes"> + <footnote auto="1" ids="a" names="a"> + <paragraph> + footnote + <emphasis> + text +. + +Footnotes nested blocks: +. +[^a] + +[^a]: footnote*text* + + abc +xyz + + > a + + - b + + c + +finish +. +<document source="notset"> + <paragraph> + <footnote_reference auto="1" ids="id1" refname="a"> + <paragraph> + finish + <transition classes="footnotes"> + <footnote auto="1" ids="a" names="a"> + <paragraph> + footnote + <emphasis> + text + <paragraph> + abc + + xyz + <block_quote> + <paragraph> + a + <bullet_list bullet="-"> + <list_item> + <paragraph> + b + <paragraph> + c +. + +Front Matter: +. +--- +a: 1 +b: foo +c: + d: 2 +--- +. +<document source="notset"> + <field_list> + <field> + <field_name> + a + <field_body> + <paragraph> + <literal> + 1 + <field> + <field_name> + b + <field_body> + <paragraph> + <literal> + foo + <field> + <field_name> + c + <field_body> + <paragraph> + <literal> + {"d": 2} +. + +Front Matter Biblio: +. +--- +author: Chris Sewell +authors: Chris Sewell, Chris Hodgraf +organization: EPFL +address: | + 1 Cedar Park Close + Thundersley + Essex +contact: <https://example.com> +version: 1.0 +revision: 1.1 +status: good +date: 2/12/1985 +copyright: MIT +dedication: | + To my *homies* +abstract: + Something something **dark** side +other: Something else +--- +. +<document source="notset"> + <field_list> + <field> + <field_name> + author + <field_body> + <paragraph> + Chris Sewell + <field> + <field_name> + authors + <field_body> + <paragraph> + Chris Sewell, Chris Hodgraf + <field> + <field_name> + organization + <field_body> + <paragraph> + EPFL + <field> + <field_name> + address + <field_body> + <paragraph> + 1 Cedar Park Close + + Thundersley + + Essex + + <field> + <field_name> + contact + <field_body> + <paragraph> + <reference refuri="https://example.com"> + https://example.com + <field> + <field_name> + version + <field_body> + <paragraph> + 1.0 + <field> + <field_name> + revision + <field_body> + <paragraph> + 1.1 + <field> + <field_name> + status + <field_body> + <paragraph> + good + <field> + <field_name> + date + <field_body> + <paragraph> + 2/12/1985 + <field> + <field_name> + copyright + <field_body> + <paragraph> + MIT + <field> + <field_name> + dedication + <field_body> + <paragraph> + To my + <emphasis> + homies + + <field> + <field_name> + abstract + <field_body> + <paragraph> + Something something + <strong> + dark + side + <field> + <field_name> + other + <field_body> + <paragraph> + <literal> + Something else +. + +Front Matter Bad Yaml: +. +--- +a: { +--- +. +<document source="notset"> + <system_message level="2" line="1" source="notset" type="WARNING"> + <paragraph> + Malformed YAML [myst.topmatter] +. + +Front Matter HTML Meta +. +--- +myst: + html_meta: + keywords: Sphinx, documentation, builder + description lang=en: An amusing story + description lang=fr: Un histoire amusant + http-equiv=Content-Type: text/html; charset=ISO-8859-1 +--- +. +<document source="notset"> + <pending> + .. internal attributes: + .transform: docutils.transforms.components.Filter + .details: + component: 'writer' + format: 'html' + nodes: + <meta content="Sphinx, documentation, builder" name="keywords"> + <pending> + .. internal attributes: + .transform: docutils.transforms.components.Filter + .details: + component: 'writer' + format: 'html' + nodes: + <meta content="An amusing story" lang="en" name="description"> + <pending> + .. internal attributes: + .transform: docutils.transforms.components.Filter + .details: + component: 'writer' + format: 'html' + nodes: + <meta content="Un histoire amusant" lang="fr" name="description"> + <pending> + .. internal attributes: + .transform: docutils.transforms.components.Filter + .details: + component: 'writer' + format: 'html' + nodes: + <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> +. + +Full Test: +. +--- +a: 1 +--- + +(target)= +# header 1 +## sub header 1 + +a *b* **c** `abc` + +## sub header 2 + +x y [a](http://www.xyz.com) z + +--- + +# header 2 + +```::python {a=1} +a = 1 +``` + +[](target) +. +<document source="notset"> + <field_list> + <field> + <field_name> + a + <field_body> + <paragraph> + <literal> + 1 + <target ids="target" names="target"> + <section ids="header-1" names="header\ 1"> + <title> + header 1 + <section ids="sub-header-1" names="sub\ header\ 1"> + <title> + sub header 1 + <paragraph> + a + <emphasis> + b + + <strong> + c + + <literal> + abc + <section ids="sub-header-2" names="sub\ header\ 2"> + <title> + sub header 2 + <paragraph> + x y + <reference refuri="http://www.xyz.com"> + a + z + <transition> + <section ids="header-2" names="header\ 2"> + <title> + header 2 + <literal_block classes="code ::python" xml:space="preserve"> + a = 1 + <paragraph> + <reference refname="target"> +. diff --git a/tests/test_renderers/fixtures/docutil_syntax_extensions.txt b/tests/test_renderers/fixtures/docutil_syntax_extensions.txt new file mode 100644 index 0000000..5efcb68 --- /dev/null +++ b/tests/test_renderers/fixtures/docutil_syntax_extensions.txt @@ -0,0 +1,139 @@ +[dollarmath] --myst-enable-extensions=dollarmath +. +$foo$ + +a $foo +bar$ b + +$$foo$$ + +$$ +a = 1 +$$ +. +<document source="<string>"> + <paragraph> + <math> + foo + <paragraph> + a + <math> + foo + bar + b + <math_block nowrap="False" number="True" xml:space="preserve"> + foo + <math_block nowrap="False" number="True" xml:space="preserve"> + + a = 1 +. + +[amsmath] --myst-enable-extensions=amsmath +. +\begin{equation} a \end{equation} + +\begin{equation} +a +\end{equation} + +\begin{equation*} +a +\end{equation*} +. +<document source="<string>"> + <math_block classes="amsmath" nowrap="True" numbered="True" xml:space="preserve"> + \begin{equation} a \end{equation} + <math_block classes="amsmath" nowrap="True" numbered="True" xml:space="preserve"> + \begin{equation} + a + \end{equation} + <math_block classes="amsmath" nowrap="True" xml:space="preserve"> + \begin{equation*} + a + \end{equation*} +. + +[deflist] --myst-enable-extensions=deflist +. +term +: definition +. +<document source="<string>"> + <definition_list classes="simple myst"> + <definition_list_item> + <term> + term + <definition> + <paragraph> + definition +. + +[fieldlist] --myst-enable-extensions=fieldlist +. +:name: value +. +<document source="<string>"> + <docinfo> + <field classes="name"> + <field_name> + name + <field_body> + <paragraph> + value +. + +[colon_fence] --myst-enable-extensions=colon_fence +. +:::{note} +content +::: +. +<document source="<string>"> + <note> + <paragraph> + content +. + +[replacements] --myst-enable-extensions=replacements +. +(c) (C) (r) (R) (tm) (TM) (p) (P) +- ... +. +<document source="<string>"> + <paragraph> + © © ® ® ™ ™ § § ± … +. + +[strikethrough] --myst-enable-extensions=strikethrough +. +~~foo~~ +. +<document source="<string>"> + <paragraph> + <system_message level="2" line="1" source="<string>" type="WARNING"> + <paragraph> + Strikethrough is currently only supported in HTML output [myst.strikethrough] + <raw format="html" xml:space="preserve"> + <s> + foo + <raw format="html" xml:space="preserve"> + </s> +. + +[tasklist] --myst-enable-extensions=tasklist +. +- [ ] foo +- [x] bar +. +<document source="<string>"> + <bullet_list bullet="-" classes="contains-task-list"> + <list_item classes="task-list-item"> + <paragraph> + <raw format="html" xml:space="preserve"> + <input class="task-list-item-checkbox" disabled="disabled" type="checkbox"> + foo + <list_item classes="task-list-item"> + <paragraph> + <raw format="html" xml:space="preserve"> + <input class="task-list-item-checkbox" checked="checked" disabled="disabled" type="checkbox"> + bar +. diff --git a/tests/test_renderers/fixtures/dollarmath.md b/tests/test_renderers/fixtures/dollarmath.md new file mode 100644 index 0000000..e3e5fd2 --- /dev/null +++ b/tests/test_renderers/fixtures/dollarmath.md @@ -0,0 +1,75 @@ +Inline Math: +. +$foo$ +. +<document source="<src>/index.md"> + <paragraph> + <math> + foo +. + +Inline Math, multi-line: +. +a $foo +bar$ b +. +<document source="<src>/index.md"> + <paragraph> + a + <math> + foo + bar + b +. + +Inline Math, multi-line with line break (invalid): +. +a $foo + +bar$ b +. +<document source="<src>/index.md"> + <paragraph> + a $foo + <paragraph> + bar$ b +. + +Math Block: +. +$$foo$$ +. +<document source="<src>/index.md"> + <math_block nowrap="False" number="True" xml:space="preserve"> + foo +. + +Math Block With Equation Label: +. +$$foo$$ (abc) +. +<document source="<src>/index.md"> + <target ids="equation-abc"> + <math_block docname="index" label="abc" nowrap="False" number="1" xml:space="preserve"> + foo +. + +Math Block multiple: +. +$$ +a = 1 +$$ + +$$ +b = 2 +$$ (a) +. +<document source="<src>/index.md"> + <math_block nowrap="False" number="True" xml:space="preserve"> + + a = 1 + <target ids="equation-a"> + <math_block docname="index" label="a" nowrap="False" number="1" xml:space="preserve"> + + b = 2 +. diff --git a/tests/test_renderers/fixtures/eval_rst.md b/tests/test_renderers/fixtures/eval_rst.md new file mode 100644 index 0000000..9f21bd1 --- /dev/null +++ b/tests/test_renderers/fixtures/eval_rst.md @@ -0,0 +1,23 @@ +eval-rst link +. +```{eval-rst} +`MyST Parser <https://myst-parser.readthedocs.io/>`_ +``` +. +<document source="<src>/index.md"> + <paragraph> + <reference name="MyST Parser" refuri="https://myst-parser.readthedocs.io/"> + MyST Parser + <target ids="myst-parser" names="myst\ parser" refuri="https://myst-parser.readthedocs.io/"> +. + +eval-rst bold +. +```{eval-rst} +**bold** +. +<document source="<src>/index.md"> + <paragraph> + <strong> + bold +. diff --git a/tests/test_renderers/fixtures/mock_include.md b/tests/test_renderers/fixtures/mock_include.md new file mode 100644 index 0000000..32d779e --- /dev/null +++ b/tests/test_renderers/fixtures/mock_include.md @@ -0,0 +1,62 @@ +Basic Include: +. +```{include} other.md +``` +. +<document source="tmpdir/test.md"> + <paragraph> + a + + b + + c +. + +Include with Front Matter (should be ignored): +. +```{include} fmatter.md +``` +. +<document source="tmpdir/test.md"> + <paragraph> + b +. + +Include Literal: +. +```{include} other.md +:literal: True +``` +. +<document source="tmpdir/test.md"> + <literal_block source="tmpdir/other.md" xml:space="preserve"> + a + b + c +. + +Include Literal, line range: +. +```{include} other.md +:literal: True +:start-line: 1 +:end-line: 2 +``` +. +<document source="tmpdir/test.md"> + <literal_block source="tmpdir/other.md" xml:space="preserve"> + b +. + +Include code: +. +```{include} other.md +:code: md +``` +. +<document source="tmpdir/test.md"> + <literal_block classes="code md" source="tmpdir/other.md" xml:space="preserve"> + a + b + c +. diff --git a/tests/test_renderers/fixtures/mock_include_errors.md b/tests/test_renderers/fixtures/mock_include_errors.md new file mode 100644 index 0000000..1e5c2e9 --- /dev/null +++ b/tests/test_renderers/fixtures/mock_include_errors.md @@ -0,0 +1,24 @@ +Missing path: +. +```{include} +``` +. +tmpdir/test.md:1: (ERROR/3) Directive 'include': 1 argument(s) required, 0 supplied +. + +Non-existent path: +. +```{include} other.md +``` +. +tmpdir/test.md:1: (SEVERE/4) Directive "include": error reading file: tmpdir/other.md +[Errno 2] No such file or directory: 'tmpdir/other.md'. +. + +Error in include file: +. +```{include} bad.md +``` +. +tmpdir/bad.md:2: (ERROR/3) Unknown interpreted text role "a". +. diff --git a/tests/test_renderers/fixtures/myst-config.txt b/tests/test_renderers/fixtures/myst-config.txt new file mode 100644 index 0000000..668895a --- /dev/null +++ b/tests/test_renderers/fixtures/myst-config.txt @@ -0,0 +1,176 @@ +[title-to-header] --myst-title-to-header="yes" +. +--- +title: "The title *nested syntax*" +--- + +# Other header +. +<document source="<string>"> + <docinfo> + <field classes="title"> + <field_name> + title + <field_body> + <paragraph> + <literal> + The title *nested syntax* + <section ids="the-title-nested-syntax" names="the\ title\ nested\ syntax"> + <title> + The title + <emphasis> + nested syntax + <section ids="other-header" names="other\ header"> + <title> + Other header +. + +[linkify] --myst-enable-extensions=linkify +. +www.example.com +. +<document source="<string>"> + <paragraph> + <reference refuri="http://www.example.com"> + www.example.com +. + +[gfm-strikethrough] --myst-gfm-only="yes" +. +~~strike~~ +. +<document source="<string>"> + <paragraph> + <system_message level="2" line="1" source="<string>" type="WARNING"> + <paragraph> + Strikethrough is currently only supported in HTML output [myst.strikethrough] + <raw format="html" xml:space="preserve"> + <s> + strike + <raw format="html" xml:space="preserve"> + </s> + +<string>:1: (WARNING/2) Strikethrough is currently only supported in HTML output [myst.strikethrough] +. + +[gfm-disallowed-html] --myst-gfm-only="yes" +. +<strong> <title> <style> <em> + +<blockquote> + <xmp> is disallowed. <XMP> is also disallowed. +</blockquote> +. +<document source="<string>"> + <paragraph> + <raw format="html" xml:space="preserve"> + <strong> + + <raw format="html" xml:space="preserve"> + <title> + + <raw format="html" xml:space="preserve"> + <style> + + <raw format="html" xml:space="preserve"> + <em> + <raw format="html" xml:space="preserve"> + <blockquote> + <xmp> is disallowed. <XMP> is also disallowed. + </blockquote> +. + +[gfm-autolink] --myst-gfm-only="yes" +. +www.commonmark.org + +Visit www.commonmark.org/help for more information. + +www.google.com/search?q=Markup+(business) + +www.google.com/search?q=Markup+(business))) + +(www.google.com/search?q=Markup+(business)) + +(www.google.com/search?q=Markup+(business) + +www.google.com/search?q=(business))+ok + +www.google.com/search?q=commonmark&hl=en + +www.google.com/search?q=commonmark&hl; + +www.commonmark.org/he<lp +. +<document source="<string>"> + <paragraph> + <reference refuri="http://www.commonmark.org"> + www.commonmark.org + <paragraph> + Visit + <reference refuri="http://www.commonmark.org/help"> + www.commonmark.org/help + for more information. + <paragraph> + <reference refuri="http://www.google.com/search?q=Markup+(business)"> + www.google.com/search?q=Markup+(business) + <paragraph> + <reference refuri="http://www.google.com/search?q=Markup+(business)"> + www.google.com/search?q=Markup+(business) + )) + <paragraph> + ( + <reference refuri="http://www.google.com/search?q=Markup+(business)"> + www.google.com/search?q=Markup+(business) + ) + <paragraph> + ( + <reference refuri="http://www.google.com/search?q=Markup+(business)"> + www.google.com/search?q=Markup+(business) + <paragraph> + <reference refuri="http://www.google.com/search?q=(business)"> + www.google.com/search?q=(business) + )+ok + <paragraph> + <reference refuri="http://www.google.com/search?q=commonmark&hl=en"> + www.google.com/search?q=commonmark&hl=en + <paragraph> + <reference refuri="http://www.google.com/search?q=commonmark&hl"> + www.google.com/search?q=commonmark&hl + ; + <paragraph> + <reference refuri="http://www.commonmark.org/he"> + www.commonmark.org/he + <lp +. + +[attrs_image] --myst-enable-extensions=attrs_image +. +![a](b){#id .a width="100%" align=center height=20px}{.b} +. +<document source="<string>"> + <paragraph> + <image align="center" alt="a" classes="a b" height="20px" ids="id" names="id" uri="b" width="100%"> +. + +[attrs_image_warnings] --myst-enable-extensions=attrs_image +. +![a](b){width=1x height=2x align=other } +. +<document source="<string>"> + <paragraph> + <system_message level="2" line="1" source="<string>" type="WARNING"> + <paragraph> + Invalid width value for image: '1x' [myst.image] + <system_message level="2" line="1" source="<string>" type="WARNING"> + <paragraph> + Invalid height value for image: '2x' [myst.image] + <system_message level="2" line="1" source="<string>" type="WARNING"> + <paragraph> + Invalid align value for image: 'other' [myst.image] + <image alt="a" uri="b"> + +<string>:1: (WARNING/2) Invalid width value for image: '1x' [myst.image] +<string>:1: (WARNING/2) Invalid height value for image: '2x' [myst.image] +<string>:1: (WARNING/2) Invalid align value for image: 'other' [myst.image] +. diff --git a/tests/test_renderers/fixtures/reporter_warnings.md b/tests/test_renderers/fixtures/reporter_warnings.md new file mode 100644 index 0000000..e9998b9 --- /dev/null +++ b/tests/test_renderers/fixtures/reporter_warnings.md @@ -0,0 +1,180 @@ +Duplicate Reference definitions: +. +[a]: b +[a]: c +. +<string>:2: (WARNING/2) Duplicate reference definition: A [myst.ref] +. + +Missing Reference: +. +[a](b) +. +<string>:1: (ERROR/3) Unknown target name: "b". +. + +Unknown role: +. +abc + +{xyz}`a` +. +<string>:3: (ERROR/3) Unknown interpreted text role "xyz". +. + +Unknown directive: +. + +```{xyz} +``` +. +<string>:2: (ERROR/3) Unknown directive type "xyz". +. + +Bad Front Matter: +. +--- +a: { +--- +. +<string>:1: (WARNING/2) Malformed YAML [myst.topmatter] +. + +Unknown Front Matter myst key: +. +--- +myst: + unknown: true +--- +. +<string>:1: (WARNING/2) Unknown field: unknown [myst.topmatter] +. + +Invalid Front Matter myst key: +. +--- +myst: + title_to_header: 1 + url_schemes: [1] + substitutions: + key: [] +--- +. +<string>:1: (WARNING/2) 'title_to_header' must be of type <class 'bool'> (got 1 that is a <class 'int'>). [myst.topmatter] +<string>:1: (WARNING/2) 'url_schemes[0]' must be of type <class 'str'> (got 1 that is a <class 'int'>). [myst.topmatter] +<string>:1: (WARNING/2) 'substitutions['key']' must be of type (<class 'str'>, <class 'int'>, <class 'float'>) (got [] that is a <class 'list'>). [myst.topmatter] +. + +Bad HTML Meta +. +--- +myst: + html_meta: + name noequals: value + +--- +. +<string>:: (ERROR/3) Error parsing meta tag attribute "name noequals": no '=' in noequals. +. + +Directive parsing error: +. + +```{class} +``` +. +<string>:2: (ERROR/3) Directive 'class': 1 argument(s) required, 0 supplied +. + +Directive run error: +. + +```{date} +x +``` +. +<string>:2: (ERROR/3) Invalid context: the "date" directive can only be used within a substitution definition. +. + +Do not start headings at H1: +. +## title 1 +. +<string>:1: (WARNING/2) Document headings start at H2, not H1 [myst.header] +. + +Non-consecutive headings: +. +# title 1 +### title 3 +. +<string>:2: (WARNING/2) Non-consecutive header level increase; H1 to H3 [myst.header] +. + +multiple footnote definitions +. +[^a] + +[^a]: definition 1 +[^a]: definition 2 +. +<string>:: (WARNING/2) Multiple footnote definitions found for label: 'a' [myst.footnote] +. + +Warnings in eval-rst +. +some external + +lines + +```{eval-rst} +some internal + +lines + +.. unknown:: some text + +:unknown:`a` +``` +. +<string>:10: (ERROR/3) Unknown directive type "unknown". + +.. unknown:: some text + +<string>:12: (ERROR/3) Unknown interpreted text role "unknown". +. + +bad-option-value +. +```{note} +:class: [1] +``` +. +<string>:1: (ERROR/3) Directive 'note': option "class" value not string (enclose with ""): [1] + +:class: [1] + +. + +header nested in admonition +. +```{note} +# Header +``` +. +<string>:2: (WARNING/2) Disallowed nested header found, converting to rubric [myst.nested_header] +. + +nested parse warning +. +Paragraph + +```{note} +:class: abc +:name: xyz + +{unknown}`a` +``` +. +<string>:7: (ERROR/3) Unknown interpreted text role "unknown". +. diff --git a/tests/test_renderers/fixtures/sphinx_directives.md b/tests/test_renderers/fixtures/sphinx_directives.md new file mode 100644 index 0000000..2b92457 --- /dev/null +++ b/tests/test_renderers/fixtures/sphinx_directives.md @@ -0,0 +1,441 @@ +default-role (`sphinx.directives.DefaultRole`): +. +```{default-role} +``` +. +<document source="<src>/index.md"> +. + +default-domain (`sphinx.directives.DefaultDomain`): +. +```{default-domain} mydomain +``` +. +<document source="<src>/index.md"> +. + +object (`sphinx.directives.ObjectDescription`): +. +```{object} something +``` +. +<document source="<src>/index.md"> + <index entries=""> + <desc classes="object" desctype="object" domain="" noindex="False" objtype="object"> + <desc_signature classes="sig sig-object"> + <desc_name classes="sig-name descname" xml:space="preserve"> + something + <desc_content> +. + +highlight (`sphinx.directives.code.Highlight`): +. +```{highlight} something +``` +. +<document source="<src>/index.md"> + <highlightlang force="False" lang="something" linenothreshold="9223372036854775807"> +. + +code-block (`sphinx.directives.code.CodeBlock`): +. +```{code-block} +:dedent: + + a=1 +``` +. +<document source="<src>/index.md"> + <literal_block force="False" highlight_args="{}" language="default" xml:space="preserve"> + a=1 +. + +sourcecode (`sphinx.directives.code.CodeBlock`): +. +```{sourcecode} +``` +. +<document source="<src>/index.md"> + <literal_block force="False" highlight_args="{}" language="default" xml:space="preserve"> +. + +SKIP: Tested in sphinx builds +. +```{literalinclude} /path/to/file +``` +. +<document source="notset"> + <system_message level="2" line="1" source="notset" type="WARNING"> + <paragraph> + Include file '/srcdir/path/to/file' not found or reading it failed +. + +toctree (`sphinx.directives.other.TocTree`): +. +```{toctree} +``` +. +<document source="<src>/index.md"> + <compound classes="toctree-wrapper"> + <toctree caption="True" entries="" glob="False" hidden="False" includefiles="" includehidden="False" maxdepth="-1" numbered="0" parent="index" titlesonly="False"> +. + +sectionauthor (`sphinx.directives.other.Author`): +. +```{sectionauthor} bob geldof +``` +. +<document source="<src>/index.md"> +. + +moduleauthor (`sphinx.directives.other.Author`): +. +```{moduleauthor} ringo starr +``` +. +<document source="<src>/index.md"> +. + +codeauthor (`sphinx.directives.other.Author`): +. +```{codeauthor} paul mcartney +``` +. +<document source="<src>/index.md"> +. + +index (`sphinx.directives.other.Index`): +. +```{index} something +``` +. +<document source="<src>/index.md"> + <index entries="('single',\ 'something',\ 'index-0',\ '',\ None)" inline="False"> + <target ids="index-0"> +. + +seealso (`sphinx.directives.other.SeeAlso`): +. +```{seealso} + +a +``` +. +<document source="<src>/index.md"> + <seealso> + <paragraph> + a +. + +tabularcolumns (`sphinx.directives.other.TabularColumns`): +. +```{tabularcolumns} spec +``` +. +<document source="<src>/index.md"> + <tabular_col_spec spec="spec"> +. + +centered (`sphinx.directives.other.Centered`): +. +```{centered} text +``` +. +<document source="<src>/index.md"> + <centered> + text +. + +acks (`sphinx.directives.other.Acks`): +. +```{acks} + +- name +``` +. +<document source="<src>/index.md"> + <acks> + <bullet_list bullet="-"> + <list_item> + <paragraph> + name +. + +hlist (`sphinx.directives.other.HList`): +. +```{hlist} + +- item +``` +. +<document source="<src>/index.md"> + <hlist ncolumns="2"> + <hlistcol> + <bullet_list> + <list_item> + <paragraph> + item + <hlistcol> + <bullet_list> +. + +only (`sphinx.directives.other.Only`): +. +```{only} expr +``` +. +<document source="<src>/index.md"> + <only expr="expr"> +. + +SKIP: Tested in sphinx builds +. +```{include} path/to/include +``` +. +<document source="notset"> +. + +figure (`sphinx.directives.patches.Figure`): +. +```{figure} path/to/figure + +*caption* + +legend +``` +. +<document source="<src>/index.md"> + <figure> + <image uri="path/to/figure"> + <caption> + <emphasis> + caption + <legend> + <paragraph> + legend +. + +SKIP: MockingError: MockState has not yet implemented attribute 'nested_list_parse' +. +```{meta} +foo +``` +. +<document source="notset"> +. + +table (`sphinx.directives.patches.RSTTable`): +. +```{table} *title* +:name: name + +| a | b | +|---|---| +| 1 | 2 | +``` +. +<document source="<src>/index.md"> + <table classes="colwidths-auto" ids="name" names="name"> + <title> + <emphasis> + title + <tgroup cols="2"> + <colspec colwidth="50"> + <colspec colwidth="50"> + <thead> + <row> + <entry> + <paragraph> + a + <entry> + <paragraph> + b + <tbody> + <row> + <entry> + <paragraph> + 1 + <entry> + <paragraph> + 2 +. + +csv-table (`sphinx.directives.patches.CSVTable`): +. +```{csv-table} + +"Albatross", 2.99, "On a stick!" +``` +. +<document source="<src>/index.md"> + <table> + <tgroup cols="3"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <tbody> + <row> + <entry> + <paragraph> + Albatross + <entry> + <paragraph> + 2.99 + <entry> + <paragraph> + On a stick! +. + +list-table (`sphinx.directives.patches.ListTable`): +. +```{list-table} + +* - item +``` +. +<document source="<src>/index.md"> + <table> + <tgroup cols="1"> + <colspec colwidth="100"> + <tbody> + <row> + <entry> + <paragraph> + item +. + +code (`sphinx.directives.patches.Code`): +. +```{code} python + +a +``` +. +<document source="<src>/index.md"> + <literal_block force="False" highlight_args="{}" language="python" xml:space="preserve"> + a +. + +math (`sphinx.directives.patches.MathDirective`): +. +```{math} +``` +. +<document source="<src>/index.md"> + <math_block docname="index" label="True" nowrap="False" number="True" xml:space="preserve"> +. + +deprecated (`sphinx.domains.changeset.VersionChange`): +. +```{deprecated} 0.3 +``` +. +<document source="<src>/index.md"> + <versionmodified type="deprecated" version="0.3"> + <paragraph translatable="False"> + <inline classes="versionmodified deprecated"> + Deprecated since version 0.3. +. + +versionadded (`sphinx.domains.changeset.VersionChange`): +. +```{versionadded} 0.2 +``` +. +<document source="<src>/index.md"> + <versionmodified type="versionadded" version="0.2"> + <paragraph translatable="False"> + <inline classes="versionmodified added"> + New in version 0.2. +. + +versionchanged (`sphinx.domains.changeset.VersionChange`): +. +```{versionchanged} 0.1 +``` +. +<document source="<src>/index.md"> + <versionmodified type="versionchanged" version="0.1"> + <paragraph translatable="False"> + <inline classes="versionmodified changed"> + Changed in version 0.1. +. + +glossary (`sphinx.domains.std.Glossary`): +. +```{glossary} + +term 1 : A +term 2 : B + Definition of both terms. +``` +. +<document source="<src>/index.md"> + <glossary> + <definition_list classes="glossary"> + <definition_list_item> + <term ids="term-term-1"> + term 1 + <index entries="('single',\ 'term\ 1',\ 'term-term-1',\ 'main',\ 'A')"> + <term ids="term-term-2"> + term 2 + <index entries="('single',\ 'term\ 2',\ 'term-term-2',\ 'main',\ 'B')"> + <definition> + <paragraph> + Definition of both terms. +. + +SPHINX4-SKIP productionlist (`sphinx.domains.std.ProductionList`): +. +```{productionlist} try_stmt: try1_stmt | try2_stmt +``` +. +<document source="<src>/index.md"> + <productionlist> + <production ids="grammar-token-try_stmt" tokenname="try_stmt" xml:space="preserve"> + try1_stmt | try2_stmt +. + +cmdoption (`sphinx.domains.std.Cmdoption`): +. +```{cmdoption} a +``` +. +<document source="<src>/index.md"> + <index entries="('pair',\ 'command\ line\ option;\ a',\ 'cmdoption-arg-a',\ '',\ None)"> + <desc classes="std cmdoption" desctype="cmdoption" domain="std" noindex="False" objtype="cmdoption"> + <desc_signature allnames="a" classes="sig sig-object" ids="cmdoption-arg-a"> + <desc_name classes="sig-name descname" xml:space="preserve"> + a + <desc_addname classes="sig-prename descclassname" xml:space="preserve"> + <desc_content> +. + +rst:directive (`sphinx.domains.rst.ReSTDirective`): +. +```{rst:directive} a +``` +. +<document source="<src>/index.md"> + <index entries="('single',\ 'a\ (directive)',\ 'directive-a',\ '',\ None)"> + <desc classes="rst directive" desctype="directive" domain="rst" noindex="False" objtype="directive"> + <desc_signature classes="sig sig-object" ids="directive-a"> + <desc_name classes="sig-name descname" xml:space="preserve"> + .. a:: + <desc_content> +. + +SPHINX4-SKIP rst:directive:option (`sphinx.domains.rst.ReSTDirectiveOption`): +. +```{rst:directive:option} a +``` +. +<document source="<src>/index.md"> + <index entries="('single',\ ':a:\ (directive\ option)',\ 'directive-option-a',\ '',\ 'A')"> + <desc classes="rst directive:option" desctype="directive:option" domain="rst" noindex="False" objtype="directive:option"> + <desc_signature classes="sig sig-object" ids="directive-option-a"> + <desc_name classes="sig-name descname" xml:space="preserve"> + :a: + <desc_content> +. diff --git a/tests/test_renderers/fixtures/sphinx_roles.md b/tests/test_renderers/fixtures/sphinx_roles.md new file mode 100644 index 0000000..37683db --- /dev/null +++ b/tests/test_renderers/fixtures/sphinx_roles.md @@ -0,0 +1,632 @@ +c:func (`sphinx.domains.c.CXRefRole`): +. +{c:func}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="c" refexplicit="False" reftarget="a" reftype="func" refwarn="False"> + <literal classes="xref c c-func"> + a() +. + +c:member (`sphinx.domains.c.CObject`): +. +{c:member}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="c" refexplicit="False" reftarget="a" reftype="member" refwarn="False"> + <literal classes="xref c c-member"> + a +. + +c:macro (`sphinx.domains.c.CObject`): +. +{c:macro}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="c" refexplicit="False" reftarget="a" reftype="macro" refwarn="False"> + <literal classes="xref c c-macro"> + a +. + +c:data (`sphinx.domains.c.CXRefRole`): +. +{c:data}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="c" refexplicit="False" reftarget="a" reftype="data" refwarn="False"> + <literal classes="xref c c-data"> + a +. + +c:type (`sphinx.domains.c.CObject`): +. +{c:type}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="c" refexplicit="False" reftarget="a" reftype="type" refwarn="False"> + <literal classes="xref c c-type"> + a +. + +cpp:any (`sphinx.domains.cpp.CPPXRefRole`): +. +{cpp:any}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="any" refwarn="False"> + <literal classes="xref cpp cpp-any"> + a +. + +cpp:class (`sphinx.domains.cpp.CPPClassObject`): +. +{cpp:class}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="class" refwarn="False"> + <literal classes="xref cpp cpp-class"> + a +. + +cpp:struct (`sphinx.domains.cpp.CPPClassObject`): +. +{cpp:struct}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="struct" refwarn="False"> + <literal classes="xref cpp cpp-struct"> + a +. + +cpp:union (`sphinx.domains.cpp.CPPUnionObject`): +. +{cpp:union}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="union" refwarn="False"> + <literal classes="xref cpp cpp-union"> + a +. + +cpp:func (`sphinx.domains.cpp.CPPXRefRole`): +. +{cpp:func}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="func" refwarn="False"> + <literal classes="xref cpp cpp-func"> + a() +. + +cpp:member (`sphinx.domains.cpp.CPPMemberObject`): +. +{cpp:member}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="member" refwarn="False"> + <literal classes="xref cpp cpp-member"> + a +. + +cpp:var (`sphinx.domains.cpp.CPPMemberObject`): +. +{cpp:var}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="var" refwarn="False"> + <literal classes="xref cpp cpp-var"> + a +. + +cpp:type (`sphinx.domains.cpp.CPPTypeObject`): +. +{cpp:type}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="type" refwarn="False"> + <literal classes="xref cpp cpp-type"> + a +. + +cpp:concept (`sphinx.domains.cpp.CPPConceptObject`): +. +{cpp:concept}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="concept" refwarn="False"> + <literal classes="xref cpp cpp-concept"> + a +. + +cpp:enum (`sphinx.domains.cpp.CPPEnumObject`): +. +{cpp:enum}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="enum" refwarn="False"> + <literal classes="xref cpp cpp-enum"> + a +. + +cpp:enumerator (`sphinx.domains.cpp.CPPEnumeratorObject`): +. +{cpp:enumerator}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="enumerator" refwarn="False"> + <literal classes="xref cpp cpp-enumerator"> + a +. + +SKIP cpp:expr (`sphinx.domains.cpp.CPPExprRole`): +. +{cpp:expr}`a` +. +<document source="notset"> + <paragraph> + <desc_inline classes="cpp-expr sig sig-inline cpp"> + <pending_xref classname="True" cpp:parent_key="<sphinx.domains.cpp.LookupKey object at 0x7f948a6a73d0>" modname="True" refdomain="cpp" reftarget="a" reftype="identifier"> + <desc_sig_name classes="n"> + a +. + +SKIP cpp:texpr (`sphinx.domains.cpp.CPPExprRole`): +. +{cpp:texpr}`a` +. +<document source="notset"> + <paragraph> + <desc_inline classes="cpp-texpr sig sig-inline cpp"> + <pending_xref classname="True" cpp:parent_key="<sphinx.domains.cpp.LookupKey object at 0x7fac40b5f950>" modname="True" refdomain="cpp" reftarget="a" reftype="identifier"> + <desc_sig_name classes="n"> + a +. + +js:func (`sphinx.domains.javascript.JSXRefRole`): +. +{js:func}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref js:module="True" js:object="True" refdoc="index" refdomain="js" refexplicit="False" reftarget="a" reftype="func" refwarn="False"> + <literal classes="xref js js-func"> + a() +. + +js:meth (`sphinx.domains.javascript.JSXRefRole`): +. +{js:meth}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref js:module="True" js:object="True" refdoc="index" refdomain="js" refexplicit="False" reftarget="a" reftype="meth" refwarn="False"> + <literal classes="xref js js-meth"> + a() +. + +js:class (`sphinx.domains.javascript.JSConstructor`): +. +{js:class}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref js:module="True" js:object="True" refdoc="index" refdomain="js" refexplicit="False" reftarget="a" reftype="class" refwarn="False"> + <literal classes="xref js js-class"> + a() +. + +js:data (`sphinx.domains.javascript.JSObject`): +. +{js:data}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref js:module="True" js:object="True" refdoc="index" refdomain="js" refexplicit="False" reftarget="a" reftype="data" refwarn="False"> + <literal classes="xref js js-data"> + a +. + +js:attr (`sphinx.domains.javascript.JSXRefRole`): +. +{js:attr}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref js:module="True" js:object="True" refdoc="index" refdomain="js" refexplicit="False" reftarget="a" reftype="attr" refwarn="False"> + <literal classes="xref js js-attr"> + a +. + +js:mod (`sphinx.domains.javascript.JSXRefRole`): +. +{js:mod}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref js:module="True" js:object="True" refdoc="index" refdomain="js" refexplicit="False" reftarget="a" reftype="mod" refwarn="False"> + <literal classes="xref js js-mod"> + a +. + +eq (`sphinx.domains.math.MathReferenceRole`): +. +{eq}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="math" refexplicit="False" reftarget="a" reftype="eq" refwarn="True"> + <literal classes="xref eq"> + a +. + +math:numref (`sphinx.domains.math.MathReferenceRole`): +. +{math:numref}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="math" refexplicit="False" reftarget="a" reftype="numref" refwarn="False"> + <literal classes="xref math math-numref"> + a +. + +py:data (`sphinx.domains.python.PyVariable`): +. +{py:data}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="a" reftype="data" refwarn="False"> + <literal classes="xref py py-data"> + a +. + +py:exc (`sphinx.domains.python.PyXRefRole`): +. +{py:exc}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="a" reftype="exc" refwarn="False"> + <literal classes="xref py py-exc"> + a +. + +py:func (`sphinx.domains.python.PyXRefRole`): +. +{py:func}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="a" reftype="func" refwarn="False"> + <literal classes="xref py py-func"> + a() +. + +py:class (`sphinx.domains.python.PyClasslike`): +. +{py:class}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="a" reftype="class" refwarn="False"> + <literal classes="xref py py-class"> + a +. + +py:const (`sphinx.domains.python.PyXRefRole`): +. +{py:const}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="a" reftype="const" refwarn="False"> + <literal classes="xref py py-const"> + a +. + +py:attr (`sphinx.domains.python.PyXRefRole`): +. +{py:attr}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="a" reftype="attr" refwarn="False"> + <literal classes="xref py py-attr"> + a +. + +py:meth (`sphinx.domains.python.PyXRefRole`): +. +{py:meth}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="a" reftype="meth" refwarn="False"> + <literal classes="xref py py-meth"> + a() +. + +py:mod (`sphinx.domains.python.PyXRefRole`): +. +{py:mod}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="a" reftype="mod" refwarn="False"> + <literal classes="xref py py-mod"> + a +. + +py:obj (`sphinx.domains.python.PyXRefRole`): +. +{py:obj}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="a" reftype="obj" refwarn="False"> + <literal classes="xref py py-obj"> + a +. + +rst:role (`sphinx.domains.rst.ReSTRole`): +. +{rst:role}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="rst" refexplicit="False" reftarget="a" reftype="role" refwarn="False"> + <literal classes="xref rst rst-role"> + a +. + +program (`sphinx.domains.std.Program`): +. +{program}`a` +. +<document source="<src>/index.md"> + <paragraph> + <literal_strong classes="program"> + a +. + +option (`sphinx.domains.std.Cmdoption`): +. +{option}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="std" refexplicit="False" reftarget="a" reftype="option" refwarn="True" std:program="True"> + <literal classes="xref std std-option"> + a +. + +envvar (`sphinx.domains.std.EnvVarXRefRole`): +. +{envvar}`a` +. +<document source="<src>/index.md"> + <paragraph> + <index entries="('single',\ 'a',\ 'index-0',\ '',\ None) ('single',\ 'environment\ variable;\ a',\ 'index-0',\ '',\ None)"> + <target ids="index-0"> + <pending_xref refdoc="index" refdomain="std" refexplicit="False" reftarget="a" reftype="envvar" refwarn="False"> + <literal classes="xref std std-envvar"> + a +. + +index (`sphinx.roles.Index`): +. +{index}`a` +. +<document source="<src>/index.md"> + <paragraph> + <index entries="('single',\ 'a',\ 'index-0',\ '',\ None)"> + <target ids="index-0"> + a +. + +download (`sphinx.roles.XRefRole`): +. +{download}`a` +. +<document source="<src>/index.md"> + <paragraph> + <download_reference refdoc="index" refdomain="" refexplicit="False" reftarget="a" reftype="download" refwarn="False"> + <literal classes="xref download"> + a +. + +any (`sphinx.roles.AnyXRefRole`): +. +{any}`a <alt text>` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="" refexplicit="True" reftarget="alt text" reftype="any" refwarn="True"> + <literal classes="xref any"> + a +. + +pep (`sphinx.roles.PEP`): +. +{pep}`1` +. +<document source="<src>/index.md"> + <paragraph> + <index entries="('single',\ 'Python\ Enhancement\ Proposals;\ PEP\ 1',\ 'index-0',\ '',\ None)"> + <target ids="index-0"> + <reference classes="pep" internal="False" refuri="https://peps.python.org/pep-0001/"> + <strong> + PEP 1 +. + +rfc (`sphinx.roles.RFC`): +. +{rfc}`1` +. +<document source="<src>/index.md"> + <paragraph> + <index entries="('single',\ 'RFC;\ RFC\ 1',\ 'index-0',\ '',\ None)"> + <target ids="index-0"> + <reference classes="rfc" internal="False" refuri="https://datatracker.ietf.org/doc/html/rfc1.html"> + <strong> + RFC 1 +. + +guilabel (`sphinx.roles.GUILabel`): +. +{guilabel}`a` +. +<document source="<src>/index.md"> + <paragraph> + <inline classes="guilabel" rawtext=":guilabel:`a`"> + a +. + +menuselection (`sphinx.roles.MenuSelection`): +. +{menuselection}`a` +. +<document source="<src>/index.md"> + <paragraph> + <inline classes="menuselection" rawtext=":menuselection:`a`"> + a +. + +file (`sphinx.roles.EmphasizedLiteral`): +. +{file}`a` +. +<document source="<src>/index.md"> + <paragraph> + <literal classes="file" role="file"> + a +. + +samp (`sphinx.roles.EmphasizedLiteral`): +. +{samp}`a` +. +<document source="<src>/index.md"> + <paragraph> + <literal classes="samp" role="samp"> + a +. + +SKIP: Non-deterministic output +. +{abbr}`a` +. +<document source="notset"> + <paragraph> + <abbreviation class="<function class_option at 0x1079fb830>> + a +. + +rst:dir (`sphinx.roles.XRefRole`): +. +{rst:dir}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="rst" refexplicit="False" reftarget="a" reftype="dir" refwarn="False"> + <literal classes="xref rst rst-dir"> + a +. + +token (`sphinx.roles.XRefRole`): +. +{token}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="std" refexplicit="False" reftarget="a" reftype="token" refwarn="False"> + <literal classes="xref std std-token"> + a +. + +term (`sphinx.roles.XRefRole`): +. +{term}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="std" refexplicit="False" reftarget="a" reftype="term" refwarn="True"> + <inline classes="xref std std-term"> + a +. + +ref (`sphinx.roles.XRefRole`): +. +{ref}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="std" refexplicit="False" reftarget="a" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + a +. + +ref with line breaks (`sphinx.roles.XRefRole`): +. +{ref}`some +text +<and +a +custom reference>` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="std" refexplicit="True" reftarget="and a custom reference" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + some text +. + +numref (`sphinx.roles.XRefRole`): +. +{numref}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="std" refexplicit="False" reftarget="a" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + a +. + +keyword (`sphinx.roles.XRefRole`): +. +{keyword}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="std" refexplicit="False" reftarget="a" reftype="keyword" refwarn="True"> + <literal classes="xref std std-keyword"> + a +. + +doc (`sphinx.roles.XRefRole`): +. +{doc}`this lecture <heavy_tails>` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="std" refexplicit="True" reftarget="heavy_tails" reftype="doc" refwarn="True"> + <inline classes="xref std std-doc"> + this lecture +. diff --git a/tests/test_renderers/fixtures/sphinx_syntax_elements.md b/tests/test_renderers/fixtures/sphinx_syntax_elements.md new file mode 100644 index 0000000..1ac085c --- /dev/null +++ b/tests/test_renderers/fixtures/sphinx_syntax_elements.md @@ -0,0 +1,800 @@ +Raw +. +foo +. +<document source="<src>/index.md"> + <paragraph> + foo +. + +Hard-break +. +foo\ +bar +. +<document source="<src>/index.md"> + <paragraph> + foo + <raw format="html" xml:space="preserve"> + <br /> + <raw format="latex" xml:space="preserve"> + \\ + bar +. + +Strong: +. +**foo** +. +<document source="<src>/index.md"> + <paragraph> + <strong> + foo +. + +Emphasis +. +*foo* +. +<document source="<src>/index.md"> + <paragraph> + <emphasis> + foo +. + +Escaped Emphasis: +. +\*foo* +. +<document source="<src>/index.md"> + <paragraph> + *foo* +. + +Mixed Inline +. +a *b* **c** `abc` \\* +. +<document source="<src>/index.md"> + <paragraph> + a + <emphasis> + b + + <strong> + c + + <literal> + abc + \* +. + +Inline Code: +. +`foo` +. +<document source="<src>/index.md"> + <paragraph> + <literal> + foo +. + +Heading: +. +# foo +. +<document source="<src>/index.md"> + <section ids="foo" names="foo"> + <title> + foo +. + +Heading Levels: +. +# a +## b +### c +# d +. +<document source="<src>/index.md"> + <section ids="a" names="a"> + <title> + a + <section ids="b" names="b"> + <title> + b + <section ids="c" names="c"> + <title> + c + <section ids="d" names="d"> + <title> + d +. + +Block Code: +. + foo +. +<document source="<src>/index.md"> + <literal_block language="none" xml:space="preserve"> + foo +. + +Fenced Code: +. +```sh +foo +``` +. +<document source="<src>/index.md"> + <literal_block language="sh" xml:space="preserve"> + foo +. + +Fenced Code no language: +. +``` +foo +``` +. +<document source="<src>/index.md"> + <literal_block language="default" xml:space="preserve"> + foo +. + +Fenced Code no language with trailing whitespace: +. +``` +foo +``` +. +<document source="<src>/index.md"> + <literal_block language="default" xml:space="preserve"> + foo +. + +Image empty: +. +![]() +. +<document source="<src>/index.md"> + <paragraph> + <image alt="" uri=""> +. + +Image with alt and title: +. +![alt](src "title") +. +<document source="<src>/index.md"> + <paragraph> + <image alt="alt" title="title" uri="src"> +. + +Image with escapable html: +. +![alt](http://www.google<>.com) +. +<document source="<src>/index.md"> + <paragraph> + <image alt="alt" uri="http://www.google%3C%3E.com"> +. + +Block Quote: +. +> *foo* +. +<document source="<src>/index.md"> + <block_quote> + <paragraph> + <emphasis> + foo +. + +Bullet List: +. +- *foo* +* bar +. +<document source="<src>/index.md"> + <bullet_list bullet="-"> + <list_item> + <paragraph> + <emphasis> + foo + <bullet_list bullet="*"> + <list_item> + <paragraph> + bar +. + +Nested Bullets +. +- a + - b + - c + - d +. +<document source="<src>/index.md"> + <bullet_list bullet="-"> + <list_item> + <paragraph> + a + <bullet_list bullet="-"> + <list_item> + <paragraph> + b + <bullet_list bullet="-"> + <list_item> + <paragraph> + c + <list_item> + <paragraph> + d +. + +Enumerated List: +. +1. *foo* + +1) bar + +para + +10. starting +11. enumerator +. +<document source="<src>/index.md"> + <enumerated_list enumtype="arabic" prefix="" suffix="."> + <list_item> + <paragraph> + <emphasis> + foo + <enumerated_list enumtype="arabic" prefix="" suffix=")"> + <list_item> + <paragraph> + bar + <paragraph> + para + <enumerated_list enumtype="arabic" prefix="" start="10" suffix="."> + <list_item> + <paragraph> + starting + <list_item> + <paragraph> + enumerator +. + +Nested Enumrated List: +. +1. a +2. b + 1. c +. +<document source="<src>/index.md"> + <enumerated_list enumtype="arabic" prefix="" suffix="."> + <list_item> + <paragraph> + a + <list_item> + <paragraph> + b + <enumerated_list enumtype="arabic" prefix="" suffix="."> + <list_item> + <paragraph> + c +. + +Sphinx Role containing backtick: +. +{code}``a=1{`}`` +. +<document source="<src>/index.md"> + <paragraph> + <literal classes="code"> + a=1{`} +. + +Target: +. +(target)= +. +<document source="<src>/index.md"> + <target ids="target" names="target"> +. + +Target with whitespace: +. +(target with space)= +. +<document source="<src>/index.md"> + <target ids="target-with-space" names="target\ with\ space"> +. + +Referencing: +. +(target)= + +Title +===== + +[alt1](target) + +[](target2) + +[alt2](https://www.google.com) + +[alt3](#target3) +. +<document source="<src>/index.md"> + <target ids="target" names="target"> + <section ids="title" names="title"> + <title> + Title + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="target" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + alt1 + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="target2" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + <paragraph> + <reference refuri="https://www.google.com"> + alt2 + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="#target3" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + alt3 +. + +Comments: +. +line 1 +% a comment +line 2 +. +<document source="<src>/index.md"> + <paragraph> + line 1 + <comment xml:space="preserve"> + a comment + <paragraph> + line 2 +. + +Block Break: +. ++++ string +. +<document source="<src>/index.md"> + <comment classes="block_break" xml:space="preserve"> + string +. + +Link Reference: +. +[name][key] + +[key]: https://www.google.com "a title" +. +<document source="<src>/index.md"> + <paragraph> + <reference refuri="https://www.google.com" title="a title"> + name +. + +Link Reference short version: +. +[name] + +[name]: https://www.google.com "a title" +. +<document source="<src>/index.md"> + <paragraph> + <reference refuri="https://www.google.com" title="a title"> + name +. + +Block Quotes: +. +```{epigraph} +a b*c* + +-- a**b** +``` +. +<document source="<src>/index.md"> + <block_quote classes="epigraph"> + <paragraph> + a b + <emphasis> + c + <attribution> + a + <strong> + b +. + +Link Definition in directive: +. +```{note} +[a] +``` + +[a]: link +. +<document source="<src>/index.md"> + <note> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="link" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + a +. + +Link Definition in nested directives: +. +```{note} +[ref1]: link +``` + +```{note} +[ref1] +[ref2] +``` + +```{note} +[ref2]: link +``` +. +<document source="<src>/index.md"> + <note> + <note> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="link" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + ref1 + + [ref2] + <note> +. + +Footnotes: +. +[^a] + +[^a]: footnote*text* +. +<document source="<src>/index.md"> + <paragraph> + <footnote_reference auto="1" ids="id1" refname="a"> + <transition classes="footnotes"> + <footnote auto="1" ids="a" names="a"> + <paragraph> + footnote + <emphasis> + text +. + +Footnotes nested blocks: +. +[^a] + +[^a]: footnote*text* + + abc +xyz + + > a + + - b + + c + +finish +. +<document source="<src>/index.md"> + <paragraph> + <footnote_reference auto="1" ids="id1" refname="a"> + <paragraph> + finish + <transition classes="footnotes"> + <footnote auto="1" ids="a" names="a"> + <paragraph> + footnote + <emphasis> + text + <paragraph> + abc + + xyz + <block_quote> + <paragraph> + a + <bullet_list bullet="-"> + <list_item> + <paragraph> + b + <paragraph> + c +. + +Front Matter: +. +--- +a: 1 +b: foo +c: + d: 2 +--- +. +<document source="<src>/index.md"> + <field_list> + <field> + <field_name> + a + <field_body> + <paragraph> + <literal> + 1 + <field> + <field_name> + b + <field_body> + <paragraph> + <literal> + foo + <field> + <field_name> + c + <field_body> + <paragraph> + <literal> + {"d": 2} +. + +Front Matter Biblio: +. +--- +author: Chris Sewell +authors: Chris Sewell, Chris Hodgraf +organization: EPFL +address: | + 1 Cedar Park Close + Thundersley + Essex +contact: <https://example.com> +version: 1.0 +revision: 1.1 +status: good +date: 2/12/1985 +copyright: MIT +dedication: | + To my *homies* +abstract: + Something something **dark** side +other: Something else +--- +. +<document source="<src>/index.md"> + <field_list> + <field> + <field_name> + author + <field_body> + <paragraph> + Chris Sewell + <field> + <field_name> + authors + <field_body> + <paragraph> + Chris Sewell, Chris Hodgraf + <field> + <field_name> + organization + <field_body> + <paragraph> + EPFL + <field> + <field_name> + address + <field_body> + <paragraph> + 1 Cedar Park Close + + Thundersley + + Essex + + <field> + <field_name> + contact + <field_body> + <paragraph> + <reference refuri="https://example.com"> + https://example.com + <field> + <field_name> + version + <field_body> + <paragraph> + 1.0 + <field> + <field_name> + revision + <field_body> + <paragraph> + 1.1 + <field> + <field_name> + status + <field_body> + <paragraph> + good + <field> + <field_name> + date + <field_body> + <paragraph> + 2/12/1985 + <field> + <field_name> + copyright + <field_body> + <paragraph> + MIT + <field> + <field_name> + dedication + <field_body> + <paragraph> + To my + <emphasis> + homies + + <field> + <field_name> + abstract + <field_body> + <paragraph> + Something something + <strong> + dark + side + <field> + <field_name> + other + <field_body> + <paragraph> + <literal> + Something else +. + +Front Matter Bad Yaml: +. +--- +a: { +--- +. +<document source="<src>/index.md"> + <system_message level="2" line="1" source="<src>/index.md" type="WARNING"> + <paragraph> + Malformed YAML [myst.topmatter] +. + +Front Matter HTML Meta +. +--- +myst: + html_meta: + keywords: Sphinx, documentation, builder + description lang=en: An amusing story + description lang=fr: Un histoire amusant + http-equiv=Content-Type: text/html; charset=ISO-8859-1 +--- +. +<document source="<src>/index.md"> + <pending> + .. internal attributes: + .transform: docutils.transforms.components.Filter + .details: + component: 'writer' + format: 'html' + nodes: + <meta content="Sphinx, documentation, builder" name="keywords"> + <pending> + .. internal attributes: + .transform: docutils.transforms.components.Filter + .details: + component: 'writer' + format: 'html' + nodes: + <meta content="An amusing story" lang="en" name="description"> + <pending> + .. internal attributes: + .transform: docutils.transforms.components.Filter + .details: + component: 'writer' + format: 'html' + nodes: + <meta content="Un histoire amusant" lang="fr" name="description"> + <pending> + .. internal attributes: + .transform: docutils.transforms.components.Filter + .details: + component: 'writer' + format: 'html' + nodes: + <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> +. + +Full Test: +. +--- +a: 1 +--- + +(target)= +# header 1 +## sub header 1 + +a *b* **c** `abc` + +## sub header 2 + +x y [a](http://www.xyz.com) z + +--- + +# header 2 + +```::python {a=1} +a = 1 +``` + +[](target) +. +<document source="<src>/index.md"> + <field_list> + <field> + <field_name> + a + <field_body> + <paragraph> + <literal> + 1 + <target ids="target" names="target"> + <section ids="header-1" names="header\ 1"> + <title> + header 1 + <section ids="sub-header-1" names="sub\ header\ 1"> + <title> + sub header 1 + <paragraph> + a + <emphasis> + b + + <strong> + c + + <literal> + abc + <section ids="sub-header-2" names="sub\ header\ 2"> + <title> + sub header 2 + <paragraph> + x y + <reference refuri="http://www.xyz.com"> + a + z + <transition> + <section ids="header-2" names="header\ 2"> + <title> + header 2 + <literal_block language="::python" xml:space="preserve"> + a = 1 + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="target" reftype="myst" refwarn="True"> + <inline classes="xref myst"> +. diff --git a/tests/test_renderers/fixtures/tables.md b/tests/test_renderers/fixtures/tables.md new file mode 100644 index 0000000..b478b92 --- /dev/null +++ b/tests/test_renderers/fixtures/tables.md @@ -0,0 +1,148 @@ +Simple: +. +a|b +-|- +1|2 +. +<document source="<src>/index.md"> + <table classes="colwidths-auto"> + <tgroup cols="2"> + <colspec colwidth="50"> + <colspec colwidth="50"> + <thead> + <row> + <entry> + <paragraph> + a + <entry> + <paragraph> + b + <tbody> + <row> + <entry> + <paragraph> + 1 + <entry> + <paragraph> + 2 +. + +Header only: +. +| abc | def | +| --- | --- | +. +<document source="<src>/index.md"> + <table classes="colwidths-auto"> + <tgroup cols="2"> + <colspec colwidth="50"> + <colspec colwidth="50"> + <thead> + <row> + <entry> + <paragraph> + abc + <entry> + <paragraph> + def +. + +Aligned: +. +a | b | c +:-|:-:| -: +1 | 2 | 3 +. +<document source="<src>/index.md"> + <table classes="colwidths-auto"> + <tgroup cols="3"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <thead> + <row> + <entry classes="text-left"> + <paragraph> + a + <entry classes="text-center"> + <paragraph> + b + <entry classes="text-right"> + <paragraph> + c + <tbody> + <row> + <entry classes="text-left"> + <paragraph> + 1 + <entry classes="text-center"> + <paragraph> + 2 + <entry classes="text-right"> + <paragraph> + 3 +. + +Nested syntax: +. +| *a* | __*b*__ | +| --- | -------- | +|c | {sub}`x` | +. +<document source="<src>/index.md"> + <table classes="colwidths-auto"> + <tgroup cols="2"> + <colspec colwidth="50"> + <colspec colwidth="50"> + <thead> + <row> + <entry> + <paragraph> + <emphasis> + a + <entry> + <paragraph> + <strong> + <emphasis> + b + <tbody> + <row> + <entry> + <paragraph> + c + <entry> + <paragraph> + <subscript> + x +. + +External links: +. +a|b +|-|-| +[link-a](https://www.google.com/)|[link-b](https://www.python.org/) +. +<document source="<src>/index.md"> + <table classes="colwidths-auto"> + <tgroup cols="2"> + <colspec colwidth="50"> + <colspec colwidth="50"> + <thead> + <row> + <entry> + <paragraph> + a + <entry> + <paragraph> + b + <tbody> + <row> + <entry> + <paragraph> + <reference refuri="https://www.google.com/"> + link-a + <entry> + <paragraph> + <reference refuri="https://www.python.org/"> + link-b +. diff --git a/tests/test_renderers/test_error_reporting.py b/tests/test_renderers/test_error_reporting.py new file mode 100644 index 0000000..2547e85 --- /dev/null +++ b/tests/test_renderers/test_error_reporting.py @@ -0,0 +1,22 @@ +"""Tests of the warning reporting for different MyST Markdown inputs.""" +from io import StringIO +from pathlib import Path + +import pytest +from docutils.core import publish_doctree + +from myst_parser.parsers.docutils_ import Parser + +FIXTURE_PATH = Path(__file__).parent.joinpath("fixtures") + + +@pytest.mark.param_file(FIXTURE_PATH / "reporter_warnings.md") +def test_basic(file_params): + """Test basic functionality.""" + report_stream = StringIO() + publish_doctree( + file_params.content, + parser=Parser(), + settings_overrides={"warning_stream": report_stream}, + ) + file_params.assert_expected(report_stream.getvalue(), rstrip=True) diff --git a/tests/test_renderers/test_fixtures_docutils.py b/tests/test_renderers/test_fixtures_docutils.py new file mode 100644 index 0000000..a1e16e5 --- /dev/null +++ b/tests/test_renderers/test_fixtures_docutils.py @@ -0,0 +1,107 @@ +"""Test fixture files, using the ``DocutilsRenderer``. + +Note, the output AST is before any transforms are applied. +""" +import shlex +from io import StringIO +from pathlib import Path + +import pytest +from docutils.core import Publisher, publish_doctree + +from myst_parser.parsers.docutils_ import Parser + +FIXTURE_PATH = Path(__file__).parent.joinpath("fixtures") + + +@pytest.mark.param_file(FIXTURE_PATH / "docutil_syntax_elements.md") +def test_syntax_elements(file_params, monkeypatch): + """Test conversion of Markdown to docutils AST (before transforms are applied).""" + + def _apply_transforms(self): + pass + + monkeypatch.setattr(Publisher, "apply_transforms", _apply_transforms) + + doctree = publish_doctree( + file_params.content, + source_path="notset", + parser=Parser(), + settings_overrides={"myst_highlight_code_blocks": False}, + ) + + # in docutils 0.18 footnote ids have changed + outcome = doctree.pformat().replace('"footnote-reference-1"', '"id1"') + file_params.assert_expected(outcome, rstrip_lines=True) + + +@pytest.mark.param_file(FIXTURE_PATH / "docutil_roles.md") +def test_docutils_roles(file_params, monkeypatch): + """Test conversion of Markdown to docutils AST (before transforms are applied).""" + + def _apply_transforms(self): + pass + + monkeypatch.setattr(Publisher, "apply_transforms", _apply_transforms) + + doctree = publish_doctree( + file_params.content, + source_path="notset", + parser=Parser(), + ) + + ptree = doctree.pformat() + # docutils >=0.19 changes: + ptree = ptree.replace( + 'refuri="http://tools.ietf.org/html/rfc1.html"', + 'refuri="https://tools.ietf.org/html/rfc1.html"', + ) + ptree = ptree.replace( + 'refuri="http://www.python.org/dev/peps/pep-0000"', + 'refuri="https://peps.python.org/pep-0000"', + ) + + file_params.assert_expected(ptree, rstrip_lines=True) + + +@pytest.mark.param_file(FIXTURE_PATH / "docutil_directives.md") +def test_docutils_directives(file_params, monkeypatch): + """Test output of docutils directives.""" + if "SKIP" in file_params.description: # line-block directive not yet supported + pytest.skip(file_params.description) + + def _apply_transforms(self): + pass + + monkeypatch.setattr(Publisher, "apply_transforms", _apply_transforms) + + doctree = publish_doctree( + file_params.content, + source_path="notset", + parser=Parser(), + ) + + file_params.assert_expected(doctree.pformat(), rstrip_lines=True) + + +@pytest.mark.param_file(FIXTURE_PATH / "docutil_syntax_extensions.txt") +def test_syntax_extensions(file_params): + """The description is parsed as a docutils commandline""" + pub = Publisher(parser=Parser()) + option_parser = pub.setup_option_parser() + try: + settings = option_parser.parse_args( + shlex.split(file_params.description) + ).__dict__ + except Exception as err: + raise AssertionError( + f"Failed to parse commandline: {file_params.description}\n{err}" + ) + report_stream = StringIO() + settings["warning_stream"] = report_stream + doctree = publish_doctree( + file_params.content, + parser=Parser(), + settings_overrides=settings, + ) + file_params.assert_expected(doctree.pformat(), rstrip_lines=True) diff --git a/tests/test_renderers/test_fixtures_sphinx.py b/tests/test_renderers/test_fixtures_sphinx.py new file mode 100644 index 0000000..b8cf549 --- /dev/null +++ b/tests/test_renderers/test_fixtures_sphinx.py @@ -0,0 +1,119 @@ +"""Test fixture files, using the ``SphinxRenderer``. + +Note, the output AST is before any transforms are applied. +""" +from __future__ import annotations + +import re +import sys +from pathlib import Path + +import pytest +from sphinx_pytest.plugin import CreateDoctree + +from myst_parser.mdit_to_docutils.sphinx_ import SphinxRenderer + +FIXTURE_PATH = Path(__file__).parent.joinpath("fixtures") + + +@pytest.mark.param_file(FIXTURE_PATH / "sphinx_syntax_elements.md") +def test_syntax_elements(file_params, sphinx_doctree_no_tr: CreateDoctree): + sphinx_doctree_no_tr.set_conf({"extensions": ["myst_parser"]}) + result = sphinx_doctree_no_tr(file_params.content, "index.md") + file_params.assert_expected(result.pformat("index"), rstrip_lines=True) + + +@pytest.mark.param_file(FIXTURE_PATH / "tables.md") +def test_tables(file_params, sphinx_doctree_no_tr: CreateDoctree): + sphinx_doctree_no_tr.set_conf({"extensions": ["myst_parser"]}) + result = sphinx_doctree_no_tr(file_params.content, "index.md") + file_params.assert_expected(result.pformat("index"), rstrip_lines=True) + + +@pytest.mark.param_file(FIXTURE_PATH / "directive_options.md") +def test_directive_options(file_params, sphinx_doctree_no_tr: CreateDoctree): + sphinx_doctree_no_tr.set_conf({"extensions": ["myst_parser"]}) + result = sphinx_doctree_no_tr(file_params.content, "index.md") + file_params.assert_expected(result.pformat("index"), rstrip_lines=True) + + +@pytest.mark.param_file(FIXTURE_PATH / "sphinx_directives.md") +def test_sphinx_directives(file_params, sphinx_doctree_no_tr: CreateDoctree): + # TODO fix skipped directives + # TODO test domain directives + if file_params.title.startswith("SKIP") or file_params.title.startswith( + "SPHINX4-SKIP" + ): + pytest.skip(file_params.title) + + sphinx_doctree_no_tr.set_conf({"extensions": ["myst_parser"]}) + pformat = sphinx_doctree_no_tr(file_params.content, "index.md").pformat("index") + # see https://github.com/sphinx-doc/sphinx/issues/9827 + pformat = pformat.replace('<glossary sorted="False">', "<glossary>") + # see https://github.com/executablebooks/MyST-Parser/issues/522 + if sys.maxsize == 2147483647: + pformat = pformat.replace('"2147483647"', '"9223372036854775807"') + file_params.assert_expected(pformat, rstrip_lines=True) + + +@pytest.mark.param_file(FIXTURE_PATH / "sphinx_roles.md") +def test_sphinx_roles(file_params, sphinx_doctree_no_tr: CreateDoctree): + if file_params.title.startswith("SKIP"): + pytest.skip(file_params.title) + + sphinx_doctree_no_tr.set_conf({"extensions": ["myst_parser"]}) + pformat = sphinx_doctree_no_tr(file_params.content, "index.md").pformat("index") + # sphinx 3 adds a parent key + pformat = re.sub('cpp:parent_key="[^"]*"', 'cpp:parent_key=""', pformat) + # sphinx >= 4.5.0 adds a trailing slash to PEP URLs, + # see https://github.com/sphinx-doc/sphinx/commit/658689433eacc9eb + pformat = pformat.replace( + ' refuri="http://www.python.org/dev/peps/pep-0001">', + ' refuri="http://www.python.org/dev/peps/pep-0001/">', + ) + file_params.assert_expected(pformat, rstrip_lines=True) + + +@pytest.mark.param_file(FIXTURE_PATH / "dollarmath.md") +def test_dollarmath(file_params, sphinx_doctree_no_tr: CreateDoctree): + sphinx_doctree_no_tr.set_conf( + {"extensions": ["myst_parser"], "myst_enable_extensions": ["dollarmath"]} + ) + result = sphinx_doctree_no_tr(file_params.content, "index.md") + file_params.assert_expected(result.pformat("index"), rstrip_lines=True) + + +@pytest.mark.param_file(FIXTURE_PATH / "amsmath.md") +def test_amsmath(file_params, sphinx_doctree_no_tr: CreateDoctree, monkeypatch): + monkeypatch.setattr(SphinxRenderer, "_random_label", lambda self: "mock-uuid") + sphinx_doctree_no_tr.set_conf( + {"extensions": ["myst_parser"], "myst_enable_extensions": ["amsmath"]} + ) + result = sphinx_doctree_no_tr(file_params.content, "index.md") + file_params.assert_expected(result.pformat("index"), rstrip_lines=True) + + +@pytest.mark.param_file(FIXTURE_PATH / "containers.md") +def test_containers(file_params, sphinx_doctree_no_tr: CreateDoctree, monkeypatch): + monkeypatch.setattr(SphinxRenderer, "_random_label", lambda self: "mock-uuid") + sphinx_doctree_no_tr.set_conf( + {"extensions": ["myst_parser"], "myst_enable_extensions": ["colon_fence"]} + ) + result = sphinx_doctree_no_tr(file_params.content, "index.md") + file_params.assert_expected(result.pformat("index"), rstrip_lines=True) + + +@pytest.mark.param_file(FIXTURE_PATH / "eval_rst.md") +def test_evalrst_elements(file_params, sphinx_doctree_no_tr: CreateDoctree): + sphinx_doctree_no_tr.set_conf({"extensions": ["myst_parser"]}) + result = sphinx_doctree_no_tr(file_params.content, "index.md") + file_params.assert_expected(result.pformat("index"), rstrip_lines=True) + + +@pytest.mark.param_file(FIXTURE_PATH / "definition_lists.md") +def test_definition_lists(file_params, sphinx_doctree_no_tr: CreateDoctree): + sphinx_doctree_no_tr.set_conf( + {"extensions": ["myst_parser"], "myst_enable_extensions": ["deflist"]} + ) + result = sphinx_doctree_no_tr(file_params.content, "index.md") + file_params.assert_expected(result.pformat("index"), rstrip_lines=True) diff --git a/tests/test_renderers/test_include_directive.py b/tests/test_renderers/test_include_directive.py new file mode 100644 index 0000000..f02b246 --- /dev/null +++ b/tests/test_renderers/test_include_directive.py @@ -0,0 +1,52 @@ +import os +from io import StringIO +from pathlib import Path + +import pytest +from docutils.core import publish_doctree + +from myst_parser.parsers.docutils_ import Parser + +FIXTURE_PATH = Path(__file__).parent.joinpath("fixtures") + + +@pytest.mark.param_file(FIXTURE_PATH / "mock_include.md") +def test_render(file_params, tmp_path, monkeypatch): + monkeypatch.chdir(tmp_path) + + tmp_path.joinpath("other.md").write_text("a\nb\nc") + tmp_path.joinpath("fmatter.md").write_text("---\na: 1\n---\nb") + + doctree = publish_doctree( + file_params.content, + parser=Parser(), + settings_overrides={"myst_highlight_code_blocks": False}, + ) + + doctree["source"] = "tmpdir/test.md" + output = doctree.pformat().replace(str(tmp_path) + os.sep, "tmpdir" + "/").rstrip() + + file_params.assert_expected(output, rstrip=True) + + +@pytest.mark.param_file(FIXTURE_PATH / "mock_include_errors.md") +def test_errors(file_params, tmp_path, monkeypatch): + if file_params.title.startswith("Non-existent path") and os.name == "nt": + pytest.skip("tmp_path not converted correctly on Windows") + + monkeypatch.chdir(tmp_path) + + tmp_path.joinpath("bad.md").write_text("{a}`b`") + + report_stream = StringIO() + publish_doctree( + file_params.content, + source_path=str(tmp_path / "test.md"), + parser=Parser(), + settings_overrides={"halt_level": 6, "warning_stream": report_stream}, + ) + + file_params.assert_expected( + report_stream.getvalue().replace(str(tmp_path) + os.sep, "tmpdir" + "/"), + rstrip=True, + ) diff --git a/tests/test_renderers/test_myst_config.py b/tests/test_renderers/test_myst_config.py new file mode 100644 index 0000000..31e2444 --- /dev/null +++ b/tests/test_renderers/test_myst_config.py @@ -0,0 +1,38 @@ +"""Test (docutils) parsing with different ``MdParserConfig`` options set.""" +import shlex +from io import StringIO +from pathlib import Path + +import pytest +from docutils.core import Publisher, publish_doctree + +from myst_parser.parsers.docutils_ import Parser + +FIXTURE_PATH = Path(__file__).parent.joinpath("fixtures") + + +@pytest.mark.param_file(FIXTURE_PATH / "myst-config.txt") +def test_cmdline(file_params): + """The description is parsed as a docutils commandline""" + pub = Publisher(parser=Parser()) + option_parser = pub.setup_option_parser() + try: + settings = option_parser.parse_args( + shlex.split(file_params.description) + ).__dict__ + except Exception as err: + raise AssertionError( + f"Failed to parse commandline: {file_params.description}\n{err}" + ) + report_stream = StringIO() + settings["warning_stream"] = report_stream + doctree = publish_doctree( + file_params.content, + parser=Parser(), + settings_overrides=settings, + ) + output = doctree.pformat() + warnings = report_stream.getvalue() + if warnings: + output += "\n" + warnings + file_params.assert_expected(output, rstrip_lines=True) diff --git a/tests/test_renderers/test_myst_refs.py b/tests/test_renderers/test_myst_refs.py new file mode 100644 index 0000000..083b34a --- /dev/null +++ b/tests/test_renderers/test_myst_refs.py @@ -0,0 +1,38 @@ +import pytest +from sphinx_pytest.plugin import CreateDoctree + + +@pytest.mark.parametrize( + "test_name,text,should_warn", + [ + ("null", "", False), + ("missing", "[](ref)", True), + ("doc", "[](index)", False), + ("doc_with_extension", "[](index.md)", False), + ("doc_nested", "[*text*](index)", False), + ("ref", "(ref)=\n# Title\n[](ref)", False), + ("ref_nested", "(ref)=\n# Title\n[*text*](ref)", False), + ("duplicate", "(index)=\n# Title\n[](index)", True), + ("ref_colon", "(ref:colon)=\n# Title\n[](ref:colon)", False), + ], +) +def test_parse( + test_name: str, + text: str, + should_warn: bool, + sphinx_doctree: CreateDoctree, + file_regression, +): + sphinx_doctree.set_conf({"extensions": ["myst_parser"]}) + result = sphinx_doctree(text, "index.md") + assert not result.warnings + + doctree = result.get_resolved_doctree("index") + + if should_warn: + assert result.warnings + else: + assert not result.warnings + + doctree["source"] = "root/index.md" + file_regression.check(doctree.pformat(), basename=test_name, extension=".xml") diff --git a/tests/test_renderers/test_myst_refs/doc.xml b/tests/test_renderers/test_myst_refs/doc.xml new file mode 100644 index 0000000..55cb74c --- /dev/null +++ b/tests/test_renderers/test_myst_refs/doc.xml @@ -0,0 +1,5 @@ +<document source="root/index.md"> + <paragraph> + <reference internal="True" refuri=""> + <inline classes="doc std std-doc"> + <no title> diff --git a/tests/test_renderers/test_myst_refs/doc_nested.xml b/tests/test_renderers/test_myst_refs/doc_nested.xml new file mode 100644 index 0000000..35679d9 --- /dev/null +++ b/tests/test_renderers/test_myst_refs/doc_nested.xml @@ -0,0 +1,6 @@ +<document source="root/index.md"> + <paragraph> + <reference internal="True" refuri=""> + <inline classes="doc std std-doc"> + <emphasis> + text diff --git a/tests/test_renderers/test_myst_refs/doc_with_extension.xml b/tests/test_renderers/test_myst_refs/doc_with_extension.xml new file mode 100644 index 0000000..55cb74c --- /dev/null +++ b/tests/test_renderers/test_myst_refs/doc_with_extension.xml @@ -0,0 +1,5 @@ +<document source="root/index.md"> + <paragraph> + <reference internal="True" refuri=""> + <inline classes="doc std std-doc"> + <no title> diff --git a/tests/test_renderers/test_myst_refs/duplicate.xml b/tests/test_renderers/test_myst_refs/duplicate.xml new file mode 100644 index 0000000..755906c --- /dev/null +++ b/tests/test_renderers/test_myst_refs/duplicate.xml @@ -0,0 +1,9 @@ +<document source="root/index.md"> + <target refid="index"> + <section ids="title index" names="title index"> + <title> + Title + <paragraph> + <reference internal="True" refid="index"> + <inline classes="std std-ref"> + Title diff --git a/tests/test_renderers/test_myst_refs/missing.xml b/tests/test_renderers/test_myst_refs/missing.xml new file mode 100644 index 0000000..6bc72ad --- /dev/null +++ b/tests/test_renderers/test_myst_refs/missing.xml @@ -0,0 +1,3 @@ +<document source="root/index.md"> + <paragraph> + <inline classes="xref myst"> diff --git a/tests/test_renderers/test_myst_refs/null.xml b/tests/test_renderers/test_myst_refs/null.xml new file mode 100644 index 0000000..d09aa5e --- /dev/null +++ b/tests/test_renderers/test_myst_refs/null.xml @@ -0,0 +1 @@ +<document source="root/index.md"> diff --git a/tests/test_renderers/test_myst_refs/ref.xml b/tests/test_renderers/test_myst_refs/ref.xml new file mode 100644 index 0000000..e4ae200 --- /dev/null +++ b/tests/test_renderers/test_myst_refs/ref.xml @@ -0,0 +1,9 @@ +<document source="root/index.md"> + <target refid="ref"> + <section ids="title ref" names="title ref"> + <title> + Title + <paragraph> + <reference internal="True" refid="ref"> + <inline classes="std std-ref"> + Title diff --git a/tests/test_renderers/test_myst_refs/ref_colon.xml b/tests/test_renderers/test_myst_refs/ref_colon.xml new file mode 100644 index 0000000..f1e9923 --- /dev/null +++ b/tests/test_renderers/test_myst_refs/ref_colon.xml @@ -0,0 +1,9 @@ +<document source="root/index.md"> + <target refid="ref-colon"> + <section ids="title ref-colon" names="title ref:colon"> + <title> + Title + <paragraph> + <reference internal="True" refid="ref-colon"> + <inline classes="std std-ref"> + Title diff --git a/tests/test_renderers/test_myst_refs/ref_nested.xml b/tests/test_renderers/test_myst_refs/ref_nested.xml new file mode 100644 index 0000000..be69ef2 --- /dev/null +++ b/tests/test_renderers/test_myst_refs/ref_nested.xml @@ -0,0 +1,10 @@ +<document source="root/index.md"> + <target refid="ref"> + <section ids="title ref" names="title ref"> + <title> + Title + <paragraph> + <reference internal="True" refid="ref"> + <inline classes="std std-ref"> + <emphasis> + text diff --git a/tests/test_renderers/test_parse_directives.py b/tests/test_renderers/test_parse_directives.py new file mode 100644 index 0000000..ae6792b --- /dev/null +++ b/tests/test_renderers/test_parse_directives.py @@ -0,0 +1,46 @@ +from pathlib import Path + +import pytest +import yaml +from docutils.parsers.rst.directives.admonitions import Admonition, Note +from docutils.parsers.rst.directives.body import Rubric +from markdown_it import MarkdownIt + +from myst_parser.parsers.directives import DirectiveParsingError, parse_directive_text + +FIXTURE_PATH = Path(__file__).parent.joinpath("fixtures") + + +@pytest.mark.param_file(FIXTURE_PATH / "directive_parsing.txt") +def test_parsing(file_params): + """Test parsing of directive text.""" + tokens = MarkdownIt("commonmark").parse(file_params.content) + assert len(tokens) == 1 and tokens[0].type == "fence" + name, *first_line = tokens[0].info.split(maxsplit=1) + if name == "{note}": + klass = Note + elif name == "{admonition}": + klass = Admonition + else: + raise AssertionError(f"Unknown directive: {name}") + arguments, options, body_lines, content_offset = parse_directive_text( + klass, first_line[0] if first_line else "", tokens[0].content + ) + outcome = yaml.safe_dump( + { + "arguments": arguments, + "options": options, + "body": body_lines, + "content_offset": content_offset, + }, + sort_keys=True, + ) + file_params.assert_expected(outcome, rstrip_lines=True) + + +@pytest.mark.parametrize( + "descript,klass,arguments,content", [("no content", Rubric, "", "a")] +) +def test_parsing_errors(descript, klass, arguments, content): + with pytest.raises(DirectiveParsingError): + parse_directive_text(klass, arguments, content) diff --git a/tests/test_sphinx/conftest.py b/tests/test_sphinx/conftest.py new file mode 100644 index 0000000..4165a31 --- /dev/null +++ b/tests/test_sphinx/conftest.py @@ -0,0 +1,127 @@ +""" +Uses sphinx's pytest fixture to run builds + +usage: + +.. code-block:: python + + @pytest.mark.sphinx( + buildername='html', + srcdir='path/to/source') + def test_basic(app, status, warning, get_sphinx_app_output): + + app.build() + + assert 'build succeeded' in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + output = get_sphinx_app_output(app, buildername='html') + +parameters available to parse to ``@pytest.mark.sphinx``: + +- buildername='html' +- srcdir=None +- testroot='root' (only used if srcdir not set) +- freshenv=False +- confoverrides=None +- status=None +- warning=None +- tags=None +- docutilsconf=None + +""" +import os +import pathlib +import shutil + +import pytest +from bs4 import BeautifulSoup +from sphinx.testing.path import path + +from myst_parser._compat import findall + +SOURCE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "sourcedirs")) + + +@pytest.fixture(scope="session", autouse=True) +def remove_sphinx_builds(): + """remove all build directories from the test folder""" + yield + srcdirs = pathlib.Path(SOURCE_DIR) + for entry in srcdirs.iterdir(): # type: pathlib.Path + if entry.is_dir() and entry.joinpath("_build").exists(): + shutil.rmtree(str(entry.joinpath("_build"))) + + +@pytest.fixture +def get_sphinx_app_output(file_regression): + def read( + app, + buildername="html", + filename="index.html", + encoding="utf-8", + regress_html=False, + regress_ext=".html", + replace=None, + ): + + outpath = path(os.path.join(str(app.srcdir), "_build", buildername, filename)) + if not outpath.exists(): + raise OSError(f"no output file exists: {outpath}") + + try: + # introduced in sphinx 3.0 + content = outpath.read_text(encoding=encoding) + except AttributeError: + content = outpath.text(encoding=encoding) + + if regress_html: + # only regress the inner body, since other sections are non-deterministic + soup = BeautifulSoup(content, "html.parser") + doc_div = soup.findAll("div", {"class": "documentwrapper"})[0] + # pygments 2.11.0 introduces a whitespace tag + for pygment_whitespace in doc_div.select("pre > span.w"): + pygment_whitespace.replace_with(pygment_whitespace.text) + text = doc_div.prettify() + for find, rep in (replace or {}).items(): + text = text.replace(find, rep) + file_regression.check(text, extension=regress_ext, encoding="utf8") + + return content + + return read + + +@pytest.fixture +def get_sphinx_app_doctree(file_regression): + def read( + app, + docname="index", + resolve=False, + regress=False, + replace=None, + regress_ext=".xml", + ): + if resolve: + doctree = app.env.get_and_resolve_doctree(docname, app.builder) + extension = f".resolved{regress_ext}" + else: + doctree = app.env.get_doctree(docname) + extension = regress_ext + + # convert absolute filenames + for node in findall(doctree)( + lambda n: "source" in n and not isinstance(n, str) + ): + node["source"] = pathlib.Path(node["source"]).name + + if regress: + text = doctree.pformat() # type: str + for find, rep in (replace or {}).items(): + text = text.replace(find, rep) + file_regression.check(text, extension=extension) + + return doctree + + return read diff --git a/tests/test_sphinx/sourcedirs/.gitignore b/tests/test_sphinx/sourcedirs/.gitignore new file mode 100644 index 0000000..69fa449 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/.gitignore @@ -0,0 +1 @@ +_build/ diff --git a/tests/test_sphinx/sourcedirs/basic/conf.py b/tests/test_sphinx/sourcedirs/basic/conf.py new file mode 100644 index 0000000..e1c5009 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/basic/conf.py @@ -0,0 +1,2 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build"] diff --git a/tests/test_sphinx/sourcedirs/basic/content.md b/tests/test_sphinx/sourcedirs/basic/content.md new file mode 100644 index 0000000..ab7b6e2 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/basic/content.md @@ -0,0 +1,104 @@ +--- +author: Chris Sewell +authors: Chris Sewell, Chris Hodgraf +organization: EPFL +address: | + 1 Cedar Park Close + Thundersley + Essex +contact: <https://example.com> +version: 1.0 +revision: 1.1 +status: good +date: 2/12/1985 +copyright: MIT +dedication: | + To my *homies* +abstract: + Something something **dark** side +other: Something else +other_dict: + key: value +--- + +(target)= + +# Header + +% comment + +````{note} +abcd *abc* [google](https://www.google.com) + + ```{warning} + xyz + ``` + +```` + +```{admonition} Title with [link](target2) +Content +``` + +(target2)= + +```{figure} example.jpg +--- +height: 40px +target: https://www.google.com +--- +Caption +``` + +![*alternative text*](example.jpg) + +<https://www.google.com> + +**{code}`` a=1{`} ``** + +{math}`sdfds` + +**$a=1$** + +$$b=2$$ + +$$c=2$$ (eq:label) + +{eq}`eq:label` + +`` a=1{`} `` + +| a | b | +|-----|--:| +| *a* | 2 | +| [link-a](https://google.com) | [link-b](https://python.org) | + +this +is +a +paragraph +% a comment 2 + +this is a second paragraph + +- a list + - a sub list +% a comment 3 +- new list? + +{ref}`target` {ref}`target2` + ++++ a block break + +[name][key] + +[key]: https://www.google.com "a title" + +``` +def func(a, b=1): + print(a) +``` + +Special substitution references: + +{sub-ref}`wordcount-words` words | {sub-ref}`wordcount-minutes` min read diff --git a/tests/test_sphinx/sourcedirs/basic/example.jpg b/tests/test_sphinx/sourcedirs/basic/example.jpg Binary files differnew file mode 100644 index 0000000..1c1e83e --- /dev/null +++ b/tests/test_sphinx/sourcedirs/basic/example.jpg diff --git a/tests/test_sphinx/sourcedirs/basic/index.md b/tests/test_sphinx/sourcedirs/basic/index.md new file mode 100644 index 0000000..1c9d9c7 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/basic/index.md @@ -0,0 +1,3 @@ +```{toctree} +content +``` diff --git a/tests/test_sphinx/sourcedirs/basic/orphan.md b/tests/test_sphinx/sourcedirs/basic/orphan.md new file mode 100644 index 0000000..c42b7c3 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/basic/orphan.md @@ -0,0 +1,5 @@ +--- +orphan: true +--- + +This is an orphan document, not specified in any toctrees. diff --git a/tests/test_sphinx/sourcedirs/commonmark_only/conf.py b/tests/test_sphinx/sourcedirs/commonmark_only/conf.py new file mode 100644 index 0000000..ef5f1d8 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/commonmark_only/conf.py @@ -0,0 +1,3 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build"] +myst_commonmark_only = True diff --git a/tests/test_sphinx/sourcedirs/commonmark_only/index.md b/tests/test_sphinx/sourcedirs/commonmark_only/index.md new file mode 100644 index 0000000..4212519 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/commonmark_only/index.md @@ -0,0 +1,7 @@ +# Test + +```{note} +hallo +``` + +{a}`b` diff --git a/tests/test_sphinx/sourcedirs/extended_syntaxes/conf.py b/tests/test_sphinx/sourcedirs/extended_syntaxes/conf.py new file mode 100644 index 0000000..9845000 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/extended_syntaxes/conf.py @@ -0,0 +1,20 @@ +extensions = ["myst_parser"] +language = "en" +exclude_patterns = ["_build"] +myst_disable_syntax = ["emphasis"] +myst_dmath_allow_space = False +myst_dmath_double_inline = True +mathjax_config = {} +myst_enable_extensions = [ + "dollarmath", + "amsmath", + "deflist", + "colon_fence", + "linkify", + "tasklist", +] +myst_number_code_blocks = ["typescript"] +myst_html_meta = { + "description lang=en": "meta description", + "property=og:locale": "en_US", +} diff --git a/tests/test_sphinx/sourcedirs/extended_syntaxes/fun-fish.png b/tests/test_sphinx/sourcedirs/extended_syntaxes/fun-fish.png Binary files differnew file mode 100644 index 0000000..c9a4997 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/extended_syntaxes/fun-fish.png diff --git a/tests/test_sphinx/sourcedirs/extended_syntaxes/index.md b/tests/test_sphinx/sourcedirs/extended_syntaxes/index.md new file mode 100644 index 0000000..e9fcea9 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/extended_syntaxes/index.md @@ -0,0 +1,67 @@ +# Test + +*disabled* + +$a=1$ + +$$x=5$$ + +$$x=5$$ (2) + +$ a=1 $ + +a $$c=3$$ b + +\begin{equation} +b=2 +\end{equation} + +```{math} +c=3 + +d=4 +``` + +Term **1** + +: Definition *1* + + second paragraph + +Term 2 + ~ Definition 2a + ~ Definition 2b + +Term 3 + : code block + + : > quote + + : other + +:::{figure-md} target +:class: other + +![fun-fish](fun-fish.png) + +This is a caption in **Markdown** +::: + +:::{figure-md} other-target +:class: other + +<img src="fun-fish.png" alt="fishy" class="bg-primary mb-1" width="200px"> + +This is a caption in **Markdown** +::: + +linkify URL: www.example.com + +- [ ] hallo +- [x] there + +Numbered code block: + +```typescript +type Result = "pass" | "fail" +``` diff --git a/tests/test_sphinx/sourcedirs/fieldlist/conf.py b/tests/test_sphinx/sourcedirs/fieldlist/conf.py new file mode 100644 index 0000000..1e3d992 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/fieldlist/conf.py @@ -0,0 +1,4 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build"] + +myst_enable_extensions = ["fieldlist"] diff --git a/tests/test_sphinx/sourcedirs/fieldlist/index.md b/tests/test_sphinx/sourcedirs/fieldlist/index.md new file mode 100644 index 0000000..2ed4856 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/fieldlist/index.md @@ -0,0 +1,19 @@ +:orphan: + +# Test + +:field: + +:*field*: content + +```{py:function} send_message(sender, priority) + +Send a message to a recipient + +:param str sender: The person sending the message +:param priority: The priority of the message, can be a number 1-5 +:type priority: int +:return: the message id +:rtype: int +:raises ValueError: if the message_body exceeds 160 characters +``` diff --git a/tests/test_sphinx/sourcedirs/footnotes/conf.py b/tests/test_sphinx/sourcedirs/footnotes/conf.py new file mode 100644 index 0000000..e1c5009 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/footnotes/conf.py @@ -0,0 +1,2 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build"] diff --git a/tests/test_sphinx/sourcedirs/footnotes/footnote_md.md b/tests/test_sphinx/sourcedirs/footnotes/footnote_md.md new file mode 100644 index 0000000..ca46d0e --- /dev/null +++ b/tests/test_sphinx/sourcedirs/footnotes/footnote_md.md @@ -0,0 +1,29 @@ +# Footnotes with Markdown + +[^c] + +```{note} +[^d] +``` + +[^a] + +[^a]: some footnote *text* + +[^b]: a footnote before its reference + +[^b] + +[^c]: a footnote referenced first + +[^d]: a footnote referenced in a directive + +[^123] [^123] + +[^123]: multiple references footnote + +[^x]: an unreferenced footnote + +[^e] + +> - [^e]: footnote definition in a block element diff --git a/tests/test_sphinx/sourcedirs/footnotes/footnote_rst.rst b/tests/test_sphinx/sourcedirs/footnotes/footnote_rst.rst new file mode 100644 index 0000000..219f98a --- /dev/null +++ b/tests/test_sphinx/sourcedirs/footnotes/footnote_rst.rst @@ -0,0 +1,26 @@ +Footnotes with rST +------------------ + +[#c]_ + +.. note:: + + [#d]_ + +[#a]_ + +.. [#a] some footnote *text* + +.. [#b] a footnote before its reference + +[#b]_ + +.. [#c] a footnote referenced first + +.. [#d] a footnote referenced in a directive + +[#123]_ [#123]_ + +.. [#123] multiple references footnote + +.. [#x] an unreferenced footnote diff --git a/tests/test_sphinx/sourcedirs/footnotes/index.md b/tests/test_sphinx/sourcedirs/footnotes/index.md new file mode 100644 index 0000000..4e4bc08 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/footnotes/index.md @@ -0,0 +1,4 @@ +```{toctree} +footnote_rst +footnote_md +``` diff --git a/tests/test_sphinx/sourcedirs/gettext/conf.py b/tests/test_sphinx/sourcedirs/gettext/conf.py new file mode 100644 index 0000000..0dff9fe --- /dev/null +++ b/tests/test_sphinx/sourcedirs/gettext/conf.py @@ -0,0 +1,4 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build"] +copyright = "2020, Executable Book Project" +myst_enable_extensions = ["deflist"] diff --git a/tests/test_sphinx/sourcedirs/gettext/fr/LC_MESSAGES/index.po b/tests/test_sphinx/sourcedirs/gettext/fr/LC_MESSAGES/index.po new file mode 100644 index 0000000..43e5320 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/gettext/fr/LC_MESSAGES/index.po @@ -0,0 +1,127 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) XXXX, Executable Book Project +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2000-01-01 00:00+0000\n" +"PO-Revision-Date: 2000-01-01 00:00+0000\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "**bold** text 1" +msgstr "texte 1 en **gras**" + +msgid "**bold** text 2" +msgstr "texte 2 en **gras**" + +msgid "**bold** text 3" +msgstr "texte 3 en **gras**" + +msgid "**bold** text 4" +msgstr "texte 4 en **gras**" + +msgid "**bold** text 5" +msgstr "texte 5 en **gras**" + +msgid "**bold** text 6" +msgstr "texte 6 en **gras**" + +msgid "**bold** text 7" +msgstr "texte 7 en **gras**" + +msgid "**bold** text 8" +msgstr "texte 8 en **gras**" + +msgid "**bold** text 9" +msgstr "texte 9 en **gras**" + +msgid "**bold** text 10" +msgstr "texte 10 en **gras**" + +msgid "<div markdown=1>\n" +"" +msgstr "<span markdown=1>\n" +"" + +msgid "**bold** text 11" +msgstr "texte 11 en **gras**" + +msgid "Extra ```backticks```" +msgstr "\"```Backtick```\" supplémentaire" + +msgid "</div>\n" +"" +msgstr "</span>\n" +"" + +msgid "**additional** text 12\n" +"" +msgstr "texte 12 **supplémentaire**\n" +"" + +msgid "**additional** text 13\n" +"" +msgstr "texte 13 **supplémentaire**\n" +"" + +msgid "{\n" +" \"additional\": \"text 14\"\n" +"}\n" +"" +msgstr "{\n" +" \"supplémentaire\": \"texte 14\"\n" +"}\n" +"" + +msgid "<h3>**additional** text 15</h3>\n" +"" +msgstr "<h3>texte 15 **supplémentaire**</h3>\n" +"" + +msgid ">>> print('doctest block')\n" +"doctest block\n" +"" +msgstr ">>> print('bloque doctest')\n" +"'bloque doctest\n" +"" + +msgid "<iframe src=\"http://sphinx-doc.org\"></iframe>" +msgstr "<iframe src=\"http://sphinx-doc.org/fr/master/\"></iframe>" + +msgid "![Fun Fish 1](fun-fish.png)" +msgstr "![Poisson amusant 1](poisson-amusant.png)" + +msgid "Fun Fish 1" +msgstr "Poisson amusant 1" + +msgid ".. image:: fun-fish.png" +msgstr ".. image:: poisson-amusant.png" + +msgid "Fun Fish 2" +msgstr "Poisson amusant 2" + +msgid "Fun Fish 3" +msgstr "Poisson amusant 3" + +msgid ".. image:: fun-fish.png\n" +" :alt: Fun Fish 1" +msgstr ".. image:: poisson-amusant.png\n" +" :alt: Poisson amusant 1" + +msgid ".. image:: fun-fish.png\n" +" :alt: Fun Fish 2" +msgstr ".. image:: poisson-amusant.png\n" +" :alt: Poisson amusant 2" + +msgid ".. image:: fun-fish.png\n" +" :alt: Fun Fish 3" +msgstr ".. image:: poisson-amusant.png\n" +" :alt: Poisson amusant 3" diff --git a/tests/test_sphinx/sourcedirs/gettext/fun-fish.png b/tests/test_sphinx/sourcedirs/gettext/fun-fish.png Binary files differnew file mode 100644 index 0000000..c9a4997 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/gettext/fun-fish.png diff --git a/tests/test_sphinx/sourcedirs/gettext/index.md b/tests/test_sphinx/sourcedirs/gettext/index.md new file mode 100644 index 0000000..a721944 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/gettext/index.md @@ -0,0 +1,63 @@ +# **bold** text 1 + +**bold** text 2 + +> **bold** text 3 + +```{eval-rst} +.. note:: + + **bold** text 4 +``` + +* **bold** text 5 + +1. **bold** text 6 + +**bold** text 7 +: **bold** text 8 + +| **bold** text 9 | +| ---------------- | +| **bold** text 10 | + +<div markdown=1> + +**bold** text 11 + +Extra ```backticks``` + +</div> + + **additional** text 12 + +``` +**additional** text 13 +``` + +```json +{ + "additional": "text 14" +} +``` + +<h3>**additional** text 15</h3> + +```python +>>> print('doctest block') +doctest block +``` + +```{raw} html +<iframe src="http://sphinx-doc.org"></iframe> +``` + +![Fun Fish 1](fun-fish.png) + +```{image} fun-fish.png +:alt: Fun Fish 2 +``` + +```{figure} fun-fish.png +:alt: Fun Fish 3 +``` diff --git a/tests/test_sphinx/sourcedirs/gettext/poisson-amusant.png b/tests/test_sphinx/sourcedirs/gettext/poisson-amusant.png Binary files differnew file mode 100644 index 0000000..c9a4997 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/gettext/poisson-amusant.png diff --git a/tests/test_sphinx/sourcedirs/heading_slug_func/conf.py b/tests/test_sphinx/sourcedirs/heading_slug_func/conf.py new file mode 100644 index 0000000..f6612b4 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/heading_slug_func/conf.py @@ -0,0 +1,6 @@ +from docutils.nodes import make_id + +extensions = ["myst_parser"] +exclude_patterns = ["_build"] +myst_heading_anchors = 2 +myst_heading_slug_func = make_id diff --git a/tests/test_sphinx/sourcedirs/heading_slug_func/index.md b/tests/test_sphinx/sourcedirs/heading_slug_func/index.md new file mode 100644 index 0000000..ec11ada --- /dev/null +++ b/tests/test_sphinx/sourcedirs/heading_slug_func/index.md @@ -0,0 +1,3 @@ +# Hyphen - 1 + +## Dot 1.1 diff --git a/tests/test_sphinx/sourcedirs/include_from_rst/conf.py b/tests/test_sphinx/sourcedirs/include_from_rst/conf.py new file mode 100644 index 0000000..a743e3c --- /dev/null +++ b/tests/test_sphinx/sourcedirs/include_from_rst/conf.py @@ -0,0 +1,2 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build", "include.md"] diff --git a/tests/test_sphinx/sourcedirs/include_from_rst/include.md b/tests/test_sphinx/sourcedirs/include_from_rst/include.md new file mode 100644 index 0000000..20f34b9 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/include_from_rst/include.md @@ -0,0 +1,5 @@ +# Markdown + +[target] + +[target]: http://example.com/ diff --git a/tests/test_sphinx/sourcedirs/include_from_rst/index.rst b/tests/test_sphinx/sourcedirs/include_from_rst/index.rst new file mode 100644 index 0000000..0bb3177 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/include_from_rst/index.rst @@ -0,0 +1,5 @@ +Title +===== + +.. include:: include.md + :parser: myst_parser.sphinx_ diff --git a/tests/test_sphinx/sourcedirs/includes/conf.py b/tests/test_sphinx/sourcedirs/includes/conf.py new file mode 100644 index 0000000..4cf4e93 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/includes/conf.py @@ -0,0 +1,2 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build", "*.inc.md", "**/*.inc.md"] diff --git a/tests/test_sphinx/sourcedirs/includes/example1.jpg b/tests/test_sphinx/sourcedirs/includes/example1.jpg Binary files differnew file mode 100644 index 0000000..1c1e83e --- /dev/null +++ b/tests/test_sphinx/sourcedirs/includes/example1.jpg diff --git a/tests/test_sphinx/sourcedirs/includes/include1.inc.md b/tests/test_sphinx/sourcedirs/includes/include1.inc.md new file mode 100644 index 0000000..3eea6ac --- /dev/null +++ b/tests/test_sphinx/sourcedirs/includes/include1.inc.md @@ -0,0 +1,12 @@ +--- +orphan: true +--- +(inc_header)= +## A Sub-Heading in Include + +Some text with *syntax* + +```{include} subfolder/include2.inc.md +:relative-images: +:relative-docs: .. +``` diff --git a/tests/test_sphinx/sourcedirs/includes/include_code.py b/tests/test_sphinx/sourcedirs/includes/include_code.py new file mode 100644 index 0000000..3158954 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/includes/include_code.py @@ -0,0 +1,2 @@ +def a_func(param): + print(param) diff --git a/tests/test_sphinx/sourcedirs/includes/include_literal.txt b/tests/test_sphinx/sourcedirs/includes/include_literal.txt new file mode 100644 index 0000000..5bb9418 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/includes/include_literal.txt @@ -0,0 +1,6 @@ +This should be *literal* + +Lots +of +lines +so we can select some diff --git a/tests/test_sphinx/sourcedirs/includes/index.md b/tests/test_sphinx/sourcedirs/includes/index.md new file mode 100644 index 0000000..dc904e3 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/includes/index.md @@ -0,0 +1,31 @@ +# Main Title + +```{include} include1.inc.md +``` + +{ref}`inc_header` + +```{include} include_code.py +:code: python +``` + +```{include} include_code.py +:code: python +:number-lines: 0 +``` + +```{include} include_literal.txt +:literal: +``` + +```{include} include_literal.txt +:literal: +:name: literal_ref +:start-line: 2 +:end-before: lines +:number-lines: 0 +``` + +### A Sub-sub-Heading + +some more text diff --git a/tests/test_sphinx/sourcedirs/includes/subfolder/example2.jpg b/tests/test_sphinx/sourcedirs/includes/subfolder/example2.jpg Binary files differnew file mode 100644 index 0000000..1c1e83e --- /dev/null +++ b/tests/test_sphinx/sourcedirs/includes/subfolder/example2.jpg diff --git a/tests/test_sphinx/sourcedirs/includes/subfolder/include2.inc.md b/tests/test_sphinx/sourcedirs/includes/subfolder/include2.inc.md new file mode 100644 index 0000000..a6eebcf --- /dev/null +++ b/tests/test_sphinx/sourcedirs/includes/subfolder/include2.inc.md @@ -0,0 +1,21 @@ +## A Sub-Heading in Nested Include + +Some other text with **syntax** + +This relative path will refer to the importing file: + +```{figure} example1.jpg +Caption +``` + +This absolute path will refer to the project root (where the `conf.py` is): + +```{figure} /subfolder/example2.jpg +Caption +``` + +![alt](example2.jpg) + +![alt](https://example.com) + +[text](../index.md) diff --git a/tests/test_sphinx/sourcedirs/mathjax/conf.py b/tests/test_sphinx/sourcedirs/mathjax/conf.py new file mode 100644 index 0000000..b2a70c8 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/mathjax/conf.py @@ -0,0 +1,12 @@ +import sphinx + +extensions = ["myst_parser"] +exclude_patterns = ["_build"] + +if sphinx.version_info[0] <= 3: + mathjax_config = {"tex2jax": {"processClass": "other"}} +else: + mathjax3_config = {"options": {"processHtmlClass": "other"}} + +# this should remove the warning +# suppress_warnings = ["myst.mathjax"] diff --git a/tests/test_sphinx/sourcedirs/mathjax/index.md b/tests/test_sphinx/sourcedirs/mathjax/index.md new file mode 100644 index 0000000..0226511 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/mathjax/index.md @@ -0,0 +1,5 @@ +# Test + +```{math} +a = 1 +``` diff --git a/tests/test_sphinx/sourcedirs/references/conf.py b/tests/test_sphinx/sourcedirs/references/conf.py new file mode 100644 index 0000000..099510a --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references/conf.py @@ -0,0 +1,3 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build"] +myst_heading_anchors = 2 diff --git a/tests/test_sphinx/sourcedirs/references/file_link.txt b/tests/test_sphinx/sourcedirs/references/file_link.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references/file_link.txt diff --git a/tests/test_sphinx/sourcedirs/references/index.md b/tests/test_sphinx/sourcedirs/references/index.md new file mode 100644 index 0000000..c31bedb --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references/index.md @@ -0,0 +1,54 @@ +(title)= + +# Title with **nested** $a=1$ + +[](https://example.com) + +[plain text](https://example.com) + +[nested *syntax*](https://example.com) + +[](title) + +[plain text](title) + +[nested *syntax*](title) + +[](index.md) + +[plain text](index.md) + +[nested *syntax*](index.md) + +[download **link**](file_link.txt) + +[](subfolder/file_link2.txt) + +```{eval-rst} +.. _insidecodeblock: + +I am inside the eval-rst fence + +Referencing the :ref:`title` + +Still inside the codeblock insidecodeblock_ +``` + +I am outside the [fence](insidecodeblock) + +## Title *anchors* + +```{toctree} +other.md +subfolder/other2.md +``` + +[](#title-anchors) + +[](./#title-anchors) + +[](./other.md#title-anchors) + +[](other.md#title-anchors) + +[](subfolder/other2.md#title-anchors) diff --git a/tests/test_sphinx/sourcedirs/references/other.md b/tests/test_sphinx/sourcedirs/references/other.md new file mode 100644 index 0000000..9dfb9be --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references/other.md @@ -0,0 +1,3 @@ +# Title *anchors* + +a diff --git a/tests/test_sphinx/sourcedirs/references/subfolder/file_link2.txt b/tests/test_sphinx/sourcedirs/references/subfolder/file_link2.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references/subfolder/file_link2.txt diff --git a/tests/test_sphinx/sourcedirs/references/subfolder/other2.md b/tests/test_sphinx/sourcedirs/references/subfolder/other2.md new file mode 100644 index 0000000..6687282 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references/subfolder/other2.md @@ -0,0 +1,3 @@ +# Title *anchors* + +[](../index.md#title-anchors) diff --git a/tests/test_sphinx/sourcedirs/references_singlehtml/conf.py b/tests/test_sphinx/sourcedirs/references_singlehtml/conf.py new file mode 100644 index 0000000..0d760fc --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references_singlehtml/conf.py @@ -0,0 +1,6 @@ +extensions = [ + "myst_parser", +] +master_doc = "index" +exclude_patterns = ["_build"] +myst_heading_anchors = 2 diff --git a/tests/test_sphinx/sourcedirs/references_singlehtml/index.md b/tests/test_sphinx/sourcedirs/references_singlehtml/index.md new file mode 100644 index 0000000..d38d875 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references_singlehtml/index.md @@ -0,0 +1,15 @@ +# Title + +```{toctree} +other/index +``` + +{doc}`other/other` + +{any}`other/other` + +[](./other/other.md) + +[](#title) + +[](./other/other.md#other-title) diff --git a/tests/test_sphinx/sourcedirs/references_singlehtml/other/index.md b/tests/test_sphinx/sourcedirs/references_singlehtml/other/index.md new file mode 100644 index 0000000..3a4fb08 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references_singlehtml/other/index.md @@ -0,0 +1,6 @@ +# Other Index + +```{toctree} +other +other2 +``` diff --git a/tests/test_sphinx/sourcedirs/references_singlehtml/other/other.md b/tests/test_sphinx/sourcedirs/references_singlehtml/other/other.md new file mode 100644 index 0000000..a833673 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references_singlehtml/other/other.md @@ -0,0 +1,9 @@ +# Other Title + +{doc}`other2` + +{any}`other2` + +[](./other2.md) + +[](../index.md#title) diff --git a/tests/test_sphinx/sourcedirs/references_singlehtml/other/other2.md b/tests/test_sphinx/sourcedirs/references_singlehtml/other/other2.md new file mode 100644 index 0000000..f97239e --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references_singlehtml/other/other2.md @@ -0,0 +1 @@ +# Other 2 Title diff --git a/tests/test_sphinx/sourcedirs/substitutions/conf.py b/tests/test_sphinx/sourcedirs/substitutions/conf.py new file mode 100644 index 0000000..57c5d68 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/substitutions/conf.py @@ -0,0 +1,4 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build"] +myst_enable_extensions = ["substitution"] +myst_substitutions = {"conf": "This was from the conf", "override": "From conf"} diff --git a/tests/test_sphinx/sourcedirs/substitutions/fun-fish.png b/tests/test_sphinx/sourcedirs/substitutions/fun-fish.png Binary files differnew file mode 100644 index 0000000..c9a4997 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/substitutions/fun-fish.png diff --git a/tests/test_sphinx/sourcedirs/substitutions/index.md b/tests/test_sphinx/sourcedirs/substitutions/index.md new file mode 100644 index 0000000..e1dd672 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/substitutions/index.md @@ -0,0 +1,56 @@ +--- +myst: + substitutions: + text: "- text" + text_with_nest: > + output + with *Markdown* + {{ nested }} + nested: nested substitution + admonition: | + prefix + + ```{note} + A note {{ nested }} + ``` + inline_admonition: | + ```{note} + Inline note + ``` + override: Overridden by front matter + +--- + +{{ text_with_nest }} + +{{ admonition }} + +a {{ text }} b + +c {{ text_with_nest }} d + +e {{ inline_admonition }} f + +{{ conf }} + +{{ override }} + +This will process the substitution + +```{parsed-literal} +{{ text_with_nest }} +``` + +This will not process the substitution + +```python +{{ text_with_nest }} +``` + +Using env and filters: + +{{ env.docname | upper }} + +```{toctree} +other.md +``` diff --git a/tests/test_sphinx/sourcedirs/substitutions/other.md b/tests/test_sphinx/sourcedirs/substitutions/other.md new file mode 100644 index 0000000..8681af4 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/substitutions/other.md @@ -0,0 +1,3 @@ +# Other + +{{ override }} diff --git a/tests/test_sphinx/sourcedirs/texi_table/conf.py b/tests/test_sphinx/sourcedirs/texi_table/conf.py new file mode 100644 index 0000000..e1c5009 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/texi_table/conf.py @@ -0,0 +1,2 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build"] diff --git a/tests/test_sphinx/sourcedirs/texi_table/index.md b/tests/test_sphinx/sourcedirs/texi_table/index.md new file mode 100644 index 0000000..9face4b --- /dev/null +++ b/tests/test_sphinx/sourcedirs/texi_table/index.md @@ -0,0 +1,3 @@ +| foo | bar | +| --- | --- | +| baz | bim | diff --git a/tests/test_sphinx/test_sphinx_builds.py b/tests/test_sphinx/test_sphinx_builds.py new file mode 100644 index 0000000..beba484 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds.py @@ -0,0 +1,565 @@ +"""Uses sphinx's pytest fixture to run builds. + +see conftest.py for fixture usage + +NOTE: sphinx 3 & 4 regress against different output files, +the major difference being sphinx 4 uses docutils 0.17, +which uses semantic HTML tags +(e.g. converting `<div class="section">` to `<section>`) +""" +import os +import re + +import pytest +import sphinx +from docutils import VersionInfo, __version_info__ + +SOURCE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "sourcedirs")) + + +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "basic"), + freshenv=True, + confoverrides={"myst_enable_extensions": ["dollarmath"]}, +) +def test_basic( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, +): + """basic test.""" + app.build() + + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + try: + get_sphinx_app_doctree( + app, + docname="content", + regress=True, + ) + finally: + get_sphinx_app_doctree( + app, + docname="content", + resolve=True, + regress=True, + ) + get_sphinx_app_output( + app, + filename="content.html", + regress_html=True, + regress_ext=f".sphinx{sphinx.version_info[0]}.html", + ) + + assert app.env.metadata["content"] == { + "author": "Chris Sewell", + "authors": ["Chris Sewell", "Chris Hodgraf"], + "organization": "EPFL", + "address": "1 Cedar Park Close\nThundersley\nEssex\n", + "contact": "https://example.com", + "version": "1.0", + "revision": "1.1", + "status": "good", + "date": "2/12/1985", + "copyright": "MIT", + "other": "Something else", + "other_dict": '{"key": "value"}', + "wordcount": {"minutes": 0, "words": 57}, + } + + +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "references"), + freshenv=True, + confoverrides={"myst_enable_extensions": ["dollarmath"]}, +) +def test_references( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, +): + """Test reference resolution.""" + app.build() + + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + try: + get_sphinx_app_doctree(app, docname="index", regress=True) + finally: + try: + get_sphinx_app_doctree(app, docname="index", resolve=True, regress=True) + finally: + get_sphinx_app_output( + app, + filename="index.html", + regress_html=True, + replace={"Permalink to this headline": "Permalink to this heading"}, + ) + + +@pytest.mark.sphinx( + buildername="singlehtml", + srcdir=os.path.join(SOURCE_DIR, "references_singlehtml"), + freshenv=True, + confoverrides={"nitpicky": True}, +) +def test_references_singlehtml( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, +): + """Test reference resolution for singlehtml builds.""" + app.build() + + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + # try: + # get_sphinx_app_doctree(app, docname="index", regress=True) + # finally: + # get_sphinx_app_doctree(app, docname="index", resolve=True, regress=True) + + try: + get_sphinx_app_doctree( + app, + docname="other/other", + regress=True, + replace={"other\\other.md": "other/other.md"}, + ) + finally: + get_sphinx_app_doctree( + app, + docname="other/other", + resolve=True, + regress=True, + replace={"other\\other.md": "other/other.md"}, + ) + + get_sphinx_app_output( + app, + filename="index.html", + buildername="singlehtml", + regress_html=True, + replace={"Permalink to this headline": "Permalink to this heading"}, + ) + + +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "heading_slug_func"), + freshenv=True, +) +def test_heading_slug_func( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, +): + """Test heading_slug_func configuration.""" + app.build() + + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + try: + get_sphinx_app_doctree(app, docname="index", regress=True) + finally: + get_sphinx_app_doctree(app, docname="index", resolve=True, regress=True) + get_sphinx_app_output( + app, + filename="index.html", + regress_html=True, + replace={"Permalink to this headline": "Permalink to this heading"}, + ) + + +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "extended_syntaxes"), + freshenv=True, +) +def test_extended_syntaxes( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, + monkeypatch, +): + """test setting addition configuration values.""" + from myst_parser.mdit_to_docutils.sphinx_ import SphinxRenderer + + monkeypatch.setattr(SphinxRenderer, "_random_label", lambda self: "mock-uuid") + app.build() + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + try: + get_sphinx_app_doctree( + app, + docname="index", + regress=True, + ) + finally: + get_sphinx_app_output( + app, + filename="index.html", + regress_html=True, + replace={"Permalink to this headline": "Permalink to this heading"}, + ) + + +@pytest.mark.sphinx( + buildername="html", srcdir=os.path.join(SOURCE_DIR, "includes"), freshenv=True +) +def test_includes( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, +): + """Test of include directive.""" + app.build() + + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + try: + get_sphinx_app_doctree( + app, + docname="index", + regress=True, + # fix for Windows CI + replace={ + r"subfolder\example2.jpg": "subfolder/example2.jpg", + r"subfolder\\example2.jpg": "subfolder/example2.jpg", + r"subfolder\\\\example2.jpg": "subfolder/example2.jpg", + }, + ) + finally: + get_sphinx_app_output( + app, + filename="index.html", + regress_html=True, + replace={ + "Permalink to this headline": "Permalink to this heading", + r"'subfolder\\example2'": "'subfolder/example2'", + r'uri="subfolder\\example2"': 'uri="subfolder/example2"', + "_images/example21.jpg": "_images/example2.jpg", + }, + ) + + +@pytest.mark.skipif( + __version_info__ < VersionInfo(0, 17, 0, "final", 0, True), + reason="parser option added in docutils 0.17", +) +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "include_from_rst"), + freshenv=True, +) +def test_include_from_rst( + app, + status, + warning, + get_sphinx_app_doctree, +): + """Test of include directive inside RST file.""" + app.build() + + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + get_sphinx_app_doctree( + app, + docname="index", + regress=True, + regress_ext=".xml", + ) + + +@pytest.mark.skipif( + __version_info__ < VersionInfo(0, 19, 0, "final", 0, True), + reason="Footnote HTML changed in docutils 0.19", +) +@pytest.mark.sphinx( + buildername="html", srcdir=os.path.join(SOURCE_DIR, "footnotes"), freshenv=True +) +def test_footnotes( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, +): + """Test of include directive.""" + app.build() + + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + try: + get_sphinx_app_doctree(app, docname="footnote_md", regress=True) + finally: + get_sphinx_app_output( + app, + filename="footnote_md.html", + regress_html=True, + regress_ext=f".sphinx{sphinx.version_info[0]}.html", + ) + + +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "commonmark_only"), + freshenv=True, +) +def test_commonmark_only( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, +): + """test setting addition configuration values.""" + app.build() + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert "lexer name '{note}'" in warnings + + try: + get_sphinx_app_doctree(app, docname="index", regress=True) + finally: + get_sphinx_app_output( + app, + filename="index.html", + regress_html=True, + replace={"Permalink to this headline": "Permalink to this heading"}, + ) + + +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "substitutions"), + freshenv=True, +) +def test_substitutions( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, + file_regression, +): + """test setting addition configuration values.""" + app.build() + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + try: + get_sphinx_app_doctree(app, docname="index", regress=True) + file_regression.check( + get_sphinx_app_doctree(app, docname="other").pformat(), + extension=".other.xml", + ) + finally: + get_sphinx_app_output(app, filename="index.html", regress_html=True) + + +@pytest.mark.sphinx( + buildername="gettext", srcdir=os.path.join(SOURCE_DIR, "gettext"), freshenv=True +) +def test_gettext( + app, + status, + warning, + get_sphinx_app_output, + file_regression, +): + """Test gettext message extraction.""" + app.build() + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + output = get_sphinx_app_output(app, filename="index.pot", buildername="gettext") + output = re.sub(r"POT-Creation-Date: [0-9: +-]+", "POT-Creation-Date: ", output) + output = re.sub(r"Copyright \(C\) [0-9]{4}", "Copyright (C) XXXX", output) + + file_regression.check(output, extension=".pot") + + +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "gettext"), + freshenv=True, + confoverrides={"language": "fr", "gettext_compact": False, "locale_dirs": ["."]}, +) +def test_gettext_html( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, +): + """Test gettext message extraction.""" + app.build() + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + try: + get_sphinx_app_doctree( + app, + docname="index", + regress=True, + ) + finally: + get_sphinx_app_doctree( + app, + docname="index", + resolve=True, + regress=True, + ) + get_sphinx_app_output( + app, + filename="index.html", + regress_html=True, + regress_ext=f".sphinx{sphinx.version_info[0]}.html", + ) + + +@pytest.mark.sphinx( + buildername="gettext", + srcdir=os.path.join(SOURCE_DIR, "gettext"), + freshenv=True, + confoverrides={ + "gettext_additional_targets": [ + "index", + "literal-block", + "doctest-block", + "raw", + "image", + ], + }, +) +def test_gettext_additional_targets( + app, + status, + warning, + get_sphinx_app_output, + file_regression, +): + """Test gettext message extraction.""" + app.build() + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + output = get_sphinx_app_output(app, filename="index.pot", buildername="gettext") + output = re.sub(r"POT-Creation-Date: [0-9: +-]+", "POT-Creation-Date: ", output) + output = re.sub(r"Copyright \(C\) [0-9]{4}", "Copyright (C) XXXX", output) + + file_regression.check(output, extension=".pot") + + +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "mathjax"), + freshenv=True, + confoverrides={"myst_enable_extensions": ["dollarmath"]}, +) +def test_mathjax_warning( + app, + status, + warning, +): + """Test mathjax config override warning.""" + app.build() + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert ( + "overridden by myst-parser: 'other' -> 'tex2jax_process|mathjax_process|math|output_area'" + in warnings + ) + + +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "fieldlist"), + freshenv=True, +) +def test_fieldlist_extension( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, +): + """test setting addition configuration values.""" + app.build() + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + try: + get_sphinx_app_doctree( + app, + docname="index", + regress=True, + # changed in: + # https://www.sphinx-doc.org/en/master/changes.html#release-4-4-0-released-jan-17-2022 + replace={ + ( + '<literal_strong py:class="True" ' + 'py:module="True" refspecific="True">' + ): "<literal_strong>" + }, + ) + finally: + get_sphinx_app_output( + app, + filename="index.html", + regress_html=True, + regress_ext=f".sphinx{sphinx.version_info[0]}.html", + ) + + +@pytest.mark.sphinx( + buildername="texinfo", + srcdir=os.path.join(SOURCE_DIR, "texi_table"), + freshenv=True, +) +def test_texinfo_table( + app, + status, + warning, +): + """Test that tables can be built with the Texinfo builder.""" + app.build() + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" diff --git a/tests/test_sphinx/test_sphinx_builds/test_basic.resolved.xml b/tests/test_sphinx/test_sphinx_builds/test_basic.resolved.xml new file mode 100644 index 0000000..8a12765 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_basic.resolved.xml @@ -0,0 +1,154 @@ +<document source="content.md"> + <topic classes="dedication"> + <title> + Dedication + <paragraph> + To my + <emphasis> + homies + + <topic classes="abstract"> + <title> + Abstract + <paragraph> + Something something + <strong> + dark + side + <target refid="target"> + <section classes="tex2jax_ignore mathjax_ignore" ids="header target" names="header target"> + <title> + Header + <comment xml:space="preserve"> + comment + <note> + <paragraph> + abcd + <emphasis> + abc + + <reference refuri="https://www.google.com"> + google + <warning> + <paragraph> + xyz + <admonition classes="admonition-title-with-link-target2"> + <title> + Title with + <reference internal="True" refid="target2"> + <inline classes="std std-ref"> + link + <paragraph> + Content + <target refid="target2"> + <figure ids="id1 target2" names="target2"> + <reference refuri="https://www.google.com"> + <image candidates="{'*': 'example.jpg'}" height="40px" uri="example.jpg"> + <caption> + Caption + <paragraph> + <image alt="alternative text" candidates="{'*': 'example.jpg'}" uri="example.jpg"> + <paragraph> + <reference refuri="https://www.google.com"> + https://www.google.com + <paragraph> + <strong> + <literal classes="code"> + a=1{`} + <paragraph> + <math> + sdfds + <paragraph> + <strong> + <math> + a=1 + <math_block nowrap="False" number="True" xml:space="preserve"> + b=2 + <target refid="equation-eq-label"> + <math_block docname="content" ids="equation-eq-label" label="eq:label" nowrap="False" number="1" xml:space="preserve"> + c=2 + <paragraph> + <reference internal="True" refid="equation-eq-label"> + (1) + <paragraph> + <literal> + a=1{`} + <table classes="colwidths-auto"> + <tgroup cols="2"> + <colspec colwidth="50"> + <colspec colwidth="50"> + <thead> + <row> + <entry> + <paragraph> + a + <entry classes="text-right"> + <paragraph> + b + <tbody> + <row> + <entry> + <paragraph> + <emphasis> + a + <entry classes="text-right"> + <paragraph> + 2 + <row> + <entry> + <paragraph> + <reference refuri="https://google.com"> + link-a + <entry classes="text-right"> + <paragraph> + <reference refuri="https://python.org"> + link-b + <paragraph> + this + + is + + a + + paragraph + <comment xml:space="preserve"> + a comment 2 + <paragraph> + this is a second paragraph + <bullet_list bullet="-"> + <list_item> + <paragraph> + a list + <bullet_list bullet="-"> + <list_item> + <paragraph> + a sub list + <comment xml:space="preserve"> + a comment 3 + <bullet_list bullet="-"> + <list_item> + <paragraph> + new list? + <paragraph> + <reference internal="True" refid="target"> + <inline classes="std std-ref"> + Header + + <reference internal="True" refid="target2"> + <inline classes="std std-ref"> + Caption + <comment classes="block_break" xml:space="preserve"> + a block break + <paragraph> + <reference refuri="https://www.google.com" title="a title"> + name + <literal_block language="default" linenos="False" xml:space="preserve"> + def func(a, b=1): + print(a) + <paragraph> + Special substitution references: + <paragraph> + 57 + words | + 0 + min read diff --git a/tests/test_sphinx/test_sphinx_builds/test_basic.sphinx4.html b/tests/test_sphinx/test_sphinx_builds/test_basic.sphinx4.html new file mode 100644 index 0000000..743f7a1 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_basic.sphinx4.html @@ -0,0 +1,252 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <div class="dedication topic"> + <p class="topic-title"> + Dedication + </p> + <p> + To my + <em> + homies + </em> + </p> + </div> + <div class="abstract topic"> + <p class="topic-title"> + Abstract + </p> + <p> + Something something + <strong> + dark + </strong> + side + </p> + </div> + <section class="tex2jax_ignore mathjax_ignore" id="header"> + <span id="target"> + </span> + <h1> + Header + <a class="headerlink" href="#header" title="Permalink to this headline"> + ¶ + </a> + </h1> + <div class="admonition note"> + <p class="admonition-title"> + Note + </p> + <p> + abcd + <em> + abc + </em> + <a class="reference external" href="https://www.google.com"> + google + </a> + </p> + <div class="admonition warning"> + <p class="admonition-title"> + Warning + </p> + <p> + xyz + </p> + </div> + </div> + <div class="admonition-title-with-link-target2 admonition"> + <p class="admonition-title"> + Title with + <a class="reference internal" href="#target2"> + <span class="std std-ref"> + link + </span> + </a> + </p> + <p> + Content + </p> + </div> + <figure class="align-default" id="id1"> + <span id="target2"> + </span> + <a class="reference external image-reference" href="https://www.google.com"> + <img alt="_images/example.jpg" src="_images/example.jpg" style="height: 40px;"/> + </a> + <figcaption> + <p> + <span class="caption-text"> + Caption + </span> + <a class="headerlink" href="#id1" title="Permalink to this image"> + ¶ + </a> + </p> + </figcaption> + </figure> + <p> + <img alt="alternative text" src="_images/example.jpg"/> + </p> + <p> + <a class="reference external" href="https://www.google.com"> + https://www.google.com + </a> + </p> + <p> + <strong> + <code class="code docutils literal notranslate"> + <span class="pre"> + a=1{`} + </span> + </code> + </strong> + </p> + <p> + <span class="math notranslate nohighlight"> + \(sdfds\) + </span> + </p> + <p> + <strong> + <span class="math notranslate nohighlight"> + \(a=1\) + </span> + </strong> + </p> + <div class="math notranslate nohighlight"> + \[b=2\] + </div> + <div class="math notranslate nohighlight" id="equation-eq-label"> + <span class="eqno"> + (1) + <a class="headerlink" href="#equation-eq-label" title="Permalink to this equation"> + ¶ + </a> + </span> + \[c=2\] + </div> + <p> + <a class="reference internal" href="#equation-eq-label"> + (1) + </a> + </p> + <p> + <code class="docutils literal notranslate"> + <span class="pre"> + a=1{`} + </span> + </code> + </p> + <table class="colwidths-auto docutils align-default"> + <thead> + <tr class="row-odd"> + <th class="head"> + <p> + a + </p> + </th> + <th class="text-right head"> + <p> + b + </p> + </th> + </tr> + </thead> + <tbody> + <tr class="row-even"> + <td> + <p> + <em> + a + </em> + </p> + </td> + <td class="text-right"> + <p> + 2 + </p> + </td> + </tr> + <tr class="row-odd"> + <td> + <p> + <a class="reference external" href="https://google.com"> + link-a + </a> + </p> + </td> + <td class="text-right"> + <p> + <a class="reference external" href="https://python.org"> + link-b + </a> + </p> + </td> + </tr> + </tbody> + </table> + <p> + this +is +a +paragraph + </p> + <p> + this is a second paragraph + </p> + <ul class="simple"> + <li> + <p> + a list + </p> + <ul> + <li> + <p> + a sub list + </p> + </li> + </ul> + </li> + </ul> + <ul class="simple"> + <li> + <p> + new list? + </p> + </li> + </ul> + <p> + <a class="reference internal" href="#target"> + <span class="std std-ref"> + Header + </span> + </a> + <a class="reference internal" href="#target2"> + <span class="std std-ref"> + Caption + </span> + </a> + </p> + <p> + <a class="reference external" href="https://www.google.com"> + name + </a> + </p> + <div class="highlight-default notranslate"> + <div class="highlight"> + <pre><span></span><span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="o">=</span><span class="mi">1</span><span class="p">):</span> + <span class="nb">print</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> +</pre> + </div> + </div> + <p> + Special substitution references: + </p> + <p> + 57 words | 0 min read + </p> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_basic.sphinx5.html b/tests/test_sphinx/test_sphinx_builds/test_basic.sphinx5.html new file mode 100644 index 0000000..9813b70 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_basic.sphinx5.html @@ -0,0 +1,252 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <div class="topic dedication" role="doc-dedication"> + <p class="topic-title"> + Dedication + </p> + <p> + To my + <em> + homies + </em> + </p> + </div> + <div class="topic abstract" role="doc-abstract"> + <p class="topic-title"> + Abstract + </p> + <p> + Something something + <strong> + dark + </strong> + side + </p> + </div> + <section class="tex2jax_ignore mathjax_ignore" id="header"> + <span id="target"> + </span> + <h1> + Header + <a class="headerlink" href="#header" title="Permalink to this heading"> + ¶ + </a> + </h1> + <div class="admonition note"> + <p class="admonition-title"> + Note + </p> + <p> + abcd + <em> + abc + </em> + <a class="reference external" href="https://www.google.com"> + google + </a> + </p> + <div class="admonition warning"> + <p class="admonition-title"> + Warning + </p> + <p> + xyz + </p> + </div> + </div> + <div class="admonition-title-with-link-target2 admonition"> + <p class="admonition-title"> + Title with + <a class="reference internal" href="#target2"> + <span class="std std-ref"> + link + </span> + </a> + </p> + <p> + Content + </p> + </div> + <figure class="align-default" id="id1"> + <span id="target2"> + </span> + <a class="reference external image-reference" href="https://www.google.com"> + <img alt="_images/example.jpg" src="_images/example.jpg" style="height: 40px;"/> + </a> + <figcaption> + <p> + <span class="caption-text"> + Caption + </span> + <a class="headerlink" href="#id1" title="Permalink to this image"> + ¶ + </a> + </p> + </figcaption> + </figure> + <p> + <img alt="alternative text" src="_images/example.jpg"/> + </p> + <p> + <a class="reference external" href="https://www.google.com"> + https://www.google.com + </a> + </p> + <p> + <strong> + <code class="code docutils literal notranslate"> + <span class="pre"> + a=1{`} + </span> + </code> + </strong> + </p> + <p> + <span class="math notranslate nohighlight"> + \(sdfds\) + </span> + </p> + <p> + <strong> + <span class="math notranslate nohighlight"> + \(a=1\) + </span> + </strong> + </p> + <div class="math notranslate nohighlight"> + \[b=2\] + </div> + <div class="math notranslate nohighlight" id="equation-eq-label"> + <span class="eqno"> + (1) + <a class="headerlink" href="#equation-eq-label" title="Permalink to this equation"> + ¶ + </a> + </span> + \[c=2\] + </div> + <p> + <a class="reference internal" href="#equation-eq-label"> + (1) + </a> + </p> + <p> + <code class="docutils literal notranslate"> + <span class="pre"> + a=1{`} + </span> + </code> + </p> + <table class="docutils align-default"> + <thead> + <tr class="row-odd"> + <th class="head"> + <p> + a + </p> + </th> + <th class="head text-right"> + <p> + b + </p> + </th> + </tr> + </thead> + <tbody> + <tr class="row-even"> + <td> + <p> + <em> + a + </em> + </p> + </td> + <td class="text-right"> + <p> + 2 + </p> + </td> + </tr> + <tr class="row-odd"> + <td> + <p> + <a class="reference external" href="https://google.com"> + link-a + </a> + </p> + </td> + <td class="text-right"> + <p> + <a class="reference external" href="https://python.org"> + link-b + </a> + </p> + </td> + </tr> + </tbody> + </table> + <p> + this +is +a +paragraph + </p> + <p> + this is a second paragraph + </p> + <ul class="simple"> + <li> + <p> + a list + </p> + <ul> + <li> + <p> + a sub list + </p> + </li> + </ul> + </li> + </ul> + <ul class="simple"> + <li> + <p> + new list? + </p> + </li> + </ul> + <p> + <a class="reference internal" href="#target"> + <span class="std std-ref"> + Header + </span> + </a> + <a class="reference internal" href="#target2"> + <span class="std std-ref"> + Caption + </span> + </a> + </p> + <p> + <a class="reference external" href="https://www.google.com"> + name + </a> + </p> + <div class="highlight-default notranslate"> + <div class="highlight"> + <pre><span></span><span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="o">=</span><span class="mi">1</span><span class="p">):</span> + <span class="nb">print</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> +</pre> + </div> + </div> + <p> + Special substitution references: + </p> + <p> + 57 words | 0 min read + </p> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_basic.xml b/tests/test_sphinx/test_sphinx_builds/test_basic.xml new file mode 100644 index 0000000..34b0e3c --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_basic.xml @@ -0,0 +1,155 @@ +<document source="content.md"> + <topic classes="dedication"> + <title> + Dedication + <paragraph> + To my + <emphasis> + homies + + <topic classes="abstract"> + <title> + Abstract + <paragraph> + Something something + <strong> + dark + side + <target refid="target"> + <section classes="tex2jax_ignore mathjax_ignore" ids="header target" names="header target"> + <title> + Header + <comment xml:space="preserve"> + comment + <note> + <paragraph> + abcd + <emphasis> + abc + + <reference refuri="https://www.google.com"> + google + <warning> + <paragraph> + xyz + <admonition classes="admonition-title-with-link-target2"> + <title> + Title with + <pending_xref refdoc="content" refdomain="True" refexplicit="True" reftarget="target2" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + link + <paragraph> + Content + <target refid="target2"> + <figure ids="id1 target2" names="target2"> + <reference refuri="https://www.google.com"> + <image candidates="{'*': 'example.jpg'}" height="40px" uri="example.jpg"> + <caption> + Caption + <paragraph> + <image alt="alternative text" candidates="{'*': 'example.jpg'}" uri="example.jpg"> + <paragraph> + <reference refuri="https://www.google.com"> + https://www.google.com + <paragraph> + <strong> + <literal classes="code"> + a=1{`} + <paragraph> + <math> + sdfds + <paragraph> + <strong> + <math> + a=1 + <math_block nowrap="False" number="True" xml:space="preserve"> + b=2 + <target refid="equation-eq-label"> + <math_block docname="content" ids="equation-eq-label" label="eq:label" nowrap="False" number="1" xml:space="preserve"> + c=2 + <paragraph> + <pending_xref refdoc="content" refdomain="math" refexplicit="False" reftarget="eq:label" reftype="eq" refwarn="True"> + <literal classes="xref eq"> + eq:label + <paragraph> + <literal> + a=1{`} + <table classes="colwidths-auto"> + <tgroup cols="2"> + <colspec colwidth="50"> + <colspec colwidth="50"> + <thead> + <row> + <entry> + <paragraph> + a + <entry classes="text-right"> + <paragraph> + b + <tbody> + <row> + <entry> + <paragraph> + <emphasis> + a + <entry classes="text-right"> + <paragraph> + 2 + <row> + <entry> + <paragraph> + <reference refuri="https://google.com"> + link-a + <entry classes="text-right"> + <paragraph> + <reference refuri="https://python.org"> + link-b + <paragraph> + this + + is + + a + + paragraph + <comment xml:space="preserve"> + a comment 2 + <paragraph> + this is a second paragraph + <bullet_list bullet="-"> + <list_item> + <paragraph> + a list + <bullet_list bullet="-"> + <list_item> + <paragraph> + a sub list + <comment xml:space="preserve"> + a comment 3 + <bullet_list bullet="-"> + <list_item> + <paragraph> + new list? + <paragraph> + <pending_xref refdoc="content" refdomain="std" refexplicit="False" reftarget="target" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + target + + <pending_xref refdoc="content" refdomain="std" refexplicit="False" reftarget="target2" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + target2 + <comment classes="block_break" xml:space="preserve"> + a block break + <paragraph> + <reference refuri="https://www.google.com" title="a title"> + name + <literal_block language="default" xml:space="preserve"> + def func(a, b=1): + print(a) + <paragraph> + Special substitution references: + <paragraph> + 57 + words | + 0 + min read diff --git a/tests/test_sphinx/test_sphinx_builds/test_commonmark_only.html b/tests/test_sphinx/test_sphinx_builds/test_commonmark_only.html new file mode 100644 index 0000000..381996f --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_commonmark_only.html @@ -0,0 +1,28 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="test"> + <h1> + Test + <a class="headerlink" href="#test" title="Permalink to this heading"> + ¶ + </a> + </h1> + <div class="highlight-{note} notranslate"> + <div class="highlight"> + <pre><span></span>hallo +</pre> + </div> + </div> + <p> + {a} + <code class="docutils literal notranslate"> + <span class="pre"> + b + </span> + </code> + </p> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_commonmark_only.xml b/tests/test_sphinx/test_sphinx_builds/test_commonmark_only.xml new file mode 100644 index 0000000..d685466 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_commonmark_only.xml @@ -0,0 +1,10 @@ +<document source="index.md"> + <section ids="test" names="test"> + <title> + Test + <literal_block language="{note}" xml:space="preserve"> + hallo + <paragraph> + {a} + <literal> + b diff --git a/tests/test_sphinx/test_sphinx_builds/test_extended_syntaxes.html b/tests/test_sphinx/test_sphinx_builds/test_extended_syntaxes.html new file mode 100644 index 0000000..cc6e85b --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_extended_syntaxes.html @@ -0,0 +1,166 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section class="tex2jax_ignore mathjax_ignore" id="test"> + <h1> + Test + <a class="headerlink" href="#test" title="Permalink to this heading"> + ¶ + </a> + </h1> + <p> + *disabled* + </p> + <p> + <span class="math notranslate nohighlight"> + \(a=1\) + </span> + </p> + <div class="math notranslate nohighlight"> + \[x=5\] + </div> + <div class="math notranslate nohighlight" id="equation-2"> + <span class="eqno"> + (1) + <a class="headerlink" href="#equation-2" title="Permalink to this equation"> + ¶ + </a> + </span> + \[x=5\] + </div> + <p> + $ a=1 $ + </p> + <p> + a + <div class="math notranslate nohighlight"> + \[c=3\] + </div> + b + </p> + <div class="amsmath math notranslate nohighlight" id="equation-mock-uuid"> + <span class="eqno"> + (2) + <a class="headerlink" href="#equation-mock-uuid" title="Permalink to this equation"> + ¶ + </a> + </span> + \[\begin{equation} +b=2 +\end{equation}\] + </div> + <div class="math notranslate nohighlight"> + \[ \begin{align}\begin{aligned}c=3\\d=4\end{aligned}\end{align} \] + </div> + <dl class="simple myst"> + <dt> + Term **1** + </dt> + <dd> + <p> + Definition *1* + </p> + <p> + second paragraph + </p> + </dd> + <dt> + Term 2 + </dt> + <dd> + <p> + Definition 2a + </p> + </dd> + <dd> + <p> + Definition 2b + </p> + </dd> + <dt> + Term 3 + </dt> + <dd> + <div class="highlight-none notranslate"> + <div class="highlight"> + <pre><span></span>code block +</pre> + </div> + </div> + </dd> + <dd> + <blockquote> + <div> + <p> + quote + </p> + </div> + </blockquote> + </dd> + <dd> + <p> + other + </p> + </dd> + </dl> + <figure class="other align-default" id="target"> + <img alt="fun-fish" src="_images/fun-fish.png"/> + <figcaption> + <p> + <span class="caption-text"> + This is a caption in **Markdown** + </span> + <a class="headerlink" href="#target" title="Permalink to this image"> + ¶ + </a> + </p> + </figcaption> + </figure> + <figure class="other align-default" id="other-target"> + <a class="bg-primary mb-1 reference internal image-reference" href="_images/fun-fish.png"> + <img alt="fishy" class="bg-primary mb-1" src="_images/fun-fish.png" style="width: 200px;"/> + </a> + <figcaption> + <p> + <span class="caption-text"> + This is a caption in **Markdown** + </span> + <a class="headerlink" href="#other-target" title="Permalink to this image"> + ¶ + </a> + </p> + </figcaption> + </figure> + <p> + linkify URL: + <a class="reference external" href="http://www.example.com"> + www.example.com + </a> + </p> + <ul class="contains-task-list simple"> + <li class="task-list-item"> + <p> + <input class="task-list-item-checkbox" disabled="disabled" type="checkbox"/> + hallo + </p> + </li> + <li class="task-list-item"> + <p> + <input checked="checked" class="task-list-item-checkbox" disabled="disabled" type="checkbox"/> + there + </p> + </li> + </ul> + <p> + Numbered code block: + </p> + <div class="highlight-typescript notranslate"> + <div class="highlight"> + <pre><span></span><span class="linenos">1</span><span class="kr">type</span> <span class="nx">Result</span> <span class="o">=</span> <span class="s2">"pass"</span> <span class="o">|</span> <span class="s2">"fail"</span> +</pre> + </div> + </div> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_extended_syntaxes.xml b/tests/test_sphinx/test_sphinx_builds/test_extended_syntaxes.xml new file mode 100644 index 0000000..8cefbe3 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_extended_syntaxes.xml @@ -0,0 +1,90 @@ +<document source="index.md"> + <meta content="meta description" lang="en" name="description"> + <meta content="en_US" property="og:locale"> + <section classes="tex2jax_ignore mathjax_ignore" ids="test" names="test"> + <title> + Test + <paragraph> + *disabled* + <paragraph> + <math> + a=1 + <math_block nowrap="False" number="True" xml:space="preserve"> + x=5 + <target refid="equation-2"> + <math_block docname="index" ids="equation-2" label="2" nowrap="False" number="1" xml:space="preserve"> + x=5 + <paragraph> + $ a=1 $ + <paragraph> + a + <math_block nowrap="False" number="True" xml:space="preserve"> + c=3 + b + <target refid="equation-mock-uuid"> + <math_block classes="amsmath" docname="index" ids="equation-mock-uuid" label="mock-uuid" nowrap="True" number="2" xml:space="preserve"> + \begin{equation} + b=2 + \end{equation} + <math_block docname="index" label="True" nowrap="False" number="True" xml:space="preserve"> + c=3 + + d=4 + <definition_list classes="simple myst"> + <definition_list_item> + <term> + Term **1** + <definition> + <paragraph> + Definition *1* + <paragraph> + second paragraph + <definition_list_item> + <term> + Term 2 + <definition> + <paragraph> + Definition 2a + <definition> + <paragraph> + Definition 2b + <definition_list_item> + <term> + Term 3 + <definition> + <literal_block language="none" xml:space="preserve"> + code block + <definition> + <block_quote> + <paragraph> + quote + <definition> + <paragraph> + other + <figure classes="other" ids="target" names="target"> + <image alt="fun-fish" candidates="{'*': 'fun-fish.png'}" uri="fun-fish.png"> + <caption> + This is a caption in **Markdown** + <figure classes="other" ids="other-target" names="other-target"> + <image alt="fishy" candidates="{'*': 'fun-fish.png'}" classes="bg-primary mb-1" uri="fun-fish.png" width="200px"> + <caption> + This is a caption in **Markdown** + <paragraph> + linkify URL: + <reference refuri="http://www.example.com"> + www.example.com + <bullet_list bullet="-" classes="contains-task-list"> + <list_item classes="task-list-item"> + <paragraph> + <raw format="html" xml:space="preserve"> + <input class="task-list-item-checkbox" disabled="disabled" type="checkbox"> + hallo + <list_item classes="task-list-item"> + <paragraph> + <raw format="html" xml:space="preserve"> + <input class="task-list-item-checkbox" checked="checked" disabled="disabled" type="checkbox"> + there + <paragraph> + Numbered code block: + <literal_block language="typescript" linenos="True" xml:space="preserve"> + type Result = "pass" | "fail" diff --git a/tests/test_sphinx/test_sphinx_builds/test_fieldlist_extension.sphinx4.html b/tests/test_sphinx/test_sphinx_builds/test_fieldlist_extension.sphinx4.html new file mode 100644 index 0000000..bef86e9 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_fieldlist_extension.sphinx4.html @@ -0,0 +1,131 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="test"> + <h1> + Test + <a class="headerlink" href="#test" title="Permalink to this headline"> + ¶ + </a> + </h1> + <dl class="myst field-list simple"> + <dt class="field-odd"> + field + </dt> + <dd class="field-odd"> + <p> + </p> + </dd> + <dt class="field-even"> + <em> + field + </em> + </dt> + <dd class="field-even"> + <p> + content + </p> + </dd> + </dl> + <dl class="py function"> + <dt class="sig sig-object py" id="send_message"> + <span class="sig-name descname"> + <span class="pre"> + send_message + </span> + </span> + <span class="sig-paren"> + ( + </span> + <em class="sig-param"> + <span class="n"> + <span class="pre"> + sender + </span> + </span> + </em> + , + <em class="sig-param"> + <span class="n"> + <span class="pre"> + priority + </span> + </span> + </em> + <span class="sig-paren"> + ) + </span> + <a class="headerlink" href="#send_message" title="Permalink to this definition"> + ¶ + </a> + </dt> + <dd> + <p> + Send a message to a recipient + </p> + <dl class="myst field-list simple"> + <dt class="field-odd"> + Parameters + </dt> + <dd class="field-odd"> + <ul class="simple"> + <li> + <p> + <strong> + sender + </strong> + ( + <em> + str + </em> + ) – The person sending the message + </p> + </li> + <li> + <p> + <strong> + priority + </strong> + ( + <em> + int + </em> + ) – The priority of the message, can be a number 1-5 + </p> + </li> + </ul> + </dd> + <dt class="field-even"> + Returns + </dt> + <dd class="field-even"> + <p> + the message id + </p> + </dd> + <dt class="field-odd"> + Return type + </dt> + <dd class="field-odd"> + <p> + int + </p> + </dd> + <dt class="field-even"> + Raises + </dt> + <dd class="field-even"> + <p> + <strong> + ValueError + </strong> + – if the message_body exceeds 160 characters + </p> + </dd> + </dl> + </dd> + </dl> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_fieldlist_extension.sphinx5.html b/tests/test_sphinx/test_sphinx_builds/test_fieldlist_extension.sphinx5.html new file mode 100644 index 0000000..8548f3d --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_fieldlist_extension.sphinx5.html @@ -0,0 +1,149 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="test"> + <h1> + Test + <a class="headerlink" href="#test" title="Permalink to this heading"> + ¶ + </a> + </h1> + <dl class="myst field-list simple"> + <dt class="field-odd"> + field + <span class="colon"> + : + </span> + </dt> + <dd class="field-odd"> + <p> + </p> + </dd> + <dt class="field-even"> + <em> + field + </em> + <span class="colon"> + : + </span> + </dt> + <dd class="field-even"> + <p> + content + </p> + </dd> + </dl> + <dl class="py function"> + <dt class="sig sig-object py" id="send_message"> + <span class="sig-name descname"> + <span class="pre"> + send_message + </span> + </span> + <span class="sig-paren"> + ( + </span> + <em class="sig-param"> + <span class="n"> + <span class="pre"> + sender + </span> + </span> + </em> + , + <em class="sig-param"> + <span class="n"> + <span class="pre"> + priority + </span> + </span> + </em> + <span class="sig-paren"> + ) + </span> + <a class="headerlink" href="#send_message" title="Permalink to this definition"> + ¶ + </a> + </dt> + <dd> + <p> + Send a message to a recipient + </p> + <dl class="myst field-list simple"> + <dt class="field-odd"> + Parameters + <span class="colon"> + : + </span> + </dt> + <dd class="field-odd"> + <ul class="simple"> + <li> + <p> + <strong> + sender + </strong> + ( + <em> + str + </em> + ) – The person sending the message + </p> + </li> + <li> + <p> + <strong> + priority + </strong> + ( + <em> + int + </em> + ) – The priority of the message, can be a number 1-5 + </p> + </li> + </ul> + </dd> + <dt class="field-even"> + Returns + <span class="colon"> + : + </span> + </dt> + <dd class="field-even"> + <p> + the message id + </p> + </dd> + <dt class="field-odd"> + Return type + <span class="colon"> + : + </span> + </dt> + <dd class="field-odd"> + <p> + int + </p> + </dd> + <dt class="field-even"> + Raises + <span class="colon"> + : + </span> + </dt> + <dd class="field-even"> + <p> + <strong> + ValueError + </strong> + – if the message_body exceeds 160 characters + </p> + </dd> + </dl> + </dd> + </dl> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_fieldlist_extension.xml b/tests/test_sphinx/test_sphinx_builds/test_fieldlist_extension.xml new file mode 100644 index 0000000..1fb20d4 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_fieldlist_extension.xml @@ -0,0 +1,82 @@ +<document source="index.md"> + <section ids="test" names="test"> + <title> + Test + <field_list classes="myst"> + <field> + <field_name> + field + <field_body> + <field> + <field_name> + <emphasis> + field + <field_body> + <paragraph> + content + <index entries="('pair',\ 'built-in\ function;\ send_message()',\ 'send_message',\ '',\ None)"> + <desc classes="py function" desctype="function" domain="py" noindex="False" objtype="function"> + <desc_signature class="" classes="sig sig-object" fullname="send_message" ids="send_message" module="True"> + <desc_name classes="sig-name descname" xml:space="preserve"> + send_message + <desc_parameterlist xml:space="preserve"> + <desc_parameter xml:space="preserve"> + <desc_sig_name classes="n"> + sender + <desc_parameter xml:space="preserve"> + <desc_sig_name classes="n"> + priority + <desc_content> + <paragraph> + Send a message to a recipient + <field_list classes="myst"> + <field> + <field_name> + Parameters + <field_body> + <bullet_list> + <list_item> + <paragraph> + <literal_strong> + sender + ( + <pending_xref py:class="True" py:module="True" refdomain="py" refexplicit="False" refspecific="True" reftarget="str" reftype="class"> + <literal_emphasis> + str + ) + – + The person sending the message + <list_item> + <paragraph> + <literal_strong> + priority + ( + <pending_xref py:class="True" py:module="True" refdomain="py" refexplicit="False" refspecific="True" reftarget="int" reftype="class"> + <literal_emphasis> + int + ) + – + The priority of the message, can be a number 1-5 + <field> + <field_name> + Returns + <field_body> + <paragraph> + the message id + <field> + <field_name> + Return type + <field_body> + <paragraph> + <pending_xref py:class="True" py:module="True" refdomain="py" refexplicit="False" refspecific="True" reftarget="int" reftype="class"> + int + <field> + <field_name> + Raises + <field_body> + <paragraph> + <pending_xref py:class="True" py:module="True" refdomain="py" refexplicit="False" refspecific="True" reftarget="ValueError" reftype="exc"> + <literal_strong> + ValueError + – + if the message_body exceeds 160 characters diff --git a/tests/test_sphinx/test_sphinx_builds/test_footnotes.sphinx4.html b/tests/test_sphinx/test_sphinx_builds/test_footnotes.sphinx4.html new file mode 100644 index 0000000..70cfb54 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_footnotes.sphinx4.html @@ -0,0 +1,147 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="footnotes-with-markdown"> + <h1> + Footnotes with Markdown + <a class="headerlink" href="#footnotes-with-markdown" title="Permalink to this headline"> + ¶ + </a> + </h1> + <p> + <a class="footnote-reference brackets" href="#c" id="id1"> + 1 + </a> + </p> + <div class="admonition note"> + <p class="admonition-title"> + Note + </p> + <p> + <a class="footnote-reference brackets" href="#d" id="id2"> + 2 + </a> + </p> + </div> + <p> + <a class="footnote-reference brackets" href="#a" id="id3"> + 3 + </a> + </p> + <p> + <a class="footnote-reference brackets" href="#b" id="id4"> + 4 + </a> + </p> + <p> + <a class="footnote-reference brackets" href="#id8" id="id5"> + 123 + </a> + <a class="footnote-reference brackets" href="#id8" id="id6"> + 123 + </a> + </p> + <p> + <a class="footnote-reference brackets" href="#e" id="id7"> + 5 + </a> + </p> + <blockquote> + <div> + <ul class="simple"> + <li> + </li> + </ul> + </div> + </blockquote> + <hr class="footnotes docutils"/> + <dl class="footnote brackets"> + <dt class="label" id="c"> + <span class="brackets"> + <a class="fn-backref" href="#id1"> + 1 + </a> + </span> + </dt> + <dd> + <p> + a footnote referenced first + </p> + </dd> + <dt class="label" id="d"> + <span class="brackets"> + <a class="fn-backref" href="#id2"> + 2 + </a> + </span> + </dt> + <dd> + <p> + a footnote referenced in a directive + </p> + </dd> + <dt class="label" id="a"> + <span class="brackets"> + <a class="fn-backref" href="#id3"> + 3 + </a> + </span> + </dt> + <dd> + <p> + some footnote + <em> + text + </em> + </p> + </dd> + <dt class="label" id="b"> + <span class="brackets"> + <a class="fn-backref" href="#id4"> + 4 + </a> + </span> + </dt> + <dd> + <p> + a footnote before its reference + </p> + </dd> + <dt class="label" id="id8"> + <span class="brackets"> + 123 + </span> + <span class="fn-backref"> + ( + <a href="#id5"> + 1 + </a> + , + <a href="#id6"> + 2 + </a> + ) + </span> + </dt> + <dd> + <p> + multiple references footnote + </p> + </dd> + <dt class="label" id="e"> + <span class="brackets"> + <a class="fn-backref" href="#id7"> + 5 + </a> + </span> + </dt> + <dd> + <p> + footnote definition in a block element + </p> + </dd> + </dl> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_footnotes.sphinx5.html b/tests/test_sphinx/test_sphinx_builds/test_footnotes.sphinx5.html new file mode 100644 index 0000000..546739c --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_footnotes.sphinx5.html @@ -0,0 +1,213 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="footnotes-with-markdown"> + <h1> + Footnotes with Markdown + <a class="headerlink" href="#footnotes-with-markdown" title="Permalink to this heading"> + ¶ + </a> + </h1> + <p> + <a class="footnote-reference brackets" href="#c" id="id1" role="doc-noteref"> + <span class="fn-bracket"> + [ + </span> + 1 + <span class="fn-bracket"> + ] + </span> + </a> + </p> + <div class="admonition note"> + <p class="admonition-title"> + Note + </p> + <p> + <a class="footnote-reference brackets" href="#d" id="id2" role="doc-noteref"> + <span class="fn-bracket"> + [ + </span> + 2 + <span class="fn-bracket"> + ] + </span> + </a> + </p> + </div> + <p> + <a class="footnote-reference brackets" href="#a" id="id3" role="doc-noteref"> + <span class="fn-bracket"> + [ + </span> + 3 + <span class="fn-bracket"> + ] + </span> + </a> + </p> + <p> + <a class="footnote-reference brackets" href="#b" id="id4" role="doc-noteref"> + <span class="fn-bracket"> + [ + </span> + 4 + <span class="fn-bracket"> + ] + </span> + </a> + </p> + <p> + <a class="footnote-reference brackets" href="#id8" id="id5" role="doc-noteref"> + <span class="fn-bracket"> + [ + </span> + 123 + <span class="fn-bracket"> + ] + </span> + </a> + <a class="footnote-reference brackets" href="#id8" id="id6" role="doc-noteref"> + <span class="fn-bracket"> + [ + </span> + 123 + <span class="fn-bracket"> + ] + </span> + </a> + </p> + <p> + <a class="footnote-reference brackets" href="#e" id="id7" role="doc-noteref"> + <span class="fn-bracket"> + [ + </span> + 5 + <span class="fn-bracket"> + ] + </span> + </a> + </p> + <blockquote> + <div> + <ul class="simple"> + <li> + </li> + </ul> + </div> + </blockquote> + <hr class="footnotes docutils"/> + <aside class="footnote-list brackets"> + <aside class="footnote brackets" id="c" role="note"> + <span class="label"> + <span class="fn-bracket"> + [ + </span> + <a href="#id1" role="doc-backlink"> + 1 + </a> + <span class="fn-bracket"> + ] + </span> + </span> + <p> + a footnote referenced first + </p> + </aside> + <aside class="footnote brackets" id="d" role="note"> + <span class="label"> + <span class="fn-bracket"> + [ + </span> + <a href="#id2" role="doc-backlink"> + 2 + </a> + <span class="fn-bracket"> + ] + </span> + </span> + <p> + a footnote referenced in a directive + </p> + </aside> + <aside class="footnote brackets" id="a" role="note"> + <span class="label"> + <span class="fn-bracket"> + [ + </span> + <a href="#id3" role="doc-backlink"> + 3 + </a> + <span class="fn-bracket"> + ] + </span> + </span> + <p> + some footnote + <em> + text + </em> + </p> + </aside> + <aside class="footnote brackets" id="b" role="note"> + <span class="label"> + <span class="fn-bracket"> + [ + </span> + <a href="#id4" role="doc-backlink"> + 4 + </a> + <span class="fn-bracket"> + ] + </span> + </span> + <p> + a footnote before its reference + </p> + </aside> + <aside class="footnote brackets" id="id8" role="note"> + <span class="label"> + <span class="fn-bracket"> + [ + </span> + 123 + <span class="fn-bracket"> + ] + </span> + </span> + <span class="backrefs"> + ( + <a href="#id5" role="doc-backlink"> + 1 + </a> + , + <a href="#id6" role="doc-backlink"> + 2 + </a> + ) + </span> + <p> + multiple references footnote + </p> + </aside> + <aside class="footnote brackets" id="e" role="note"> + <span class="label"> + <span class="fn-bracket"> + [ + </span> + <a href="#id7" role="doc-backlink"> + 5 + </a> + <span class="fn-bracket"> + ] + </span> + </span> + <p> + footnote definition in a block element + </p> + </aside> + </aside> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_footnotes.xml b/tests/test_sphinx/test_sphinx_builds/test_footnotes.xml new file mode 100644 index 0000000..950d4f8 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_footnotes.xml @@ -0,0 +1,62 @@ +<document source="footnote_md.md"> + <section ids="footnotes-with-markdown" names="footnotes\ with\ markdown"> + <title> + Footnotes with Markdown + <paragraph> + <footnote_reference auto="1" docname="footnote_md" ids="id1" refid="c"> + 1 + <note> + <paragraph> + <footnote_reference auto="1" docname="footnote_md" ids="id2" refid="d"> + 2 + <paragraph> + <footnote_reference auto="1" docname="footnote_md" ids="id3" refid="a"> + 3 + <paragraph> + <footnote_reference auto="1" docname="footnote_md" ids="id4" refid="b"> + 4 + <paragraph> + <footnote_reference docname="footnote_md" ids="id5" refid="id8"> + 123 + + <footnote_reference docname="footnote_md" ids="id6" refid="id8"> + 123 + <paragraph> + <footnote_reference auto="1" docname="footnote_md" ids="id7" refid="e"> + 5 + <block_quote> + <bullet_list bullet="-"> + <list_item> + <transition classes="footnotes"> + <footnote auto="1" backrefs="id1" docname="footnote_md" ids="c" names="c"> + <label> + 1 + <paragraph> + a footnote referenced first + <footnote auto="1" backrefs="id2" docname="footnote_md" ids="d" names="d"> + <label> + 2 + <paragraph> + a footnote referenced in a directive + <footnote auto="1" backrefs="id3" docname="footnote_md" ids="a" names="a"> + <label> + 3 + <paragraph> + some footnote + <emphasis> + text + <footnote auto="1" backrefs="id4" docname="footnote_md" ids="b" names="b"> + <label> + 4 + <paragraph> + a footnote before its reference + <footnote backrefs="id5 id6" docname="footnote_md" ids="id8" names="123"> + <label> + 123 + <paragraph> + multiple references footnote + <footnote auto="1" backrefs="id7" docname="footnote_md" ids="e" names="e"> + <label> + 5 + <paragraph> + footnote definition in a block element diff --git a/tests/test_sphinx/test_sphinx_builds/test_gettext.pot b/tests/test_sphinx/test_sphinx_builds/test_gettext.pot new file mode 100644 index 0000000..933b8b6 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_gettext.pot @@ -0,0 +1,81 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) XXXX, Executable Book Project +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../index.md:1 +msgid "**bold** text 1" +msgstr "" + +#: ../../index.md:3 +msgid "**bold** text 2" +msgstr "" + +#: ../../index.md:5 +msgid "**bold** text 3" +msgstr "" + +#: ../../index.md:10 +msgid "**bold** text 4" +msgstr "" + +#: ../../index.md:13 +msgid "**bold** text 5" +msgstr "" + +#: ../../index.md:15 +msgid "**bold** text 6" +msgstr "" + +#: ../../index.md:17 +msgid "**bold** text 7" +msgstr "" + +#: ../../index.md:18 +msgid "**bold** text 8" +msgstr "" + +#: ../../index.md:0 +msgid "**bold** text 9" +msgstr "" + +#: ../../index.md:0 +msgid "**bold** text 10" +msgstr "" + +#: ../../index.md:26 +msgid "**bold** text 11" +msgstr "" + +#: ../../index.md:28 +msgid "Extra ```backticks```" +msgstr "" + +#: ../../index.md:55 +msgid "![Fun Fish 1](fun-fish.png)" +msgstr "" + +#: ../../index.md:55 +msgid "Fun Fish 1" +msgstr "" + +#: ../../index.md:57 +msgid "Fun Fish 2" +msgstr "" + +#: ../../index.md:61 +msgid "Fun Fish 3" +msgstr "" diff --git a/tests/test_sphinx/test_sphinx_builds/test_gettext_additional_targets.pot b/tests/test_sphinx/test_sphinx_builds/test_gettext_additional_targets.pot new file mode 100644 index 0000000..11c51d4 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_gettext_additional_targets.pot @@ -0,0 +1,129 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) XXXX, Executable Book Project +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../index.md:1 +msgid "**bold** text 1" +msgstr "" + +#: ../../index.md:3 +msgid "**bold** text 2" +msgstr "" + +#: ../../index.md:5 +msgid "**bold** text 3" +msgstr "" + +#: ../../index.md:10 +msgid "**bold** text 4" +msgstr "" + +#: ../../index.md:13 +msgid "**bold** text 5" +msgstr "" + +#: ../../index.md:15 +msgid "**bold** text 6" +msgstr "" + +#: ../../index.md:17 +msgid "**bold** text 7" +msgstr "" + +#: ../../index.md:18 +msgid "**bold** text 8" +msgstr "" + +#: ../../index.md:0 +msgid "**bold** text 9" +msgstr "" + +#: ../../index.md:0 +msgid "**bold** text 10" +msgstr "" + +#: ../../index.md:24 +msgid "<div markdown=1>\n" +"" +msgstr "" + +#: ../../index.md:26 +msgid "**bold** text 11" +msgstr "" + +#: ../../index.md:28 +msgid "Extra ```backticks```" +msgstr "" + +#: ../../index.md:30 +msgid "</div>\n" +"" +msgstr "" + +#: ../../index.md:32 +msgid "**additional** text 12\n" +"" +msgstr "" + +#: ../../index.md:34 +msgid "**additional** text 13\n" +"" +msgstr "" + +#: ../../index.md:38 +msgid "{\n" +" \"additional\": \"text 14\"\n" +"}\n" +"" +msgstr "" + +#: ../../index.md:44 +msgid "<h3>**additional** text 15</h3>\n" +"" +msgstr "" + +#: ../../index.md:46 +msgid ">>> print('doctest block')\n" +"doctest block\n" +"" +msgstr "" + +#: ../../index.md:51 +msgid "<iframe src=\"http://sphinx-doc.org\"></iframe>" +msgstr "" + +#: ../../index.md:55 +msgid "![Fun Fish 1](fun-fish.png)" +msgstr "" + +#: ../../index.md:55 +msgid "Fun Fish 1" +msgstr "" + +#: ../../index.md:55 +#: ../../index.md:57 +#: ../../index.md:61 +msgid ".. image:: fun-fish.png" +msgstr "" + +#: ../../index.md:57 +msgid "Fun Fish 2" +msgstr "" + +#: ../../index.md:61 +msgid "Fun Fish 3" +msgstr "" diff --git a/tests/test_sphinx/test_sphinx_builds/test_gettext_html.resolved.xml b/tests/test_sphinx/test_sphinx_builds/test_gettext_html.resolved.xml new file mode 100644 index 0000000..231ca33 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_gettext_html.resolved.xml @@ -0,0 +1,93 @@ +<document source="index.md"> + <section ids="bold-text-1" names="bold\ text\ 1 texte\ 1\ en\ gras"> + <title> + texte 1 en + <strong> + gras + <paragraph> + texte 2 en + <strong> + gras + <block_quote> + <paragraph> + texte 3 en + <strong> + gras + <note> + <paragraph> + texte 4 en + <strong> + gras + <bullet_list bullet="*"> + <list_item> + <paragraph> + texte 5 en + <strong> + gras + <enumerated_list enumtype="arabic" prefix="" suffix="."> + <list_item> + <paragraph> + texte 6 en + <strong> + gras + <definition_list classes="simple myst"> + <definition_list_item> + <term> + texte 7 en + <strong> + gras + <definition> + <paragraph> + texte 8 en + <strong> + gras + <table classes="colwidths-auto"> + <tgroup cols="1"> + <colspec colwidth="100"> + <thead> + <row> + <entry> + <paragraph> + texte 9 en + <strong> + gras + <tbody> + <row> + <entry> + <paragraph> + texte 10 en + <strong> + gras + <raw format="html" xml:space="preserve"> + <div markdown=1> + <paragraph> + texte 11 en + <strong> + gras + <paragraph> + « + <literal> + Backtick + » supplémentaire + <raw format="html" xml:space="preserve"> + </div> + <literal_block language="none" linenos="False" xml:space="preserve"> + **additional** text 12 + <literal_block language="default" linenos="False" xml:space="preserve"> + **additional** text 13 + <literal_block language="json" linenos="False" xml:space="preserve"> + { + "additional": "text 14" + } + <raw format="html" xml:space="preserve"> + <h3>**additional** text 15</h3> + <literal_block language="python" linenos="False" xml:space="preserve"> + >>> print('doctest block') + doctest block + <raw format="html" xml:space="preserve"> + <iframe src="http://sphinx-doc.org"></iframe> + <paragraph> + <image alt="Poisson amusant 1" candidates="{'*': 'poisson-amusant.png'}" uri="poisson-amusant.png"> + <image alt="Poisson amusant 2" candidates="{'*': 'fun-fish.png'}" uri="fun-fish.png"> + <figure> + <image alt="Poisson amusant 3" candidates="{'*': 'fun-fish.png'}" uri="fun-fish.png"> diff --git a/tests/test_sphinx/test_sphinx_builds/test_gettext_html.sphinx4.html b/tests/test_sphinx/test_sphinx_builds/test_gettext_html.sphinx4.html new file mode 100644 index 0000000..825048a --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_gettext_html.sphinx4.html @@ -0,0 +1,162 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="bold-text-1"> + <h1> + texte 1 en + <strong> + gras + </strong> + <a class="headerlink" href="#bold-text-1" title="Lien permanent vers ce titre"> + ¶ + </a> + </h1> + <p> + texte 2 en + <strong> + gras + </strong> + </p> + <blockquote> + <div> + <p> + texte 3 en + <strong> + gras + </strong> + </p> + </div> + </blockquote> + <div class="admonition note"> + <p class="admonition-title"> + Note + </p> + <p> + texte 4 en + <strong> + gras + </strong> + </p> + </div> + <ul class="simple"> + <li> + <p> + texte 5 en + <strong> + gras + </strong> + </p> + </li> + </ul> + <ol class="arabic simple"> + <li> + <p> + texte 6 en + <strong> + gras + </strong> + </p> + </li> + </ol> + <dl class="simple myst"> + <dt> + texte 7 en + <strong> + gras + </strong> + </dt> + <dd> + <p> + texte 8 en + <strong> + gras + </strong> + </p> + </dd> + </dl> + <table class="colwidths-auto docutils align-default"> + <thead> + <tr class="row-odd"> + <th class="head"> + <p> + texte 9 en + <strong> + gras + </strong> + </p> + </th> + </tr> + </thead> + <tbody> + <tr class="row-even"> + <td> + <p> + texte 10 en + <strong> + gras + </strong> + </p> + </td> + </tr> + </tbody> + </table> + <div markdown="1"> + <p> + texte 11 en + <strong> + gras + </strong> + </p> + <p> + « + <code class="docutils literal notranslate"> + <span class="pre"> + Backtick + </span> + </code> + » supplémentaire + </p> + </div> + <div class="highlight-none notranslate"> + <div class="highlight"> + <pre><span></span>**additional** text 12 +</pre> + </div> + </div> + <div class="highlight-default notranslate"> + <div class="highlight"> + <pre><span></span><span class="o">**</span><span class="n">additional</span><span class="o">**</span> <span class="n">text</span> <span class="mi">13</span> +</pre> + </div> + </div> + <div class="highlight-json notranslate"> + <div class="highlight"> + <pre><span></span><span class="p">{</span> + <span class="nt">"additional"</span><span class="p">:</span> <span class="s2">"text 14"</span> +<span class="p">}</span> +</pre> + </div> + </div> + <h3> + **additional** text 15 + </h3> + <div class="highlight-python notranslate"> + <div class="highlight"> + <pre><span></span><span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="s1">'doctest block'</span><span class="p">)</span> +<span class="go">doctest block</span> +</pre> + </div> + </div> + <iframe src="http://sphinx-doc.org"> + </iframe> + <p> + <img alt="Poisson amusant 1" src="_images/poisson-amusant.png"/> + </p> + <img alt="Poisson amusant 2" src="_images/fun-fish.png"/> + <figure class="align-default"> + <img alt="Poisson amusant 3" src="_images/fun-fish.png"/> + </figure> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_gettext_html.sphinx5.html b/tests/test_sphinx/test_sphinx_builds/test_gettext_html.sphinx5.html new file mode 100644 index 0000000..469e188 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_gettext_html.sphinx5.html @@ -0,0 +1,162 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="bold-text-1"> + <h1> + texte 1 en + <strong> + gras + </strong> + <a class="headerlink" href="#bold-text-1" title="Lien permanent vers cette rubrique"> + ¶ + </a> + </h1> + <p> + texte 2 en + <strong> + gras + </strong> + </p> + <blockquote> + <div> + <p> + texte 3 en + <strong> + gras + </strong> + </p> + </div> + </blockquote> + <div class="admonition note"> + <p class="admonition-title"> + Note + </p> + <p> + texte 4 en + <strong> + gras + </strong> + </p> + </div> + <ul class="simple"> + <li> + <p> + texte 5 en + <strong> + gras + </strong> + </p> + </li> + </ul> + <ol class="arabic simple"> + <li> + <p> + texte 6 en + <strong> + gras + </strong> + </p> + </li> + </ol> + <dl class="simple myst"> + <dt> + texte 7 en + <strong> + gras + </strong> + </dt> + <dd> + <p> + texte 8 en + <strong> + gras + </strong> + </p> + </dd> + </dl> + <table class="docutils align-default"> + <thead> + <tr class="row-odd"> + <th class="head"> + <p> + texte 9 en + <strong> + gras + </strong> + </p> + </th> + </tr> + </thead> + <tbody> + <tr class="row-even"> + <td> + <p> + texte 10 en + <strong> + gras + </strong> + </p> + </td> + </tr> + </tbody> + </table> + <div markdown="1"> + <p> + texte 11 en + <strong> + gras + </strong> + </p> + <p> + « + <code class="docutils literal notranslate"> + <span class="pre"> + Backtick + </span> + </code> + » supplémentaire + </p> + </div> + <div class="highlight-none notranslate"> + <div class="highlight"> + <pre><span></span>**additional** text 12 +</pre> + </div> + </div> + <div class="highlight-default notranslate"> + <div class="highlight"> + <pre><span></span><span class="o">**</span><span class="n">additional</span><span class="o">**</span> <span class="n">text</span> <span class="mi">13</span> +</pre> + </div> + </div> + <div class="highlight-json notranslate"> + <div class="highlight"> + <pre><span></span><span class="p">{</span> + <span class="nt">"additional"</span><span class="p">:</span> <span class="s2">"text 14"</span> +<span class="p">}</span> +</pre> + </div> + </div> + <h3> + **additional** text 15 + </h3> + <div class="highlight-python notranslate"> + <div class="highlight"> + <pre><span></span><span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="s1">'doctest block'</span><span class="p">)</span> +<span class="go">doctest block</span> +</pre> + </div> + </div> + <iframe src="http://sphinx-doc.org"> + </iframe> + <p> + <img alt="Poisson amusant 1" src="_images/poisson-amusant.png"/> + </p> + <img alt="Poisson amusant 2" src="_images/fun-fish.png"/> + <figure class="align-default"> + <img alt="Poisson amusant 3" src="_images/fun-fish.png"/> + </figure> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_gettext_html.xml b/tests/test_sphinx/test_sphinx_builds/test_gettext_html.xml new file mode 100644 index 0000000..dfc5f41 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_gettext_html.xml @@ -0,0 +1,93 @@ +<document source="index.md"> + <section ids="bold-text-1" names="bold\ text\ 1 texte\ 1\ en\ gras"> + <title> + texte 1 en + <strong> + gras + <paragraph> + texte 2 en + <strong> + gras + <block_quote> + <paragraph> + texte 3 en + <strong> + gras + <note> + <paragraph> + texte 4 en + <strong> + gras + <bullet_list bullet="*"> + <list_item> + <paragraph> + texte 5 en + <strong> + gras + <enumerated_list enumtype="arabic" prefix="" suffix="."> + <list_item> + <paragraph> + texte 6 en + <strong> + gras + <definition_list classes="simple myst"> + <definition_list_item> + <term> + texte 7 en + <strong> + gras + <definition> + <paragraph> + texte 8 en + <strong> + gras + <table classes="colwidths-auto"> + <tgroup cols="1"> + <colspec colwidth="100"> + <thead> + <row> + <entry> + <paragraph> + texte 9 en + <strong> + gras + <tbody> + <row> + <entry> + <paragraph> + texte 10 en + <strong> + gras + <raw format="html" xml:space="preserve"> + <div markdown=1> + <paragraph> + texte 11 en + <strong> + gras + <paragraph> + « + <literal> + Backtick + » supplémentaire + <raw format="html" xml:space="preserve"> + </div> + <literal_block language="none" xml:space="preserve"> + **additional** text 12 + <literal_block language="default" xml:space="preserve"> + **additional** text 13 + <literal_block language="json" xml:space="preserve"> + { + "additional": "text 14" + } + <raw format="html" xml:space="preserve"> + <h3>**additional** text 15</h3> + <literal_block language="python" xml:space="preserve"> + >>> print('doctest block') + doctest block + <raw format="html" xml:space="preserve"> + <iframe src="http://sphinx-doc.org"></iframe> + <paragraph> + <image alt="Poisson amusant 1" candidates="{'*': 'poisson-amusant.png'}" uri="poisson-amusant.png"> + <image alt="Poisson amusant 2" candidates="{'*': 'fun-fish.png'}" uri="fun-fish.png"> + <figure> + <image alt="Poisson amusant 3" candidates="{'*': 'fun-fish.png'}" uri="fun-fish.png"> diff --git a/tests/test_sphinx/test_sphinx_builds/test_heading_slug_func.html b/tests/test_sphinx/test_sphinx_builds/test_heading_slug_func.html new file mode 100644 index 0000000..67c4415 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_heading_slug_func.html @@ -0,0 +1,22 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="hyphen-1"> + <h1> + Hyphen - 1 + <a class="headerlink" href="#hyphen-1" title="Permalink to this heading"> + ¶ + </a> + </h1> + <section id="dot-1-1"> + <h2> + Dot 1.1 + <a class="headerlink" href="#dot-1-1" title="Permalink to this heading"> + ¶ + </a> + </h2> + </section> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_heading_slug_func.resolved.xml b/tests/test_sphinx/test_sphinx_builds/test_heading_slug_func.resolved.xml new file mode 100644 index 0000000..e48908d --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_heading_slug_func.resolved.xml @@ -0,0 +1,7 @@ +<document source="index.md"> + <section ids="hyphen-1" myst-anchor="index.md#hyphen-1" names="hyphen\ -\ 1"> + <title> + Hyphen - 1 + <section ids="dot-1-1" myst-anchor="index.md#dot-1-1" names="dot\ 1.1"> + <title> + Dot 1.1 diff --git a/tests/test_sphinx/test_sphinx_builds/test_heading_slug_func.xml b/tests/test_sphinx/test_sphinx_builds/test_heading_slug_func.xml new file mode 100644 index 0000000..e48908d --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_heading_slug_func.xml @@ -0,0 +1,7 @@ +<document source="index.md"> + <section ids="hyphen-1" myst-anchor="index.md#hyphen-1" names="hyphen\ -\ 1"> + <title> + Hyphen - 1 + <section ids="dot-1-1" myst-anchor="index.md#dot-1-1" names="dot\ 1.1"> + <title> + Dot 1.1 diff --git a/tests/test_sphinx/test_sphinx_builds/test_include_from_rst.xml b/tests/test_sphinx/test_sphinx_builds/test_include_from_rst.xml new file mode 100644 index 0000000..9248bd3 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_include_from_rst.xml @@ -0,0 +1,10 @@ +<document source="index.rst"> + <section ids="title" names="title"> + <title> + Title + <section ids="markdown" names="markdown"> + <title> + Markdown + <paragraph> + <reference refuri="http://example.com/"> + target diff --git a/tests/test_sphinx/test_sphinx_builds/test_includes.html b/tests/test_sphinx/test_sphinx_builds/test_includes.html new file mode 100644 index 0000000..41eb1ee --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_includes.html @@ -0,0 +1,135 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="main-title"> + <h1> + Main Title + <a class="headerlink" href="#main-title" title="Permalink to this heading"> + ¶ + </a> + </h1> + <section id="a-sub-heading-in-include"> + <span id="inc-header"> + </span> + <h2> + A Sub-Heading in Include + <a class="headerlink" href="#a-sub-heading-in-include" title="Permalink to this heading"> + ¶ + </a> + </h2> + <p> + Some text with + <em> + syntax + </em> + </p> + </section> + <section id="a-sub-heading-in-nested-include"> + <h2> + A Sub-Heading in Nested Include + <a class="headerlink" href="#a-sub-heading-in-nested-include" title="Permalink to this heading"> + ¶ + </a> + </h2> + <p> + Some other text with + <strong> + syntax + </strong> + </p> + <p> + This relative path will refer to the importing file: + </p> + <figure class="align-default" id="id1"> + <img alt="_images/example1.jpg" src="_images/example1.jpg"/> + <figcaption> + <p> + <span class="caption-text"> + Caption + </span> + <a class="headerlink" href="#id1" title="Permalink to this image"> + ¶ + </a> + </p> + </figcaption> + </figure> + <p> + This absolute path will refer to the project root (where the + <code class="docutils literal notranslate"> + <span class="pre"> + conf.py + </span> + </code> + is): + </p> + <figure class="align-default" id="id2"> + <img alt="_images/example2.jpg" src="_images/example2.jpg"/> + <figcaption> + <p> + <span class="caption-text"> + Caption + </span> + <a class="headerlink" href="#id2" title="Permalink to this image"> + ¶ + </a> + </p> + </figcaption> + </figure> + <p> + <img alt="alt" src="_images/example2.jpg"/> + </p> + <p> + <img alt="alt" src="https://example.com"/> + </p> + <p> + <a class="reference internal" href="#"> + <span class="doc std std-doc"> + text + </span> + </a> + </p> + <p> + <a class="reference internal" href="#inc-header"> + <span class="std std-ref"> + A Sub-Heading in Include + </span> + </a> + </p> + <div class="code python highlight-default notranslate"> + <div class="highlight"> + <pre><span></span><span class="k">def</span> <span class="nf">a_func</span><span class="p">(</span><span class="n">param</span><span class="p">):</span> + <span class="nb">print</span><span class="p">(</span><span class="n">param</span><span class="p">)</span> +</pre> + </div> + </div> + <pre class="code python literal-block"><small class="ln">0 </small><code data-lineno="0 "><span class="keyword">def</span> <span class="name function">a_func</span><span class="punctuation">(</span><span class="name">param</span><span class="punctuation">):</span> +</code><small class="ln">1 </small><code data-lineno="1 "> <span class="name builtin">print</span><span class="punctuation">(</span><span class="name">param</span><span class="punctuation">)</span></code></pre> + <div class="highlight-default notranslate"> + <div class="highlight"> + <pre><span></span><span class="n">This</span> <span class="n">should</span> <span class="n">be</span> <span class="o">*</span><span class="n">literal</span><span class="o">*</span> + +<span class="n">Lots</span> +<span class="n">of</span> +<span class="n">lines</span> +<span class="n">so</span> <span class="n">we</span> <span class="n">can</span> <span class="n">select</span> <span class="n">some</span> +</pre> + </div> + </div> + <pre class="literal-block" id="literal-ref"><span class="ln">0 </span>Lots +<span class="ln">1 </span>of</pre> + <section id="a-sub-sub-heading"> + <h3> + A Sub-sub-Heading + <a class="headerlink" href="#a-sub-sub-heading" title="Permalink to this heading"> + ¶ + </a> + </h3> + <p> + some more text + </p> + </section> + </section> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_includes.xml b/tests/test_sphinx/test_sphinx_builds/test_includes.xml new file mode 100644 index 0000000..1e8779c --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_includes.xml @@ -0,0 +1,113 @@ +<document source="index.md"> + <section ids="main-title" names="main\ title"> + <title> + Main Title + <target refid="inc-header"> + <section ids="a-sub-heading-in-include inc-header" names="a\ sub-heading\ in\ include inc_header"> + <title> + A Sub-Heading in Include + <paragraph> + Some text with + <emphasis> + syntax + <section ids="a-sub-heading-in-nested-include" names="a\ sub-heading\ in\ nested\ include"> + <title> + A Sub-Heading in Nested Include + <paragraph> + Some other text with + <strong> + syntax + <paragraph> + This relative path will refer to the importing file: + <figure ids="id1"> + <image candidates="{'*': 'example1.jpg'}" uri="example1.jpg"> + <caption> + Caption + <paragraph> + This absolute path will refer to the project root (where the + <literal> + conf.py + is): + <figure ids="id2"> + <image candidates="{'*': 'subfolder/example2.jpg'}" uri="subfolder/example2.jpg"> + <caption> + Caption + <paragraph> + <image alt="alt" candidates="{'*': 'subfolder/example2.jpg'}" uri="subfolder/example2.jpg"> + <paragraph> + <image alt="alt" candidates="{'?': 'https://example.com'}" uri="https://example.com"> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="index.md" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + text + <paragraph> + <pending_xref refdoc="index" refdomain="std" refexplicit="False" reftarget="inc_header" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + inc_header + <literal_block classes="code python" source="include_code.py" xml:space="preserve"> + <inline classes="keyword"> + def + + <inline classes="name function"> + a_func + <inline classes="punctuation"> + ( + <inline classes="name"> + param + <inline classes="punctuation"> + ): + + + <inline classes="name builtin"> + print + <inline classes="punctuation"> + ( + <inline classes="name"> + param + <inline classes="punctuation"> + ) + <literal_block classes="code python" source="include_code.py" xml:space="preserve"> + <inline classes="ln"> + 0 + <inline classes="keyword"> + def + + <inline classes="name function"> + a_func + <inline classes="punctuation"> + ( + <inline classes="name"> + param + <inline classes="punctuation"> + ): + + <inline classes="ln"> + 1 + + <inline classes="name builtin"> + print + <inline classes="punctuation"> + ( + <inline classes="name"> + param + <inline classes="punctuation"> + ) + <literal_block source="include_literal.txt" xml:space="preserve"> + This should be *literal* + + Lots + of + lines + so we can select some + <literal_block ids="literal-ref" names="literal_ref" source="include_literal.txt" xml:space="preserve"> + <inline classes="ln"> + 0 + Lots + <inline classes="ln"> + 1 + of + <section ids="a-sub-sub-heading" names="a\ sub-sub-heading"> + <title> + A Sub-sub-Heading + <paragraph> + some more text diff --git a/tests/test_sphinx/test_sphinx_builds/test_references.html b/tests/test_sphinx/test_sphinx_builds/test_references.html new file mode 100644 index 0000000..a6d4036 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_references.html @@ -0,0 +1,195 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section class="tex2jax_ignore mathjax_ignore" id="title-with-nested-a-1"> + <span id="title"> + </span> + <h1> + Title with + <strong> + nested + </strong> + <span class="math notranslate nohighlight"> + \(a=1\) + </span> + <a class="headerlink" href="#title-with-nested-a-1" title="Permalink to this heading"> + ¶ + </a> + </h1> + <p> + <a class="reference external" href="https://example.com"> + </a> + </p> + <p> + <a class="reference external" href="https://example.com"> + plain text + </a> + </p> + <p> + <a class="reference external" href="https://example.com"> + nested + <em> + syntax + </em> + </a> + </p> + <p> + <a class="reference internal" href="#title"> + <span class="std std-ref"> + Title with nested a=1 + </span> + </a> + </p> + <p> + <a class="reference internal" href="#title"> + <span class="std std-ref"> + plain text + </span> + </a> + </p> + <p> + <a class="reference internal" href="#title"> + <span class="std std-ref"> + nested + <em> + syntax + </em> + </span> + </a> + </p> + <p> + <a class="reference internal" href="#"> + <span class="doc std std-doc"> + Title with nested a=1 + </span> + </a> + </p> + <p> + <a class="reference internal" href="#"> + <span class="doc std std-doc"> + plain text + </span> + </a> + </p> + <p> + <a class="reference internal" href="#"> + <span class="doc std std-doc"> + nested + <em> + syntax + </em> + </span> + </a> + </p> + <p> + <a class="reference download internal" download="" href="_downloads/ab0d698fdd2b6a81c34b5ed380fe6f61/file_link.txt"> + <span class="xref download myst"> + download + <strong> + link + </strong> + </span> + </a> + </p> + <p> + <a class="reference download internal" download="" href="_downloads/1952147a8403903cb78cecf56f049085/file_link2.txt"> + <span class="xref download myst"> + subfolder/file_link2.txt + </span> + </a> + </p> + <p id="insidecodeblock"> + I am inside the eval-rst fence + </p> + <p> + Referencing the + <a class="reference internal" href="#title"> + <span class="std std-ref"> + Title with nested a=1 + </span> + </a> + </p> + <p> + Still inside the codeblock + <a class="reference internal" href="#insidecodeblock"> + insidecodeblock + </a> + </p> + <p> + I am outside the + <a class="reference internal" href="#insidecodeblock"> + <span class="std std-ref"> + fence + </span> + </a> + </p> + <section id="title-anchors"> + <h2> + Title + <em> + anchors + </em> + <a class="headerlink" href="#title-anchors" title="Permalink to this heading"> + ¶ + </a> + </h2> + <div class="toctree-wrapper compound"> + <ul> + <li class="toctree-l1"> + <a class="reference internal" href="other.html"> + Title + <em> + anchors + </em> + </a> + </li> + <li class="toctree-l1"> + <a class="reference internal" href="subfolder/other2.html"> + Title + <em> + anchors + </em> + </a> + </li> + </ul> + </div> + <p> + <a class="reference internal" href="#title-anchors"> + <span class="std std-doc"> + Title anchors + </span> + </a> + </p> + <p> + <a class="reference internal" href="#title-anchors"> + <span class="std std-doc"> + Title anchors + </span> + </a> + </p> + <p> + <a class="reference internal" href="other.html#title-anchors"> + <span class="std std-doc"> + Title anchors + </span> + </a> + </p> + <p> + <a class="reference internal" href="other.html#title-anchors"> + <span class="std std-doc"> + Title anchors + </span> + </a> + </p> + <p> + <a class="reference internal" href="subfolder/other2.html#title-anchors"> + <span class="std std-doc"> + Title anchors + </span> + </a> + </p> + </section> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_references.resolved.xml b/tests/test_sphinx/test_sphinx_builds/test_references.resolved.xml new file mode 100644 index 0000000..9c6a4ca --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_references.resolved.xml @@ -0,0 +1,115 @@ +<document source="index.md"> + <target refid="title"> + <section classes="tex2jax_ignore mathjax_ignore" ids="title-with-nested-a-1 title" myst-anchor="index.md#title-with-nested" names="title\ with\ nested\ a=1 title"> + <title> + Title with + <strong> + nested + + <math> + a=1 + <paragraph> + <reference refuri="https://example.com"> + <paragraph> + <reference refuri="https://example.com"> + plain text + <paragraph> + <reference refuri="https://example.com"> + nested + <emphasis> + syntax + <paragraph> + <reference internal="True" refid="title"> + <inline classes="std std-ref"> + Title with nested a=1 + <paragraph> + <reference internal="True" refid="title"> + <inline classes="std std-ref"> + plain text + <paragraph> + <reference internal="True" refid="title"> + <inline classes="std std-ref"> + nested + <emphasis> + syntax + <paragraph> + <reference internal="True" refuri=""> + <inline classes="doc std std-doc"> + Title with nested a=1 + <paragraph> + <reference internal="True" refuri=""> + <inline classes="doc std std-doc"> + plain text + <paragraph> + <reference internal="True" refuri=""> + <inline classes="doc std std-doc"> + nested + <emphasis> + syntax + <paragraph> + <download_reference filename="ab0d698fdd2b6a81c34b5ed380fe6f61/file_link.txt" refdoc="index" refdomain="True" refexplicit="True" reftarget="file_link.txt" reftype="myst" refwarn="False"> + <inline classes="xref download myst"> + download + <strong> + link + <paragraph> + <download_reference filename="1952147a8403903cb78cecf56f049085/file_link2.txt" refdoc="index" refdomain="True" refexplicit="False" reftarget="subfolder/file_link2.txt" reftype="myst" refwarn="False"> + <inline classes="xref download myst"> + subfolder/file_link2.txt + <target refid="insidecodeblock"> + <paragraph ids="insidecodeblock" names="insidecodeblock"> + I am inside the eval-rst fence + <paragraph> + Referencing the + <reference internal="True" refid="title"> + <inline classes="std std-ref"> + Title with nested a=1 + <paragraph> + Still inside the codeblock + <reference name="insidecodeblock" refid="insidecodeblock"> + insidecodeblock + <paragraph> + I am outside the + <reference internal="True" refid="insidecodeblock"> + <inline classes="std std-ref"> + fence + <section ids="title-anchors" myst-anchor="index.md#title-anchors" names="title\ anchors"> + <title> + Title + <emphasis> + anchors + <compound classes="toctree-wrapper"> + <compact_paragraph toctree="True"> + <bullet_list> + <list_item classes="toctree-l1"> + <compact_paragraph classes="toctree-l1"> + <reference anchorname="" internal="True" refuri="other.html"> + Title + <emphasis> + anchors + <list_item classes="toctree-l1"> + <compact_paragraph classes="toctree-l1"> + <reference anchorname="" internal="True" refuri="subfolder/other2.html"> + Title + <emphasis> + anchors + <paragraph> + <reference internal="True" refid="title-anchors"> + <inline classes="std std-doc"> + Title anchors + <paragraph> + <reference internal="True" refid="title-anchors"> + <inline classes="std std-doc"> + Title anchors + <paragraph> + <reference internal="True" refuri="other.html#title-anchors"> + <inline classes="std std-doc"> + Title anchors + <paragraph> + <reference internal="True" refuri="other.html#title-anchors"> + <inline classes="std std-doc"> + Title anchors + <paragraph> + <reference internal="True" refuri="subfolder/other2.html#title-anchors"> + <inline classes="std std-doc"> + Title anchors diff --git a/tests/test_sphinx/test_sphinx_builds/test_references.xml b/tests/test_sphinx/test_sphinx_builds/test_references.xml new file mode 100644 index 0000000..03bfb8d --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_references.xml @@ -0,0 +1,95 @@ +<document source="index.md"> + <target refid="title"> + <section classes="tex2jax_ignore mathjax_ignore" ids="title-with-nested-a-1 title" myst-anchor="index.md#title-with-nested" names="title\ with\ nested\ a=1 title"> + <title> + Title with + <strong> + nested + + <math> + a=1 + <paragraph> + <reference refuri="https://example.com"> + <paragraph> + <reference refuri="https://example.com"> + plain text + <paragraph> + <reference refuri="https://example.com"> + nested + <emphasis> + syntax + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="title" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="title" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + plain text + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="title" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + nested + <emphasis> + syntax + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="index.md" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="index.md" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + plain text + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="index.md" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + nested + <emphasis> + syntax + <paragraph> + <download_reference filename="ab0d698fdd2b6a81c34b5ed380fe6f61/file_link.txt" refdoc="index" refdomain="True" refexplicit="True" reftarget="file_link.txt" reftype="myst" refwarn="False"> + <inline classes="xref download myst"> + download + <strong> + link + <paragraph> + <download_reference filename="1952147a8403903cb78cecf56f049085/file_link2.txt" refdoc="index" refdomain="True" refexplicit="False" reftarget="subfolder/file_link2.txt" reftype="myst" refwarn="False"> + <inline classes="xref download myst"> + subfolder/file_link2.txt + <target refid="insidecodeblock"> + <paragraph ids="insidecodeblock" names="insidecodeblock"> + I am inside the eval-rst fence + <paragraph> + Referencing the + <pending_xref refdoc="index" refdomain="std" refexplicit="False" reftarget="title" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + title + <paragraph> + Still inside the codeblock + <reference name="insidecodeblock" refid="insidecodeblock"> + insidecodeblock + <paragraph> + I am outside the + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="insidecodeblock" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + fence + <section ids="title-anchors" myst-anchor="index.md#title-anchors" names="title\ anchors"> + <title> + Title + <emphasis> + anchors + <compound classes="toctree-wrapper"> + <toctree caption="True" entries="(None,\ 'other') (None,\ 'subfolder/other2')" glob="False" hidden="False" includefiles="other subfolder/other2" includehidden="False" maxdepth="-1" numbered="0" parent="index" rawentries="" titlesonly="False"> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="#title-anchors" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="./#title-anchors" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="./other.md#title-anchors" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="other.md#title-anchors" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="subfolder/other2.md#title-anchors" reftype="myst" refwarn="True"> + <inline classes="xref myst"> diff --git a/tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.html b/tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.html new file mode 100644 index 0000000..b3d98a9 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.html @@ -0,0 +1,111 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="title"> + <h1> + Title + <a class="headerlink" href="#title" title="Permalink to this heading"> + ¶ + </a> + </h1> + <div class="toctree-wrapper compound"> + <span id="document-other/index"> + </span> + <section id="other-index"> + <h2> + Other Index + <a class="headerlink" href="#other-index" title="Permalink to this heading"> + ¶ + </a> + </h2> + <div class="toctree-wrapper compound"> + <span id="document-other/other"> + </span> + <section id="other-title"> + <h3> + Other Title + <a class="headerlink" href="#other-title" title="Permalink to this heading"> + ¶ + </a> + </h3> + <p> + <a class="reference internal" href="index.html#document-other/other2"> + <span class="doc"> + Other 2 Title + </span> + </a> + </p> + <p> + <a class="reference internal" href="index.html#document-other/other2"> + <span class="doc"> + Other 2 Title + </span> + </a> + </p> + <p> + <a class="reference internal" href="index.html#document-other/other2"> + <span class="doc std std-doc"> + Other 2 Title + </span> + </a> + </p> + <p> + <a class="reference internal" href="index.html#title"> + <span class="std std-doc"> + Title + </span> + </a> + </p> + </section> + <span id="document-other/other2"> + </span> + <section id="other-2-title"> + <h3> + Other 2 Title + <a class="headerlink" href="#other-2-title" title="Permalink to this heading"> + ¶ + </a> + </h3> + </section> + </div> + </section> + </div> + <p> + <a class="reference internal" href="index.html#document-other/other"> + <span class="doc"> + Other Title + </span> + </a> + </p> + <p> + <a class="reference internal" href="index.html#document-other/other"> + <span class="doc"> + Other Title + </span> + </a> + </p> + <p> + <a class="reference internal" href="index.html#document-other/other"> + <span class="doc std std-doc"> + Other Title + </span> + </a> + </p> + <p> + <a class="reference internal" href="#title"> + <span class="std std-doc"> + Title + </span> + </a> + </p> + <p> + <a class="reference internal" href="index.html#other-title"> + <span class="std std-doc"> + Other Title + </span> + </a> + </p> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.resolved.xml b/tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.resolved.xml new file mode 100644 index 0000000..606e769 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.resolved.xml @@ -0,0 +1,20 @@ +<document source="other.md"> + <section ids="other-title" myst-anchor="other/other.md#other-title" names="other\ title"> + <title> + Other Title + <paragraph> + <reference internal="True" refuri="index.html#document-other/other2"> + <inline classes="doc"> + Other 2 Title + <paragraph> + <reference internal="True" refuri="index.html#document-other/other2"> + <inline classes="doc doc doc"> + Other 2 Title + <paragraph> + <reference internal="True" refuri="index.html#document-other/other2"> + <inline classes="doc std std-doc"> + Other 2 Title + <paragraph> + <reference internal="True" refuri="index.html#document-index#title"> + <inline classes="std std-doc"> + Title diff --git a/tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.xml b/tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.xml new file mode 100644 index 0000000..a209b4f --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.xml @@ -0,0 +1,18 @@ +<document source="other.md"> + <section ids="other-title" myst-anchor="other/other.md#other-title" names="other\ title"> + <title> + Other Title + <paragraph> + <pending_xref refdoc="other/other" refdomain="std" refexplicit="False" reftarget="other2" reftype="doc" refwarn="True"> + <inline classes="xref std std-doc"> + other2 + <paragraph> + <pending_xref refdoc="other/other" refdomain="" refexplicit="False" reftarget="other2" reftype="any" refwarn="True"> + <literal classes="xref any"> + other2 + <paragraph> + <pending_xref refdoc="other/other" refdomain="True" refexplicit="False" reftarget="./other2.md" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + <paragraph> + <pending_xref refdoc="other/other" refdomain="True" refexplicit="False" reftarget="../index.md#title" reftype="myst" refwarn="True"> + <inline classes="xref myst"> diff --git a/tests/test_sphinx/test_sphinx_builds/test_substitutions.html b/tests/test_sphinx/test_sphinx_builds/test_substitutions.html new file mode 100644 index 0000000..c5b3f43 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_substitutions.html @@ -0,0 +1,82 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <p> + output with + <em> + Markdown + </em> + nested substitution + </p> + <p> + prefix + </p> + <div class="admonition note"> + <p class="admonition-title"> + Note + </p> + <p> + A note nested substitution + </p> + </div> + <p> + a - text b + </p> + <p> + c output with + <em> + Markdown + </em> + nested substitution + d + </p> + <p> + e + <div class="admonition note"> + <p class="admonition-title"> + Note + </p> + <p> + Inline note + </p> + </div> + f + </p> + <p> + This was from the conf + </p> + <p> + Overridden by front matter + </p> + <p> + This will process the substitution + </p> + <pre class="literal-block">output with <em>Markdown</em> nested substitution +</pre> + <p> + This will not process the substitution + </p> + <div class="highlight-python notranslate"> + <div class="highlight"> + <pre><span></span><span class="p">{{</span> <span class="n">text_with_nest</span> <span class="p">}}</span> +</pre> + </div> + </div> + <p> + Using env and filters: + </p> + <p> + INDEX + </p> + <div class="toctree-wrapper compound"> + <ul> + <li class="toctree-l1"> + <a class="reference internal" href="other.html"> + Other + </a> + </li> + </ul> + </div> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_substitutions.other.xml b/tests/test_sphinx/test_sphinx_builds/test_substitutions.other.xml new file mode 100644 index 0000000..b8f94f5 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_substitutions.other.xml @@ -0,0 +1,6 @@ +<document source="other.md"> + <section ids="other" names="other"> + <title> + Other + <paragraph> + From conf diff --git a/tests/test_sphinx/test_sphinx_builds/test_substitutions.xml b/tests/test_sphinx/test_sphinx_builds/test_substitutions.xml new file mode 100644 index 0000000..9a63ee2 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_substitutions.xml @@ -0,0 +1,55 @@ +<document source="index.md"> + <paragraph> + output with + <emphasis> + Markdown + + nested substitution + <paragraph> + prefix + <note> + <paragraph> + A note + nested substitution + <paragraph> + a + - text + b + <paragraph> + c + output with + <emphasis> + Markdown + + nested substitution + + d + <paragraph> + e + <note> + <paragraph> + Inline note + f + <paragraph> + This was from the conf + <paragraph> + Overridden by front matter + <paragraph> + This will process the substitution + <literal_block xml:space="preserve"> + output with + <emphasis> + Markdown + + nested substitution + + <paragraph> + This will not process the substitution + <literal_block language="python" xml:space="preserve"> + {{ text_with_nest }} + <paragraph> + Using env and filters: + <paragraph> + INDEX + <compound classes="toctree-wrapper"> + <toctree caption="True" entries="(None,\ 'other')" glob="False" hidden="False" includefiles="other" includehidden="False" maxdepth="-1" numbered="0" parent="index" rawentries="" titlesonly="False"> |