From d11b75301624f3c59c7243ad1e75243446f5c229 Mon Sep 17 00:00:00 2001 From: Sadaf Ebrahimi Date: Fri, 4 Nov 2022 20:35:11 +0000 Subject: Upgrade markdown to 3.4.1 This project was upgraded with external_updater. Usage: tools/external_updater/updater.sh update markdown For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md Test: TreeHugger Change-Id: I96b25097329b04dcfd580791826971ce299c12f1 --- .codecov.yml | 1 + .coveragerc | 5 + .gitattributes | 7 + .github/workflows/deploy.yml | 53 + .github/workflows/manual_deploy.yml | 30 + .github/workflows/process.yml | 35 + .github/workflows/tox.yml | 88 + .gitignore | 81 +- .spell-dict | 163 + CODE_OF_CONDUCT.md | 49 + INSTALL.md | 9 + LICENSE.md | 29 + MANIFEST.in | 10 +- METADATA | 8 +- MarkdownTest/MarkdownTest.pl | 165 - .../Tests_2004/Amps and angle encoding.html | 17 - .../Tests_2004/Amps and angle encoding.text | 21 - .../Tests_2004/Amps and angle encoding.text-out | 21 - .../Tests_2004/Amps and angle encoding.text-res | 21 - MarkdownTest/Tests_2004/Auto links.html | 18 - MarkdownTest/Tests_2004/Auto links.text | 13 - MarkdownTest/Tests_2004/Auto links.text-out | 28 - MarkdownTest/Tests_2004/Auto links.text-res | 28 - MarkdownTest/Tests_2004/Backslash escapes.html | 102 - MarkdownTest/Tests_2004/Backslash escapes.text | 104 - MarkdownTest/Tests_2004/Backslash escapes.text-out | 79 - MarkdownTest/Tests_2004/Backslash escapes.text-res | 79 - .../Tests_2004/Blockquotes with code blocks.html | 15 - .../Tests_2004/Blockquotes with code blocks.text | 11 - .../Blockquotes with code blocks.text-out | 25 - .../Blockquotes with code blocks.text-res | 25 - ...rd-wrapped paragraphs with list-like lines.html | 8 - ...rd-wrapped paragraphs with list-like lines.text | 8 - ...rapped paragraphs with list-like lines.text-out | 14 - ...rapped paragraphs with list-like lines.text-res | 14 - MarkdownTest/Tests_2004/Horizontal rules.html | 71 - MarkdownTest/Tests_2004/Horizontal rules.text | 67 - MarkdownTest/Tests_2004/Horizontal rules.text-out | 61 - MarkdownTest/Tests_2004/Horizontal rules.text-res | 61 - .../Tests_2004/Inline HTML (Advanced).html | 14 - .../Tests_2004/Inline HTML (Advanced).text | 14 - .../Tests_2004/Inline HTML (Advanced).text-out | 19 - .../Tests_2004/Inline HTML (Advanced).text-res | 19 - MarkdownTest/Tests_2004/Inline HTML (Simple).html | 72 - MarkdownTest/Tests_2004/Inline HTML (Simple).text | 69 - .../Tests_2004/Inline HTML (Simple).text-out | 59 - .../Tests_2004/Inline HTML (Simple).text-res | 59 - MarkdownTest/Tests_2004/Inline HTML comments.html | 13 - MarkdownTest/Tests_2004/Inline HTML comments.text | 13 - .../Tests_2004/Inline HTML comments.text-out | 18 - .../Tests_2004/Inline HTML comments.text-res | 18 - MarkdownTest/Tests_2004/Links, inline style.html | 9 - MarkdownTest/Tests_2004/Links, inline style.text | 9 - .../Tests_2004/Links, inline style.text-out | 17 - .../Tests_2004/Links, inline style.text-res | 17 - .../Tests_2004/Links, reference style.html | 18 - .../Tests_2004/Links, reference style.text | 31 - .../Tests_2004/Links, reference style.text-out | 22 - .../Tests_2004/Links, reference style.text-res | 22 - MarkdownTest/Tests_2004/Links-in-Headers.text-out | 9 - MarkdownTest/Tests_2004/Links-in-Headers.text-res | 9 - .../Tests_2004/Literal quotes in titles.html | 3 - .../Tests_2004/Literal quotes in titles.text | 7 - .../Tests_2004/Literal quotes in titles.text-out | 14 - .../Tests_2004/Literal quotes in titles.text-res | 14 - .../Markdown Documentation - Basics.html | 314 -- .../Markdown Documentation - Basics.text | 306 -- .../Markdown Documentation - Basics.text-out | 321 -- .../Markdown Documentation - Basics.text-res | 321 -- .../Markdown Documentation - Syntax.html | 942 ---- .../Markdown Documentation - Syntax.text | 888 ---- .../Markdown Documentation - Syntax.text-out | 957 ---- .../Markdown Documentation - Syntax.text-res | 957 ---- MarkdownTest/Tests_2004/Nested blockquotes.html | 9 - MarkdownTest/Tests_2004/Nested blockquotes.text | 5 - .../Tests_2004/Nested blockquotes.text-out | 17 - .../Tests_2004/Nested blockquotes.text-res | 17 - .../Tests_2004/Ordered and unordered lists.html | 137 - .../Tests_2004/Ordered and unordered lists.text | 122 - .../Ordered and unordered lists.text-out | 159 - .../Ordered and unordered lists.text-res | 159 - .../Tests_2004/Strong and em together.html | 7 - .../Tests_2004/Strong and em together.text | 7 - .../Tests_2004/Strong and em together.text-out | 14 - .../Tests_2004/Strong and em together.text-res | 14 - MarkdownTest/Tests_2004/Tabs.html | 25 - MarkdownTest/Tests_2004/Tabs.text | 21 - MarkdownTest/Tests_2004/Tabs.text-out | 37 - MarkdownTest/Tests_2004/Tabs.text-res | 37 - MarkdownTest/Tests_2004/Tidyness.html | 8 - MarkdownTest/Tests_2004/Tidyness.text | 5 - MarkdownTest/Tests_2004/Tidyness.text-out | 18 - MarkdownTest/Tests_2004/Tidyness.text-res | 18 - MarkdownTest/Tests_2004/Yuri-Attributes.html | 28 - MarkdownTest/Tests_2004/Yuri-Attributes.text | 19 - MarkdownTest/Tests_2004/Yuri-Attributes.text-out | 29 - MarkdownTest/Tests_2004/Yuri-Attributes.text-res | 29 - MarkdownTest/Tests_2004/Yuri-Attributes.text~ | 24 - MarkdownTest/Tests_2004/Yuri-Email.html | 18 - MarkdownTest/Tests_2004/Yuri-Email.text | 7 - MarkdownTest/Tests_2004/Yuri-Email.text-out | 17 - MarkdownTest/Tests_2004/Yuri-Email.text-res | 17 - MarkdownTest/Tests_2004/Yuri-Footnotes.html | 46 - MarkdownTest/Tests_2004/Yuri-Footnotes.text | 32 - MarkdownTest/Tests_2004/Yuri-Footnotes.text-out | 42 - MarkdownTest/Tests_2004/Yuri-Footnotes.text-res | 55 - MarkdownTest/Tests_2004/Yuri-Links-in-Headers.html | 15 - MarkdownTest/Tests_2004/Yuri-Links-in-Headers.text | 18 - .../Tests_2004/Yuri-Links-in-Headers.text-out | 18 - .../Tests_2004/Yuri-Links-in-Headers.text-res | 18 - .../Tests_2007/Amps and angle encoding.html | 17 - .../Tests_2007/Amps and angle encoding.text | 21 - MarkdownTest/Tests_2007/Auto links.html | 18 - MarkdownTest/Tests_2007/Auto links.text | 13 - MarkdownTest/Tests_2007/Backslash escapes.html | 118 - MarkdownTest/Tests_2007/Backslash escapes.text | 120 - .../Tests_2007/Blockquotes with code blocks.html | 15 - .../Tests_2007/Blockquotes with code blocks.text | 11 - MarkdownTest/Tests_2007/Code Blocks.html | 18 - MarkdownTest/Tests_2007/Code Blocks.text | 14 - MarkdownTest/Tests_2007/Code Spans.html | 5 - MarkdownTest/Tests_2007/Code Spans.text | 5 - ...rd-wrapped paragraphs with list-like lines.html | 8 - ...rd-wrapped paragraphs with list-like lines.text | 8 - MarkdownTest/Tests_2007/Horizontal rules.html | 71 - MarkdownTest/Tests_2007/Horizontal rules.text | 67 - MarkdownTest/Tests_2007/Images.html | 21 - MarkdownTest/Tests_2007/Images.text | 26 - .../Tests_2007/Inline HTML (Advanced).html | 30 - .../Tests_2007/Inline HTML (Advanced).text | 30 - MarkdownTest/Tests_2007/Inline HTML (Simple).html | 72 - MarkdownTest/Tests_2007/Inline HTML (Simple).text | 69 - MarkdownTest/Tests_2007/Inline HTML comments.html | 13 - MarkdownTest/Tests_2007/Inline HTML comments.text | 13 - MarkdownTest/Tests_2007/Links, inline style.html | 23 - MarkdownTest/Tests_2007/Links, inline style.text | 24 - .../Tests_2007/Links, reference style.html | 52 - .../Tests_2007/Links, reference style.text | 71 - .../Tests_2007/Links, shortcut references.html | 9 - .../Tests_2007/Links, shortcut references.text | 20 - .../Tests_2007/Literal quotes in titles.html | 3 - .../Tests_2007/Literal quotes in titles.text | 7 - .../Markdown Documentation - Basics.html | 314 -- .../Markdown Documentation - Basics.text | 306 -- .../Markdown Documentation - Syntax.html | 942 ---- .../Markdown Documentation - Syntax.text | 888 ---- MarkdownTest/Tests_2007/Nested blockquotes.html | 9 - MarkdownTest/Tests_2007/Nested blockquotes.text | 5 - .../Tests_2007/Ordered and unordered lists.html | 148 - .../Tests_2007/Ordered and unordered lists.text | 131 - .../Tests_2007/Strong and em together.html | 7 - .../Tests_2007/Strong and em together.text | 7 - MarkdownTest/Tests_2007/Tabs.html | 25 - MarkdownTest/Tests_2007/Tabs.text | 21 - MarkdownTest/Tests_2007/Tidyness.html | 8 - MarkdownTest/Tests_2007/Tidyness.text | 5 - MarkdownTest/readme.txt | 1 - README.md | 64 + bin/markdown | 42 - checklinks.sh | 31 + checkspelling.sh | 38 + doc-requirements.txt | 2 + docs/AUTHORS | 44 - docs/CHANGE_LOG | 180 - docs/INSTALL | 73 - docs/LICENSE | 30 - docs/README | 30 - docs/README.html | 12 - docs/authors.md | 70 + docs/change_log/index.md | 321 ++ docs/change_log/release-2.0.md | 69 + docs/change_log/release-2.1.md | 118 + docs/change_log/release-2.2.md | 64 + docs/change_log/release-2.3.md | 85 + docs/change_log/release-2.4.md | 73 + docs/change_log/release-2.5.md | 189 + docs/change_log/release-2.6.md | 304 ++ docs/change_log/release-3.0.md | 228 + docs/change_log/release-3.1.md | 48 + docs/change_log/release-3.2.md | 96 + docs/change_log/release-3.3.md | 109 + docs/change_log/release-3.4.md | 113 + docs/cli.md | 189 + docs/command_line.txt | 98 - docs/contributing.md | 561 +++ docs/extensions/Abbreviations.txt | 53 - docs/extensions/CodeHilite.txt | 113 - docs/extensions/Definition_Lists.txt | 55 - docs/extensions/Fenced_Code_Blocks.txt | 63 - docs/extensions/HTML_Tidy.txt | 27 - docs/extensions/HeaderId.txt | 104 - docs/extensions/ImageLinks.txt | 27 - docs/extensions/Meta-Data.txt | 88 - docs/extensions/RSS.txt | 35 - docs/extensions/Tables.txt | 53 - docs/extensions/Tables_of_Contents.txt | 50 - docs/extensions/WikiLinks.txt | 144 - docs/extensions/abbreviations.md | 51 + docs/extensions/admonition.md | 115 + docs/extensions/api.md | 886 ++++ docs/extensions/attr_list.md | 202 + docs/extensions/code_hilite.md | 308 ++ docs/extensions/definition_lists.md | 58 + docs/extensions/extra.md | 62 + docs/extensions/extra.txt | 43 - docs/extensions/fenced_code_blocks.md | 269 ++ docs/extensions/footnotes.md | 133 + docs/extensions/footnotes.txt | 62 - docs/extensions/index.md | 87 + docs/extensions/index.txt | 44 - docs/extensions/legacy_attrs.md | 66 + docs/extensions/legacy_em.md | 31 + docs/extensions/md_in_html.md | 237 + docs/extensions/meta_data.md | 113 + docs/extensions/nl2br.md | 41 + docs/extensions/sane_lists.md | 104 + docs/extensions/smarty.md | 84 + docs/extensions/tables.md | 87 + docs/extensions/toc.md | 232 + docs/extensions/wikilinks.md | 154 + docs/favicon.ico | Bin 0 -> 15086 bytes docs/index.md | 112 + docs/install.md | 32 + docs/py.png | Bin 0 -> 695 bytes docs/reference.md | 269 ++ docs/release-2.0.1.txt | 16 - docs/release-2.0.2.txt | 9 - docs/release-2.0.txt | 67 - docs/test_tools.md | 178 + docs/using_as_module.txt | 150 - docs/writing_extensions.txt | 594 --- makefile | 63 + markdown/__init__.py | 616 +-- markdown/__main__.py | 151 + markdown/__meta__.py | 49 + markdown/blockparser.py | 92 +- markdown/blockprocessors.py | 423 +- markdown/commandline.py | 96 - markdown/core.py | 407 ++ markdown/etree_loader.py | 33 - markdown/extensions/__init__.py | 86 + markdown/extensions/abbr.py | 114 +- markdown/extensions/admonition.py | 170 + markdown/extensions/attr_list.py | 166 + markdown/extensions/codehilite.py | 400 +- markdown/extensions/def_list.py | 87 +- markdown/extensions/extra.py | 53 +- markdown/extensions/fenced_code.py | 223 +- markdown/extensions/footnotes.py | 474 +- markdown/extensions/headerid.py | 195 - markdown/extensions/html_tidy.py | 62 - markdown/extensions/imagelinks.py | 119 - markdown/extensions/legacy_attrs.py | 67 + markdown/extensions/legacy_em.py | 49 + markdown/extensions/md_in_html.py | 364 ++ markdown/extensions/meta.py | 83 +- markdown/extensions/nl2br.py | 33 + markdown/extensions/rss.py | 114 - markdown/extensions/sane_lists.py | 54 + markdown/extensions/smarty.py | 257 ++ markdown/extensions/tables.py | 223 +- markdown/extensions/toc.py | 472 +- markdown/extensions/wikilinks.py | 156 +- markdown/html4.py | 274 -- markdown/htmlparser.py | 323 ++ markdown/inlinepatterns.py | 875 +++- markdown/odict.py | 162 - markdown/postprocessors.py | 124 +- markdown/preprocessors.py | 223 +- markdown/serializers.py | 189 + markdown/test_tools.py | 220 + markdown/treeprocessors.py | 307 +- markdown/util.py | 358 ++ mkdocs.yml | 64 + pyproject.toml | 4 + regression-tests.py | 234 - setup.cfg | 2 + setup.py | 193 +- test-markdown.py | 347 -- tests/__init__.py | 20 + tests/basic/amps-and-angle-encoding.html | 9 + tests/basic/amps-and-angle-encoding.txt | 21 + tests/basic/angle-links-and-img.html | 4 + tests/basic/angle-links-and-img.txt | 4 + tests/basic/auto-links.html | 15 + tests/basic/auto-links.txt | 17 + tests/basic/backlash-escapes.html | 67 + tests/basic/backlash-escapes.txt | 104 + tests/basic/blockquotes-with-code-blocks.html | 12 + tests/basic/blockquotes-with-code-blocks.txt | 11 + tests/basic/codeblock-in-list.html | 14 + tests/basic/codeblock-in-list.txt | 10 + tests/basic/hard-wrapped.html | 7 + tests/basic/hard-wrapped.txt | 8 + tests/basic/horizontal-rules.html | 39 + tests/basic/horizontal-rules.txt | 67 + tests/basic/links-inline.html | 5 + tests/basic/links-inline.txt | 9 + tests/basic/links-reference.html | 22 + tests/basic/links-reference.txt | 61 + tests/basic/literal-quotes.html | 2 + tests/basic/literal-quotes.txt | 7 + tests/basic/markdown-documentation-basics.html | 243 + tests/basic/markdown-documentation-basics.txt | 306 ++ tests/basic/markdown-syntax.html | 728 +++ tests/basic/markdown-syntax.txt | 888 ++++ tests/basic/nested-blockquotes.html | 7 + tests/basic/nested-blockquotes.txt | 5 + tests/basic/ordered-and-unordered-list.html | 146 + tests/basic/ordered-and-unordered-list.txt | 122 + tests/basic/strong-and-em-together.html | 4 + tests/basic/strong-and-em-together.txt | 7 + tests/basic/tabs.html | 23 + tests/basic/tabs.txt | 21 + tests/basic/tidyness.html | 8 + tests/basic/tidyness.txt | 5 + tests/extensions-x-abbr/abbr.html | 4 - tests/extensions-x-abbr/abbr.txt | 13 - tests/extensions-x-codehilite/code.html | 16 - tests/extensions-x-codehilite/code.txt | 12 - tests/extensions-x-def_list/loose_def_list.html | 21 - tests/extensions-x-def_list/loose_def_list.txt | 20 - tests/extensions-x-def_list/markdown-syntax.html | 728 --- tests/extensions-x-def_list/markdown-syntax.txt | 888 ---- tests/extensions-x-def_list/simple_def-lists.html | 37 - tests/extensions-x-def_list/simple_def-lists.txt | 29 - tests/extensions-x-footnotes/footnote.html | 29 - tests/extensions-x-footnotes/footnote.txt | 14 - tests/extensions-x-footnotes/named_markers.html | 24 - tests/extensions-x-footnotes/named_markers.txt | 9 - tests/extensions-x-tables/tables.html | 119 - tests/extensions-x-tables/tables.txt | 34 - tests/extensions-x-toc/invalid.html | 6 - tests/extensions-x-toc/invalid.txt | 9 - tests/extensions-x-toc/nested.html | 16 - tests/extensions-x-toc/nested.txt | 9 - tests/extensions-x-toc/syntax-toc.html | 699 --- tests/extensions-x-toc/syntax-toc.txt | 851 ---- tests/extensions-x-wikilinks/wikilinks.html | 6 - tests/extensions-x-wikilinks/wikilinks.txt | 14 - tests/extensions/admonition.html | 48 + tests/extensions/admonition.txt | 45 + tests/extensions/attr_list.html | 69 + tests/extensions/attr_list.txt | 94 + tests/extensions/codehilite.html | 16 + tests/extensions/codehilite.txt | 12 + tests/extensions/extra/def-in-list.html | 25 + tests/extensions/extra/def-in-list.txt | 15 + tests/extensions/extra/extra_config.html | 9 + tests/extensions/extra/extra_config.txt | 5 + tests/extensions/extra/footnote.html | 71 + tests/extensions/extra/footnote.txt | 62 + .../extensions/extra/footnote_many_footnotes.html | 4801 ++++++++++++++++++++ tests/extensions/extra/footnote_many_footnotes.txt | 4796 +++++++++++++++++++ tests/extensions/extra/footnote_placeholder.html | 9 + tests/extensions/extra/footnote_placeholder.txt | 5 + .../extra/footnote_placeholder_depth.html | 13 + .../extra/footnote_placeholder_depth.txt | 5 + tests/extensions/extra/loose_def_list.html | 31 + tests/extensions/extra/loose_def_list.txt | 31 + tests/extensions/extra/markdown-syntax.html | 728 +++ tests/extensions/extra/markdown-syntax.txt | 888 ++++ tests/extensions/extra/named_markers.html | 20 + tests/extensions/extra/named_markers.txt | 9 + tests/extensions/extra/raw-html.html | 123 + tests/extensions/extra/raw-html.txt | 184 + tests/extensions/extra/simple_def-lists.html | 43 + tests/extensions/extra/simple_def-lists.txt | 35 + tests/extensions/github_flavored.html | 40 + tests/extensions/github_flavored.txt | 45 + tests/extensions/nl2br_w_attr_list.html | 1 + tests/extensions/nl2br_w_attr_list.txt | 2 + tests/extensions/sane_lists.html | 32 + tests/extensions/sane_lists.txt | 26 + tests/extensions/smarty.html | 32 + tests/extensions/smarty.txt | 40 + tests/extensions/toc.html | 699 +++ tests/extensions/toc.txt | 851 ++++ tests/extensions/toc_invalid.html | 6 + tests/extensions/toc_invalid.txt | 9 + tests/extensions/toc_nested.html | 16 + tests/extensions/toc_nested.txt | 9 + tests/extensions/toc_nested2.html | 14 + tests/extensions/toc_nested2.txt | 10 + tests/extensions/toc_nested_list.html | 30 + tests/extensions/toc_nested_list.txt | 19 + tests/extensions/toc_out_of_order.html | 8 + tests/extensions/toc_out_of_order.txt | 5 + tests/extensions/wikilinks.html | 9 + tests/extensions/wikilinks.txt | 14 + tests/html4/html4.html | 2 - tests/html4/html4.txt | 2 - tests/markdown-test/amps-and-angle-encoding.html | 9 - tests/markdown-test/amps-and-angle-encoding.txt | 21 - tests/markdown-test/angle-links-and-img.html | 4 - tests/markdown-test/angle-links-and-img.txt | 4 - tests/markdown-test/auto-links.html | 15 - tests/markdown-test/auto-links.txt | 17 - tests/markdown-test/backlash-escapes.html | 67 - tests/markdown-test/backlash-escapes.txt | 104 - tests/markdown-test/benchmark.dat | 20 - .../blockquotes-with-code-blocks.html | 12 - .../markdown-test/blockquotes-with-code-blocks.txt | 11 - tests/markdown-test/codeblock-in-list.html | 14 - tests/markdown-test/codeblock-in-list.txt | 10 - tests/markdown-test/hard-wrapped.html | 7 - tests/markdown-test/hard-wrapped.txt | 8 - tests/markdown-test/horizontal-rules.html | 39 - tests/markdown-test/horizontal-rules.txt | 67 - tests/markdown-test/inline-html-advanced.html | 12 - tests/markdown-test/inline-html-advanced.txt | 14 - tests/markdown-test/inline-html-comments.html | 11 - tests/markdown-test/inline-html-comments.txt | 13 - tests/markdown-test/inline-html-simple.html | 58 - tests/markdown-test/inline-html-simple.txt | 69 - tests/markdown-test/links-inline.html | 5 - tests/markdown-test/links-inline.txt | 9 - tests/markdown-test/links-reference.html | 10 - tests/markdown-test/links-reference.txt | 31 - tests/markdown-test/literal-quotes.html | 2 - tests/markdown-test/literal-quotes.txt | 7 - .../markdown-documentation-basics.html | 243 - .../markdown-documentation-basics.txt | 306 -- tests/markdown-test/markdown-syntax.html | 728 --- tests/markdown-test/markdown-syntax.txt | 888 ---- tests/markdown-test/nested-blockquotes.html | 7 - tests/markdown-test/nested-blockquotes.txt | 5 - .../markdown-test/ordered-and-unordered-list.html | 146 - tests/markdown-test/ordered-and-unordered-list.txt | 122 - tests/markdown-test/strong-and-em-together.html | 4 - tests/markdown-test/strong-and-em-together.txt | 7 - tests/markdown-test/tabs.html | 23 - tests/markdown-test/tabs.txt | 21 - tests/markdown-test/tidyness.html | 8 - tests/markdown-test/tidyness.txt | 5 - tests/misc/amp-in-url.html | 1 - tests/misc/amp-in-url.txt | 1 - tests/misc/ampersand.html | 2 - tests/misc/ampersand.txt | 5 - tests/misc/attributes2.html | 6 - tests/misc/attributes2.txt | 10 - tests/misc/backtick-escape.html | 5 +- tests/misc/backtick-escape.txt | 5 +- tests/misc/bidi.html | 4 +- tests/misc/bidi.txt | 4 +- tests/misc/blank-block-quote.html | 2 +- tests/misc/blank_lines_in_codeblocks.html | 61 + tests/misc/blank_lines_in_codeblocks.txt | 73 + tests/misc/blockquote-hr.html | 9 + tests/misc/blockquote-hr.txt | 6 + tests/misc/br.html | 2 +- tests/misc/br.txt | 2 +- tests/misc/brackets-in-img-title.html | 9 + tests/misc/brackets-in-img-title.txt | 12 + tests/misc/comments.html | 5 - tests/misc/comments.txt | 7 - tests/misc/div.html | 4 - tests/misc/div.txt | 5 - tests/misc/em-around-links.html | 15 +- tests/misc/em-around-links.txt | 10 +- tests/misc/em_strong.html | 3 +- tests/misc/em_strong.txt | 1 + tests/misc/em_strong_complex.html | 14 + tests/misc/em_strong_complex.txt | 27 + tests/misc/email.html | 3 +- tests/misc/email.txt | 2 + tests/misc/escaped_links.html | 4 + tests/misc/escaped_links.txt | 9 + tests/misc/h1.html | 4 +- tests/misc/h1.txt | 6 + tests/misc/header-in-lists.html | 20 + tests/misc/header-in-lists.txt | 14 + tests/misc/html-comments.html | 2 - tests/misc/html-comments.txt | 2 - tests/misc/html.html | 9 - tests/misc/html.txt | 13 - tests/misc/image.html | 1 - tests/misc/image.txt | 2 - tests/misc/ins-at-start-of-paragraph.html | 1 + tests/misc/ins-at-start-of-paragraph.txt | 1 + tests/misc/lists3.html | 4 +- tests/misc/lists7.html | 98 + tests/misc/lists7.txt | 44 + tests/misc/lists8.html | 39 + tests/misc/lists8.txt | 16 + tests/misc/markup-inside-p.html | 21 - tests/misc/markup-inside-p.txt | 21 - tests/misc/mismatched-tags.html | 11 - tests/misc/mismatched-tags.txt | 9 - tests/misc/more_comments.html | 7 - tests/misc/more_comments.txt | 9 - tests/misc/multi-line-tags.html | 4 - tests/misc/multi-line-tags.txt | 6 - tests/misc/multi-paragraph-block-quote.html | 2 +- tests/misc/multi-test.html | 2 - tests/misc/multi-test.txt | 6 - tests/misc/multiline-comments.html | 16 - tests/misc/multiline-comments.txt | 18 - tests/misc/nested-lists.html | 13 + tests/misc/nested-lists.txt | 9 + tests/misc/nested-patterns.html | 17 +- tests/misc/nested-patterns.txt | 20 +- tests/misc/para-with-hr.html | 5 +- tests/misc/para-with-hr.txt | 3 + tests/misc/php.html | 11 - tests/misc/php.txt | 13 - tests/misc/pre.html | 13 - tests/misc/pre.txt | 14 - tests/misc/some-test.html | 6 +- tests/misc/tabs-in-lists.html | 2 +- tests/misc/two-spaces.html | 6 +- tests/misc/uche.html | 2 +- tests/misc/uche.txt | 3 +- tests/misc/underscores.html | 2 +- tests/php/Auto Links.text | 3 + tests/php/Auto Links.xhtml | 3 + tests/php/Backslash escapes.text | 1 + tests/php/Backslash escapes.xhtml | 1 + tests/php/Code Spans.text | 6 + tests/php/Code Spans.xhtml | 6 + tests/php/Code block in a list item.text | 15 + tests/php/Code block in a list item.xhtml | 18 + tests/php/Code block on second line.text | 2 + tests/php/Code block on second line.xhtml | 2 + tests/php/Email auto links.text | 3 + tests/php/Email auto links.xhtml | 3 + tests/php/Emphasis.text | 80 + tests/php/Emphasis.xhtml | 83 + tests/php/Empty List Item.text | 35 + tests/php/Empty List Item.xhtml | 47 + tests/php/Headers.text | 9 + tests/php/Headers.xhtml | 39 + tests/php/Horizontal Rules.text | 29 + tests/php/Horizontal Rules.xhtml | 30 + tests/php/Inline HTML (Simple).text | 15 + tests/php/Inline HTML (Simple).xhtml | 15 + tests/php/Inline HTML (Span).text | 4 + tests/php/Inline HTML (Span).xhtml | 4 + tests/php/Inline HTML comments.text | 9 + tests/php/Inline HTML comments.xhtml | 9 + tests/php/Ins & del.text | 17 + tests/php/Ins & del.xhtml | 17 + tests/php/License | 339 ++ tests/php/Links, inline style.text | 1 + tests/php/Links, inline style.xhtml | 1 + tests/php/MD5 Hashes.text | 11 + tests/php/MD5 Hashes.xhtml | 11 + tests/php/Mixed OLs and ULs.text | 13 + tests/php/Mixed OLs and ULs.xhtml | 21 + tests/php/Nesting.text | 11 + tests/php/Nesting.xhtml | 11 + tests/php/PHP-Specific Bugs.text | 22 + tests/php/PHP-Specific Bugs.xhtml | 17 + tests/php/Parens in URL.text | 14 + tests/php/Parens in URL.xhtml | 11 + tests/php/Quotes in attributes.text | 5 + tests/php/Quotes in attributes.xhtml | 5 + tests/php/Tight blocks.text | 1 + tests/php/Tight blocks.xhtml | 21 + tests/php/extra/Abbr.text | 31 + tests/php/extra/Abbr.xhtml | 15 + tests/php/extra/Definition Lists.text | 115 + tests/php/extra/Definition Lists.xhtml | 155 + tests/php/extra/Emphasis.text | 80 + tests/php/extra/Emphasis.xhtml | 83 + tests/php/extra/Fenced Code Blocks.text | 60 + tests/php/extra/Fenced Code Blocks.xhtml | 53 + tests/php/extra/Footnotes.text | 61 + tests/php/extra/Footnotes.xhtml | 96 + .../extra/Inline HTML with Markdown content.text | 104 + .../extra/Inline HTML with Markdown content.xhtml | 125 + tests/php/extra/Tables.text | 104 + tests/php/extra/Tables.xhtml | 310 ++ tests/pl/Tests_2004/Amps and angle encoding.html | 17 + tests/pl/Tests_2004/Amps and angle encoding.text | 21 + tests/pl/Tests_2004/Auto links.html | 18 + tests/pl/Tests_2004/Auto links.text | 13 + tests/pl/Tests_2004/Backslash escapes.html | 102 + tests/pl/Tests_2004/Backslash escapes.text | 104 + .../Tests_2004/Blockquotes with code blocks.html | 15 + .../Tests_2004/Blockquotes with code blocks.text | 11 + ...rd-wrapped paragraphs with list-like lines.html | 8 + ...rd-wrapped paragraphs with list-like lines.text | 8 + tests/pl/Tests_2004/Horizontal rules.html | 71 + tests/pl/Tests_2004/Horizontal rules.text | 67 + tests/pl/Tests_2004/Inline HTML (Advanced).html | 14 + tests/pl/Tests_2004/Inline HTML (Advanced).text | 14 + tests/pl/Tests_2004/Inline HTML (Simple).html | 72 + tests/pl/Tests_2004/Inline HTML (Simple).text | 69 + tests/pl/Tests_2004/Inline HTML comments.html | 13 + tests/pl/Tests_2004/Inline HTML comments.text | 13 + tests/pl/Tests_2004/Links, inline style.html | 9 + tests/pl/Tests_2004/Links, inline style.text | 9 + tests/pl/Tests_2004/Links, reference style.html | 18 + tests/pl/Tests_2004/Links, reference style.text | 31 + tests/pl/Tests_2004/Literal quotes in titles.html | 3 + tests/pl/Tests_2004/Literal quotes in titles.text | 7 + .../Markdown Documentation - Basics.html | 314 ++ .../Markdown Documentation - Basics.text | 306 ++ .../Markdown Documentation - Syntax.html | 942 ++++ .../Markdown Documentation - Syntax.text | 888 ++++ tests/pl/Tests_2004/Nested blockquotes.html | 9 + tests/pl/Tests_2004/Nested blockquotes.text | 5 + .../pl/Tests_2004/Ordered and unordered lists.html | 137 + .../pl/Tests_2004/Ordered and unordered lists.text | 122 + tests/pl/Tests_2004/Strong and em together.html | 7 + tests/pl/Tests_2004/Strong and em together.text | 7 + tests/pl/Tests_2004/Tabs.html | 25 + tests/pl/Tests_2004/Tabs.text | 21 + tests/pl/Tests_2004/Tidyness.html | 8 + tests/pl/Tests_2004/Tidyness.text | 5 + tests/pl/Tests_2004/Yuri-Attributes.html | 28 + tests/pl/Tests_2004/Yuri-Attributes.text | 19 + tests/pl/Tests_2004/Yuri-Email.html | 18 + tests/pl/Tests_2004/Yuri-Email.text | 7 + tests/pl/Tests_2004/Yuri-Footnotes.html | 46 + tests/pl/Tests_2004/Yuri-Footnotes.text | 32 + tests/pl/Tests_2004/Yuri-Links-in-Headers.html | 15 + tests/pl/Tests_2004/Yuri-Links-in-Headers.text | 18 + tests/pl/Tests_2007/Amps and angle encoding.html | 17 + tests/pl/Tests_2007/Amps and angle encoding.text | 21 + tests/pl/Tests_2007/Auto links.html | 18 + tests/pl/Tests_2007/Auto links.text | 13 + tests/pl/Tests_2007/Backslash escapes.html | 118 + tests/pl/Tests_2007/Backslash escapes.text | 120 + .../Tests_2007/Blockquotes with code blocks.html | 15 + .../Tests_2007/Blockquotes with code blocks.text | 11 + tests/pl/Tests_2007/Code Blocks.html | 18 + tests/pl/Tests_2007/Code Blocks.text | 14 + tests/pl/Tests_2007/Code Spans.html | 5 + tests/pl/Tests_2007/Code Spans.text | 5 + ...rd-wrapped paragraphs with list-like lines.html | 8 + ...rd-wrapped paragraphs with list-like lines.text | 8 + tests/pl/Tests_2007/Horizontal rules.html | 71 + tests/pl/Tests_2007/Horizontal rules.text | 67 + tests/pl/Tests_2007/Images.html | 21 + tests/pl/Tests_2007/Images.text | 26 + tests/pl/Tests_2007/Inline HTML (Advanced).html | 30 + tests/pl/Tests_2007/Inline HTML (Advanced).text | 30 + tests/pl/Tests_2007/Inline HTML (Simple).html | 72 + tests/pl/Tests_2007/Inline HTML (Simple).text | 69 + tests/pl/Tests_2007/Inline HTML comments.html | 13 + tests/pl/Tests_2007/Inline HTML comments.text | 13 + tests/pl/Tests_2007/Links, inline style.html | 23 + tests/pl/Tests_2007/Links, inline style.text | 24 + tests/pl/Tests_2007/Links, reference style.html | 52 + tests/pl/Tests_2007/Links, reference style.text | 71 + .../pl/Tests_2007/Links, shortcut references.html | 9 + .../pl/Tests_2007/Links, shortcut references.text | 20 + tests/pl/Tests_2007/Literal quotes in titles.html | 3 + tests/pl/Tests_2007/Literal quotes in titles.text | 7 + .../Markdown Documentation - Basics.html | 314 ++ .../Markdown Documentation - Basics.text | 306 ++ .../Markdown Documentation - Syntax.html | 942 ++++ .../Markdown Documentation - Syntax.text | 888 ++++ tests/pl/Tests_2007/Nested blockquotes.html | 9 + tests/pl/Tests_2007/Nested blockquotes.text | 5 + .../pl/Tests_2007/Ordered and unordered lists.html | 148 + .../pl/Tests_2007/Ordered and unordered lists.text | 131 + tests/pl/Tests_2007/Strong and em together.html | 7 + tests/pl/Tests_2007/Strong and em together.text | 7 + tests/pl/Tests_2007/Tabs.html | 25 + tests/pl/Tests_2007/Tabs.text | 21 + tests/pl/Tests_2007/Tidyness.html | 8 + tests/pl/Tests_2007/Tidyness.text | 5 + tests/safe_mode/inline-html-advanced.html | 11 - tests/safe_mode/inline-html-advanced.txt | 14 - tests/safe_mode/inline-html-comments.html | 8 - tests/safe_mode/inline-html-comments.txt | 13 - tests/safe_mode/inline-html-simple.html | 45 - tests/safe_mode/inline-html-simple.txt | 69 - tests/safe_mode/script_tags.html | 28 - tests/safe_mode/script_tags.txt | 33 - tests/safe_mode/unsafe_urls.html | 20 - tests/safe_mode/unsafe_urls.txt | 27 - tests/test_apis.py | 957 ++++ tests/test_extensions.py | 665 +++ tests/test_legacy.py | 194 + tests/test_meta.py | 24 + tests/test_syntax/__init__.py | 20 + tests/test_syntax/blocks/__init__.py | 20 + tests/test_syntax/blocks/test_blockquotes.py | 51 + tests/test_syntax/blocks/test_code_blocks.py | 88 + tests/test_syntax/blocks/test_headers.py | 729 +++ tests/test_syntax/blocks/test_hr.py | 402 ++ tests/test_syntax/blocks/test_html_blocks.py | 1619 +++++++ tests/test_syntax/blocks/test_paragraphs.py | 229 + tests/test_syntax/extensions/__init__.py | 20 + tests/test_syntax/extensions/test_abbr.py | 242 + tests/test_syntax/extensions/test_admonition.py | 245 + tests/test_syntax/extensions/test_attr_list.py | 80 + tests/test_syntax/extensions/test_code_hilite.py | 764 ++++ tests/test_syntax/extensions/test_def_list.py | 323 ++ tests/test_syntax/extensions/test_fenced_code.py | 1020 +++++ tests/test_syntax/extensions/test_footnotes.py | 338 ++ tests/test_syntax/extensions/test_legacy_attrs.py | 67 + tests/test_syntax/extensions/test_legacy_em.py | 66 + tests/test_syntax/extensions/test_md_in_html.py | 1216 +++++ tests/test_syntax/extensions/test_smarty.py | 36 + tests/test_syntax/extensions/test_tables.py | 922 ++++ tests/test_syntax/extensions/test_toc.py | 614 +++ tests/test_syntax/inline/__init__.py | 20 + tests/test_syntax/inline/test_autolinks.py | 63 + tests/test_syntax/inline/test_emphasis.py | 130 + tests/test_syntax/inline/test_entities.py | 43 + tests/test_syntax/inline/test_images.py | 184 + tests/test_syntax/inline/test_links.py | 386 ++ tests/test_syntax/inline/test_raw_html.py | 30 + tox.ini | 43 + 709 files changed, 52815 insertions(+), 25249 deletions(-) create mode 100644 .codecov.yml create mode 100644 .coveragerc create mode 100644 .gitattributes create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/manual_deploy.yml create mode 100644 .github/workflows/process.yml create mode 100644 .github/workflows/tox.yml create mode 100644 .spell-dict create mode 100644 CODE_OF_CONDUCT.md create mode 100644 INSTALL.md create mode 100644 LICENSE.md delete mode 100755 MarkdownTest/MarkdownTest.pl delete mode 100644 MarkdownTest/Tests_2004/Amps and angle encoding.html delete mode 100644 MarkdownTest/Tests_2004/Amps and angle encoding.text delete mode 100644 MarkdownTest/Tests_2004/Amps and angle encoding.text-out delete mode 100644 MarkdownTest/Tests_2004/Amps and angle encoding.text-res delete mode 100644 MarkdownTest/Tests_2004/Auto links.html delete mode 100644 MarkdownTest/Tests_2004/Auto links.text delete mode 100644 MarkdownTest/Tests_2004/Auto links.text-out delete mode 100644 MarkdownTest/Tests_2004/Auto links.text-res delete mode 100644 MarkdownTest/Tests_2004/Backslash escapes.html delete mode 100644 MarkdownTest/Tests_2004/Backslash escapes.text delete mode 100644 MarkdownTest/Tests_2004/Backslash escapes.text-out delete mode 100644 MarkdownTest/Tests_2004/Backslash escapes.text-res delete mode 100644 MarkdownTest/Tests_2004/Blockquotes with code blocks.html delete mode 100644 MarkdownTest/Tests_2004/Blockquotes with code blocks.text delete mode 100644 MarkdownTest/Tests_2004/Blockquotes with code blocks.text-out delete mode 100644 MarkdownTest/Tests_2004/Blockquotes with code blocks.text-res delete mode 100644 MarkdownTest/Tests_2004/Hard-wrapped paragraphs with list-like lines.html delete mode 100644 MarkdownTest/Tests_2004/Hard-wrapped paragraphs with list-like lines.text delete mode 100644 MarkdownTest/Tests_2004/Hard-wrapped paragraphs with list-like lines.text-out delete mode 100644 MarkdownTest/Tests_2004/Hard-wrapped paragraphs with list-like lines.text-res delete mode 100644 MarkdownTest/Tests_2004/Horizontal rules.html delete mode 100644 MarkdownTest/Tests_2004/Horizontal rules.text delete mode 100644 MarkdownTest/Tests_2004/Horizontal rules.text-out delete mode 100644 MarkdownTest/Tests_2004/Horizontal rules.text-res delete mode 100644 MarkdownTest/Tests_2004/Inline HTML (Advanced).html delete mode 100644 MarkdownTest/Tests_2004/Inline HTML (Advanced).text delete mode 100644 MarkdownTest/Tests_2004/Inline HTML (Advanced).text-out delete mode 100644 MarkdownTest/Tests_2004/Inline HTML (Advanced).text-res delete mode 100644 MarkdownTest/Tests_2004/Inline HTML (Simple).html delete mode 100644 MarkdownTest/Tests_2004/Inline HTML (Simple).text delete mode 100644 MarkdownTest/Tests_2004/Inline HTML (Simple).text-out delete mode 100644 MarkdownTest/Tests_2004/Inline HTML (Simple).text-res delete mode 100644 MarkdownTest/Tests_2004/Inline HTML comments.html delete mode 100644 MarkdownTest/Tests_2004/Inline HTML comments.text delete mode 100644 MarkdownTest/Tests_2004/Inline HTML comments.text-out delete mode 100644 MarkdownTest/Tests_2004/Inline HTML comments.text-res delete mode 100644 MarkdownTest/Tests_2004/Links, inline style.html delete mode 100644 MarkdownTest/Tests_2004/Links, inline style.text delete mode 100644 MarkdownTest/Tests_2004/Links, inline style.text-out delete mode 100644 MarkdownTest/Tests_2004/Links, inline style.text-res delete mode 100644 MarkdownTest/Tests_2004/Links, reference style.html delete mode 100644 MarkdownTest/Tests_2004/Links, reference style.text delete mode 100644 MarkdownTest/Tests_2004/Links, reference style.text-out delete mode 100644 MarkdownTest/Tests_2004/Links, reference style.text-res delete mode 100644 MarkdownTest/Tests_2004/Links-in-Headers.text-out delete mode 100644 MarkdownTest/Tests_2004/Links-in-Headers.text-res delete mode 100644 MarkdownTest/Tests_2004/Literal quotes in titles.html delete mode 100644 MarkdownTest/Tests_2004/Literal quotes in titles.text delete mode 100644 MarkdownTest/Tests_2004/Literal quotes in titles.text-out delete mode 100644 MarkdownTest/Tests_2004/Literal quotes in titles.text-res delete mode 100644 MarkdownTest/Tests_2004/Markdown Documentation - Basics.html delete mode 100644 MarkdownTest/Tests_2004/Markdown Documentation - Basics.text delete mode 100644 MarkdownTest/Tests_2004/Markdown Documentation - Basics.text-out delete mode 100644 MarkdownTest/Tests_2004/Markdown Documentation - Basics.text-res delete mode 100644 MarkdownTest/Tests_2004/Markdown Documentation - Syntax.html delete mode 100644 MarkdownTest/Tests_2004/Markdown Documentation - Syntax.text delete mode 100644 MarkdownTest/Tests_2004/Markdown Documentation - Syntax.text-out delete mode 100644 MarkdownTest/Tests_2004/Markdown Documentation - Syntax.text-res delete mode 100644 MarkdownTest/Tests_2004/Nested blockquotes.html delete mode 100644 MarkdownTest/Tests_2004/Nested blockquotes.text delete mode 100644 MarkdownTest/Tests_2004/Nested blockquotes.text-out delete mode 100644 MarkdownTest/Tests_2004/Nested blockquotes.text-res delete mode 100644 MarkdownTest/Tests_2004/Ordered and unordered lists.html delete mode 100644 MarkdownTest/Tests_2004/Ordered and unordered lists.text delete mode 100644 MarkdownTest/Tests_2004/Ordered and unordered lists.text-out delete mode 100644 MarkdownTest/Tests_2004/Ordered and unordered lists.text-res delete mode 100644 MarkdownTest/Tests_2004/Strong and em together.html delete mode 100644 MarkdownTest/Tests_2004/Strong and em together.text delete mode 100644 MarkdownTest/Tests_2004/Strong and em together.text-out delete mode 100644 MarkdownTest/Tests_2004/Strong and em together.text-res delete mode 100644 MarkdownTest/Tests_2004/Tabs.html delete mode 100644 MarkdownTest/Tests_2004/Tabs.text delete mode 100644 MarkdownTest/Tests_2004/Tabs.text-out delete mode 100644 MarkdownTest/Tests_2004/Tabs.text-res delete mode 100644 MarkdownTest/Tests_2004/Tidyness.html delete mode 100644 MarkdownTest/Tests_2004/Tidyness.text delete mode 100644 MarkdownTest/Tests_2004/Tidyness.text-out delete mode 100644 MarkdownTest/Tests_2004/Tidyness.text-res delete mode 100644 MarkdownTest/Tests_2004/Yuri-Attributes.html delete mode 100644 MarkdownTest/Tests_2004/Yuri-Attributes.text delete mode 100644 MarkdownTest/Tests_2004/Yuri-Attributes.text-out delete mode 100644 MarkdownTest/Tests_2004/Yuri-Attributes.text-res delete mode 100644 MarkdownTest/Tests_2004/Yuri-Attributes.text~ delete mode 100644 MarkdownTest/Tests_2004/Yuri-Email.html delete mode 100644 MarkdownTest/Tests_2004/Yuri-Email.text delete mode 100644 MarkdownTest/Tests_2004/Yuri-Email.text-out delete mode 100644 MarkdownTest/Tests_2004/Yuri-Email.text-res delete mode 100644 MarkdownTest/Tests_2004/Yuri-Footnotes.html delete mode 100644 MarkdownTest/Tests_2004/Yuri-Footnotes.text delete mode 100644 MarkdownTest/Tests_2004/Yuri-Footnotes.text-out delete mode 100644 MarkdownTest/Tests_2004/Yuri-Footnotes.text-res delete mode 100644 MarkdownTest/Tests_2004/Yuri-Links-in-Headers.html delete mode 100644 MarkdownTest/Tests_2004/Yuri-Links-in-Headers.text delete mode 100644 MarkdownTest/Tests_2004/Yuri-Links-in-Headers.text-out delete mode 100644 MarkdownTest/Tests_2004/Yuri-Links-in-Headers.text-res delete mode 100644 MarkdownTest/Tests_2007/Amps and angle encoding.html delete mode 100644 MarkdownTest/Tests_2007/Amps and angle encoding.text delete mode 100644 MarkdownTest/Tests_2007/Auto links.html delete mode 100644 MarkdownTest/Tests_2007/Auto links.text delete mode 100644 MarkdownTest/Tests_2007/Backslash escapes.html delete mode 100644 MarkdownTest/Tests_2007/Backslash escapes.text delete mode 100644 MarkdownTest/Tests_2007/Blockquotes with code blocks.html delete mode 100644 MarkdownTest/Tests_2007/Blockquotes with code blocks.text delete mode 100644 MarkdownTest/Tests_2007/Code Blocks.html delete mode 100644 MarkdownTest/Tests_2007/Code Blocks.text delete mode 100644 MarkdownTest/Tests_2007/Code Spans.html delete mode 100644 MarkdownTest/Tests_2007/Code Spans.text delete mode 100644 MarkdownTest/Tests_2007/Hard-wrapped paragraphs with list-like lines.html delete mode 100644 MarkdownTest/Tests_2007/Hard-wrapped paragraphs with list-like lines.text delete mode 100644 MarkdownTest/Tests_2007/Horizontal rules.html delete mode 100644 MarkdownTest/Tests_2007/Horizontal rules.text delete mode 100644 MarkdownTest/Tests_2007/Images.html delete mode 100644 MarkdownTest/Tests_2007/Images.text delete mode 100644 MarkdownTest/Tests_2007/Inline HTML (Advanced).html delete mode 100644 MarkdownTest/Tests_2007/Inline HTML (Advanced).text delete mode 100644 MarkdownTest/Tests_2007/Inline HTML (Simple).html delete mode 100644 MarkdownTest/Tests_2007/Inline HTML (Simple).text delete mode 100644 MarkdownTest/Tests_2007/Inline HTML comments.html delete mode 100644 MarkdownTest/Tests_2007/Inline HTML comments.text delete mode 100644 MarkdownTest/Tests_2007/Links, inline style.html delete mode 100644 MarkdownTest/Tests_2007/Links, inline style.text delete mode 100644 MarkdownTest/Tests_2007/Links, reference style.html delete mode 100644 MarkdownTest/Tests_2007/Links, reference style.text delete mode 100755 MarkdownTest/Tests_2007/Links, shortcut references.html delete mode 100755 MarkdownTest/Tests_2007/Links, shortcut references.text delete mode 100644 MarkdownTest/Tests_2007/Literal quotes in titles.html delete mode 100644 MarkdownTest/Tests_2007/Literal quotes in titles.text delete mode 100644 MarkdownTest/Tests_2007/Markdown Documentation - Basics.html delete mode 100644 MarkdownTest/Tests_2007/Markdown Documentation - Basics.text delete mode 100644 MarkdownTest/Tests_2007/Markdown Documentation - Syntax.html delete mode 100644 MarkdownTest/Tests_2007/Markdown Documentation - Syntax.text delete mode 100644 MarkdownTest/Tests_2007/Nested blockquotes.html delete mode 100644 MarkdownTest/Tests_2007/Nested blockquotes.text delete mode 100644 MarkdownTest/Tests_2007/Ordered and unordered lists.html delete mode 100644 MarkdownTest/Tests_2007/Ordered and unordered lists.text delete mode 100644 MarkdownTest/Tests_2007/Strong and em together.html delete mode 100644 MarkdownTest/Tests_2007/Strong and em together.text delete mode 100644 MarkdownTest/Tests_2007/Tabs.html delete mode 100644 MarkdownTest/Tests_2007/Tabs.text delete mode 100644 MarkdownTest/Tests_2007/Tidyness.html delete mode 100644 MarkdownTest/Tests_2007/Tidyness.text delete mode 100644 MarkdownTest/readme.txt create mode 100644 README.md delete mode 100755 bin/markdown create mode 100755 checklinks.sh create mode 100755 checkspelling.sh create mode 100644 doc-requirements.txt delete mode 100644 docs/AUTHORS delete mode 100644 docs/CHANGE_LOG delete mode 100644 docs/INSTALL delete mode 100644 docs/LICENSE delete mode 100644 docs/README delete mode 100644 docs/README.html create mode 100644 docs/authors.md create mode 100644 docs/change_log/index.md create mode 100644 docs/change_log/release-2.0.md create mode 100644 docs/change_log/release-2.1.md create mode 100644 docs/change_log/release-2.2.md create mode 100644 docs/change_log/release-2.3.md create mode 100644 docs/change_log/release-2.4.md create mode 100644 docs/change_log/release-2.5.md create mode 100644 docs/change_log/release-2.6.md create mode 100644 docs/change_log/release-3.0.md create mode 100644 docs/change_log/release-3.1.md create mode 100644 docs/change_log/release-3.2.md create mode 100644 docs/change_log/release-3.3.md create mode 100644 docs/change_log/release-3.4.md create mode 100644 docs/cli.md delete mode 100644 docs/command_line.txt create mode 100644 docs/contributing.md delete mode 100644 docs/extensions/Abbreviations.txt delete mode 100644 docs/extensions/CodeHilite.txt delete mode 100644 docs/extensions/Definition_Lists.txt delete mode 100644 docs/extensions/Fenced_Code_Blocks.txt delete mode 100644 docs/extensions/HTML_Tidy.txt delete mode 100644 docs/extensions/HeaderId.txt delete mode 100644 docs/extensions/ImageLinks.txt delete mode 100644 docs/extensions/Meta-Data.txt delete mode 100644 docs/extensions/RSS.txt delete mode 100644 docs/extensions/Tables.txt delete mode 100644 docs/extensions/Tables_of_Contents.txt delete mode 100644 docs/extensions/WikiLinks.txt create mode 100644 docs/extensions/abbreviations.md create mode 100644 docs/extensions/admonition.md create mode 100644 docs/extensions/api.md create mode 100644 docs/extensions/attr_list.md create mode 100644 docs/extensions/code_hilite.md create mode 100644 docs/extensions/definition_lists.md create mode 100644 docs/extensions/extra.md delete mode 100644 docs/extensions/extra.txt create mode 100644 docs/extensions/fenced_code_blocks.md create mode 100644 docs/extensions/footnotes.md delete mode 100644 docs/extensions/footnotes.txt create mode 100644 docs/extensions/index.md delete mode 100644 docs/extensions/index.txt create mode 100644 docs/extensions/legacy_attrs.md create mode 100644 docs/extensions/legacy_em.md create mode 100644 docs/extensions/md_in_html.md create mode 100644 docs/extensions/meta_data.md create mode 100644 docs/extensions/nl2br.md create mode 100644 docs/extensions/sane_lists.md create mode 100644 docs/extensions/smarty.md create mode 100644 docs/extensions/tables.md create mode 100644 docs/extensions/toc.md create mode 100644 docs/extensions/wikilinks.md create mode 100644 docs/favicon.ico create mode 100644 docs/index.md create mode 100644 docs/install.md create mode 100644 docs/py.png create mode 100644 docs/reference.md delete mode 100644 docs/release-2.0.1.txt delete mode 100644 docs/release-2.0.2.txt delete mode 100644 docs/release-2.0.txt create mode 100644 docs/test_tools.md delete mode 100644 docs/using_as_module.txt delete mode 100644 docs/writing_extensions.txt create mode 100644 makefile create mode 100644 markdown/__main__.py create mode 100644 markdown/__meta__.py delete mode 100644 markdown/commandline.py create mode 100644 markdown/core.py delete mode 100644 markdown/etree_loader.py create mode 100644 markdown/extensions/admonition.py create mode 100644 markdown/extensions/attr_list.py delete mode 100644 markdown/extensions/headerid.py delete mode 100644 markdown/extensions/html_tidy.py delete mode 100644 markdown/extensions/imagelinks.py create mode 100644 markdown/extensions/legacy_attrs.py create mode 100644 markdown/extensions/legacy_em.py create mode 100644 markdown/extensions/md_in_html.py create mode 100644 markdown/extensions/nl2br.py delete mode 100644 markdown/extensions/rss.py create mode 100644 markdown/extensions/sane_lists.py create mode 100644 markdown/extensions/smarty.py delete mode 100644 markdown/html4.py create mode 100644 markdown/htmlparser.py delete mode 100644 markdown/odict.py create mode 100644 markdown/serializers.py create mode 100644 markdown/test_tools.py create mode 100644 markdown/util.py create mode 100644 mkdocs.yml create mode 100644 pyproject.toml delete mode 100755 regression-tests.py create mode 100644 setup.cfg delete mode 100755 test-markdown.py create mode 100644 tests/__init__.py create mode 100644 tests/basic/amps-and-angle-encoding.html create mode 100644 tests/basic/amps-and-angle-encoding.txt create mode 100644 tests/basic/angle-links-and-img.html create mode 100644 tests/basic/angle-links-and-img.txt create mode 100644 tests/basic/auto-links.html create mode 100644 tests/basic/auto-links.txt create mode 100644 tests/basic/backlash-escapes.html create mode 100644 tests/basic/backlash-escapes.txt create mode 100644 tests/basic/blockquotes-with-code-blocks.html create mode 100644 tests/basic/blockquotes-with-code-blocks.txt create mode 100644 tests/basic/codeblock-in-list.html create mode 100644 tests/basic/codeblock-in-list.txt create mode 100644 tests/basic/hard-wrapped.html create mode 100644 tests/basic/hard-wrapped.txt create mode 100644 tests/basic/horizontal-rules.html create mode 100644 tests/basic/horizontal-rules.txt create mode 100644 tests/basic/links-inline.html create mode 100644 tests/basic/links-inline.txt create mode 100644 tests/basic/links-reference.html create mode 100644 tests/basic/links-reference.txt create mode 100644 tests/basic/literal-quotes.html create mode 100644 tests/basic/literal-quotes.txt create mode 100644 tests/basic/markdown-documentation-basics.html create mode 100644 tests/basic/markdown-documentation-basics.txt create mode 100644 tests/basic/markdown-syntax.html create mode 100644 tests/basic/markdown-syntax.txt create mode 100644 tests/basic/nested-blockquotes.html create mode 100644 tests/basic/nested-blockquotes.txt create mode 100644 tests/basic/ordered-and-unordered-list.html create mode 100644 tests/basic/ordered-and-unordered-list.txt create mode 100644 tests/basic/strong-and-em-together.html create mode 100644 tests/basic/strong-and-em-together.txt create mode 100644 tests/basic/tabs.html create mode 100644 tests/basic/tabs.txt create mode 100644 tests/basic/tidyness.html create mode 100644 tests/basic/tidyness.txt delete mode 100644 tests/extensions-x-abbr/abbr.html delete mode 100644 tests/extensions-x-abbr/abbr.txt delete mode 100644 tests/extensions-x-codehilite/code.html delete mode 100644 tests/extensions-x-codehilite/code.txt delete mode 100644 tests/extensions-x-def_list/loose_def_list.html delete mode 100644 tests/extensions-x-def_list/loose_def_list.txt delete mode 100644 tests/extensions-x-def_list/markdown-syntax.html delete mode 100644 tests/extensions-x-def_list/markdown-syntax.txt delete mode 100644 tests/extensions-x-def_list/simple_def-lists.html delete mode 100644 tests/extensions-x-def_list/simple_def-lists.txt delete mode 100644 tests/extensions-x-footnotes/footnote.html delete mode 100644 tests/extensions-x-footnotes/footnote.txt delete mode 100644 tests/extensions-x-footnotes/named_markers.html delete mode 100644 tests/extensions-x-footnotes/named_markers.txt delete mode 100644 tests/extensions-x-tables/tables.html delete mode 100644 tests/extensions-x-tables/tables.txt delete mode 100644 tests/extensions-x-toc/invalid.html delete mode 100644 tests/extensions-x-toc/invalid.txt delete mode 100644 tests/extensions-x-toc/nested.html delete mode 100644 tests/extensions-x-toc/nested.txt delete mode 100644 tests/extensions-x-toc/syntax-toc.html delete mode 100644 tests/extensions-x-toc/syntax-toc.txt delete mode 100644 tests/extensions-x-wikilinks/wikilinks.html delete mode 100644 tests/extensions-x-wikilinks/wikilinks.txt create mode 100644 tests/extensions/admonition.html create mode 100644 tests/extensions/admonition.txt create mode 100644 tests/extensions/attr_list.html create mode 100644 tests/extensions/attr_list.txt create mode 100644 tests/extensions/codehilite.html create mode 100644 tests/extensions/codehilite.txt create mode 100644 tests/extensions/extra/def-in-list.html create mode 100644 tests/extensions/extra/def-in-list.txt create mode 100644 tests/extensions/extra/extra_config.html create mode 100644 tests/extensions/extra/extra_config.txt create mode 100644 tests/extensions/extra/footnote.html create mode 100644 tests/extensions/extra/footnote.txt create mode 100644 tests/extensions/extra/footnote_many_footnotes.html create mode 100644 tests/extensions/extra/footnote_many_footnotes.txt create mode 100644 tests/extensions/extra/footnote_placeholder.html create mode 100644 tests/extensions/extra/footnote_placeholder.txt create mode 100644 tests/extensions/extra/footnote_placeholder_depth.html create mode 100644 tests/extensions/extra/footnote_placeholder_depth.txt create mode 100644 tests/extensions/extra/loose_def_list.html create mode 100644 tests/extensions/extra/loose_def_list.txt create mode 100644 tests/extensions/extra/markdown-syntax.html create mode 100644 tests/extensions/extra/markdown-syntax.txt create mode 100644 tests/extensions/extra/named_markers.html create mode 100644 tests/extensions/extra/named_markers.txt create mode 100644 tests/extensions/extra/raw-html.html create mode 100644 tests/extensions/extra/raw-html.txt create mode 100644 tests/extensions/extra/simple_def-lists.html create mode 100644 tests/extensions/extra/simple_def-lists.txt create mode 100644 tests/extensions/github_flavored.html create mode 100644 tests/extensions/github_flavored.txt create mode 100644 tests/extensions/nl2br_w_attr_list.html create mode 100644 tests/extensions/nl2br_w_attr_list.txt create mode 100644 tests/extensions/sane_lists.html create mode 100644 tests/extensions/sane_lists.txt create mode 100644 tests/extensions/smarty.html create mode 100644 tests/extensions/smarty.txt create mode 100644 tests/extensions/toc.html create mode 100644 tests/extensions/toc.txt create mode 100644 tests/extensions/toc_invalid.html create mode 100644 tests/extensions/toc_invalid.txt create mode 100644 tests/extensions/toc_nested.html create mode 100644 tests/extensions/toc_nested.txt create mode 100644 tests/extensions/toc_nested2.html create mode 100644 tests/extensions/toc_nested2.txt create mode 100644 tests/extensions/toc_nested_list.html create mode 100644 tests/extensions/toc_nested_list.txt create mode 100644 tests/extensions/toc_out_of_order.html create mode 100644 tests/extensions/toc_out_of_order.txt create mode 100644 tests/extensions/wikilinks.html create mode 100644 tests/extensions/wikilinks.txt delete mode 100644 tests/html4/html4.html delete mode 100644 tests/html4/html4.txt delete mode 100644 tests/markdown-test/amps-and-angle-encoding.html delete mode 100644 tests/markdown-test/amps-and-angle-encoding.txt delete mode 100644 tests/markdown-test/angle-links-and-img.html delete mode 100644 tests/markdown-test/angle-links-and-img.txt delete mode 100644 tests/markdown-test/auto-links.html delete mode 100644 tests/markdown-test/auto-links.txt delete mode 100644 tests/markdown-test/backlash-escapes.html delete mode 100644 tests/markdown-test/backlash-escapes.txt delete mode 100644 tests/markdown-test/benchmark.dat delete mode 100644 tests/markdown-test/blockquotes-with-code-blocks.html delete mode 100644 tests/markdown-test/blockquotes-with-code-blocks.txt delete mode 100644 tests/markdown-test/codeblock-in-list.html delete mode 100644 tests/markdown-test/codeblock-in-list.txt delete mode 100644 tests/markdown-test/hard-wrapped.html delete mode 100644 tests/markdown-test/hard-wrapped.txt delete mode 100644 tests/markdown-test/horizontal-rules.html delete mode 100644 tests/markdown-test/horizontal-rules.txt delete mode 100644 tests/markdown-test/inline-html-advanced.html delete mode 100644 tests/markdown-test/inline-html-advanced.txt delete mode 100644 tests/markdown-test/inline-html-comments.html delete mode 100644 tests/markdown-test/inline-html-comments.txt delete mode 100644 tests/markdown-test/inline-html-simple.html delete mode 100644 tests/markdown-test/inline-html-simple.txt delete mode 100644 tests/markdown-test/links-inline.html delete mode 100644 tests/markdown-test/links-inline.txt delete mode 100644 tests/markdown-test/links-reference.html delete mode 100644 tests/markdown-test/links-reference.txt delete mode 100644 tests/markdown-test/literal-quotes.html delete mode 100644 tests/markdown-test/literal-quotes.txt delete mode 100644 tests/markdown-test/markdown-documentation-basics.html delete mode 100644 tests/markdown-test/markdown-documentation-basics.txt delete mode 100644 tests/markdown-test/markdown-syntax.html delete mode 100644 tests/markdown-test/markdown-syntax.txt delete mode 100644 tests/markdown-test/nested-blockquotes.html delete mode 100644 tests/markdown-test/nested-blockquotes.txt delete mode 100644 tests/markdown-test/ordered-and-unordered-list.html delete mode 100644 tests/markdown-test/ordered-and-unordered-list.txt delete mode 100644 tests/markdown-test/strong-and-em-together.html delete mode 100644 tests/markdown-test/strong-and-em-together.txt delete mode 100644 tests/markdown-test/tabs.html delete mode 100644 tests/markdown-test/tabs.txt delete mode 100644 tests/markdown-test/tidyness.html delete mode 100644 tests/markdown-test/tidyness.txt delete mode 100644 tests/misc/amp-in-url.html delete mode 100644 tests/misc/amp-in-url.txt delete mode 100644 tests/misc/ampersand.html delete mode 100644 tests/misc/ampersand.txt delete mode 100644 tests/misc/attributes2.html delete mode 100644 tests/misc/attributes2.txt create mode 100644 tests/misc/blank_lines_in_codeblocks.html create mode 100644 tests/misc/blank_lines_in_codeblocks.txt create mode 100644 tests/misc/brackets-in-img-title.html create mode 100644 tests/misc/brackets-in-img-title.txt delete mode 100644 tests/misc/comments.html delete mode 100644 tests/misc/comments.txt delete mode 100644 tests/misc/div.html delete mode 100644 tests/misc/div.txt create mode 100644 tests/misc/em_strong_complex.html create mode 100644 tests/misc/em_strong_complex.txt create mode 100644 tests/misc/escaped_links.html create mode 100644 tests/misc/escaped_links.txt create mode 100644 tests/misc/header-in-lists.html create mode 100644 tests/misc/header-in-lists.txt delete mode 100644 tests/misc/html-comments.html delete mode 100644 tests/misc/html-comments.txt delete mode 100644 tests/misc/html.html delete mode 100644 tests/misc/html.txt delete mode 100644 tests/misc/image.html delete mode 100644 tests/misc/image.txt create mode 100644 tests/misc/ins-at-start-of-paragraph.html create mode 100644 tests/misc/ins-at-start-of-paragraph.txt create mode 100644 tests/misc/lists7.html create mode 100644 tests/misc/lists7.txt create mode 100644 tests/misc/lists8.html create mode 100644 tests/misc/lists8.txt delete mode 100644 tests/misc/markup-inside-p.html delete mode 100644 tests/misc/markup-inside-p.txt delete mode 100644 tests/misc/mismatched-tags.html delete mode 100644 tests/misc/mismatched-tags.txt delete mode 100644 tests/misc/more_comments.html delete mode 100644 tests/misc/more_comments.txt delete mode 100644 tests/misc/multi-line-tags.html delete mode 100644 tests/misc/multi-line-tags.txt delete mode 100644 tests/misc/multiline-comments.html delete mode 100644 tests/misc/multiline-comments.txt delete mode 100644 tests/misc/php.html delete mode 100644 tests/misc/php.txt delete mode 100644 tests/misc/pre.html delete mode 100644 tests/misc/pre.txt create mode 100644 tests/php/Auto Links.text create mode 100644 tests/php/Auto Links.xhtml create mode 100644 tests/php/Backslash escapes.text create mode 100644 tests/php/Backslash escapes.xhtml create mode 100644 tests/php/Code Spans.text create mode 100644 tests/php/Code Spans.xhtml create mode 100644 tests/php/Code block in a list item.text create mode 100644 tests/php/Code block in a list item.xhtml create mode 100644 tests/php/Code block on second line.text create mode 100644 tests/php/Code block on second line.xhtml create mode 100644 tests/php/Email auto links.text create mode 100644 tests/php/Email auto links.xhtml create mode 100644 tests/php/Emphasis.text create mode 100644 tests/php/Emphasis.xhtml create mode 100644 tests/php/Empty List Item.text create mode 100644 tests/php/Empty List Item.xhtml create mode 100644 tests/php/Headers.text create mode 100644 tests/php/Headers.xhtml create mode 100644 tests/php/Horizontal Rules.text create mode 100644 tests/php/Horizontal Rules.xhtml create mode 100644 tests/php/Inline HTML (Simple).text create mode 100644 tests/php/Inline HTML (Simple).xhtml create mode 100644 tests/php/Inline HTML (Span).text create mode 100644 tests/php/Inline HTML (Span).xhtml create mode 100644 tests/php/Inline HTML comments.text create mode 100644 tests/php/Inline HTML comments.xhtml create mode 100644 tests/php/Ins & del.text create mode 100644 tests/php/Ins & del.xhtml create mode 100644 tests/php/License create mode 100644 tests/php/Links, inline style.text create mode 100644 tests/php/Links, inline style.xhtml create mode 100644 tests/php/MD5 Hashes.text create mode 100644 tests/php/MD5 Hashes.xhtml create mode 100644 tests/php/Mixed OLs and ULs.text create mode 100644 tests/php/Mixed OLs and ULs.xhtml create mode 100644 tests/php/Nesting.text create mode 100644 tests/php/Nesting.xhtml create mode 100644 tests/php/PHP-Specific Bugs.text create mode 100644 tests/php/PHP-Specific Bugs.xhtml create mode 100644 tests/php/Parens in URL.text create mode 100644 tests/php/Parens in URL.xhtml create mode 100644 tests/php/Quotes in attributes.text create mode 100644 tests/php/Quotes in attributes.xhtml create mode 100644 tests/php/Tight blocks.text create mode 100644 tests/php/Tight blocks.xhtml create mode 100644 tests/php/extra/Abbr.text create mode 100644 tests/php/extra/Abbr.xhtml create mode 100644 tests/php/extra/Definition Lists.text create mode 100644 tests/php/extra/Definition Lists.xhtml create mode 100644 tests/php/extra/Emphasis.text create mode 100644 tests/php/extra/Emphasis.xhtml create mode 100644 tests/php/extra/Fenced Code Blocks.text create mode 100644 tests/php/extra/Fenced Code Blocks.xhtml create mode 100644 tests/php/extra/Footnotes.text create mode 100644 tests/php/extra/Footnotes.xhtml create mode 100644 tests/php/extra/Inline HTML with Markdown content.text create mode 100644 tests/php/extra/Inline HTML with Markdown content.xhtml create mode 100644 tests/php/extra/Tables.text create mode 100644 tests/php/extra/Tables.xhtml create mode 100644 tests/pl/Tests_2004/Amps and angle encoding.html create mode 100644 tests/pl/Tests_2004/Amps and angle encoding.text create mode 100644 tests/pl/Tests_2004/Auto links.html create mode 100644 tests/pl/Tests_2004/Auto links.text create mode 100644 tests/pl/Tests_2004/Backslash escapes.html create mode 100644 tests/pl/Tests_2004/Backslash escapes.text create mode 100644 tests/pl/Tests_2004/Blockquotes with code blocks.html create mode 100644 tests/pl/Tests_2004/Blockquotes with code blocks.text create mode 100644 tests/pl/Tests_2004/Hard-wrapped paragraphs with list-like lines.html create mode 100644 tests/pl/Tests_2004/Hard-wrapped paragraphs with list-like lines.text create mode 100644 tests/pl/Tests_2004/Horizontal rules.html create mode 100644 tests/pl/Tests_2004/Horizontal rules.text create mode 100644 tests/pl/Tests_2004/Inline HTML (Advanced).html create mode 100644 tests/pl/Tests_2004/Inline HTML (Advanced).text create mode 100644 tests/pl/Tests_2004/Inline HTML (Simple).html create mode 100644 tests/pl/Tests_2004/Inline HTML (Simple).text create mode 100644 tests/pl/Tests_2004/Inline HTML comments.html create mode 100644 tests/pl/Tests_2004/Inline HTML comments.text create mode 100644 tests/pl/Tests_2004/Links, inline style.html create mode 100644 tests/pl/Tests_2004/Links, inline style.text create mode 100644 tests/pl/Tests_2004/Links, reference style.html create mode 100644 tests/pl/Tests_2004/Links, reference style.text create mode 100644 tests/pl/Tests_2004/Literal quotes in titles.html create mode 100644 tests/pl/Tests_2004/Literal quotes in titles.text create mode 100644 tests/pl/Tests_2004/Markdown Documentation - Basics.html create mode 100644 tests/pl/Tests_2004/Markdown Documentation - Basics.text create mode 100644 tests/pl/Tests_2004/Markdown Documentation - Syntax.html create mode 100644 tests/pl/Tests_2004/Markdown Documentation - Syntax.text create mode 100644 tests/pl/Tests_2004/Nested blockquotes.html create mode 100644 tests/pl/Tests_2004/Nested blockquotes.text create mode 100644 tests/pl/Tests_2004/Ordered and unordered lists.html create mode 100644 tests/pl/Tests_2004/Ordered and unordered lists.text create mode 100644 tests/pl/Tests_2004/Strong and em together.html create mode 100644 tests/pl/Tests_2004/Strong and em together.text create mode 100644 tests/pl/Tests_2004/Tabs.html create mode 100644 tests/pl/Tests_2004/Tabs.text create mode 100644 tests/pl/Tests_2004/Tidyness.html create mode 100644 tests/pl/Tests_2004/Tidyness.text create mode 100644 tests/pl/Tests_2004/Yuri-Attributes.html create mode 100644 tests/pl/Tests_2004/Yuri-Attributes.text create mode 100644 tests/pl/Tests_2004/Yuri-Email.html create mode 100644 tests/pl/Tests_2004/Yuri-Email.text create mode 100644 tests/pl/Tests_2004/Yuri-Footnotes.html create mode 100644 tests/pl/Tests_2004/Yuri-Footnotes.text create mode 100644 tests/pl/Tests_2004/Yuri-Links-in-Headers.html create mode 100644 tests/pl/Tests_2004/Yuri-Links-in-Headers.text create mode 100644 tests/pl/Tests_2007/Amps and angle encoding.html create mode 100644 tests/pl/Tests_2007/Amps and angle encoding.text create mode 100644 tests/pl/Tests_2007/Auto links.html create mode 100644 tests/pl/Tests_2007/Auto links.text create mode 100644 tests/pl/Tests_2007/Backslash escapes.html create mode 100644 tests/pl/Tests_2007/Backslash escapes.text create mode 100644 tests/pl/Tests_2007/Blockquotes with code blocks.html create mode 100644 tests/pl/Tests_2007/Blockquotes with code blocks.text create mode 100644 tests/pl/Tests_2007/Code Blocks.html create mode 100644 tests/pl/Tests_2007/Code Blocks.text create mode 100644 tests/pl/Tests_2007/Code Spans.html create mode 100644 tests/pl/Tests_2007/Code Spans.text create mode 100644 tests/pl/Tests_2007/Hard-wrapped paragraphs with list-like lines.html create mode 100644 tests/pl/Tests_2007/Hard-wrapped paragraphs with list-like lines.text create mode 100644 tests/pl/Tests_2007/Horizontal rules.html create mode 100644 tests/pl/Tests_2007/Horizontal rules.text create mode 100644 tests/pl/Tests_2007/Images.html create mode 100644 tests/pl/Tests_2007/Images.text create mode 100644 tests/pl/Tests_2007/Inline HTML (Advanced).html create mode 100644 tests/pl/Tests_2007/Inline HTML (Advanced).text create mode 100644 tests/pl/Tests_2007/Inline HTML (Simple).html create mode 100644 tests/pl/Tests_2007/Inline HTML (Simple).text create mode 100644 tests/pl/Tests_2007/Inline HTML comments.html create mode 100644 tests/pl/Tests_2007/Inline HTML comments.text create mode 100644 tests/pl/Tests_2007/Links, inline style.html create mode 100644 tests/pl/Tests_2007/Links, inline style.text create mode 100644 tests/pl/Tests_2007/Links, reference style.html create mode 100644 tests/pl/Tests_2007/Links, reference style.text create mode 100644 tests/pl/Tests_2007/Links, shortcut references.html create mode 100644 tests/pl/Tests_2007/Links, shortcut references.text create mode 100644 tests/pl/Tests_2007/Literal quotes in titles.html create mode 100644 tests/pl/Tests_2007/Literal quotes in titles.text create mode 100644 tests/pl/Tests_2007/Markdown Documentation - Basics.html create mode 100644 tests/pl/Tests_2007/Markdown Documentation - Basics.text create mode 100644 tests/pl/Tests_2007/Markdown Documentation - Syntax.html create mode 100644 tests/pl/Tests_2007/Markdown Documentation - Syntax.text create mode 100644 tests/pl/Tests_2007/Nested blockquotes.html create mode 100644 tests/pl/Tests_2007/Nested blockquotes.text create mode 100644 tests/pl/Tests_2007/Ordered and unordered lists.html create mode 100644 tests/pl/Tests_2007/Ordered and unordered lists.text create mode 100644 tests/pl/Tests_2007/Strong and em together.html create mode 100644 tests/pl/Tests_2007/Strong and em together.text create mode 100644 tests/pl/Tests_2007/Tabs.html create mode 100644 tests/pl/Tests_2007/Tabs.text create mode 100644 tests/pl/Tests_2007/Tidyness.html create mode 100644 tests/pl/Tests_2007/Tidyness.text delete mode 100644 tests/safe_mode/inline-html-advanced.html delete mode 100644 tests/safe_mode/inline-html-advanced.txt delete mode 100644 tests/safe_mode/inline-html-comments.html delete mode 100644 tests/safe_mode/inline-html-comments.txt delete mode 100644 tests/safe_mode/inline-html-simple.html delete mode 100644 tests/safe_mode/inline-html-simple.txt delete mode 100644 tests/safe_mode/script_tags.html delete mode 100644 tests/safe_mode/script_tags.txt delete mode 100644 tests/safe_mode/unsafe_urls.html delete mode 100644 tests/safe_mode/unsafe_urls.txt create mode 100644 tests/test_apis.py create mode 100644 tests/test_extensions.py create mode 100644 tests/test_legacy.py create mode 100644 tests/test_meta.py create mode 100644 tests/test_syntax/__init__.py create mode 100644 tests/test_syntax/blocks/__init__.py create mode 100644 tests/test_syntax/blocks/test_blockquotes.py create mode 100644 tests/test_syntax/blocks/test_code_blocks.py create mode 100644 tests/test_syntax/blocks/test_headers.py create mode 100644 tests/test_syntax/blocks/test_hr.py create mode 100644 tests/test_syntax/blocks/test_html_blocks.py create mode 100644 tests/test_syntax/blocks/test_paragraphs.py create mode 100644 tests/test_syntax/extensions/__init__.py create mode 100644 tests/test_syntax/extensions/test_abbr.py create mode 100644 tests/test_syntax/extensions/test_admonition.py create mode 100644 tests/test_syntax/extensions/test_attr_list.py create mode 100644 tests/test_syntax/extensions/test_code_hilite.py create mode 100644 tests/test_syntax/extensions/test_def_list.py create mode 100644 tests/test_syntax/extensions/test_fenced_code.py create mode 100644 tests/test_syntax/extensions/test_footnotes.py create mode 100644 tests/test_syntax/extensions/test_legacy_attrs.py create mode 100644 tests/test_syntax/extensions/test_legacy_em.py create mode 100644 tests/test_syntax/extensions/test_md_in_html.py create mode 100644 tests/test_syntax/extensions/test_smarty.py create mode 100644 tests/test_syntax/extensions/test_tables.py create mode 100644 tests/test_syntax/extensions/test_toc.py create mode 100644 tests/test_syntax/inline/__init__.py create mode 100644 tests/test_syntax/inline/test_autolinks.py create mode 100644 tests/test_syntax/inline/test_emphasis.py create mode 100644 tests/test_syntax/inline/test_entities.py create mode 100644 tests/test_syntax/inline/test_images.py create mode 100644 tests/test_syntax/inline/test_links.py create mode 100644 tests/test_syntax/inline/test_raw_html.py create mode 100644 tox.ini diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..db24720 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1 @@ +comment: off diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..c785d90 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,5 @@ +[run] +omit= + *site-packages* + tests/* + markdown/test_tools.py diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..2ef1d0d --- /dev/null +++ b/.gitattributes @@ -0,0 +1,7 @@ +tests/basic/** linguist-vendored +tests/extensions/** linguist-vendored +tests/misc/** linguist-vendored +tests/options/** linguist-vendored +tests/php/** linguist-vendored +tests/pl/** linguist-vendored +tests/safe_mode/** linguist-vendored diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..fca5318 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,53 @@ +name: deploy + +on: + push: + tags: + - '*' + +jobs: + + pypi: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + - name: Build + run: | + python setup.py bdist_wheel sdist --formats gztar + - name: Publish + if: success() + uses: pypa/gh-action-pypi-publish@v1.1.0 + with: + user: __token__ + password: ${{ secrets.PYPI_PASSWORD }} + + ghpages: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools + python -m pip install -r doc-requirements.txt + - name: Build + run: | + python -m mkdocs build --clean --verbose + - name: Publish + if: success() + uses: peaceiris/actions-gh-pages@v3 + with: + deploy_key: ${{ secrets.PAGES_DEPLOY_KEY }} + external_repository: Python-Markdown/Python-Markdown.github.io + publish_branch: master + publish_dir: ./site diff --git a/.github/workflows/manual_deploy.yml b/.github/workflows/manual_deploy.yml new file mode 100644 index 0000000..b2ce06b --- /dev/null +++ b/.github/workflows/manual_deploy.yml @@ -0,0 +1,30 @@ +name: manual deploy + +on: + workflow_dispatch + +jobs: + + ghpages: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools + python -m pip install -r doc-requirements.txt + - name: Build + run: | + python -m mkdocs build --clean --verbose + - name: Publish + if: success() + uses: peaceiris/actions-gh-pages@v3 + with: + deploy_key: ${{ secrets.PAGES_DEPLOY_KEY }} + external_repository: Python-Markdown/Python-Markdown.github.io + publish_branch: master + publish_dir: ./site diff --git a/.github/workflows/process.yml b/.github/workflows/process.yml new file mode 100644 index 0000000..d6d4c94 --- /dev/null +++ b/.github/workflows/process.yml @@ -0,0 +1,35 @@ +name: bot + +on: + pull_request: + branches: + - '**' + +jobs: + require_changelog: + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: mskelton/changelog-reminder-action@v1 + with: + # Match any file in the docs/change_log/ dir. + changelogRegex: "docs/change_log/.*" + # Only require changelog update if changes were made in markdown/ + include: "markdown/.*" + message: | + @${{ github.actor }}, thank you for your contribution. It appears that you have not added a comment to the + change log describing the changes you have made. Doing so will help to ensure your contribution is accepted. + + Please see the [Contributing Guide](https://python-markdown.github.io/contributing/#pull-requests) for details. + + markdown-link-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + use-quiet-mode: yes + use-verbose-mode: yes + check-modified-files-only: yes + base-branch: master diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml new file mode 100644 index 0000000..e2004ad --- /dev/null +++ b/.github/workflows/tox.yml @@ -0,0 +1,88 @@ +# This workflow will install dependencies and run tests/linters with a matrix of tox environments. + +name: CI + +on: + push: + branches: + - master + tags: + - '**' + pull_request: + branches: + - '**' + +jobs: + test: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + max-parallel: 4 + matrix: + tox-env: [py37, py38, py39, py310, pypy37, pypy38, pypy39, pygments] + include: + - tox-env: py37 + python-version: '3.7' + - tox-env: py38 + python-version: '3.8' + - tox-env: py39 + python-version: '3.9' + - tox-env: py310 + python-version: '3.10' + - tox-env: pypy37 + python-version: pypy-3.7 + - tox-env: pypy38 + python-version: pypy-3.8 + - tox-env: pypy39 + python-version: pypy-3.9 + - tox-env: pygments + python-version: '3.7' + + env: + TOXENV: ${{ matrix.tox-env }} + + steps: + - uses: actions/checkout@v2 + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + sudo apt-get install libtidy-dev + python -m pip install --upgrade pip tox coverage codecov + - name: Run tox + run: python -m tox + - name: Upload Results + if: success() + uses: codecov/codecov-action@v1 + with: + file: ./coverage.xml + flags: unittests + name: ${{ matrix.tox-env }} + fail_ci_if_error: false + + lint: + runs-on: ubuntu-latest + strategy: + fail-fast: false + max-parallel: 4 + matrix: + tox-env: [flake8, pep517check, checkspelling] + + env: + TOXENV: ${{ matrix.tox-env }} + + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: Install dependencies + run: | + python -m pip install --upgrade pip tox + if [[ "$TOXENV" == 'checkspelling' ]]; then sudo apt-get install aspell aspell-en; fi + - name: Run tox + run: python -m tox diff --git a/.gitignore b/.gitignore index 0238e63..6de88e3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,74 @@ -*.pyc -*.bak -*.tmp -*.swp -tmp/* -build/* -dist/* +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +test-output.html + +# Translations +*.mo +*.pot + +# Scrapy stuff: +.scrapy + +# PyBuilder +target/ + +# IPython Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# virtualenv +venv/ +ENV/ + +# MkDocs documentation +site/ + +# Mac files +.DS_Store diff --git a/.spell-dict b/.spell-dict new file mode 100644 index 0000000..6408100 --- /dev/null +++ b/.spell-dict @@ -0,0 +1,163 @@ +facelessuser +mitya +waylan +Abrahamsen +Altmayer +API +Artem +aspell +Babelmark +backtick +backticks +Balogh +BlockParser +Blockprocessor +Blockprocessors +blockquote +blockquotes +boolean +CamelCase +Chodarev +CLI +CodeHilite +codehilite +Cogumbreiro +convertFile +CSS +dedent +deliminators +deregister +Dmitry +docdata +ElementTree +encodings +extendMarkdown +Fauske +formatter +Fortin +GitHub +globals +Gruber +GSoC +hacky +HeaderId +HTTPS +html +implementers +InlineProcessor +Jiryu +JSON +Kjell +Krech +kwargs +Limberg +MacOS +Magne +MAILTO +makeExtension +Manfed +markdownFromFile +Maruku +md +metadata +MkDocs +multi +MultiMarkdown +munge +namespace +NanoDOM +Neale +nosetests +OrderedDict +OrderedDicts +OSX +ol +Ph +PHP +Posix +postprocessor +postprocessors +prepend +prepended +preprocessor +preprocessors +Pygments +PyPI +PyPy +PYTHONPATH +PyTidyLib +PyYAML +rc +refactor +refactored +refactors +registerExtension +richeland +RSS +rST +ryneeverett +sanitizer +sanitizers +Sauder +schemeless +setuptools +Sergej +serializer +serializers +Shachnev +sitemap +slugify +SmartyPants +Sourceforge +StackOverflow +Stansifer +stdout +Stelios +Stienstra +subclasses +SuperFences +svn +Swartz +Szakmeister +Takteyev +Tiago +toc +tokenized +tox +Trac +traceback +Tredinnick +Treeprocessor +Treeprocessors +tuple +tuples +unclosed +unescape +unescaping +unittest +unordered +untrusted +UTF +uTidylib +versa +versioning +Waylan +whitelist +whitespace +WikiLink +WikiLinks +Wolever +workflow +Xanthakis +XHTML +xhtml +YAML +Yunusov +inline +wiki +JavaScript +plugin +plugins +configs +pre +formatters diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..a30e62f --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,49 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, and in the interest of +fostering an open and welcoming community, we pledge to respect all people who +contribute through reporting issues, posting feature requests, updating +documentation, submitting pull requests or patches, and other activities. + +We are committed to making participation in this project a harassment-free +experience for everyone, regardless of level of experience, gender, gender +identity and expression, sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, such as physical or electronic + addresses, without explicit permission +* Other unethical or unprofessional conduct + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +By adopting this Code of Conduct, project maintainers commit themselves to +fairly and consistently applying these principles to every aspect of managing +this project. Project maintainers who do not follow or enforce the Code of +Conduct may be permanently removed from the project team. + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting a project maintainer at python.markdown@gmail.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. Maintainers are +obligated to maintain confidentiality with regard to the reporter of an +incident. + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 1.3.0, available at +[https://www.contributor-covenant.org/version/1/3/0/][version] + +[homepage]: https://www.contributor-covenant.org/ +[version]: https://www.contributor-covenant.org/version/1/3/0/ diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000..a314fb6 --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,9 @@ +Installing Python-Markdown +========================== + +As an Admin/Root user on your system do: + + pip install markdown + +Or for more specific instructions, view the documentation in `docs/install.md` +or on the website at . diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..2652d97 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,29 @@ +Copyright 2007, 2008 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +* Neither the name of the Python Markdown Project nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE PYTHON MARKDOWN PROJECT ''AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL ANY CONTRIBUTORS TO THE PYTHON MARKDOWN PROJECT +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/MANIFEST.in b/MANIFEST.in index 4558938..4d3c6a2 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,12 @@ -recursive-include bin * recursive-include markdown *.py recursive-include docs * -prune markdown/extensions/legacy.py +recursive-include tests *.txt *.html *.py include setup.py +include setup.cfg +include makefile +include LICENSE.md +include README.md +include INSTALL.md include MANIFEST +include *-requirements.txt +include mkdocs.yml diff --git a/METADATA b/METADATA index f01d58a..3897cf4 100644 --- a/METADATA +++ b/METADATA @@ -3,7 +3,7 @@ # For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md name: "markdown" -description: "This is a Python implementation of John Gruber's Markdown. It is almost completely compliant with the reference implementation, though there are a few known issues." +description: "This is a Python implementation of John Gruber\'s Markdown. It is almost completely compliant with the reference implementation, though there are a few known issues." third_party { url { type: HOMEPAGE @@ -11,13 +11,13 @@ third_party { } url { type: ARCHIVE - value: "https://github.com/Python-Markdown/markdown/archive/refs/tags/2.0.3.zip" + value: "https://github.com/Python-Markdown/markdown/archive/3.4.1.zip" } - version: "2.0.3" + version: "3.4.1" license_type: NOTICE last_upgrade_date { year: 2022 month: 11 - day: 3 + day: 4 } } diff --git a/MarkdownTest/MarkdownTest.pl b/MarkdownTest/MarkdownTest.pl deleted file mode 100755 index 8e7048f..0000000 --- a/MarkdownTest/MarkdownTest.pl +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/perl - -# -# MarkdownTester -- Run tests for Markdown implementations -# -# Copyright (c) 2004-2005 John Gruber -# -# - -use strict; -use warnings; -use Getopt::Long; -use Benchmark; - -our $VERSION = '1.0.2'; -# Sat 24 Dec 2005 - -my $time_start = new Benchmark; -my $test_dir = "Tests"; -my $script = "./Markdown.pl"; -my $use_tidy = 0; -my ($flag_version); - -GetOptions ( - "script=s" => \$script, - "testdir=s" => \$test_dir, - "tidy" => \$use_tidy, - "version" => \$flag_version, - ); - -if($flag_version) { - my $progname = $0; - $progname =~ s{.*/}{}; - die "$progname version $VERSION\n"; -} - -unless (-d $test_dir) { die "'$test_dir' is not a directory.\n"; } -unless (-f $script) { die "$script does not exist.\n"; } -unless (-x $script) { die "$script is not executable.\n"; } - -my $tests_passed = 0; -my $tests_failed = 0; - -TEST: -foreach my $testfile (glob "$test_dir/*.text") { - my $testname = $testfile; - $testname =~ s{.*/(.+)\.text$}{$1}i; - print "$testname ... "; - - # Look for a corresponding .html file for each .text file: - my $resultfile = $testfile; - $resultfile =~ s{\.text$}{\.html}i; - unless (-f $resultfile) { - print "'$resultfile' does not exist.\n\n"; - next TEST; - } - - # open(TEST, $testfile) || die("Can't open testfile: $!"); - open(RESULT, $resultfile) || die("Can't open resultfile: $!"); - undef $/; - # my $t_input = ; - my $t_result = ; - - my $t_output = `'$script' '$testfile'`; - - # Normalize the output and expected result strings: - $t_result =~ s/\s+\z//; # trim trailing whitespace - $t_output =~ s/\s+\z//; # trim trailing whitespace - if ($use_tidy) { - # Escape the strings, pass them through to CLI tidy tool for tag-level equivalency - $t_result =~ s{'}{'\\''}g; # escape ' chars for shell - $t_output =~ s{'}{'\\''}g; - $t_result = `echo '$t_result' | tidy -quiet --show-warnings n`; - $t_output = `echo '$t_output' | tidy -quiet --show-warnings n`; - } - - if ($t_output eq $t_result) { - print "OK\n"; - $tests_passed++; - } - else { - print "FAILED\n\n"; - $tests_failed++; - } -} - -print "\n\n"; -print "$tests_passed passed; $tests_failed failed.\n"; - -my $time_end = new Benchmark; -my $time_diff = timediff($time_end, $time_start); -print "Benchmark: ", timestr($time_diff), "\n"; - - -__END__ - -=pod - -=head1 NAME - -B - - -=head1 SYNOPSIS - -B [ B<--options> ] [ I ... ] - - -=head1 DESCRIPTION - - -=head1 OPTIONS - -Use "--" to end switch parsing. For example, to open a file named "-z", use: - - MarkdownTest.pl -- -z - -=over 4 - -=item B<--script> - -Specify the path to the Markdown script to test. Defaults to -"./Markdown.pl". Example: - - ./MarkdownTest.pl --script ./PHP-Markdown/php-markdown - -=item B<--testdir> - -Specify the path to a directory containing test data. Defaults to "Tests". - -=item B<--tidy> - -Flag to turn on using the command line 'tidy' tool to normalize HTML -output before comparing script output to the expected test result. -Assumes that the 'tidy' command is available in your PATH. Defaults to -off. - -=back - - - -=head1 BUGS - - - -=head1 VERSION HISTORY - -1.0 Mon 13 Dec 2004-2005 - -1.0.1 Mon 19 Sep 2005 - - + Better handling of case when foo.text exists, but foo.html doesn't. - It now prints a message and moves on, rather than dying. - - -=head1 COPYRIGHT AND LICENSE - -Copyright (c) 2004-2005 John Gruber - -All rights reserved. - -This is free software; you may redistribute it and/or modify it under -the same terms as Perl itself. - -=cut diff --git a/MarkdownTest/Tests_2004/Amps and angle encoding.html b/MarkdownTest/Tests_2004/Amps and angle encoding.html deleted file mode 100644 index 9606860..0000000 --- a/MarkdownTest/Tests_2004/Amps and angle encoding.html +++ /dev/null @@ -1,17 +0,0 @@ -

AT&T has an ampersand in their name.

- -

AT&T is another way to write it.

- -

This & that.

- -

4 < 5.

- -

6 > 5.

- -

Here's a link with an ampersand in the URL.

- -

Here's a link with an amersand in the link text: AT&T.

- -

Here's an inline link.

- -

Here's an inline link.

diff --git a/MarkdownTest/Tests_2004/Amps and angle encoding.text b/MarkdownTest/Tests_2004/Amps and angle encoding.text deleted file mode 100644 index 0e9527f..0000000 --- a/MarkdownTest/Tests_2004/Amps and angle encoding.text +++ /dev/null @@ -1,21 +0,0 @@ -AT&T has an ampersand in their name. - -AT&T is another way to write it. - -This & that. - -4 < 5. - -6 > 5. - -Here's a [link] [1] with an ampersand in the URL. - -Here's a link with an amersand in the link text: [AT&T] [2]. - -Here's an inline [link](/script?foo=1&bar=2). - -Here's an inline [link](). - - -[1]: http://example.com/?foo=1&bar=2 -[2]: http://att.com/ "AT&T" \ No newline at end of file diff --git a/MarkdownTest/Tests_2004/Amps and angle encoding.text-out b/MarkdownTest/Tests_2004/Amps and angle encoding.text-out deleted file mode 100644 index d52a97e..0000000 --- a/MarkdownTest/Tests_2004/Amps and angle encoding.text-out +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - -

AT&T has an ampersand in their name.

-

AT&T is another way to write it.

-

This & that.

-

4 < 5.

-

6 > 5.

-

Here's a link -with an ampersand in the URL.

-

Here's a link with an amersand in the link text: AT&T.

-

Here's an inline link.

-

Here's an inline link.

- - diff --git a/MarkdownTest/Tests_2004/Amps and angle encoding.text-res b/MarkdownTest/Tests_2004/Amps and angle encoding.text-res deleted file mode 100644 index d52a97e..0000000 --- a/MarkdownTest/Tests_2004/Amps and angle encoding.text-res +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - -

AT&T has an ampersand in their name.

-

AT&T is another way to write it.

-

This & that.

-

4 < 5.

-

6 > 5.

-

Here's a link -with an ampersand in the URL.

-

Here's a link with an amersand in the link text: AT&T.

-

Here's an inline link.

-

Here's an inline link.

- - diff --git a/MarkdownTest/Tests_2004/Auto links.html b/MarkdownTest/Tests_2004/Auto links.html deleted file mode 100644 index f8df985..0000000 --- a/MarkdownTest/Tests_2004/Auto links.html +++ /dev/null @@ -1,18 +0,0 @@ -

Link: http://example.com/.

- -

With an ampersand: http://example.com/?foo=1&bar=2

- - - -
-

Blockquoted: http://example.com/

-
- -

Auto-links should not occur here: <http://example.com/>

- -
or here: <http://example.com/>
-
diff --git a/MarkdownTest/Tests_2004/Auto links.text b/MarkdownTest/Tests_2004/Auto links.text deleted file mode 100644 index abbc488..0000000 --- a/MarkdownTest/Tests_2004/Auto links.text +++ /dev/null @@ -1,13 +0,0 @@ -Link: . - -With an ampersand: - -* In a list? -* -* It should. - -> Blockquoted: - -Auto-links should not occur here: `` - - or here: \ No newline at end of file diff --git a/MarkdownTest/Tests_2004/Auto links.text-out b/MarkdownTest/Tests_2004/Auto links.text-out deleted file mode 100644 index 3b20890..0000000 --- a/MarkdownTest/Tests_2004/Auto links.text-out +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - -

Link: http://example.com/.

-

With an ampersand: http://example.com/?foo=1&bar=2

- -
-

Blockquoted: http://example.com/

-
-

Auto-links should not occur here: -<http://example.com/>

-
-or here: <http://example.com/>
-
-
- - diff --git a/MarkdownTest/Tests_2004/Auto links.text-res b/MarkdownTest/Tests_2004/Auto links.text-res deleted file mode 100644 index 3b20890..0000000 --- a/MarkdownTest/Tests_2004/Auto links.text-res +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - -

Link: http://example.com/.

-

With an ampersand: http://example.com/?foo=1&bar=2

- -
-

Blockquoted: http://example.com/

-
-

Auto-links should not occur here: -<http://example.com/>

-
-or here: <http://example.com/>
-
-
- - diff --git a/MarkdownTest/Tests_2004/Backslash escapes.html b/MarkdownTest/Tests_2004/Backslash escapes.html deleted file mode 100644 index 77823c3..0000000 --- a/MarkdownTest/Tests_2004/Backslash escapes.html +++ /dev/null @@ -1,102 +0,0 @@ -

These should all get escaped:

- -

Backslash: \

- -

Backtick: `

- -

Asterisk: *

- -

Underscore: _

- -

Left brace: {

- -

Right brace: }

- -

Left bracket: [

- -

Right bracket: ]

- -

Left paren: (

- -

Right paren: )

- -

Greater-than: >

- -

Hash: #

- -

Period: .

- -

Bang: !

- -

Plus: +

- -

Minus: -

- -

These should not, because they occur within a code block:

- -
Backslash: \\
-
-Backtick: \`
-
-Asterisk: \*
-
-Underscore: \_
-
-Left brace: \{
-
-Right brace: \}
-
-Left bracket: \[
-
-Right bracket: \]
-
-Left paren: \(
-
-Right paren: \)
-
-Greater-than: \>
-
-Hash: \#
-
-Period: \.
-
-Bang: \!
-
-Plus: \+
-
-Minus: \-
-
- -

Nor should these, which occur in code spans:

- -

Backslash: \\

- -

Backtick: \`

- -

Asterisk: \*

- -

Underscore: \_

- -

Left brace: \{

- -

Right brace: \}

- -

Left bracket: \[

- -

Right bracket: \]

- -

Left paren: \(

- -

Right paren: \)

- -

Greater-than: \>

- -

Hash: \#

- -

Period: \.

- -

Bang: \!

- -

Plus: \+

- -

Minus: \-

diff --git a/MarkdownTest/Tests_2004/Backslash escapes.text b/MarkdownTest/Tests_2004/Backslash escapes.text deleted file mode 100644 index 16447a0..0000000 --- a/MarkdownTest/Tests_2004/Backslash escapes.text +++ /dev/null @@ -1,104 +0,0 @@ -These should all get escaped: - -Backslash: \\ - -Backtick: \` - -Asterisk: \* - -Underscore: \_ - -Left brace: \{ - -Right brace: \} - -Left bracket: \[ - -Right bracket: \] - -Left paren: \( - -Right paren: \) - -Greater-than: \> - -Hash: \# - -Period: \. - -Bang: \! - -Plus: \+ - -Minus: \- - - - -These should not, because they occur within a code block: - - Backslash: \\ - - Backtick: \` - - Asterisk: \* - - Underscore: \_ - - Left brace: \{ - - Right brace: \} - - Left bracket: \[ - - Right bracket: \] - - Left paren: \( - - Right paren: \) - - Greater-than: \> - - Hash: \# - - Period: \. - - Bang: \! - - Plus: \+ - - Minus: \- - - -Nor should these, which occur in code spans: - -Backslash: `\\` - -Backtick: `` \` `` - -Asterisk: `\*` - -Underscore: `\_` - -Left brace: `\{` - -Right brace: `\}` - -Left bracket: `\[` - -Right bracket: `\]` - -Left paren: `\(` - -Right paren: `\)` - -Greater-than: `\>` - -Hash: `\#` - -Period: `\.` - -Bang: `\!` - -Plus: `\+` - -Minus: `\-` diff --git a/MarkdownTest/Tests_2004/Backslash escapes.text-out b/MarkdownTest/Tests_2004/Backslash escapes.text-out deleted file mode 100644 index 1aae6cc..0000000 --- a/MarkdownTest/Tests_2004/Backslash escapes.text-out +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - -

These should all get escaped:

-

Backslash: \

-

Backtick: `

-

Asterisk: *

-

Underscore: _

-

Left brace: {

-

Right brace: }

-

Left bracket: [

-

Right bracket: ]

-

Left paren: (

-

Right paren: )

-

Greater-than: >

-

Hash: #

-

Period: .

-

Bang: !

-

Plus: +

-

Minus: -

-

These should not, because they occur within a code block:

-
-Backslash: \
-
-Backtick: \`
-
-Asterisk: \*
-
-Underscore: \_
-
-Left brace: \{
-
-Right brace: \}
-
-Left bracket: \[
-
-Right bracket: \]
-
-Left paren: \(
-
-Right paren: \)
-
-Greater-than: \>
-
-Hash: \#
-
-Period: \.
-
-Bang: \!
-
-Plus: \+
-
-Minus: \-
-
-
-

Nor should these, which occur in code spans:

-

Backslash: \

-

Backtick: \`

-

Asterisk: \*

-

Underscore: \_

-

Left brace: \{

-

Right brace: \}

-

Left bracket: \[

-

Right bracket: \]

-

Left paren: \(

-

Right paren: \)

-

Greater-than: \>

-

Hash: \#

-

Period: \.

-

Bang: \!

-

Plus: \+

-

Minus: \-

- - diff --git a/MarkdownTest/Tests_2004/Backslash escapes.text-res b/MarkdownTest/Tests_2004/Backslash escapes.text-res deleted file mode 100644 index 1aae6cc..0000000 --- a/MarkdownTest/Tests_2004/Backslash escapes.text-res +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - -

These should all get escaped:

-

Backslash: \

-

Backtick: `

-

Asterisk: *

-

Underscore: _

-

Left brace: {

-

Right brace: }

-

Left bracket: [

-

Right bracket: ]

-

Left paren: (

-

Right paren: )

-

Greater-than: >

-

Hash: #

-

Period: .

-

Bang: !

-

Plus: +

-

Minus: -

-

These should not, because they occur within a code block:

-
-Backslash: \
-
-Backtick: \`
-
-Asterisk: \*
-
-Underscore: \_
-
-Left brace: \{
-
-Right brace: \}
-
-Left bracket: \[
-
-Right bracket: \]
-
-Left paren: \(
-
-Right paren: \)
-
-Greater-than: \>
-
-Hash: \#
-
-Period: \.
-
-Bang: \!
-
-Plus: \+
-
-Minus: \-
-
-
-

Nor should these, which occur in code spans:

-

Backslash: \

-

Backtick: \`

-

Asterisk: \*

-

Underscore: \_

-

Left brace: \{

-

Right brace: \}

-

Left bracket: \[

-

Right bracket: \]

-

Left paren: \(

-

Right paren: \)

-

Greater-than: \>

-

Hash: \#

-

Period: \.

-

Bang: \!

-

Plus: \+

-

Minus: \-

- - diff --git a/MarkdownTest/Tests_2004/Blockquotes with code blocks.html b/MarkdownTest/Tests_2004/Blockquotes with code blocks.html deleted file mode 100644 index 990202a..0000000 --- a/MarkdownTest/Tests_2004/Blockquotes with code blocks.html +++ /dev/null @@ -1,15 +0,0 @@ -
-

Example:

- -
sub status {
-    print "working";
-}
-
- -

Or:

- -
sub status {
-    return "working";
-}
-
-
diff --git a/MarkdownTest/Tests_2004/Blockquotes with code blocks.text b/MarkdownTest/Tests_2004/Blockquotes with code blocks.text deleted file mode 100644 index c31d171..0000000 --- a/MarkdownTest/Tests_2004/Blockquotes with code blocks.text +++ /dev/null @@ -1,11 +0,0 @@ -> Example: -> -> sub status { -> print "working"; -> } -> -> Or: -> -> sub status { -> return "working"; -> } diff --git a/MarkdownTest/Tests_2004/Blockquotes with code blocks.text-out b/MarkdownTest/Tests_2004/Blockquotes with code blocks.text-out deleted file mode 100644 index 75ef055..0000000 --- a/MarkdownTest/Tests_2004/Blockquotes with code blocks.text-out +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - -
-

Example:

-
-sub status {
-    print "working";
-}
-
-
-

Or:

-
-sub status {
-    return "working";
-}
-
-
- - diff --git a/MarkdownTest/Tests_2004/Blockquotes with code blocks.text-res b/MarkdownTest/Tests_2004/Blockquotes with code blocks.text-res deleted file mode 100644 index 75ef055..0000000 --- a/MarkdownTest/Tests_2004/Blockquotes with code blocks.text-res +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - -
-

Example:

-
-sub status {
-    print "working";
-}
-
-
-

Or:

-
-sub status {
-    return "working";
-}
-
-
- - diff --git a/MarkdownTest/Tests_2004/Hard-wrapped paragraphs with list-like lines.html b/MarkdownTest/Tests_2004/Hard-wrapped paragraphs with list-like lines.html deleted file mode 100644 index e21ac79..0000000 --- a/MarkdownTest/Tests_2004/Hard-wrapped paragraphs with list-like lines.html +++ /dev/null @@ -1,8 +0,0 @@ -

In Markdown 1.0.0 and earlier. Version -8. This line turns into a list item. -Because a hard-wrapped line in the -middle of a paragraph looked like a -list item.

- -

Here's one with a bullet. -* criminey.

diff --git a/MarkdownTest/Tests_2004/Hard-wrapped paragraphs with list-like lines.text b/MarkdownTest/Tests_2004/Hard-wrapped paragraphs with list-like lines.text deleted file mode 100644 index f8a5b27..0000000 --- a/MarkdownTest/Tests_2004/Hard-wrapped paragraphs with list-like lines.text +++ /dev/null @@ -1,8 +0,0 @@ -In Markdown 1.0.0 and earlier. Version -8. This line turns into a list item. -Because a hard-wrapped line in the -middle of a paragraph looked like a -list item. - -Here's one with a bullet. -* criminey. diff --git a/MarkdownTest/Tests_2004/Hard-wrapped paragraphs with list-like lines.text-out b/MarkdownTest/Tests_2004/Hard-wrapped paragraphs with list-like lines.text-out deleted file mode 100644 index e044b46..0000000 --- a/MarkdownTest/Tests_2004/Hard-wrapped paragraphs with list-like lines.text-out +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - -

In Markdown 1.0.0 and earlier. Version 8. This line turns into a -list item. Because a hard-wrapped line in the middle of a paragraph -looked like a list item.

-

Here's one with a bullet. * criminey.

- - diff --git a/MarkdownTest/Tests_2004/Hard-wrapped paragraphs with list-like lines.text-res b/MarkdownTest/Tests_2004/Hard-wrapped paragraphs with list-like lines.text-res deleted file mode 100644 index e044b46..0000000 --- a/MarkdownTest/Tests_2004/Hard-wrapped paragraphs with list-like lines.text-res +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - -

In Markdown 1.0.0 and earlier. Version 8. This line turns into a -list item. Because a hard-wrapped line in the middle of a paragraph -looked like a list item.

-

Here's one with a bullet. * criminey.

- - diff --git a/MarkdownTest/Tests_2004/Horizontal rules.html b/MarkdownTest/Tests_2004/Horizontal rules.html deleted file mode 100644 index 2dc2ab6..0000000 --- a/MarkdownTest/Tests_2004/Horizontal rules.html +++ /dev/null @@ -1,71 +0,0 @@ -

Dashes:

- -
- -
- -
- -
- -
---
-
- -
- -
- -
- -
- -
- - -
-
- -

Asterisks:

- -
- -
- -
- -
- -
***
-
- -
- -
- -
- -
- -
* * *
-
- -

Underscores:

- -
- -
- -
- -
- -
___
-
- -
- -
- -
- -
- -
_ _ _
-
diff --git a/MarkdownTest/Tests_2004/Horizontal rules.text b/MarkdownTest/Tests_2004/Horizontal rules.text deleted file mode 100644 index 1594bda..0000000 --- a/MarkdownTest/Tests_2004/Horizontal rules.text +++ /dev/null @@ -1,67 +0,0 @@ -Dashes: - ---- - - --- - - --- - - --- - - --- - -- - - - - - - - - - - - - - - - - - - - - - - - - -Asterisks: - -*** - - *** - - *** - - *** - - *** - -* * * - - * * * - - * * * - - * * * - - * * * - - -Underscores: - -___ - - ___ - - ___ - - ___ - - ___ - -_ _ _ - - _ _ _ - - _ _ _ - - _ _ _ - - _ _ _ diff --git a/MarkdownTest/Tests_2004/Horizontal rules.text-out b/MarkdownTest/Tests_2004/Horizontal rules.text-out deleted file mode 100644 index 71e4d27..0000000 --- a/MarkdownTest/Tests_2004/Horizontal rules.text-out +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - -

Dashes:

-
-
-
-
-
----
-
-
-
-
-
-
-
-- - -
-
-
-

Asterisks:

-
-
-
-
-
-***
-
-
-
-
-
-
-
-* * *
-
-
-

Underscores:

-
-
-
-
-
-___
-
-
-
-
-
-
-
-_ _ _
-
-
- - diff --git a/MarkdownTest/Tests_2004/Horizontal rules.text-res b/MarkdownTest/Tests_2004/Horizontal rules.text-res deleted file mode 100644 index 71e4d27..0000000 --- a/MarkdownTest/Tests_2004/Horizontal rules.text-res +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - -

Dashes:

-
-
-
-
-
----
-
-
-
-
-
-
-
-- - -
-
-
-

Asterisks:

-
-
-
-
-
-***
-
-
-
-
-
-
-
-* * *
-
-
-

Underscores:

-
-
-
-
-
-___
-
-
-
-
-
-
-
-_ _ _
-
-
- - diff --git a/MarkdownTest/Tests_2004/Inline HTML (Advanced).html b/MarkdownTest/Tests_2004/Inline HTML (Advanced).html deleted file mode 100644 index 1972d87..0000000 --- a/MarkdownTest/Tests_2004/Inline HTML (Advanced).html +++ /dev/null @@ -1,14 +0,0 @@ -

Simple block on one line:

- -
foo
- -

And nested without indentation:

- -
-
-
-foo -
-
-
bar
-
diff --git a/MarkdownTest/Tests_2004/Inline HTML (Advanced).text b/MarkdownTest/Tests_2004/Inline HTML (Advanced).text deleted file mode 100644 index 9d71ddc..0000000 --- a/MarkdownTest/Tests_2004/Inline HTML (Advanced).text +++ /dev/null @@ -1,14 +0,0 @@ -Simple block on one line: - -
foo
- -And nested without indentation: - -
-
-
-foo -
-
-
bar
-
diff --git a/MarkdownTest/Tests_2004/Inline HTML (Advanced).text-out b/MarkdownTest/Tests_2004/Inline HTML (Advanced).text-out deleted file mode 100644 index ee84e31..0000000 --- a/MarkdownTest/Tests_2004/Inline HTML (Advanced).text-out +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - -

Simple block on one line:

-
foo
-

And nested without indentation:

-
-
-
foo
-
-
bar
-
- - diff --git a/MarkdownTest/Tests_2004/Inline HTML (Advanced).text-res b/MarkdownTest/Tests_2004/Inline HTML (Advanced).text-res deleted file mode 100644 index ee84e31..0000000 --- a/MarkdownTest/Tests_2004/Inline HTML (Advanced).text-res +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - -

Simple block on one line:

-
foo
-

And nested without indentation:

-
-
-
foo
-
-
bar
-
- - diff --git a/MarkdownTest/Tests_2004/Inline HTML (Simple).html b/MarkdownTest/Tests_2004/Inline HTML (Simple).html deleted file mode 100644 index 6bf78f8..0000000 --- a/MarkdownTest/Tests_2004/Inline HTML (Simple).html +++ /dev/null @@ -1,72 +0,0 @@ -

Here's a simple block:

- -
- foo -
- -

This should be a code block, though:

- -
<div>
-    foo
-</div>
-
- -

As should this:

- -
<div>foo</div>
-
- -

Now, nested:

- -
-
-
- foo -
-
-
- -

This should just be an HTML comment:

- - - -

Multiline:

- - - -

Code block:

- -
<!-- Comment -->
-
- -

Just plain comment, with trailing spaces on the line:

- - - -

Code:

- -
<hr />
-
- -

Hr's:

- -
- -
- -
- -
- -
- -
- -
- -
- -
diff --git a/MarkdownTest/Tests_2004/Inline HTML (Simple).text b/MarkdownTest/Tests_2004/Inline HTML (Simple).text deleted file mode 100644 index 14aa2dc..0000000 --- a/MarkdownTest/Tests_2004/Inline HTML (Simple).text +++ /dev/null @@ -1,69 +0,0 @@ -Here's a simple block: - -
- foo -
- -This should be a code block, though: - -
- foo -
- -As should this: - -
foo
- -Now, nested: - -
-
-
- foo -
-
-
- -This should just be an HTML comment: - - - -Multiline: - - - -Code block: - - - -Just plain comment, with trailing spaces on the line: - - - -Code: - -
- -Hr's: - -
- -
- -
- -
- -
- -
- -
- -
- -
- diff --git a/MarkdownTest/Tests_2004/Inline HTML (Simple).text-out b/MarkdownTest/Tests_2004/Inline HTML (Simple).text-out deleted file mode 100644 index a5022e0..0000000 --- a/MarkdownTest/Tests_2004/Inline HTML (Simple).text-out +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - -

Here's a simple block:

-
foo
-

This should be a code block, though:

-
-<div>
-    foo
-</div>
-
-
-

As should this:

-
-<div>foo</div>
-
-
-

Now, nested:

-
-
-
foo
-
-
-

This should just be an HTML comment:

- -

Multiline:

- -

Code block:

-
-<!-- Comment -->
-
-
-

Just plain comment, with trailing spaces on the line:

- -

Code:

-
-<hr />
-
-
-

Hr's:

-
-
-
-
-
-
-
-
-
- - diff --git a/MarkdownTest/Tests_2004/Inline HTML (Simple).text-res b/MarkdownTest/Tests_2004/Inline HTML (Simple).text-res deleted file mode 100644 index a5022e0..0000000 --- a/MarkdownTest/Tests_2004/Inline HTML (Simple).text-res +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - -

Here's a simple block:

-
foo
-

This should be a code block, though:

-
-<div>
-    foo
-</div>
-
-
-

As should this:

-
-<div>foo</div>
-
-
-

Now, nested:

-
-
-
foo
-
-
-

This should just be an HTML comment:

- -

Multiline:

- -

Code block:

-
-<!-- Comment -->
-
-
-

Just plain comment, with trailing spaces on the line:

- -

Code:

-
-<hr />
-
-
-

Hr's:

-
-
-
-
-
-
-
-
-
- - diff --git a/MarkdownTest/Tests_2004/Inline HTML comments.html b/MarkdownTest/Tests_2004/Inline HTML comments.html deleted file mode 100644 index 3f167a1..0000000 --- a/MarkdownTest/Tests_2004/Inline HTML comments.html +++ /dev/null @@ -1,13 +0,0 @@ -

Paragraph one.

- - - - - -

Paragraph two.

- - - -

The end.

diff --git a/MarkdownTest/Tests_2004/Inline HTML comments.text b/MarkdownTest/Tests_2004/Inline HTML comments.text deleted file mode 100644 index 41d830d..0000000 --- a/MarkdownTest/Tests_2004/Inline HTML comments.text +++ /dev/null @@ -1,13 +0,0 @@ -Paragraph one. - - - - - -Paragraph two. - - - -The end. diff --git a/MarkdownTest/Tests_2004/Inline HTML comments.text-out b/MarkdownTest/Tests_2004/Inline HTML comments.text-out deleted file mode 100644 index 6e2f425..0000000 --- a/MarkdownTest/Tests_2004/Inline HTML comments.text-out +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - -

Paragraph one.

- - -

Paragraph two.

- -

The end.

- - diff --git a/MarkdownTest/Tests_2004/Inline HTML comments.text-res b/MarkdownTest/Tests_2004/Inline HTML comments.text-res deleted file mode 100644 index 6e2f425..0000000 --- a/MarkdownTest/Tests_2004/Inline HTML comments.text-res +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - -

Paragraph one.

- - -

Paragraph two.

- -

The end.

- - diff --git a/MarkdownTest/Tests_2004/Links, inline style.html b/MarkdownTest/Tests_2004/Links, inline style.html deleted file mode 100644 index bdfabb5..0000000 --- a/MarkdownTest/Tests_2004/Links, inline style.html +++ /dev/null @@ -1,9 +0,0 @@ -

Just a URL.

- -

URL and title.

- -

URL and title.

- -

URL and title.

- -

Empty.

diff --git a/MarkdownTest/Tests_2004/Links, inline style.text b/MarkdownTest/Tests_2004/Links, inline style.text deleted file mode 100644 index 4d0c1c2..0000000 --- a/MarkdownTest/Tests_2004/Links, inline style.text +++ /dev/null @@ -1,9 +0,0 @@ -Just a [URL](/url/). - -[URL and title](/url/ "title"). - -[URL and title](/url/ "title preceded by two spaces"). - -[URL and title](/url/ "title preceded by a tab"). - -[Empty](). diff --git a/MarkdownTest/Tests_2004/Links, inline style.text-out b/MarkdownTest/Tests_2004/Links, inline style.text-out deleted file mode 100644 index 0125b63..0000000 --- a/MarkdownTest/Tests_2004/Links, inline style.text-out +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - -

Just a URL.

-

URL and title.

-

URL and -title.

-

URL and -title.

-

Empty.

- - diff --git a/MarkdownTest/Tests_2004/Links, inline style.text-res b/MarkdownTest/Tests_2004/Links, inline style.text-res deleted file mode 100644 index 0125b63..0000000 --- a/MarkdownTest/Tests_2004/Links, inline style.text-res +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - -

Just a URL.

-

URL and title.

-

URL and -title.

-

URL and -title.

-

Empty.

- - diff --git a/MarkdownTest/Tests_2004/Links, reference style.html b/MarkdownTest/Tests_2004/Links, reference style.html deleted file mode 100644 index cf4d833..0000000 --- a/MarkdownTest/Tests_2004/Links, reference style.html +++ /dev/null @@ -1,18 +0,0 @@ -

Foo bar.

- -

Foo bar.

- -

Foo bar.

- -

With embedded [brackets].

- -

Indented once.

- -

Indented twice.

- -

Indented thrice.

- -

Indented [four][] times.

- -
[four]: /url
-
diff --git a/MarkdownTest/Tests_2004/Links, reference style.text b/MarkdownTest/Tests_2004/Links, reference style.text deleted file mode 100644 index b2fa734..0000000 --- a/MarkdownTest/Tests_2004/Links, reference style.text +++ /dev/null @@ -1,31 +0,0 @@ -Foo [bar] [1]. - -Foo [bar][1]. - -Foo [bar] -[1]. - -[1]: /url/ "Title" - - -With [embedded [brackets]] [b]. - - -Indented [once][]. - -Indented [twice][]. - -Indented [thrice][]. - -Indented [four][] times. - - [once]: /url - - [twice]: /url - - [thrice]: /url - - [four]: /url - - -[b]: /url/ diff --git a/MarkdownTest/Tests_2004/Links, reference style.text-out b/MarkdownTest/Tests_2004/Links, reference style.text-out deleted file mode 100644 index 04ae0cd..0000000 --- a/MarkdownTest/Tests_2004/Links, reference style.text-out +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - -

Foo bar.

-

Foo bar.

-

Foo bar.

-

With embedded [brackets].

-

Indented once.

-

Indented twice.

-

Indented thrice.

-

Indented [four][] times.

-
-[four]: /url
-
-
- - diff --git a/MarkdownTest/Tests_2004/Links, reference style.text-res b/MarkdownTest/Tests_2004/Links, reference style.text-res deleted file mode 100644 index 04ae0cd..0000000 --- a/MarkdownTest/Tests_2004/Links, reference style.text-res +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - -

Foo bar.

-

Foo bar.

-

Foo bar.

-

With embedded [brackets].

-

Indented once.

-

Indented twice.

-

Indented thrice.

-

Indented [four][] times.

-
-[four]: /url
-
-
- - diff --git a/MarkdownTest/Tests_2004/Links-in-Headers.text-out b/MarkdownTest/Tests_2004/Links-in-Headers.text-out deleted file mode 100644 index defddbf..0000000 --- a/MarkdownTest/Tests_2004/Links-in-Headers.text-out +++ /dev/null @@ -1,9 +0,0 @@ -

A plain header

-

Let's first have a plain header

-

An underlined header

-

(That's also useful)

-

A header with a link

-

First with a hash

-

Another with a link

-

This time underlined

- diff --git a/MarkdownTest/Tests_2004/Links-in-Headers.text-res b/MarkdownTest/Tests_2004/Links-in-Headers.text-res deleted file mode 100644 index cc6cfcf..0000000 --- a/MarkdownTest/Tests_2004/Links-in-Headers.text-res +++ /dev/null @@ -1,9 +0,0 @@ -

A plain header

-

Let's first have a plain header

-

An underlined header

-

(That's also useful)

-

A header with a link

-

First with a hash

-

Another with a link

-

This time underlined

- diff --git a/MarkdownTest/Tests_2004/Literal quotes in titles.html b/MarkdownTest/Tests_2004/Literal quotes in titles.html deleted file mode 100644 index 611c1ac..0000000 --- a/MarkdownTest/Tests_2004/Literal quotes in titles.html +++ /dev/null @@ -1,3 +0,0 @@ -

Foo bar.

- -

Foo bar.

diff --git a/MarkdownTest/Tests_2004/Literal quotes in titles.text b/MarkdownTest/Tests_2004/Literal quotes in titles.text deleted file mode 100644 index 29d0e42..0000000 --- a/MarkdownTest/Tests_2004/Literal quotes in titles.text +++ /dev/null @@ -1,7 +0,0 @@ -Foo [bar][]. - -Foo [bar](/url/ "Title with "quotes" inside"). - - - [bar]: /url/ "Title with "quotes" inside" - diff --git a/MarkdownTest/Tests_2004/Literal quotes in titles.text-out b/MarkdownTest/Tests_2004/Literal quotes in titles.text-out deleted file mode 100644 index 3fd6fbc..0000000 --- a/MarkdownTest/Tests_2004/Literal quotes in titles.text-out +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - -

Foo bar.

-

Foo bar.

- - diff --git a/MarkdownTest/Tests_2004/Literal quotes in titles.text-res b/MarkdownTest/Tests_2004/Literal quotes in titles.text-res deleted file mode 100644 index 3fd6fbc..0000000 --- a/MarkdownTest/Tests_2004/Literal quotes in titles.text-res +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - -

Foo bar.

-

Foo bar.

- - diff --git a/MarkdownTest/Tests_2004/Markdown Documentation - Basics.html b/MarkdownTest/Tests_2004/Markdown Documentation - Basics.html deleted file mode 100644 index d5bdbb2..0000000 --- a/MarkdownTest/Tests_2004/Markdown Documentation - Basics.html +++ /dev/null @@ -1,314 +0,0 @@ -

Markdown: Basics

- - - -

Getting the Gist of Markdown's Formatting Syntax

- -

This page offers a brief overview of what it's like to use Markdown. -The syntax page provides complete, detailed documentation for -every feature, but Markdown should be very easy to pick up simply by -looking at a few examples of it in action. The examples on this page -are written in a before/after style, showing example syntax and the -HTML output produced by Markdown.

- -

It's also helpful to simply try Markdown out; the Dingus is a -web application that allows you type your own Markdown-formatted text -and translate it to XHTML.

- -

Note: This document is itself written using Markdown; you -can see the source for it by adding '.text' to the URL.

- -

Paragraphs, Headers, Blockquotes

- -

A paragraph is simply one or more consecutive lines of text, separated -by one or more blank lines. (A blank line is any line that looks like a -blank line -- a line containing nothing spaces or tabs is considered -blank.) Normal paragraphs should not be intended with spaces or tabs.

- -

Markdown offers two styles of headers: Setext and atx. -Setext-style headers for <h1> and <h2> are created by -"underlining" with equal signs (=) and hyphens (-), respectively. -To create an atx-style header, you put 1-6 hash marks (#) at the -beginning of the line -- the number of hashes equals the resulting -HTML header level.

- -

Blockquotes are indicated using email-style '>' angle brackets.

- -

Markdown:

- -
A First Level Header
-====================
-
-A Second Level Header
----------------------
-
-Now is the time for all good men to come to
-the aid of their country. This is just a
-regular paragraph.
-
-The quick brown fox jumped over the lazy
-dog's back.
-
-### Header 3
-
-> This is a blockquote.
-> 
-> This is the second paragraph in the blockquote.
->
-> ## This is an H2 in a blockquote
-
- -

Output:

- -
<h1>A First Level Header</h1>
-
-<h2>A Second Level Header</h2>
-
-<p>Now is the time for all good men to come to
-the aid of their country. This is just a
-regular paragraph.</p>
-
-<p>The quick brown fox jumped over the lazy
-dog's back.</p>
-
-<h3>Header 3</h3>
-
-<blockquote>
-    <p>This is a blockquote.</p>
-
-    <p>This is the second paragraph in the blockquote.</p>
-
-    <h2>This is an H2 in a blockquote</h2>
-</blockquote>
-
- -

Phrase Emphasis

- -

Markdown uses asterisks and underscores to indicate spans of emphasis.

- -

Markdown:

- -
Some of these words *are emphasized*.
-Some of these words _are emphasized also_.
-
-Use two asterisks for **strong emphasis**.
-Or, if you prefer, __use two underscores instead__.
-
- -

Output:

- -
<p>Some of these words <em>are emphasized</em>.
-Some of these words <em>are emphasized also</em>.</p>
-
-<p>Use two asterisks for <strong>strong emphasis</strong>.
-Or, if you prefer, <strong>use two underscores instead</strong>.</p>
-
- -

Lists

- -

Unordered (bulleted) lists use asterisks, pluses, and hyphens (*, -+, and -) as list markers. These three markers are -interchangable; this:

- -
*   Candy.
-*   Gum.
-*   Booze.
-
- -

this:

- -
+   Candy.
-+   Gum.
-+   Booze.
-
- -

and this:

- -
-   Candy.
--   Gum.
--   Booze.
-
- -

all produce the same output:

- -
<ul>
-<li>Candy.</li>
-<li>Gum.</li>
-<li>Booze.</li>
-</ul>
-
- -

Ordered (numbered) lists use regular numbers, followed by periods, as -list markers:

- -
1.  Red
-2.  Green
-3.  Blue
-
- -

Output:

- -
<ol>
-<li>Red</li>
-<li>Green</li>
-<li>Blue</li>
-</ol>
-
- -

If you put blank lines between items, you'll get <p> tags for the -list item text. You can create multi-paragraph list items by indenting -the paragraphs by 4 spaces or 1 tab:

- -
*   A list item.
-
-    With multiple paragraphs.
-
-*   Another item in the list.
-
- -

Output:

- -
<ul>
-<li><p>A list item.</p>
-<p>With multiple paragraphs.</p></li>
-<li><p>Another item in the list.</p></li>
-</ul>
-
- -

Links

- -

Markdown supports two styles for creating links: inline and -reference. With both styles, you use square brackets to delimit the -text you want to turn into a link.

- -

Inline-style links use parentheses immediately after the link text. -For example:

- -
This is an [example link](http://example.com/).
-
- -

Output:

- -
<p>This is an <a href="http://example.com/">
-example link</a>.</p>
-
- -

Optionally, you may include a title attribute in the parentheses:

- -
This is an [example link](http://example.com/ "With a Title").
-
- -

Output:

- -
<p>This is an <a href="http://example.com/" title="With a Title">
-example link</a>.</p>
-
- -

Reference-style links allow you to refer to your links by names, which -you define elsewhere in your document:

- -
I get 10 times more traffic from [Google][1] than from
-[Yahoo][2] or [MSN][3].
-
-[1]: http://google.com/        "Google"
-[2]: http://search.yahoo.com/  "Yahoo Search"
-[3]: http://search.msn.com/    "MSN Search"
-
- -

Output:

- -
<p>I get 10 times more traffic from <a href="http://google.com/"
-title="Google">Google</a> than from <a href="http://search.yahoo.com/"
-title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
-title="MSN Search">MSN</a>.</p>
-
- -

The title attribute is optional. Link names may contain letters, -numbers and spaces, but are not case sensitive:

- -
I start my morning with a cup of coffee and
-[The New York Times][NY Times].
-
-[ny times]: http://www.nytimes.com/
-
- -

Output:

- -
<p>I start my morning with a cup of coffee and
-<a href="http://www.nytimes.com/">The New York Times</a>.</p>
-
- -

Images

- -

Image syntax is very much like link syntax.

- -

Inline (titles are optional):

- -
![alt text](/path/to/img.jpg "Title")
-
- -

Reference-style:

- -
![alt text][id]
-
-[id]: /path/to/img.jpg "Title"
-
- -

Both of the above examples produce the same output:

- -
<img src="/path/to/img.jpg" alt="alt text" title="Title" />
-
- -

Code

- -

In a regular paragraph, you can create code span by wrapping text in -backtick quotes. Any ampersands (&) and angle brackets (< or ->) will automatically be translated into HTML entities. This makes -it easy to use Markdown to write about HTML example code:

- -
I strongly recommend against using any `<blink>` tags.
-
-I wish SmartyPants used named entities like `&mdash;`
-instead of decimal-encoded entites like `&#8212;`.
-
- -

Output:

- -
<p>I strongly recommend against using any
-<code>&lt;blink&gt;</code> tags.</p>
-
-<p>I wish SmartyPants used named entities like
-<code>&amp;mdash;</code> instead of decimal-encoded
-entites like <code>&amp;#8212;</code>.</p>
-
- -

To specify an entire block of pre-formatted code, indent every line of -the block by 4 spaces or 1 tab. Just like with code spans, &, <, -and > characters will be escaped automatically.

- -

Markdown:

- -
If you want your page to validate under XHTML 1.0 Strict,
-you've got to put paragraph tags in your blockquotes:
-
-    <blockquote>
-        <p>For example.</p>
-    </blockquote>
-
- -

Output:

- -
<p>If you want your page to validate under XHTML 1.0 Strict,
-you've got to put paragraph tags in your blockquotes:</p>
-
-<pre><code>&lt;blockquote&gt;
-    &lt;p&gt;For example.&lt;/p&gt;
-&lt;/blockquote&gt;
-</code></pre>
-
diff --git a/MarkdownTest/Tests_2004/Markdown Documentation - Basics.text b/MarkdownTest/Tests_2004/Markdown Documentation - Basics.text deleted file mode 100644 index 486055c..0000000 --- a/MarkdownTest/Tests_2004/Markdown Documentation - Basics.text +++ /dev/null @@ -1,306 +0,0 @@ -Markdown: Basics -================ - - - - -Getting the Gist of Markdown's Formatting Syntax ------------------------------------------------- - -This page offers a brief overview of what it's like to use Markdown. -The [syntax page] [s] provides complete, detailed documentation for -every feature, but Markdown should be very easy to pick up simply by -looking at a few examples of it in action. The examples on this page -are written in a before/after style, showing example syntax and the -HTML output produced by Markdown. - -It's also helpful to simply try Markdown out; the [Dingus] [d] is a -web application that allows you type your own Markdown-formatted text -and translate it to XHTML. - -**Note:** This document is itself written using Markdown; you -can [see the source for it by adding '.text' to the URL] [src]. - - [s]: /projects/markdown/syntax "Markdown Syntax" - [d]: /projects/markdown/dingus "Markdown Dingus" - [src]: /projects/markdown/basics.text - - -## Paragraphs, Headers, Blockquotes ## - -A paragraph is simply one or more consecutive lines of text, separated -by one or more blank lines. (A blank line is any line that looks like a -blank line -- a line containing nothing spaces or tabs is considered -blank.) Normal paragraphs should not be intended with spaces or tabs. - -Markdown offers two styles of headers: *Setext* and *atx*. -Setext-style headers for `

` and `

` are created by -"underlining" with equal signs (`=`) and hyphens (`-`), respectively. -To create an atx-style header, you put 1-6 hash marks (`#`) at the -beginning of the line -- the number of hashes equals the resulting -HTML header level. - -Blockquotes are indicated using email-style '`>`' angle brackets. - -Markdown: - - A First Level Header - ==================== - - A Second Level Header - --------------------- - - Now is the time for all good men to come to - the aid of their country. This is just a - regular paragraph. - - The quick brown fox jumped over the lazy - dog's back. - - ### Header 3 - - > This is a blockquote. - > - > This is the second paragraph in the blockquote. - > - > ## This is an H2 in a blockquote - - -Output: - -

A First Level Header

- -

A Second Level Header

- -

Now is the time for all good men to come to - the aid of their country. This is just a - regular paragraph.

- -

The quick brown fox jumped over the lazy - dog's back.

- -

Header 3

- -
-

This is a blockquote.

- -

This is the second paragraph in the blockquote.

- -

This is an H2 in a blockquote

-
- - - -### Phrase Emphasis ### - -Markdown uses asterisks and underscores to indicate spans of emphasis. - -Markdown: - - Some of these words *are emphasized*. - Some of these words _are emphasized also_. - - Use two asterisks for **strong emphasis**. - Or, if you prefer, __use two underscores instead__. - -Output: - -

Some of these words are emphasized. - Some of these words are emphasized also.

- -

Use two asterisks for strong emphasis. - Or, if you prefer, use two underscores instead.

- - - -## Lists ## - -Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`, -`+`, and `-`) as list markers. These three markers are -interchangable; this: - - * Candy. - * Gum. - * Booze. - -this: - - + Candy. - + Gum. - + Booze. - -and this: - - - Candy. - - Gum. - - Booze. - -all produce the same output: - -
    -
  • Candy.
  • -
  • Gum.
  • -
  • Booze.
  • -
- -Ordered (numbered) lists use regular numbers, followed by periods, as -list markers: - - 1. Red - 2. Green - 3. Blue - -Output: - -
    -
  1. Red
  2. -
  3. Green
  4. -
  5. Blue
  6. -
- -If you put blank lines between items, you'll get `

` tags for the -list item text. You can create multi-paragraph list items by indenting -the paragraphs by 4 spaces or 1 tab: - - * A list item. - - With multiple paragraphs. - - * Another item in the list. - -Output: - -

    -
  • A list item.

    -

    With multiple paragraphs.

  • -
  • Another item in the list.

  • -
- - - -### Links ### - -Markdown supports two styles for creating links: *inline* and -*reference*. With both styles, you use square brackets to delimit the -text you want to turn into a link. - -Inline-style links use parentheses immediately after the link text. -For example: - - This is an [example link](http://example.com/). - -Output: - -

This is an - example link.

- -Optionally, you may include a title attribute in the parentheses: - - This is an [example link](http://example.com/ "With a Title"). - -Output: - -

This is an - example link.

- -Reference-style links allow you to refer to your links by names, which -you define elsewhere in your document: - - I get 10 times more traffic from [Google][1] than from - [Yahoo][2] or [MSN][3]. - - [1]: http://google.com/ "Google" - [2]: http://search.yahoo.com/ "Yahoo Search" - [3]: http://search.msn.com/ "MSN Search" - -Output: - -

I get 10 times more traffic from Google than from Yahoo or MSN.

- -The title attribute is optional. Link names may contain letters, -numbers and spaces, but are *not* case sensitive: - - I start my morning with a cup of coffee and - [The New York Times][NY Times]. - - [ny times]: http://www.nytimes.com/ - -Output: - -

I start my morning with a cup of coffee and - The New York Times.

- - -### Images ### - -Image syntax is very much like link syntax. - -Inline (titles are optional): - - ![alt text](/path/to/img.jpg "Title") - -Reference-style: - - ![alt text][id] - - [id]: /path/to/img.jpg "Title" - -Both of the above examples produce the same output: - - alt text - - - -### Code ### - -In a regular paragraph, you can create code span by wrapping text in -backtick quotes. Any ampersands (`&`) and angle brackets (`<` or -`>`) will automatically be translated into HTML entities. This makes -it easy to use Markdown to write about HTML example code: - - I strongly recommend against using any `` tags. - - I wish SmartyPants used named entities like `—` - instead of decimal-encoded entites like `—`. - -Output: - -

I strongly recommend against using any - <blink> tags.

- -

I wish SmartyPants used named entities like - &mdash; instead of decimal-encoded - entites like &#8212;.

- - -To specify an entire block of pre-formatted code, indent every line of -the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`, -and `>` characters will be escaped automatically. - -Markdown: - - If you want your page to validate under XHTML 1.0 Strict, - you've got to put paragraph tags in your blockquotes: - -
-

For example.

-
- -Output: - -

If you want your page to validate under XHTML 1.0 Strict, - you've got to put paragraph tags in your blockquotes:

- -
<blockquote>
-        <p>For example.</p>
-    </blockquote>
-    
diff --git a/MarkdownTest/Tests_2004/Markdown Documentation - Basics.text-out b/MarkdownTest/Tests_2004/Markdown Documentation - Basics.text-out deleted file mode 100644 index 65b90fa..0000000 --- a/MarkdownTest/Tests_2004/Markdown Documentation - Basics.text-out +++ /dev/null @@ -1,321 +0,0 @@ - - - - - - - -

Markdown: Basics

- -

Getting the Gist of Markdown's Formatting Syntax

-

This page offers a brief overview of what it's like to use -Markdown. The syntax page provides complete, detailed -documentation for every feature, but Markdown should be very easy -to pick up simply by looking at a few examples of it in action. The -examples on this page are written in a before/after style, showing -example syntax and the HTML output produced by Markdown.

-

It's also helpful to simply try Markdown out; the Dingus is a -web application that allows you type your own Markdown-formatted -text and translate it to XHTML.

-

Note: This document is itself written using -Markdown; you can see the -source for it by adding '.text' to the URL.

-

Paragraphs, Headers, Blockquotes

-

A paragraph is simply one or more consecutive lines of text, -separated by one or more blank lines. (A blank line is any line -that looks like a blank line -- a line containing nothing spaces or -tabs is considered blank.) Normal paragraphs should not be intended -with spaces or tabs.

-

Markdown offers two styles of headers: Setext and -atx. Setext-style headers for <h1> and -<h2> are created by "underlining" with equal -signs (=) and hyphens (-), respectively. -To create an atx-style header, you put 1-6 hash marks -(#) at the beginning of the line -- the number of -hashes equals the resulting HTML header level.

-

Blockquotes are indicated using email-style '>' -angle brackets.

-

Markdown:

-
-A First Level Header
-====================
-
-A Second Level Header
----------------------
-
-Now is the time for all good men to come to
-the aid of their country. This is just a
-regular paragraph.
-
-The quick brown fox jumped over the lazy
-dog's back.
-
-### Header 3
-
-> This is a blockquote.
-> 
-> This is the second paragraph in the blockquote.
->
-> ## This is an H2 in a blockquote
-
-
-

Output:

-
-<h1>A First Level Header</h1>
-
-<h2>A Second Level Header</h2>
-
-<p>Now is the time for all good men to come to
-the aid of their country. This is just a
-regular paragraph.</p>
-
-<p>The quick brown fox jumped over the lazy
-dog's back.</p>
-
-<h3>Header 3</h3>
-
-<blockquote>
-    <p>This is a blockquote.</p>
-
-    <p>This is the second paragraph in the blockquote.</p>
-
-    <h2>This is an H2 in a blockquote</h2>
-</blockquote>
-
-
-

Phrase Emphasis

-

Markdown uses asterisks and underscores to indicate spans of -emphasis.

-

Markdown:

-
-Some of these words *are emphasized*.
-Some of these words _are emphasized also_.
-
-Use two asterisks for **strong emphasis**.
-Or, if you prefer, __use two underscores instead__.
-
-
-

Output:

-
-<p>Some of these words <em>are emphasized</em>.
-Some of these words <em>are emphasized also</em>.</p>
-
-<p>Use two asterisks for <strong>strong emphasis</strong>.
-Or, if you prefer, <strong>use two underscores instead</strong>.</p>
-
-
-

Lists

-

Unordered (bulleted) lists use asterisks, pluses, and hyphens -(*, +, and -) as list -markers. These three markers are interchangable; this:

-
-*   Candy.
-*   Gum.
-*   Booze.
-
-
-

this:

-
-+   Candy.
-+   Gum.
-+   Booze.
-
-
-

and this:

-
--   Candy.
--   Gum.
--   Booze.
-
-
-

all produce the same output:

-
-<ul>
-<li>Candy.</li>
-<li>Gum.</li>
-<li>Booze.</li>
-</ul>
-
-
-

Ordered (numbered) lists use regular numbers, followed by -periods, as list markers:

-
-1.  Red
-2.  Green
-3.  Blue
-
-
-

Output:

-
-<ol>
-<li>Red</li>
-<li>Green</li>
-<li>Blue</li>
-</ol>
-
-
-

If you put blank lines between items, you'll get -<p> tags for the list item text. You can create -multi-paragraph list items by indenting the paragraphs by 4 spaces -or 1 tab:

-
-*   A list item.
-
-    With multiple paragraphs.
-
-*   Another item in the list.
-
-
-

Output:

-
-<ul>
-<li><p>A list item.</p>
-<p>With multiple paragraphs.</p></li>
-<li><p>Another item in the list.</p></li>
-</ul>
-
-
-

Links

-

Markdown supports two styles for creating links: inline -and reference. With both styles, you use square brackets -to delimit the text you want to turn into a link.

-

Inline-style links use parentheses immediately after the link -text. For example:

-
-This is an [example link](http://example.com/).
-
-
-

Output:

-
-<p>This is an <a href="http://example.com/">
-example link</a>.</p>
-
-
-

Optionally, you may include a title attribute in the -parentheses:

-
-This is an [example link](http://example.com/ "With a Title").
-
-
-

Output:

-
-<p>This is an <a href="http://example.com/" title="With a Title">
-example link</a>.</p>
-
-
-

Reference-style links allow you to refer to your links by names, -which you define elsewhere in your document:

-
-I get 10 times more traffic from [Google][1] than from
-[Yahoo][2] or [MSN][3].
-
-[1]: http://google.com/        "Google"
-[2]: http://search.yahoo.com/  "Yahoo Search"
-[3]: http://search.msn.com/    "MSN Search"
-
-
-

Output:

-
-<p>I get 10 times more traffic from <a href="http://google.com/"
-title="Google">Google</a> than from <a href="http://search.yahoo.com/"
-title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
-title="MSN Search">MSN</a>.</p>
-
-
-

The title attribute is optional. Link names may contain letters, -numbers and spaces, but are not case sensitive:

-
-I start my morning with a cup of coffee and
-[The New York Times][NY Times].
-
-[ny times]: http://www.nytimes.com/
-
-
-

Output:

-
-<p>I start my morning with a cup of coffee and
-<a href="http://www.nytimes.com/">The New York Times</a>.</p>
-
-
-

Images

-

Image syntax is very much like link syntax.

-

Inline (titles are optional):

-
-![alt text](/path/to/img.jpg "Title")
-
-
-

Reference-style:

-
-![alt text][id]
-
-[id]: /path/to/img.jpg "Title"
-
-
-

Both of the above examples produce the same output:

-
-<img src="/path/to/img.jpg" alt="alt text" title="Title" />
-
-
-

Code

-

In a regular paragraph, you can create code span by wrapping -text in backtick quotes. Any ampersands (&) and -angle brackets (< or >) will -automatically be translated into HTML entities. This makes it easy -to use Markdown to write about HTML example code:

-
-I strongly recommend against using any `<blink>` tags.
-
-I wish SmartyPants used named entities like `&mdash;`
-instead of decimal-encoded entites like `&#8212;`.
-
-
-

Output:

-
-<p>I strongly recommend against using any
-<code>&lt;blink&gt;</code> tags.</p>
-
-<p>I wish SmartyPants used named entities like
-<code>&amp;mdash;</code> instead of decimal-encoded
-entites like <code>&amp;#8212;</code>.</p>
-
-
-

To specify an entire block of pre-formatted code, indent every -line of the block by 4 spaces or 1 tab. Just like with code spans, -&, <, and > -characters will be escaped automatically.

-

Markdown:

-
-If you want your page to validate under XHTML 1.0 Strict,
-you've got to put paragraph tags in your blockquotes:
-
-    <blockquote>
-        <p>For example.</p>
-    </blockquote>
-
-
-

Output:

-
-<p>If you want your page to validate under XHTML 1.0 Strict,
-you've got to put paragraph tags in your blockquotes:</p>
-
-<pre><code>&lt;blockquote&gt;
-    &lt;p&gt;For example.&lt;/p&gt;
-&lt;/blockquote&gt;
-</code></pre>
-
-
- - diff --git a/MarkdownTest/Tests_2004/Markdown Documentation - Basics.text-res b/MarkdownTest/Tests_2004/Markdown Documentation - Basics.text-res deleted file mode 100644 index 65b90fa..0000000 --- a/MarkdownTest/Tests_2004/Markdown Documentation - Basics.text-res +++ /dev/null @@ -1,321 +0,0 @@ - - - - - - - -

Markdown: Basics

- -

Getting the Gist of Markdown's Formatting Syntax

-

This page offers a brief overview of what it's like to use -Markdown. The syntax page provides complete, detailed -documentation for every feature, but Markdown should be very easy -to pick up simply by looking at a few examples of it in action. The -examples on this page are written in a before/after style, showing -example syntax and the HTML output produced by Markdown.

-

It's also helpful to simply try Markdown out; the Dingus is a -web application that allows you type your own Markdown-formatted -text and translate it to XHTML.

-

Note: This document is itself written using -Markdown; you can see the -source for it by adding '.text' to the URL.

-

Paragraphs, Headers, Blockquotes

-

A paragraph is simply one or more consecutive lines of text, -separated by one or more blank lines. (A blank line is any line -that looks like a blank line -- a line containing nothing spaces or -tabs is considered blank.) Normal paragraphs should not be intended -with spaces or tabs.

-

Markdown offers two styles of headers: Setext and -atx. Setext-style headers for <h1> and -<h2> are created by "underlining" with equal -signs (=) and hyphens (-), respectively. -To create an atx-style header, you put 1-6 hash marks -(#) at the beginning of the line -- the number of -hashes equals the resulting HTML header level.

-

Blockquotes are indicated using email-style '>' -angle brackets.

-

Markdown:

-
-A First Level Header
-====================
-
-A Second Level Header
----------------------
-
-Now is the time for all good men to come to
-the aid of their country. This is just a
-regular paragraph.
-
-The quick brown fox jumped over the lazy
-dog's back.
-
-### Header 3
-
-> This is a blockquote.
-> 
-> This is the second paragraph in the blockquote.
->
-> ## This is an H2 in a blockquote
-
-
-

Output:

-
-<h1>A First Level Header</h1>
-
-<h2>A Second Level Header</h2>
-
-<p>Now is the time for all good men to come to
-the aid of their country. This is just a
-regular paragraph.</p>
-
-<p>The quick brown fox jumped over the lazy
-dog's back.</p>
-
-<h3>Header 3</h3>
-
-<blockquote>
-    <p>This is a blockquote.</p>
-
-    <p>This is the second paragraph in the blockquote.</p>
-
-    <h2>This is an H2 in a blockquote</h2>
-</blockquote>
-
-
-

Phrase Emphasis

-

Markdown uses asterisks and underscores to indicate spans of -emphasis.

-

Markdown:

-
-Some of these words *are emphasized*.
-Some of these words _are emphasized also_.
-
-Use two asterisks for **strong emphasis**.
-Or, if you prefer, __use two underscores instead__.
-
-
-

Output:

-
-<p>Some of these words <em>are emphasized</em>.
-Some of these words <em>are emphasized also</em>.</p>
-
-<p>Use two asterisks for <strong>strong emphasis</strong>.
-Or, if you prefer, <strong>use two underscores instead</strong>.</p>
-
-
-

Lists

-

Unordered (bulleted) lists use asterisks, pluses, and hyphens -(*, +, and -) as list -markers. These three markers are interchangable; this:

-
-*   Candy.
-*   Gum.
-*   Booze.
-
-
-

this:

-
-+   Candy.
-+   Gum.
-+   Booze.
-
-
-

and this:

-
--   Candy.
--   Gum.
--   Booze.
-
-
-

all produce the same output:

-
-<ul>
-<li>Candy.</li>
-<li>Gum.</li>
-<li>Booze.</li>
-</ul>
-
-
-

Ordered (numbered) lists use regular numbers, followed by -periods, as list markers:

-
-1.  Red
-2.  Green
-3.  Blue
-
-
-

Output:

-
-<ol>
-<li>Red</li>
-<li>Green</li>
-<li>Blue</li>
-</ol>
-
-
-

If you put blank lines between items, you'll get -<p> tags for the list item text. You can create -multi-paragraph list items by indenting the paragraphs by 4 spaces -or 1 tab:

-
-*   A list item.
-
-    With multiple paragraphs.
-
-*   Another item in the list.
-
-
-

Output:

-
-<ul>
-<li><p>A list item.</p>
-<p>With multiple paragraphs.</p></li>
-<li><p>Another item in the list.</p></li>
-</ul>
-
-
-

Links

-

Markdown supports two styles for creating links: inline -and reference. With both styles, you use square brackets -to delimit the text you want to turn into a link.

-

Inline-style links use parentheses immediately after the link -text. For example:

-
-This is an [example link](http://example.com/).
-
-
-

Output:

-
-<p>This is an <a href="http://example.com/">
-example link</a>.</p>
-
-
-

Optionally, you may include a title attribute in the -parentheses:

-
-This is an [example link](http://example.com/ "With a Title").
-
-
-

Output:

-
-<p>This is an <a href="http://example.com/" title="With a Title">
-example link</a>.</p>
-
-
-

Reference-style links allow you to refer to your links by names, -which you define elsewhere in your document:

-
-I get 10 times more traffic from [Google][1] than from
-[Yahoo][2] or [MSN][3].
-
-[1]: http://google.com/        "Google"
-[2]: http://search.yahoo.com/  "Yahoo Search"
-[3]: http://search.msn.com/    "MSN Search"
-
-
-

Output:

-
-<p>I get 10 times more traffic from <a href="http://google.com/"
-title="Google">Google</a> than from <a href="http://search.yahoo.com/"
-title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
-title="MSN Search">MSN</a>.</p>
-
-
-

The title attribute is optional. Link names may contain letters, -numbers and spaces, but are not case sensitive:

-
-I start my morning with a cup of coffee and
-[The New York Times][NY Times].
-
-[ny times]: http://www.nytimes.com/
-
-
-

Output:

-
-<p>I start my morning with a cup of coffee and
-<a href="http://www.nytimes.com/">The New York Times</a>.</p>
-
-
-

Images

-

Image syntax is very much like link syntax.

-

Inline (titles are optional):

-
-![alt text](/path/to/img.jpg "Title")
-
-
-

Reference-style:

-
-![alt text][id]
-
-[id]: /path/to/img.jpg "Title"
-
-
-

Both of the above examples produce the same output:

-
-<img src="/path/to/img.jpg" alt="alt text" title="Title" />
-
-
-

Code

-

In a regular paragraph, you can create code span by wrapping -text in backtick quotes. Any ampersands (&) and -angle brackets (< or >) will -automatically be translated into HTML entities. This makes it easy -to use Markdown to write about HTML example code:

-
-I strongly recommend against using any `<blink>` tags.
-
-I wish SmartyPants used named entities like `&mdash;`
-instead of decimal-encoded entites like `&#8212;`.
-
-
-

Output:

-
-<p>I strongly recommend against using any
-<code>&lt;blink&gt;</code> tags.</p>
-
-<p>I wish SmartyPants used named entities like
-<code>&amp;mdash;</code> instead of decimal-encoded
-entites like <code>&amp;#8212;</code>.</p>
-
-
-

To specify an entire block of pre-formatted code, indent every -line of the block by 4 spaces or 1 tab. Just like with code spans, -&, <, and > -characters will be escaped automatically.

-

Markdown:

-
-If you want your page to validate under XHTML 1.0 Strict,
-you've got to put paragraph tags in your blockquotes:
-
-    <blockquote>
-        <p>For example.</p>
-    </blockquote>
-
-
-

Output:

-
-<p>If you want your page to validate under XHTML 1.0 Strict,
-you've got to put paragraph tags in your blockquotes:</p>
-
-<pre><code>&lt;blockquote&gt;
-    &lt;p&gt;For example.&lt;/p&gt;
-&lt;/blockquote&gt;
-</code></pre>
-
-
- - diff --git a/MarkdownTest/Tests_2004/Markdown Documentation - Syntax.html b/MarkdownTest/Tests_2004/Markdown Documentation - Syntax.html deleted file mode 100644 index 5c01306..0000000 --- a/MarkdownTest/Tests_2004/Markdown Documentation - Syntax.html +++ /dev/null @@ -1,942 +0,0 @@ -

Markdown: Syntax

- - - - - -

Note: This document is itself written using Markdown; you -can see the source for it by adding '.text' to the URL.

- -
- -

Overview

- -

Philosophy

- -

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

- -

Readability, however, is emphasized above all else. A Markdown-formatted -document should be publishable as-is, as plain text, without looking -like it's been marked up with tags or formatting instructions. While -Markdown's syntax has been influenced by several existing text-to-HTML -filters -- including Setext, atx, Textile, reStructuredText, -Grutatext, and EtText -- the single biggest source of -inspiration for Markdown's syntax is the format of plain text email.

- -

To this end, Markdown's syntax is comprised entirely of punctuation -characters, which punctuation characters have been carefully chosen so -as to look like what they mean. E.g., asterisks around a word actually -look like *emphasis*. Markdown lists look like, well, lists. Even -blockquotes look like quoted passages of text, assuming you've ever -used email.

- -

Inline HTML

- -

Markdown's syntax is intended for one purpose: to be used as a -format for writing for the web.

- -

Markdown is not a replacement for HTML, or even close to it. Its -syntax is very small, corresponding only to a very small subset of -HTML tags. The idea is not to create a syntax that makes it easier -to insert HTML tags. In my opinion, HTML tags are already easy to -insert. The idea for Markdown is to make it easy to read, write, and -edit prose. HTML is a publishing format; Markdown is a writing -format. Thus, Markdown's formatting syntax only addresses issues that -can be conveyed in plain text.

- -

For any markup that is not covered by Markdown's syntax, you simply -use HTML itself. There's no need to preface it or delimit it to -indicate that you're switching from Markdown to HTML; you just use -the tags.

- -

The only restrictions are that block-level HTML elements -- e.g. <div>, -<table>, <pre>, <p>, etc. -- must be separated from surrounding -content by blank lines, and the start and end tags of the block should -not be indented with tabs or spaces. Markdown is smart enough not -to add extra (unwanted) <p> tags around HTML block-level tags.

- -

For example, to add an HTML table to a Markdown article:

- -
This is a regular paragraph.
-
-<table>
-    <tr>
-        <td>Foo</td>
-    </tr>
-</table>
-
-This is another regular paragraph.
-
- -

Note that Markdown formatting syntax is not processed within block-level -HTML tags. E.g., you can't use Markdown-style *emphasis* inside an -HTML block.

- -

Span-level HTML tags -- e.g. <span>, <cite>, or <del> -- can be -used anywhere in a Markdown paragraph, list item, or header. If you -want, you can even use HTML tags instead of Markdown formatting; e.g. if -you'd prefer to use HTML <a> or <img> tags instead of Markdown's -link or image syntax, go right ahead.

- -

Unlike block-level HTML tags, Markdown syntax is processed within -span-level tags.

- -

Automatic Escaping for Special Characters

- -

In HTML, there are two characters that demand special treatment: < -and &. Left angle brackets are used to start tags; ampersands are -used to denote HTML entities. If you want to use them as literal -characters, you must escape them as entities, e.g. &lt;, and -&amp;.

- -

Ampersands in particular are bedeviling for web writers. If you want to -write about 'AT&T', you need to write 'AT&amp;T'. You even need to -escape ampersands within URLs. Thus, if you want to link to:

- -
http://images.google.com/images?num=30&q=larry+bird
-
- -

you need to encode the URL as:

- -
http://images.google.com/images?num=30&amp;q=larry+bird
-
- -

in your anchor tag href attribute. Needless to say, this is easy to -forget, and is probably the single most common source of HTML validation -errors in otherwise well-marked-up web sites.

- -

Markdown allows you to use these characters naturally, taking care of -all the necessary escaping for you. If you use an ampersand as part of -an HTML entity, it remains unchanged; otherwise it will be translated -into &amp;.

- -

So, if you want to include a copyright symbol in your article, you can write:

- -
&copy;
-
- -

and Markdown will leave it alone. But if you write:

- -
AT&T
-
- -

Markdown will translate it to:

- -
AT&amp;T
-
- -

Similarly, because Markdown supports inline HTML, if you use -angle brackets as delimiters for HTML tags, Markdown will treat them as -such. But if you write:

- -
4 < 5
-
- -

Markdown will translate it to:

- -
4 &lt; 5
-
- -

However, inside Markdown code spans and blocks, angle brackets and -ampersands are always encoded automatically. This makes it easy to use -Markdown to write about HTML code. (As opposed to raw HTML, which is a -terrible format for writing about HTML syntax, because every single < -and & in your example code needs to be escaped.)

- -
- -

Block Elements

- -

Paragraphs and Line Breaks

- -

A paragraph is simply one or more consecutive lines of text, separated -by one or more blank lines. (A blank line is any line that looks like a -blank line -- a line containing nothing but spaces or tabs is considered -blank.) Normal paragraphs should not be intended with spaces or tabs.

- -

The implication of the "one or more consecutive lines of text" rule is -that Markdown supports "hard-wrapped" text paragraphs. This differs -significantly from most other text-to-HTML formatters (including Movable -Type's "Convert Line Breaks" option) which translate every line break -character in a paragraph into a <br /> tag.

- -

When you do want to insert a <br /> break tag using Markdown, you -end a line with two or more spaces, then type return.

- -

Yes, this takes a tad more effort to create a <br />, but a simplistic -"every line break is a <br />" rule wouldn't work for Markdown. -Markdown's email-style blockquoting and multi-paragraph list items -work best -- and look better -- when you format them with hard breaks.

- - - -

Markdown supports two styles of headers, Setext and atx.

- -

Setext-style headers are "underlined" using equal signs (for first-level -headers) and dashes (for second-level headers). For example:

- -
This is an H1
-=============
-
-This is an H2
--------------
-
- -

Any number of underlining ='s or -'s will work.

- -

Atx-style headers use 1-6 hash characters at the start of the line, -corresponding to header levels 1-6. For example:

- -
# This is an H1
-
-## This is an H2
-
-###### This is an H6
-
- -

Optionally, you may "close" atx-style headers. This is purely -cosmetic -- you can use this if you think it looks better. The -closing hashes don't even need to match the number of hashes -used to open the header. (The number of opening hashes -determines the header level.) :

- -
# This is an H1 #
-
-## This is an H2 ##
-
-### This is an H3 ######
-
- -

Blockquotes

- -

Markdown uses email-style > characters for blockquoting. If you're -familiar with quoting passages of text in an email message, then you -know how to create a blockquote in Markdown. It looks best if you hard -wrap the text and put a > before every line:

- -
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
-> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
-> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
-> 
-> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
-> id sem consectetuer libero luctus adipiscing.
-
- -

Markdown allows you to be lazy and only put the > before the first -line of a hard-wrapped paragraph:

- -
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
-consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
-Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
-
-> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
-id sem consectetuer libero luctus adipiscing.
-
- -

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by -adding additional levels of >:

- -
> This is the first level of quoting.
->
-> > This is nested blockquote.
->
-> Back to the first level.
-
- -

Blockquotes can contain other Markdown elements, including headers, lists, -and code blocks:

- -
> ## This is a header.
-> 
-> 1.   This is the first list item.
-> 2.   This is the second list item.
-> 
-> Here's some example code:
-> 
->     return shell_exec("echo $input | $markdown_script");
-
- -

Any decent text editor should make email-style quoting easy. For -example, with BBEdit, you can make a selection and choose Increase -Quote Level from the Text menu.

- -

Lists

- -

Markdown supports ordered (numbered) and unordered (bulleted) lists.

- -

Unordered lists use asterisks, pluses, and hyphens -- interchangably --- as list markers:

- -
*   Red
-*   Green
-*   Blue
-
- -

is equivalent to:

- -
+   Red
-+   Green
-+   Blue
-
- -

and:

- -
-   Red
--   Green
--   Blue
-
- -

Ordered lists use numbers followed by periods:

- -
1.  Bird
-2.  McHale
-3.  Parish
-
- -

It's important to note that the actual numbers you use to mark the -list have no effect on the HTML output Markdown produces. The HTML -Markdown produces from the above list is:

- -
<ol>
-<li>Bird</li>
-<li>McHale</li>
-<li>Parish</li>
-</ol>
-
- -

If you instead wrote the list in Markdown like this:

- -
1.  Bird
-1.  McHale
-1.  Parish
-
- -

or even:

- -
3. Bird
-1. McHale
-8. Parish
-
- -

you'd get the exact same HTML output. The point is, if you want to, -you can use ordinal numbers in your ordered Markdown lists, so that -the numbers in your source match the numbers in your published HTML. -But if you want to be lazy, you don't have to.

- -

If you do use lazy list numbering, however, you should still start the -list with the number 1. At some point in the future, Markdown may support -starting ordered lists at an arbitrary number.

- -

List markers typically start at the left margin, but may be indented by -up to three spaces. List markers must be followed by one or more spaces -or a tab.

- -

To make lists look nice, you can wrap items with hanging indents:

- -
*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
-    Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
-    viverra nec, fringilla in, laoreet vitae, risus.
-*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
-    Suspendisse id sem consectetuer libero luctus adipiscing.
-
- -

But if you want to be lazy, you don't have to:

- -
*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
-Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
-viverra nec, fringilla in, laoreet vitae, risus.
-*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
-Suspendisse id sem consectetuer libero luctus adipiscing.
-
- -

If list items are separated by blank lines, Markdown will wrap the -items in <p> tags in the HTML output. For example, this input:

- -
*   Bird
-*   Magic
-
- -

will turn into:

- -
<ul>
-<li>Bird</li>
-<li>Magic</li>
-</ul>
-
- -

But this:

- -
*   Bird
-
-*   Magic
-
- -

will turn into:

- -
<ul>
-<li><p>Bird</p></li>
-<li><p>Magic</p></li>
-</ul>
-
- -

List items may consist of multiple paragraphs. Each subsequent -paragraph in a list item must be intended by either 4 spaces -or one tab:

- -
1.  This is a list item with two paragraphs. Lorem ipsum dolor
-    sit amet, consectetuer adipiscing elit. Aliquam hendrerit
-    mi posuere lectus.
-
-    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
-    vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
-    sit amet velit.
-
-2.  Suspendisse id sem consectetuer libero luctus adipiscing.
-
- -

It looks nice if you indent every line of the subsequent -paragraphs, but here again, Markdown will allow you to be -lazy:

- -
*   This is a list item with two paragraphs.
-
-    This is the second paragraph in the list item. You're
-only required to indent the first line. Lorem ipsum dolor
-sit amet, consectetuer adipiscing elit.
-
-*   Another item in the same list.
-
- -

To put a blockquote within a list item, the blockquote's > -delimiters need to be indented:

- -
*   A list item with a blockquote:
-
-    > This is a blockquote
-    > inside a list item.
-
- -

To put a code block within a list item, the code block needs -to be indented twice -- 8 spaces or two tabs:

- -
*   A list item with a code block:
-
-        <code goes here>
-
- -

It's worth noting that it's possible to trigger an ordered list by -accident, by writing something like this:

- -
1986. What a great season.
-
- -

In other words, a number-period-space sequence at the beginning of a -line. To avoid this, you can backslash-escape the period:

- -
1986\. What a great season.
-
- -

Code Blocks

- -

Pre-formatted code blocks are used for writing about programming or -markup source code. Rather than forming normal paragraphs, the lines -of a code block are interpreted literally. Markdown wraps a code block -in both <pre> and <code> tags.

- -

To produce a code block in Markdown, simply indent every line of the -block by at least 4 spaces or 1 tab. For example, given this input:

- -
This is a normal paragraph:
-
-    This is a code block.
-
- -

Markdown will generate:

- -
<p>This is a normal paragraph:</p>
-
-<pre><code>This is a code block.
-</code></pre>
-
- -

One level of indentation -- 4 spaces or 1 tab -- is removed from each -line of the code block. For example, this:

- -
Here is an example of AppleScript:
-
-    tell application "Foo"
-        beep
-    end tell
-
- -

will turn into:

- -
<p>Here is an example of AppleScript:</p>
-
-<pre><code>tell application "Foo"
-    beep
-end tell
-</code></pre>
-
- -

A code block continues until it reaches a line that is not indented -(or the end of the article).

- -

Within a code block, ampersands (&) and angle brackets (< and >) -are automatically converted into HTML entities. This makes it very -easy to include example HTML source code using Markdown -- just paste -it and indent it, and Markdown will handle the hassle of encoding the -ampersands and angle brackets. For example, this:

- -
    <div class="footer">
-        &copy; 2004 Foo Corporation
-    </div>
-
- -

will turn into:

- -
<pre><code>&lt;div class="footer"&gt;
-    &amp;copy; 2004 Foo Corporation
-&lt;/div&gt;
-</code></pre>
-
- -

Regular Markdown syntax is not processed within code blocks. E.g., -asterisks are just literal asterisks within a code block. This means -it's also easy to use Markdown to write about Markdown's own syntax.

- -

Horizontal Rules

- -

You can produce a horizontal rule tag (<hr />) by placing three or -more hyphens, asterisks, or underscores on a line by themselves. If you -wish, you may use spaces between the hyphens or asterisks. Each of the -following lines will produce a horizontal rule:

- -
* * *
-
-***
-
-*****
-
-- - -
-
----------------------------------------
-
-_ _ _
-
- -
- -

Span Elements

- - - -

Markdown supports two style of links: inline and reference.

- -

In both styles, the link text is delimited by [square brackets].

- -

To create an inline link, use a set of regular parentheses immediately -after the link text's closing square bracket. Inside the parentheses, -put the URL where you want the link to point, along with an optional -title for the link, surrounded in quotes. For example:

- -
This is [an example](http://example.com/ "Title") inline link.
-
-[This link](http://example.net/) has no title attribute.
-
- -

Will produce:

- -
<p>This is <a href="http://example.com/" title="Title">
-an example</a> inline link.</p>
-
-<p><a href="http://example.net/">This link</a> has no
-title attribute.</p>
-
- -

If you're referring to a local resource on the same server, you can -use relative paths:

- -
See my [About](/about/) page for details.
-
- -

Reference-style links use a second set of square brackets, inside -which you place a label of your choosing to identify the link:

- -
This is [an example][id] reference-style link.
-
- -

You can optionally use a space to separate the sets of brackets:

- -
This is [an example] [id] reference-style link.
-
- -

Then, anywhere in the document, you define your link label like this, -on a line by itself:

- -
[id]: http://example.com/  "Optional Title Here"
-
- -

That is:

- -
    -
  • Square brackets containing the link identifier (optionally -indented from the left margin using up to three spaces);
  • -
  • followed by a colon;
  • -
  • followed by one or more spaces (or tabs);
  • -
  • followed by the URL for the link;
  • -
  • optionally followed by a title attribute for the link, enclosed -in double or single quotes.
  • -
- -

The link URL may, optionally, be surrounded by angle brackets:

- -
[id]: <http://example.com/>  "Optional Title Here"
-
- -

You can put the title attribute on the next line and use extra spaces -or tabs for padding, which tends to look better with longer URLs:

- -
[id]: http://example.com/longish/path/to/resource/here
-    "Optional Title Here"
-
- -

Link definitions are only used for creating links during Markdown -processing, and are stripped from your document in the HTML output.

- -

Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are not case sensitive. E.g. these two links:

- -
[link text][a]
-[link text][A]
-
- -

are equivalent.

- -

The implicit link name shortcut allows you to omit the name of the -link, in which case the link text itself is used as the name. -Just use an empty set of square brackets -- e.g., to link the word -"Google" to the google.com web site, you could simply write:

- -
[Google][]
-
- -

And then define the link:

- -
[Google]: http://google.com/
-
- -

Because link names may contain spaces, this shortcut even works for -multiple words in the link text:

- -
Visit [Daring Fireball][] for more information.
-
- -

And then define the link:

- -
[Daring Fireball]: http://daringfireball.net/
-
- -

Link definitions can be placed anywhere in your Markdown document. I -tend to put them immediately after each paragraph in which they're -used, but if you want, you can put them all at the end of your -document, sort of like footnotes.

- -

Here's an example of reference links in action:

- -
I get 10 times more traffic from [Google] [1] than from
-[Yahoo] [2] or [MSN] [3].
-
-  [1]: http://google.com/        "Google"
-  [2]: http://search.yahoo.com/  "Yahoo Search"
-  [3]: http://search.msn.com/    "MSN Search"
-
- -

Using the implicit link name shortcut, you could instead write:

- -
I get 10 times more traffic from [Google][] than from
-[Yahoo][] or [MSN][].
-
-  [google]: http://google.com/        "Google"
-  [yahoo]:  http://search.yahoo.com/  "Yahoo Search"
-  [msn]:    http://search.msn.com/    "MSN Search"
-
- -

Both of the above examples will produce the following HTML output:

- -
<p>I get 10 times more traffic from <a href="http://google.com/"
-title="Google">Google</a> than from
-<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
-or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
-
- -

For comparison, here is the same paragraph written using -Markdown's inline link style:

- -
I get 10 times more traffic from [Google](http://google.com/ "Google")
-than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
-[MSN](http://search.msn.com/ "MSN Search").
-
- -

The point of reference-style links is not that they're easier to -write. The point is that with reference-style links, your document -source is vastly more readable. Compare the above examples: using -reference-style links, the paragraph itself is only 81 characters -long; with inline-style links, it's 176 characters; and as raw HTML, -it's 234 characters. In the raw HTML, there's more markup than there -is text.

- -

With Markdown's reference-style links, a source document much more -closely resembles the final output, as rendered in a browser. By -allowing you to move the markup-related metadata out of the paragraph, -you can add links without interrupting the narrative flow of your -prose.

- -

Emphasis

- -

Markdown treats asterisks (*) and underscores (_) as indicators of -emphasis. Text wrapped with one * or _ will be wrapped with an -HTML <em> tag; double *'s or _'s will be wrapped with an HTML -<strong> tag. E.g., this input:

- -
*single asterisks*
-
-_single underscores_
-
-**double asterisks**
-
-__double underscores__
-
- -

will produce:

- -
<em>single asterisks</em>
-
-<em>single underscores</em>
-
-<strong>double asterisks</strong>
-
-<strong>double underscores</strong>
-
- -

You can use whichever style you prefer; the lone restriction is that -the same character must be used to open and close an emphasis span.

- -

Emphasis can be used in the middle of a word:

- -
un*fucking*believable
-
- -

But if you surround an * or _ with spaces, it'll be treated as a -literal asterisk or underscore.

- -

To produce a literal asterisk or underscore at a position where it -would otherwise be used as an emphasis delimiter, you can backslash -escape it:

- -
\*this text is surrounded by literal asterisks\*
-
- -

Code

- -

To indicate a span of code, wrap it with backtick quotes (`). -Unlike a pre-formatted code block, a code span indicates code within a -normal paragraph. For example:

- -
Use the `printf()` function.
-
- -

will produce:

- -
<p>Use the <code>printf()</code> function.</p>
-
- -

To include a literal backtick character within a code span, you can use -multiple backticks as the opening and closing delimiters:

- -
``There is a literal backtick (`) here.``
-
- -

which will produce this:

- -
<p><code>There is a literal backtick (`) here.</code></p>
-
- -

The backtick delimiters surrounding a code span may include spaces -- -one after the opening, one before the closing. This allows you to place -literal backtick characters at the beginning or end of a code span:

- -
A single backtick in a code span: `` ` ``
-
-A backtick-delimited string in a code span: `` `foo` ``
-
- -

will produce:

- -
<p>A single backtick in a code span: <code>`</code></p>
-
-<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
-
- -

With a code span, ampersands and angle brackets are encoded as HTML -entities automatically, which makes it easy to include example HTML -tags. Markdown will turn this:

- -
Please don't use any `<blink>` tags.
-
- -

into:

- -
<p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
-
- -

You can write this:

- -
`&#8212;` is the decimal-encoded equivalent of `&mdash;`.
-
- -

to produce:

- -
<p><code>&amp;#8212;</code> is the decimal-encoded
-equivalent of <code>&amp;mdash;</code>.</p>
-
- -

Images

- -

Admittedly, it's fairly difficult to devise a "natural" syntax for -placing images into a plain text document format.

- -

Markdown uses an image syntax that is intended to resemble the syntax -for links, allowing for two styles: inline and reference.

- -

Inline image syntax looks like this:

- -
![Alt text](/path/to/img.jpg)
-
-![Alt text](/path/to/img.jpg "Optional title")
-
- -

That is:

- -
    -
  • An exclamation mark: !;
  • -
  • followed by a set of square brackets, containing the alt -attribute text for the image;
  • -
  • followed by a set of parentheses, containing the URL or path to -the image, and an optional title attribute enclosed in double -or single quotes.
  • -
- -

Reference-style image syntax looks like this:

- -
![Alt text][id]
-
- -

Where "id" is the name of a defined image reference. Image references -are defined using syntax identical to link references:

- -
[id]: url/to/image  "Optional title attribute"
-
- -

As of this writing, Markdown has no syntax for specifying the -dimensions of an image; if this is important to you, you can simply -use regular HTML <img> tags.

- -
- -

Miscellaneous

- - - -

Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

- -
<http://example.com/>
-
- -

Markdown will turn this into:

- -
<a href="http://example.com/">http://example.com/</a>
-
- -

Automatic links for email addresses work similarly, except that -Markdown will also perform a bit of randomized decimal and hex -entity-encoding to help obscure your address from address-harvesting -spambots. For example, Markdown will turn this:

- -
<address@example.com>
-
- -

into something like this:

- -
<a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
-&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
-&#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
-&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
-
- -

which will render in a browser as a clickable link to "address@example.com".

- -

(This sort of entity-encoding trick will indeed fool many, if not -most, address-harvesting bots, but it definitely won't fool all of -them. It's better than nothing, but an address published in this way -will probably eventually start receiving spam.)

- -

Backslash Escapes

- -

Markdown allows you to use backslash escapes to generate literal -characters which would otherwise have special meaning in Markdown's -formatting syntax. For example, if you wanted to surround a word with -literal asterisks (instead of an HTML <em> tag), you can backslashes -before the asterisks, like this:

- -
\*literal asterisks\*
-
- -

Markdown provides backslash escapes for the following characters:

- -
\   backslash
-`   backtick
-*   asterisk
-_   underscore
-{}  curly braces
-[]  square brackets
-()  parentheses
-#   hash mark
-+   plus sign
--   minus sign (hyphen)
-.   dot
-!   exclamation mark
-
diff --git a/MarkdownTest/Tests_2004/Markdown Documentation - Syntax.text b/MarkdownTest/Tests_2004/Markdown Documentation - Syntax.text deleted file mode 100644 index dabd75c..0000000 --- a/MarkdownTest/Tests_2004/Markdown Documentation - Syntax.text +++ /dev/null @@ -1,888 +0,0 @@ -Markdown: Syntax -================ - - - - -* [Overview](#overview) - * [Philosophy](#philosophy) - * [Inline HTML](#html) - * [Automatic Escaping for Special Characters](#autoescape) -* [Block Elements](#block) - * [Paragraphs and Line Breaks](#p) - * [Headers](#header) - * [Blockquotes](#blockquote) - * [Lists](#list) - * [Code Blocks](#precode) - * [Horizontal Rules](#hr) -* [Span Elements](#span) - * [Links](#link) - * [Emphasis](#em) - * [Code](#code) - * [Images](#img) -* [Miscellaneous](#misc) - * [Backslash Escapes](#backslash) - * [Automatic Links](#autolink) - - -**Note:** This document is itself written using Markdown; you -can [see the source for it by adding '.text' to the URL][src]. - - [src]: /projects/markdown/syntax.text - -* * * - -

Overview

- -

Philosophy

- -Markdown is intended to be as easy-to-read and easy-to-write as is feasible. - -Readability, however, is emphasized above all else. A Markdown-formatted -document should be publishable as-is, as plain text, without looking -like it's been marked up with tags or formatting instructions. While -Markdown's syntax has been influenced by several existing text-to-HTML -filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4], -[Grutatext] [5], and [EtText] [6] -- the single biggest source of -inspiration for Markdown's syntax is the format of plain text email. - - [1]: http://docutils.sourceforge.net/mirror/setext.html - [2]: http://www.aaronsw.com/2002/atx/ - [3]: http://textism.com/tools/textile/ - [4]: http://docutils.sourceforge.net/rst.html - [5]: http://www.triptico.com/software/grutatxt.html - [6]: http://ettext.taint.org/doc/ - -To this end, Markdown's syntax is comprised entirely of punctuation -characters, which punctuation characters have been carefully chosen so -as to look like what they mean. E.g., asterisks around a word actually -look like \*emphasis\*. Markdown lists look like, well, lists. Even -blockquotes look like quoted passages of text, assuming you've ever -used email. - - - -

Inline HTML

- -Markdown's syntax is intended for one purpose: to be used as a -format for *writing* for the web. - -Markdown is not a replacement for HTML, or even close to it. Its -syntax is very small, corresponding only to a very small subset of -HTML tags. The idea is *not* to create a syntax that makes it easier -to insert HTML tags. In my opinion, HTML tags are already easy to -insert. The idea for Markdown is to make it easy to read, write, and -edit prose. HTML is a *publishing* format; Markdown is a *writing* -format. Thus, Markdown's formatting syntax only addresses issues that -can be conveyed in plain text. - -For any markup that is not covered by Markdown's syntax, you simply -use HTML itself. There's no need to preface it or delimit it to -indicate that you're switching from Markdown to HTML; you just use -the tags. - -The only restrictions are that block-level HTML elements -- e.g. `
`, -``, `
`, `

`, etc. -- must be separated from surrounding -content by blank lines, and the start and end tags of the block should -not be indented with tabs or spaces. Markdown is smart enough not -to add extra (unwanted) `

` tags around HTML block-level tags. - -For example, to add an HTML table to a Markdown article: - - This is a regular paragraph. - -

- - - -
Foo
- - This is another regular paragraph. - -Note that Markdown formatting syntax is not processed within block-level -HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an -HTML block. - -Span-level HTML tags -- e.g. ``, ``, or `` -- can be -used anywhere in a Markdown paragraph, list item, or header. If you -want, you can even use HTML tags instead of Markdown formatting; e.g. if -you'd prefer to use HTML `` or `` tags instead of Markdown's -link or image syntax, go right ahead. - -Unlike block-level HTML tags, Markdown syntax *is* processed within -span-level tags. - - -

Automatic Escaping for Special Characters

- -In HTML, there are two characters that demand special treatment: `<` -and `&`. Left angle brackets are used to start tags; ampersands are -used to denote HTML entities. If you want to use them as literal -characters, you must escape them as entities, e.g. `<`, and -`&`. - -Ampersands in particular are bedeviling for web writers. If you want to -write about 'AT&T', you need to write '`AT&T`'. You even need to -escape ampersands within URLs. Thus, if you want to link to: - - http://images.google.com/images?num=30&q=larry+bird - -you need to encode the URL as: - - http://images.google.com/images?num=30&q=larry+bird - -in your anchor tag `href` attribute. Needless to say, this is easy to -forget, and is probably the single most common source of HTML validation -errors in otherwise well-marked-up web sites. - -Markdown allows you to use these characters naturally, taking care of -all the necessary escaping for you. If you use an ampersand as part of -an HTML entity, it remains unchanged; otherwise it will be translated -into `&`. - -So, if you want to include a copyright symbol in your article, you can write: - - © - -and Markdown will leave it alone. But if you write: - - AT&T - -Markdown will translate it to: - - AT&T - -Similarly, because Markdown supports [inline HTML](#html), if you use -angle brackets as delimiters for HTML tags, Markdown will treat them as -such. But if you write: - - 4 < 5 - -Markdown will translate it to: - - 4 < 5 - -However, inside Markdown code spans and blocks, angle brackets and -ampersands are *always* encoded automatically. This makes it easy to use -Markdown to write about HTML code. (As opposed to raw HTML, which is a -terrible format for writing about HTML syntax, because every single `<` -and `&` in your example code needs to be escaped.) - - -* * * - - -

Block Elements

- - -

Paragraphs and Line Breaks

- -A paragraph is simply one or more consecutive lines of text, separated -by one or more blank lines. (A blank line is any line that looks like a -blank line -- a line containing nothing but spaces or tabs is considered -blank.) Normal paragraphs should not be intended with spaces or tabs. - -The implication of the "one or more consecutive lines of text" rule is -that Markdown supports "hard-wrapped" text paragraphs. This differs -significantly from most other text-to-HTML formatters (including Movable -Type's "Convert Line Breaks" option) which translate every line break -character in a paragraph into a `
` tag. - -When you *do* want to insert a `
` break tag using Markdown, you -end a line with two or more spaces, then type return. - -Yes, this takes a tad more effort to create a `
`, but a simplistic -"every line break is a `
`" rule wouldn't work for Markdown. -Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l] -work best -- and look better -- when you format them with hard breaks. - - [bq]: #blockquote - [l]: #list - - - - - -Markdown supports two styles of headers, [Setext] [1] and [atx] [2]. - -Setext-style headers are "underlined" using equal signs (for first-level -headers) and dashes (for second-level headers). For example: - - This is an H1 - ============= - - This is an H2 - ------------- - -Any number of underlining `=`'s or `-`'s will work. - -Atx-style headers use 1-6 hash characters at the start of the line, -corresponding to header levels 1-6. For example: - - # This is an H1 - - ## This is an H2 - - ###### This is an H6 - -Optionally, you may "close" atx-style headers. This is purely -cosmetic -- you can use this if you think it looks better. The -closing hashes don't even need to match the number of hashes -used to open the header. (The number of opening hashes -determines the header level.) : - - # This is an H1 # - - ## This is an H2 ## - - ### This is an H3 ###### - - -

Blockquotes

- -Markdown uses email-style `>` characters for blockquoting. If you're -familiar with quoting passages of text in an email message, then you -know how to create a blockquote in Markdown. It looks best if you hard -wrap the text and put a `>` before every line: - - > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, - > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. - > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. - > - > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse - > id sem consectetuer libero luctus adipiscing. - -Markdown allows you to be lazy and only put the `>` before the first -line of a hard-wrapped paragraph: - - > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, - consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. - Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. - - > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse - id sem consectetuer libero luctus adipiscing. - -Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by -adding additional levels of `>`: - - > This is the first level of quoting. - > - > > This is nested blockquote. - > - > Back to the first level. - -Blockquotes can contain other Markdown elements, including headers, lists, -and code blocks: - - > ## This is a header. - > - > 1. This is the first list item. - > 2. This is the second list item. - > - > Here's some example code: - > - > return shell_exec("echo $input | $markdown_script"); - -Any decent text editor should make email-style quoting easy. For -example, with BBEdit, you can make a selection and choose Increase -Quote Level from the Text menu. - - -

Lists

- -Markdown supports ordered (numbered) and unordered (bulleted) lists. - -Unordered lists use asterisks, pluses, and hyphens -- interchangably --- as list markers: - - * Red - * Green - * Blue - -is equivalent to: - - + Red - + Green - + Blue - -and: - - - Red - - Green - - Blue - -Ordered lists use numbers followed by periods: - - 1. Bird - 2. McHale - 3. Parish - -It's important to note that the actual numbers you use to mark the -list have no effect on the HTML output Markdown produces. The HTML -Markdown produces from the above list is: - -
    -
  1. Bird
  2. -
  3. McHale
  4. -
  5. Parish
  6. -
- -If you instead wrote the list in Markdown like this: - - 1. Bird - 1. McHale - 1. Parish - -or even: - - 3. Bird - 1. McHale - 8. Parish - -you'd get the exact same HTML output. The point is, if you want to, -you can use ordinal numbers in your ordered Markdown lists, so that -the numbers in your source match the numbers in your published HTML. -But if you want to be lazy, you don't have to. - -If you do use lazy list numbering, however, you should still start the -list with the number 1. At some point in the future, Markdown may support -starting ordered lists at an arbitrary number. - -List markers typically start at the left margin, but may be indented by -up to three spaces. List markers must be followed by one or more spaces -or a tab. - -To make lists look nice, you can wrap items with hanging indents: - - * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. - Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, - viverra nec, fringilla in, laoreet vitae, risus. - * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. - Suspendisse id sem consectetuer libero luctus adipiscing. - -But if you want to be lazy, you don't have to: - - * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. - Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, - viverra nec, fringilla in, laoreet vitae, risus. - * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. - Suspendisse id sem consectetuer libero luctus adipiscing. - -If list items are separated by blank lines, Markdown will wrap the -items in `

` tags in the HTML output. For example, this input: - - * Bird - * Magic - -will turn into: - -

    -
  • Bird
  • -
  • Magic
  • -
- -But this: - - * Bird - - * Magic - -will turn into: - -
    -
  • Bird

  • -
  • Magic

  • -
- -List items may consist of multiple paragraphs. Each subsequent -paragraph in a list item must be intended by either 4 spaces -or one tab: - - 1. This is a list item with two paragraphs. Lorem ipsum dolor - sit amet, consectetuer adipiscing elit. Aliquam hendrerit - mi posuere lectus. - - Vestibulum enim wisi, viverra nec, fringilla in, laoreet - vitae, risus. Donec sit amet nisl. Aliquam semper ipsum - sit amet velit. - - 2. Suspendisse id sem consectetuer libero luctus adipiscing. - -It looks nice if you indent every line of the subsequent -paragraphs, but here again, Markdown will allow you to be -lazy: - - * This is a list item with two paragraphs. - - This is the second paragraph in the list item. You're - only required to indent the first line. Lorem ipsum dolor - sit amet, consectetuer adipiscing elit. - - * Another item in the same list. - -To put a blockquote within a list item, the blockquote's `>` -delimiters need to be indented: - - * A list item with a blockquote: - - > This is a blockquote - > inside a list item. - -To put a code block within a list item, the code block needs -to be indented *twice* -- 8 spaces or two tabs: - - * A list item with a code block: - - - - -It's worth noting that it's possible to trigger an ordered list by -accident, by writing something like this: - - 1986. What a great season. - -In other words, a *number-period-space* sequence at the beginning of a -line. To avoid this, you can backslash-escape the period: - - 1986\. What a great season. - - - -

Code Blocks

- -Pre-formatted code blocks are used for writing about programming or -markup source code. Rather than forming normal paragraphs, the lines -of a code block are interpreted literally. Markdown wraps a code block -in both `
` and `` tags.
-
-To produce a code block in Markdown, simply indent every line of the
-block by at least 4 spaces or 1 tab. For example, given this input:
-
-    This is a normal paragraph:
-
-        This is a code block.
-
-Markdown will generate:
-
-    

This is a normal paragraph:

- -
This is a code block.
-    
- -One level of indentation -- 4 spaces or 1 tab -- is removed from each -line of the code block. For example, this: - - Here is an example of AppleScript: - - tell application "Foo" - beep - end tell - -will turn into: - -

Here is an example of AppleScript:

- -
tell application "Foo"
-        beep
-    end tell
-    
- -A code block continues until it reaches a line that is not indented -(or the end of the article). - -Within a code block, ampersands (`&`) and angle brackets (`<` and `>`) -are automatically converted into HTML entities. This makes it very -easy to include example HTML source code using Markdown -- just paste -it and indent it, and Markdown will handle the hassle of encoding the -ampersands and angle brackets. For example, this: - - - -will turn into: - -
<div class="footer">
-        &copy; 2004 Foo Corporation
-    </div>
-    
- -Regular Markdown syntax is not processed within code blocks. E.g., -asterisks are just literal asterisks within a code block. This means -it's also easy to use Markdown to write about Markdown's own syntax. - - - -

Horizontal Rules

- -You can produce a horizontal rule tag (`
`) by placing three or -more hyphens, asterisks, or underscores on a line by themselves. If you -wish, you may use spaces between the hyphens or asterisks. Each of the -following lines will produce a horizontal rule: - - * * * - - *** - - ***** - - - - - - - --------------------------------------- - - _ _ _ - - -* * * - -

Span Elements

- - - -Markdown supports two style of links: *inline* and *reference*. - -In both styles, the link text is delimited by [square brackets]. - -To create an inline link, use a set of regular parentheses immediately -after the link text's closing square bracket. Inside the parentheses, -put the URL where you want the link to point, along with an *optional* -title for the link, surrounded in quotes. For example: - - This is [an example](http://example.com/ "Title") inline link. - - [This link](http://example.net/) has no title attribute. - -Will produce: - -

This is - an example inline link.

- -

This link has no - title attribute.

- -If you're referring to a local resource on the same server, you can -use relative paths: - - See my [About](/about/) page for details. - -Reference-style links use a second set of square brackets, inside -which you place a label of your choosing to identify the link: - - This is [an example][id] reference-style link. - -You can optionally use a space to separate the sets of brackets: - - This is [an example] [id] reference-style link. - -Then, anywhere in the document, you define your link label like this, -on a line by itself: - - [id]: http://example.com/ "Optional Title Here" - -That is: - -* Square brackets containing the link identifier (optionally - indented from the left margin using up to three spaces); -* followed by a colon; -* followed by one or more spaces (or tabs); -* followed by the URL for the link; -* optionally followed by a title attribute for the link, enclosed - in double or single quotes. - -The link URL may, optionally, be surrounded by angle brackets: - - [id]: "Optional Title Here" - -You can put the title attribute on the next line and use extra spaces -or tabs for padding, which tends to look better with longer URLs: - - [id]: http://example.com/longish/path/to/resource/here - "Optional Title Here" - -Link definitions are only used for creating links during Markdown -processing, and are stripped from your document in the HTML output. - -Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links: - - [link text][a] - [link text][A] - -are equivalent. - -The *implicit link name* shortcut allows you to omit the name of the -link, in which case the link text itself is used as the name. -Just use an empty set of square brackets -- e.g., to link the word -"Google" to the google.com web site, you could simply write: - - [Google][] - -And then define the link: - - [Google]: http://google.com/ - -Because link names may contain spaces, this shortcut even works for -multiple words in the link text: - - Visit [Daring Fireball][] for more information. - -And then define the link: - - [Daring Fireball]: http://daringfireball.net/ - -Link definitions can be placed anywhere in your Markdown document. I -tend to put them immediately after each paragraph in which they're -used, but if you want, you can put them all at the end of your -document, sort of like footnotes. - -Here's an example of reference links in action: - - I get 10 times more traffic from [Google] [1] than from - [Yahoo] [2] or [MSN] [3]. - - [1]: http://google.com/ "Google" - [2]: http://search.yahoo.com/ "Yahoo Search" - [3]: http://search.msn.com/ "MSN Search" - -Using the implicit link name shortcut, you could instead write: - - I get 10 times more traffic from [Google][] than from - [Yahoo][] or [MSN][]. - - [google]: http://google.com/ "Google" - [yahoo]: http://search.yahoo.com/ "Yahoo Search" - [msn]: http://search.msn.com/ "MSN Search" - -Both of the above examples will produce the following HTML output: - -

I get 10 times more traffic from Google than from - Yahoo - or MSN.

- -For comparison, here is the same paragraph written using -Markdown's inline link style: - - I get 10 times more traffic from [Google](http://google.com/ "Google") - than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or - [MSN](http://search.msn.com/ "MSN Search"). - -The point of reference-style links is not that they're easier to -write. The point is that with reference-style links, your document -source is vastly more readable. Compare the above examples: using -reference-style links, the paragraph itself is only 81 characters -long; with inline-style links, it's 176 characters; and as raw HTML, -it's 234 characters. In the raw HTML, there's more markup than there -is text. - -With Markdown's reference-style links, a source document much more -closely resembles the final output, as rendered in a browser. By -allowing you to move the markup-related metadata out of the paragraph, -you can add links without interrupting the narrative flow of your -prose. - - -

Emphasis

- -Markdown treats asterisks (`*`) and underscores (`_`) as indicators of -emphasis. Text wrapped with one `*` or `_` will be wrapped with an -HTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML -`` tag. E.g., this input: - - *single asterisks* - - _single underscores_ - - **double asterisks** - - __double underscores__ - -will produce: - - single asterisks - - single underscores - - double asterisks - - double underscores - -You can use whichever style you prefer; the lone restriction is that -the same character must be used to open and close an emphasis span. - -Emphasis can be used in the middle of a word: - - un*fucking*believable - -But if you surround an `*` or `_` with spaces, it'll be treated as a -literal asterisk or underscore. - -To produce a literal asterisk or underscore at a position where it -would otherwise be used as an emphasis delimiter, you can backslash -escape it: - - \*this text is surrounded by literal asterisks\* - - - -

Code

- -To indicate a span of code, wrap it with backtick quotes (`` ` ``). -Unlike a pre-formatted code block, a code span indicates code within a -normal paragraph. For example: - - Use the `printf()` function. - -will produce: - -

Use the printf() function.

- -To include a literal backtick character within a code span, you can use -multiple backticks as the opening and closing delimiters: - - ``There is a literal backtick (`) here.`` - -which will produce this: - -

There is a literal backtick (`) here.

- -The backtick delimiters surrounding a code span may include spaces -- -one after the opening, one before the closing. This allows you to place -literal backtick characters at the beginning or end of a code span: - - A single backtick in a code span: `` ` `` - - A backtick-delimited string in a code span: `` `foo` `` - -will produce: - -

A single backtick in a code span: `

- -

A backtick-delimited string in a code span: `foo`

- -With a code span, ampersands and angle brackets are encoded as HTML -entities automatically, which makes it easy to include example HTML -tags. Markdown will turn this: - - Please don't use any `` tags. - -into: - -

Please don't use any <blink> tags.

- -You can write this: - - `—` is the decimal-encoded equivalent of `—`. - -to produce: - -

&#8212; is the decimal-encoded - equivalent of &mdash;.

- - - -

Images

- -Admittedly, it's fairly difficult to devise a "natural" syntax for -placing images into a plain text document format. - -Markdown uses an image syntax that is intended to resemble the syntax -for links, allowing for two styles: *inline* and *reference*. - -Inline image syntax looks like this: - - ![Alt text](/path/to/img.jpg) - - ![Alt text](/path/to/img.jpg "Optional title") - -That is: - -* An exclamation mark: `!`; -* followed by a set of square brackets, containing the `alt` - attribute text for the image; -* followed by a set of parentheses, containing the URL or path to - the image, and an optional `title` attribute enclosed in double - or single quotes. - -Reference-style image syntax looks like this: - - ![Alt text][id] - -Where "id" is the name of a defined image reference. Image references -are defined using syntax identical to link references: - - [id]: url/to/image "Optional title attribute" - -As of this writing, Markdown has no syntax for specifying the -dimensions of an image; if this is important to you, you can simply -use regular HTML `` tags. - - -* * * - - -

Miscellaneous

- - - -Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this: - - - -Markdown will turn this into: - - http://example.com/ - -Automatic links for email addresses work similarly, except that -Markdown will also perform a bit of randomized decimal and hex -entity-encoding to help obscure your address from address-harvesting -spambots. For example, Markdown will turn this: - - - -into something like this: - - address@exa - mple.com - -which will render in a browser as a clickable link to "address@example.com". - -(This sort of entity-encoding trick will indeed fool many, if not -most, address-harvesting bots, but it definitely won't fool all of -them. It's better than nothing, but an address published in this way -will probably eventually start receiving spam.) - - - -

Backslash Escapes

- -Markdown allows you to use backslash escapes to generate literal -characters which would otherwise have special meaning in Markdown's -formatting syntax. For example, if you wanted to surround a word with -literal asterisks (instead of an HTML `` tag), you can backslashes -before the asterisks, like this: - - \*literal asterisks\* - -Markdown provides backslash escapes for the following characters: - - \ backslash - ` backtick - * asterisk - _ underscore - {} curly braces - [] square brackets - () parentheses - # hash mark - + plus sign - - minus sign (hyphen) - . dot - ! exclamation mark - diff --git a/MarkdownTest/Tests_2004/Markdown Documentation - Syntax.text-out b/MarkdownTest/Tests_2004/Markdown Documentation - Syntax.text-out deleted file mode 100644 index ecf2e70..0000000 --- a/MarkdownTest/Tests_2004/Markdown Documentation - Syntax.text-out +++ /dev/null @@ -1,957 +0,0 @@ - - - - - - - -

Markdown: Syntax

- - -

Note: This document is itself written using -Markdown; you can see the -source for it by adding '.text' to the URL.

-
-

Overview

-

Philosophy

-

Markdown is intended to be as easy-to-read and easy-to-write as -is feasible.

-

Readability, however, is emphasized above all else. A -Markdown-formatted document should be publishable as-is, as plain -text, without looking like it's been marked up with tags or -formatting instructions. While Markdown's syntax has been -influenced by several existing text-to-HTML filters -- including -Setext, -atx, Textile, reStructuredText, -Grutatext, and -EtText -- the single -biggest source of inspiration for Markdown's syntax is the format -of plain text email.

-

To this end, Markdown's syntax is comprised entirely of -punctuation characters, which punctuation characters have been -carefully chosen so as to look like what they mean. E.g., asterisks -around a word actually look like *emphasis*. Markdown lists look -like, well, lists. Even blockquotes look like quoted passages of -text, assuming you've ever used email.

-

Inline HTML

-

Markdown's syntax is intended for one purpose: to be used as a -format for writing for the web.

-

Markdown is not a replacement for HTML, or even close to it. Its -syntax is very small, corresponding only to a very small subset of -HTML tags. The idea is not to create a syntax that makes -it easier to insert HTML tags. In my opinion, HTML tags are already -easy to insert. The idea for Markdown is to make it easy to read, -write, and edit prose. HTML is a publishing format; -Markdown is a writing format. Thus, Markdown's formatting -syntax only addresses issues that can be conveyed in plain -text.

-

For any markup that is not covered by Markdown's syntax, you -simply use HTML itself. There's no need to preface it or delimit it -to indicate that you're switching from Markdown to HTML; you just -use the tags.

-

The only restrictions are that block-level HTML elements -- e.g. -<div>, <table>, -<pre>, <p>, etc. -- must be -separated from surrounding content by blank lines, and the start -and end tags of the block should not be indented with tabs or -spaces. Markdown is smart enough not to add extra (unwanted) -<p> tags around HTML block-level tags.

-

For example, to add an HTML table to a Markdown article:

-
-This is a regular paragraph.
-
-<table>
-    <tr>
-        <td>Foo</td>
-    </tr>
-</table>
-
-This is another regular paragraph.
-
-
-

Note that Markdown formatting syntax is not processed within -block-level HTML tags. E.g., you can't use Markdown-style -*emphasis* inside an HTML block.

-

Span-level HTML tags -- e.g. <span>, -<cite>, or <del> -- can be -used anywhere in a Markdown paragraph, list item, or header. If you -want, you can even use HTML tags instead of Markdown formatting; -e.g. if you'd prefer to use HTML <a> or -<img> tags instead of Markdown's link or image -syntax, go right ahead.

-

Unlike block-level HTML tags, Markdown syntax is -processed within span-level tags.

-

Automatic Escaping for Special Characters

-

In HTML, there are two characters that demand special treatment: -< and &. Left angle brackets are -used to start tags; ampersands are used to denote HTML entities. If -you want to use them as literal characters, you must escape them as -entities, e.g. &lt;, and -&amp;.

-

Ampersands in particular are bedeviling for web writers. If you -want to write about 'AT&T', you need to write -'AT&amp;T'. You even need to escape ampersands -within URLs. Thus, if you want to link to:

-
-http://images.google.com/images?num=30&q=larry+bird
-
-
-

you need to encode the URL as:

-
-http://images.google.com/images?num=30&amp;q=larry+bird
-
-
-

in your anchor tag href attribute. Needless to say, -this is easy to forget, and is probably the single most common -source of HTML validation errors in otherwise well-marked-up web -sites.

-

Markdown allows you to use these characters naturally, taking -care of all the necessary escaping for you. If you use an ampersand -as part of an HTML entity, it remains unchanged; otherwise it will -be translated into &amp;.

-

So, if you want to include a copyright symbol in your article, -you can write:

-
-&copy;
-
-
-

and Markdown will leave it alone. But if you write:

-
-AT&T
-
-
-

Markdown will translate it to:

-
-AT&amp;T
-
-
-

Similarly, because Markdown supports inline -HTML, if you use angle brackets as delimiters for HTML tags, -Markdown will treat them as such. But if you write:

-
-4 < 5
-
-
-

Markdown will translate it to:

-
-4 &lt; 5
-
-
-

However, inside Markdown code spans and blocks, angle brackets -and ampersands are always encoded automatically. This -makes it easy to use Markdown to write about HTML code. (As opposed -to raw HTML, which is a terrible format for writing about HTML -syntax, because every single < and -& in your example code needs to be escaped.)

-
-

Block Elements

-

Paragraphs and Line Breaks

-

A paragraph is simply one or more consecutive lines of text, -separated by one or more blank lines. (A blank line is any line -that looks like a blank line -- a line containing nothing but -spaces or tabs is considered blank.) Normal paragraphs should not -be intended with spaces or tabs.

-

The implication of the "one or more consecutive lines of text" -rule is that Markdown supports "hard-wrapped" text paragraphs. This -differs significantly from most other text-to-HTML formatters -(including Movable Type's "Convert Line Breaks" option) which -translate every line break character in a paragraph into a -<br /> tag.

-

When you do want to insert a <br /> -break tag using Markdown, you end a line with two or more spaces, -then type return.

-

Yes, this takes a tad more effort to create a <br -/>, but a simplistic "every line break is a <br -/>" rule wouldn't work for Markdown. Markdown's -email-style blockquoting and -multi-paragraph list items work best -- and -look better -- when you format them with hard breaks.

- -

Markdown supports two styles of headers, Setext and -atx.

-

Setext-style headers are "underlined" using equal signs (for -first-level headers) and dashes (for second-level headers). For -example:

-
-This is an H1
-=============
-
-This is an H2
--------------
-
-
-

Any number of underlining ='s or -'s -will work.

-

Atx-style headers use 1-6 hash characters at the start of the -line, corresponding to header levels 1-6. For example:

-
-# This is an H1
-
-## This is an H2
-
-###### This is an H6
-
-
-

Optionally, you may "close" atx-style headers. This is purely -cosmetic -- you can use this if you think it looks better. The -closing hashes don't even need to match the number of hashes used -to open the header. (The number of opening hashes determines the -header level.) :

-
-# This is an H1 #
-
-## This is an H2 ##
-
-### This is an H3 ######
-
-
-

Blockquotes

-

Markdown uses email-style > characters for -blockquoting. If you're familiar with quoting passages of text in -an email message, then you know how to create a blockquote in -Markdown. It looks best if you hard wrap the text and put a -> before every line:

-
-> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
-> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
-> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
-> 
-> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
-> id sem consectetuer libero luctus adipiscing.
-
-
-

Markdown allows you to be lazy and only put the -> before the first line of a hard-wrapped -paragraph:

-
-> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
-consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
-Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
-
-> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
-id sem consectetuer libero luctus adipiscing.
-
-
-

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by -adding additional levels of >:

-
-> This is the first level of quoting.
->
-> > This is nested blockquote.
->
-> Back to the first level.
-
-
-

Blockquotes can contain other Markdown elements, including -headers, lists, and code blocks:

-
-> ## This is a header.
-> 
-> 1.   This is the first list item.
-> 2.   This is the second list item.
-> 
-> Here's some example code:
-> 
->     return shell_exec("echo $input | $markdown_script");
-
-
-

Any decent text editor should make email-style quoting easy. For -example, with BBEdit, you can make a selection and choose Increase -Quote Level from the Text menu.

-

Lists

-

Markdown supports ordered (numbered) and unordered (bulleted) -lists.

-

Unordered lists use asterisks, pluses, and hyphens -- -interchangably -- as list markers:

-
-*   Red
-*   Green
-*   Blue
-
-
-

is equivalent to:

-
-+   Red
-+   Green
-+   Blue
-
-
-

and:

-
--   Red
--   Green
--   Blue
-
-
-

Ordered lists use numbers followed by periods:

-
-1.  Bird
-2.  McHale
-3.  Parish
-
-
-

It's important to note that the actual numbers you use to mark -the list have no effect on the HTML output Markdown produces. The -HTML Markdown produces from the above list is:

-
-<ol>
-<li>Bird</li>
-<li>McHale</li>
-<li>Parish</li>
-</ol>
-
-
-

If you instead wrote the list in Markdown like this:

-
-1.  Bird
-1.  McHale
-1.  Parish
-
-
-

or even:

-
-3. Bird
-1. McHale
-8. Parish
-
-
-

you'd get the exact same HTML output. The point is, if you want -to, you can use ordinal numbers in your ordered Markdown lists, so -that the numbers in your source match the numbers in your published -HTML. But if you want to be lazy, you don't have to.

-

If you do use lazy list numbering, however, you should still -start the list with the number 1. At some point in the future, -Markdown may support starting ordered lists at an arbitrary -number.

-

List markers typically start at the left margin, but may be -indented by up to three spaces. List markers must be followed by -one or more spaces or a tab.

-

To make lists look nice, you can wrap items with hanging -indents:

-
-*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
-    Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
-    viverra nec, fringilla in, laoreet vitae, risus.
-*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
-    Suspendisse id sem consectetuer libero luctus adipiscing.
-
-
-

But if you want to be lazy, you don't have to:

-
-*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
-Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
-viverra nec, fringilla in, laoreet vitae, risus.
-*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
-Suspendisse id sem consectetuer libero luctus adipiscing.
-
-
-

If list items are separated by blank lines, Markdown will wrap -the items in <p> tags in the HTML output. For -example, this input:

-
-*   Bird
-*   Magic
-
-
-

will turn into:

-
-<ul>
-<li>Bird</li>
-<li>Magic</li>
-</ul>
-
-
-

But this:

-
-*   Bird
-
-*   Magic
-
-
-

will turn into:

-
-<ul>
-<li><p>Bird</p></li>
-<li><p>Magic</p></li>
-</ul>
-
-
-

List items may consist of multiple paragraphs. Each subsequent -paragraph in a list item must be intended by either 4 spaces or one -tab:

-
-1.  This is a list item with two paragraphs. Lorem ipsum dolor
-    sit amet, consectetuer adipiscing elit. Aliquam hendrerit
-    mi posuere lectus.
-
-    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
-    vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
-    sit amet velit.
-
-2.  Suspendisse id sem consectetuer libero luctus adipiscing.
-
-
-

It looks nice if you indent every line of the subsequent -paragraphs, but here again, Markdown will allow you to be lazy:

-
-*   This is a list item with two paragraphs.
-
-    This is the second paragraph in the list item. You're
-only required to indent the first line. Lorem ipsum dolor
-sit amet, consectetuer adipiscing elit.
-
-*   Another item in the same list.
-
-
-

To put a blockquote within a list item, the blockquote's -> delimiters need to be indented:

-
-*   A list item with a blockquote:
-
-    > This is a blockquote
-    > inside a list item.
-
-
-

To put a code block within a list item, the code block needs to -be indented twice -- 8 spaces or two tabs:

-
-*   A list item with a code block:
-
-        <code goes here>
-
-
-

It's worth noting that it's possible to trigger an ordered list -by accident, by writing something like this:

-
-1986. What a great season.
-
-
-

In other words, a number-period-space sequence at the -beginning of a line. To avoid this, you can backslash-escape the -period:

-
-1986\. What a great season.
-
-
-

Code Blocks

-

Pre-formatted code blocks are used for writing about programming -or markup source code. Rather than forming normal paragraphs, the -lines of a code block are interpreted literally. Markdown wraps a -code block in both <pre> and -<code> tags.

-

To produce a code block in Markdown, simply indent every line of -the block by at least 4 spaces or 1 tab. For example, given this -input:

-
-This is a normal paragraph:
-
-    This is a code block.
-
-
-

Markdown will generate:

-
-<p>This is a normal paragraph:</p>
-
-<pre><code>This is a code block.
-</code></pre>
-
-
-

One level of indentation -- 4 spaces or 1 tab -- is removed from -each line of the code block. For example, this:

-
-Here is an example of AppleScript:
-
-    tell application "Foo"
-        beep
-    end tell
-
-
-

will turn into:

-
-<p>Here is an example of AppleScript:</p>
-
-<pre><code>tell application "Foo"
-    beep
-end tell
-</code></pre>
-
-
-

A code block continues until it reaches a line that is not -indented (or the end of the article).

-

Within a code block, ampersands (&) and angle -brackets (< and >) are -automatically converted into HTML entities. This makes it very easy -to include example HTML source code using Markdown -- just paste it -and indent it, and Markdown will handle the hassle of encoding the -ampersands and angle brackets. For example, this:

-
-    <div class="footer">
-        &copy; 2004 Foo Corporation
-    </div>
-
-
-

will turn into:

-
-<pre><code>&lt;div class="footer"&gt;
-    &amp;copy; 2004 Foo Corporation
-&lt;/div&gt;
-</code></pre>
-
-
-

Regular Markdown syntax is not processed within code blocks. -E.g., asterisks are just literal asterisks within a code block. -This means it's also easy to use Markdown to write about Markdown's -own syntax.

-

Horizontal Rules

-

You can produce a horizontal rule tag (<hr -/>) by placing three or more hyphens, asterisks, or -underscores on a line by themselves. If you wish, you may use -spaces between the hyphens or asterisks. Each of the following -lines will produce a horizontal rule:

-
-* * *
-
-***
-
-*****
-
-- - -
-
----------------------------------------
-
-_ _ _
-
-
-
-

Span Elements

- -

Markdown supports two style of links: inline and -reference.

-

In both styles, the link text is delimited by [square -brackets].

-

To create an inline link, use a set of regular parentheses -immediately after the link text's closing square bracket. Inside -the parentheses, put the URL where you want the link to point, -along with an optional title for the link, surrounded in -quotes. For example:

-
-This is [an example](http://example.com/ "Title") inline link.
-
-[This link](http://example.net/) has no title attribute.
-
-
-

Will produce:

-
-<p>This is <a href="http://example.com/" title="Title">
-an example</a> inline link.</p>
-
-<p><a href="http://example.net/">This link</a> has no
-title attribute.</p>
-
-
-

If you're referring to a local resource on the same server, you -can use relative paths:

-
-See my [About](/about/) page for details.
-
-
-

Reference-style links use a second set of square brackets, -inside which you place a label of your choosing to identify the -link:

-
-This is [an example][id] reference-style link.
-
-
-

You can optionally use a space to separate the sets of -brackets:

-
-This is [an example] [id] reference-style link.
-
-
-

Then, anywhere in the document, you define your link label like -this, on a line by itself:

-
-[id]: http://example.com/  "Optional Title Here"
-
-
-

That is:

-
    -
  • Square brackets containing the link identifier (optionally -indented from the left margin using up to three spaces);
  • -
  • followed by a colon;
  • -
  • followed by one or more spaces (or tabs);
  • -
  • followed by the URL for the link;
  • -
  • optionally followed by a title attribute for the link, enclosed -in double or single quotes.
  • -
-

The link URL may, optionally, be surrounded by angle -brackets:

-
-[id]: <http://example.com/>  "Optional Title Here"
-
-
-

You can put the title attribute on the next line and use extra -spaces or tabs for padding, which tends to look better with longer -URLs:

-
-[id]: http://example.com/longish/path/to/resource/here
-    "Optional Title Here"
-
-
-

Link definitions are only used for creating links during -Markdown processing, and are stripped from your document in the -HTML output.

-

Link definition names may constist of letters, numbers, spaces, -and punctuation -- but they are not case sensitive. E.g. -these two links:

-
-[link text][a]
-[link text][A]
-
-
-

are equivalent.

-

The implicit link name shortcut allows you to omit the -name of the link, in which case the link text itself is used as the -name. Just use an empty set of square brackets -- e.g., to link the -word "Google" to the google.com web site, you could simply -write:

-
-[Google][]
-
-
-

And then define the link:

-
-[Google]: http://google.com/
-
-
-

Because link names may contain spaces, this shortcut even works -for multiple words in the link text:

-
-Visit [Daring Fireball][] for more information.
-
-
-

And then define the link:

-
-[Daring Fireball]: http://daringfireball.net/
-
-
-

Link definitions can be placed anywhere in your Markdown -document. I tend to put them immediately after each paragraph in -which they're used, but if you want, you can put them all at the -end of your document, sort of like footnotes.

-

Here's an example of reference links in action:

-
-I get 10 times more traffic from [Google] [1] than from
-[Yahoo] [2] or [MSN] [3].
-
-  [1]: http://google.com/        "Google"
-  [2]: http://search.yahoo.com/  "Yahoo Search"
-  [3]: http://search.msn.com/    "MSN Search"
-
-
-

Using the implicit link name shortcut, you could instead -write:

-
-I get 10 times more traffic from [Google][] than from
-[Yahoo][] or [MSN][].
-
-  [google]: http://google.com/        "Google"
-  [yahoo]:  http://search.yahoo.com/  "Yahoo Search"
-  [msn]:    http://search.msn.com/    "MSN Search"
-
-
-

Both of the above examples will produce the following HTML -output:

-
-<p>I get 10 times more traffic from <a href="http://google.com/"
-title="Google">Google</a> than from
-<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
-or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
-
-
-

For comparison, here is the same paragraph written using -Markdown's inline link style:

-
-I get 10 times more traffic from [Google](http://google.com/ "Google")
-than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
-[MSN](http://search.msn.com/ "MSN Search").
-
-
-

The point of reference-style links is not that they're easier to -write. The point is that with reference-style links, your document -source is vastly more readable. Compare the above examples: using -reference-style links, the paragraph itself is only 81 characters -long; with inline-style links, it's 176 characters; and as raw -HTML, it's 234 characters. In the raw HTML, there's more markup -than there is text.

-

With Markdown's reference-style links, a source document much -more closely resembles the final output, as rendered in a browser. -By allowing you to move the markup-related metadata out of the -paragraph, you can add links without interrupting the narrative -flow of your prose.

-

Emphasis

-

Markdown treats asterisks (*) and underscores -(_) as indicators of emphasis. Text wrapped with one -* or _ will be wrapped with an HTML -<em> tag; double *'s or -_'s will be wrapped with an HTML -<strong> tag. E.g., this input:

-
-*single asterisks*
-
-_single underscores_
-
-**double asterisks**
-
-__double underscores__
-
-
-

will produce:

-
-<em>single asterisks</em>
-
-<em>single underscores</em>
-
-<strong>double asterisks</strong>
-
-<strong>double underscores</strong>
-
-
-

You can use whichever style you prefer; the lone restriction is -that the same character must be used to open and close an emphasis -span.

-

Emphasis can be used in the middle of a word:

-
-un*fucking*believable
-
-
-

But if you surround an * or _ with -spaces, it'll be treated as a literal asterisk or underscore.

-

To produce a literal asterisk or underscore at a position where -it would otherwise be used as an emphasis delimiter, you can -backslash escape it:

-
-\*this text is surrounded by literal asterisks\*
-
-
-

Code

-

To indicate a span of code, wrap it with backtick quotes -(`). Unlike a pre-formatted code block, a code span -indicates code within a normal paragraph. For example:

-
-Use the `printf()` function.
-
-
-

will produce:

-
-<p>Use the <code>printf()</code> function.</p>
-
-
-

To include a literal backtick character within a code span, you -can use multiple backticks as the opening and closing -delimiters:

-
-``There is a literal backtick (`) here.``
-
-
-

which will produce this:

-
-<p><code>There is a literal backtick (`) here.</code></p>
-
-
-

The backtick delimiters surrounding a code span may include -spaces -- one after the opening, one before the closing. This -allows you to place literal backtick characters at the beginning or -end of a code span:

-
-A single backtick in a code span: `` ` ``
-
-A backtick-delimited string in a code span: `` `foo` ``
-
-
-

will produce:

-
-<p>A single backtick in a code span: <code>`</code></p>
-
-<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
-
-
-

With a code span, ampersands and angle brackets are encoded as -HTML entities automatically, which makes it easy to include example -HTML tags. Markdown will turn this:

-
-Please don't use any `<blink>` tags.
-
-
-

into:

-
-<p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
-
-
-

You can write this:

-
-`&#8212;` is the decimal-encoded equivalent of `&mdash;`.
-
-
-

to produce:

-
-<p><code>&amp;#8212;</code> is the decimal-encoded
-equivalent of <code>&amp;mdash;</code>.</p>
-
-
-

Images

-

Admittedly, it's fairly difficult to devise a "natural" syntax -for placing images into a plain text document format.

-

Markdown uses an image syntax that is intended to resemble the -syntax for links, allowing for two styles: inline and -reference.

-

Inline image syntax looks like this:

-
-![Alt text](/path/to/img.jpg)
-
-![Alt text](/path/to/img.jpg "Optional title")
-
-
-

That is:

-
    -
  • An exclamation mark: !;
  • -
  • followed by a set of square brackets, containing the -alt attribute text for the image;
  • -
  • followed by a set of parentheses, containing the URL or path to -the image, and an optional title attribute enclosed in -double or single quotes.
  • -
-

Reference-style image syntax looks like this:

-
-![Alt text][id]
-
-
-

Where "id" is the name of a defined image reference. Image -references are defined using syntax identical to link -references:

-
-[id]: url/to/image  "Optional title attribute"
-
-
-

As of this writing, Markdown has no syntax for specifying the -dimensions of an image; if this is important to you, you can simply -use regular HTML <img> tags.

-
-

Miscellaneous

- -

Markdown supports a shortcut style for creating "automatic" -links for URLs and email addresses: simply surround the URL or -email address with angle brackets. What this means is that if you -want to show the actual text of a URL or email address, and also -have it be a clickable link, you can do this:

-
-<http://example.com/>
-
-
-

Markdown will turn this into:

-
-<a href="http://example.com/">http://example.com/</a>
-
-
-

Automatic links for email addresses work similarly, except that -Markdown will also perform a bit of randomized decimal and hex -entity-encoding to help obscure your address from -address-harvesting spambots. For example, Markdown will turn -this:

-
-<address@example.com>
-
-
-

into something like this:

-
-<a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
-&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
-&#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
-&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
-
-
-

which will render in a browser as a clickable link to -"address@example.com".

-

(This sort of entity-encoding trick will indeed fool many, if -not most, address-harvesting bots, but it definitely won't fool all -of them. It's better than nothing, but an address published in this -way will probably eventually start receiving spam.)

-

Backslash Escapes

-

Markdown allows you to use backslash escapes to generate literal -characters which would otherwise have special meaning in Markdown's -formatting syntax. For example, if you wanted to surround a word -with literal asterisks (instead of an HTML <em> -tag), you can backslashes before the asterisks, like this:

-
-\*literal asterisks\*
-
-
-

Markdown provides backslash escapes for the following -characters:

-
-\   backslash
-`   backtick
-*   asterisk
-_   underscore
-{}  curly braces
-[]  square brackets
-()  parentheses
-#   hash mark
-+   plus sign
--   minus sign (hyphen)
-.   dot
-!   exclamation mark
-
-
- - diff --git a/MarkdownTest/Tests_2004/Markdown Documentation - Syntax.text-res b/MarkdownTest/Tests_2004/Markdown Documentation - Syntax.text-res deleted file mode 100644 index ecf2e70..0000000 --- a/MarkdownTest/Tests_2004/Markdown Documentation - Syntax.text-res +++ /dev/null @@ -1,957 +0,0 @@ - - - - - - - -

Markdown: Syntax

- - -

Note: This document is itself written using -Markdown; you can see the -source for it by adding '.text' to the URL.

-
-

Overview

-

Philosophy

-

Markdown is intended to be as easy-to-read and easy-to-write as -is feasible.

-

Readability, however, is emphasized above all else. A -Markdown-formatted document should be publishable as-is, as plain -text, without looking like it's been marked up with tags or -formatting instructions. While Markdown's syntax has been -influenced by several existing text-to-HTML filters -- including -Setext, -atx, Textile, reStructuredText, -Grutatext, and -EtText -- the single -biggest source of inspiration for Markdown's syntax is the format -of plain text email.

-

To this end, Markdown's syntax is comprised entirely of -punctuation characters, which punctuation characters have been -carefully chosen so as to look like what they mean. E.g., asterisks -around a word actually look like *emphasis*. Markdown lists look -like, well, lists. Even blockquotes look like quoted passages of -text, assuming you've ever used email.

-

Inline HTML

-

Markdown's syntax is intended for one purpose: to be used as a -format for writing for the web.

-

Markdown is not a replacement for HTML, or even close to it. Its -syntax is very small, corresponding only to a very small subset of -HTML tags. The idea is not to create a syntax that makes -it easier to insert HTML tags. In my opinion, HTML tags are already -easy to insert. The idea for Markdown is to make it easy to read, -write, and edit prose. HTML is a publishing format; -Markdown is a writing format. Thus, Markdown's formatting -syntax only addresses issues that can be conveyed in plain -text.

-

For any markup that is not covered by Markdown's syntax, you -simply use HTML itself. There's no need to preface it or delimit it -to indicate that you're switching from Markdown to HTML; you just -use the tags.

-

The only restrictions are that block-level HTML elements -- e.g. -<div>, <table>, -<pre>, <p>, etc. -- must be -separated from surrounding content by blank lines, and the start -and end tags of the block should not be indented with tabs or -spaces. Markdown is smart enough not to add extra (unwanted) -<p> tags around HTML block-level tags.

-

For example, to add an HTML table to a Markdown article:

-
-This is a regular paragraph.
-
-<table>
-    <tr>
-        <td>Foo</td>
-    </tr>
-</table>
-
-This is another regular paragraph.
-
-
-

Note that Markdown formatting syntax is not processed within -block-level HTML tags. E.g., you can't use Markdown-style -*emphasis* inside an HTML block.

-

Span-level HTML tags -- e.g. <span>, -<cite>, or <del> -- can be -used anywhere in a Markdown paragraph, list item, or header. If you -want, you can even use HTML tags instead of Markdown formatting; -e.g. if you'd prefer to use HTML <a> or -<img> tags instead of Markdown's link or image -syntax, go right ahead.

-

Unlike block-level HTML tags, Markdown syntax is -processed within span-level tags.

-

Automatic Escaping for Special Characters

-

In HTML, there are two characters that demand special treatment: -< and &. Left angle brackets are -used to start tags; ampersands are used to denote HTML entities. If -you want to use them as literal characters, you must escape them as -entities, e.g. &lt;, and -&amp;.

-

Ampersands in particular are bedeviling for web writers. If you -want to write about 'AT&T', you need to write -'AT&amp;T'. You even need to escape ampersands -within URLs. Thus, if you want to link to:

-
-http://images.google.com/images?num=30&q=larry+bird
-
-
-

you need to encode the URL as:

-
-http://images.google.com/images?num=30&amp;q=larry+bird
-
-
-

in your anchor tag href attribute. Needless to say, -this is easy to forget, and is probably the single most common -source of HTML validation errors in otherwise well-marked-up web -sites.

-

Markdown allows you to use these characters naturally, taking -care of all the necessary escaping for you. If you use an ampersand -as part of an HTML entity, it remains unchanged; otherwise it will -be translated into &amp;.

-

So, if you want to include a copyright symbol in your article, -you can write:

-
-&copy;
-
-
-

and Markdown will leave it alone. But if you write:

-
-AT&T
-
-
-

Markdown will translate it to:

-
-AT&amp;T
-
-
-

Similarly, because Markdown supports inline -HTML, if you use angle brackets as delimiters for HTML tags, -Markdown will treat them as such. But if you write:

-
-4 < 5
-
-
-

Markdown will translate it to:

-
-4 &lt; 5
-
-
-

However, inside Markdown code spans and blocks, angle brackets -and ampersands are always encoded automatically. This -makes it easy to use Markdown to write about HTML code. (As opposed -to raw HTML, which is a terrible format for writing about HTML -syntax, because every single < and -& in your example code needs to be escaped.)

-
-

Block Elements

-

Paragraphs and Line Breaks

-

A paragraph is simply one or more consecutive lines of text, -separated by one or more blank lines. (A blank line is any line -that looks like a blank line -- a line containing nothing but -spaces or tabs is considered blank.) Normal paragraphs should not -be intended with spaces or tabs.

-

The implication of the "one or more consecutive lines of text" -rule is that Markdown supports "hard-wrapped" text paragraphs. This -differs significantly from most other text-to-HTML formatters -(including Movable Type's "Convert Line Breaks" option) which -translate every line break character in a paragraph into a -<br /> tag.

-

When you do want to insert a <br /> -break tag using Markdown, you end a line with two or more spaces, -then type return.

-

Yes, this takes a tad more effort to create a <br -/>, but a simplistic "every line break is a <br -/>" rule wouldn't work for Markdown. Markdown's -email-style blockquoting and -multi-paragraph list items work best -- and -look better -- when you format them with hard breaks.

- -

Markdown supports two styles of headers, Setext and -atx.

-

Setext-style headers are "underlined" using equal signs (for -first-level headers) and dashes (for second-level headers). For -example:

-
-This is an H1
-=============
-
-This is an H2
--------------
-
-
-

Any number of underlining ='s or -'s -will work.

-

Atx-style headers use 1-6 hash characters at the start of the -line, corresponding to header levels 1-6. For example:

-
-# This is an H1
-
-## This is an H2
-
-###### This is an H6
-
-
-

Optionally, you may "close" atx-style headers. This is purely -cosmetic -- you can use this if you think it looks better. The -closing hashes don't even need to match the number of hashes used -to open the header. (The number of opening hashes determines the -header level.) :

-
-# This is an H1 #
-
-## This is an H2 ##
-
-### This is an H3 ######
-
-
-

Blockquotes

-

Markdown uses email-style > characters for -blockquoting. If you're familiar with quoting passages of text in -an email message, then you know how to create a blockquote in -Markdown. It looks best if you hard wrap the text and put a -> before every line:

-
-> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
-> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
-> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
-> 
-> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
-> id sem consectetuer libero luctus adipiscing.
-
-
-

Markdown allows you to be lazy and only put the -> before the first line of a hard-wrapped -paragraph:

-
-> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
-consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
-Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
-
-> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
-id sem consectetuer libero luctus adipiscing.
-
-
-

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by -adding additional levels of >:

-
-> This is the first level of quoting.
->
-> > This is nested blockquote.
->
-> Back to the first level.
-
-
-

Blockquotes can contain other Markdown elements, including -headers, lists, and code blocks:

-
-> ## This is a header.
-> 
-> 1.   This is the first list item.
-> 2.   This is the second list item.
-> 
-> Here's some example code:
-> 
->     return shell_exec("echo $input | $markdown_script");
-
-
-

Any decent text editor should make email-style quoting easy. For -example, with BBEdit, you can make a selection and choose Increase -Quote Level from the Text menu.

-

Lists

-

Markdown supports ordered (numbered) and unordered (bulleted) -lists.

-

Unordered lists use asterisks, pluses, and hyphens -- -interchangably -- as list markers:

-
-*   Red
-*   Green
-*   Blue
-
-
-

is equivalent to:

-
-+   Red
-+   Green
-+   Blue
-
-
-

and:

-
--   Red
--   Green
--   Blue
-
-
-

Ordered lists use numbers followed by periods:

-
-1.  Bird
-2.  McHale
-3.  Parish
-
-
-

It's important to note that the actual numbers you use to mark -the list have no effect on the HTML output Markdown produces. The -HTML Markdown produces from the above list is:

-
-<ol>
-<li>Bird</li>
-<li>McHale</li>
-<li>Parish</li>
-</ol>
-
-
-

If you instead wrote the list in Markdown like this:

-
-1.  Bird
-1.  McHale
-1.  Parish
-
-
-

or even:

-
-3. Bird
-1. McHale
-8. Parish
-
-
-

you'd get the exact same HTML output. The point is, if you want -to, you can use ordinal numbers in your ordered Markdown lists, so -that the numbers in your source match the numbers in your published -HTML. But if you want to be lazy, you don't have to.

-

If you do use lazy list numbering, however, you should still -start the list with the number 1. At some point in the future, -Markdown may support starting ordered lists at an arbitrary -number.

-

List markers typically start at the left margin, but may be -indented by up to three spaces. List markers must be followed by -one or more spaces or a tab.

-

To make lists look nice, you can wrap items with hanging -indents:

-
-*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
-    Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
-    viverra nec, fringilla in, laoreet vitae, risus.
-*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
-    Suspendisse id sem consectetuer libero luctus adipiscing.
-
-
-

But if you want to be lazy, you don't have to:

-
-*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
-Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
-viverra nec, fringilla in, laoreet vitae, risus.
-*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
-Suspendisse id sem consectetuer libero luctus adipiscing.
-
-
-

If list items are separated by blank lines, Markdown will wrap -the items in <p> tags in the HTML output. For -example, this input:

-
-*   Bird
-*   Magic
-
-
-

will turn into:

-
-<ul>
-<li>Bird</li>
-<li>Magic</li>
-</ul>
-
-
-

But this:

-
-*   Bird
-
-*   Magic
-
-
-

will turn into:

-
-<ul>
-<li><p>Bird</p></li>
-<li><p>Magic</p></li>
-</ul>
-
-
-

List items may consist of multiple paragraphs. Each subsequent -paragraph in a list item must be intended by either 4 spaces or one -tab:

-
-1.  This is a list item with two paragraphs. Lorem ipsum dolor
-    sit amet, consectetuer adipiscing elit. Aliquam hendrerit
-    mi posuere lectus.
-
-    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
-    vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
-    sit amet velit.
-
-2.  Suspendisse id sem consectetuer libero luctus adipiscing.
-
-
-

It looks nice if you indent every line of the subsequent -paragraphs, but here again, Markdown will allow you to be lazy:

-
-*   This is a list item with two paragraphs.
-
-    This is the second paragraph in the list item. You're
-only required to indent the first line. Lorem ipsum dolor
-sit amet, consectetuer adipiscing elit.
-
-*   Another item in the same list.
-
-
-

To put a blockquote within a list item, the blockquote's -> delimiters need to be indented:

-
-*   A list item with a blockquote:
-
-    > This is a blockquote
-    > inside a list item.
-
-
-

To put a code block within a list item, the code block needs to -be indented twice -- 8 spaces or two tabs:

-
-*   A list item with a code block:
-
-        <code goes here>
-
-
-

It's worth noting that it's possible to trigger an ordered list -by accident, by writing something like this:

-
-1986. What a great season.
-
-
-

In other words, a number-period-space sequence at the -beginning of a line. To avoid this, you can backslash-escape the -period:

-
-1986\. What a great season.
-
-
-

Code Blocks

-

Pre-formatted code blocks are used for writing about programming -or markup source code. Rather than forming normal paragraphs, the -lines of a code block are interpreted literally. Markdown wraps a -code block in both <pre> and -<code> tags.

-

To produce a code block in Markdown, simply indent every line of -the block by at least 4 spaces or 1 tab. For example, given this -input:

-
-This is a normal paragraph:
-
-    This is a code block.
-
-
-

Markdown will generate:

-
-<p>This is a normal paragraph:</p>
-
-<pre><code>This is a code block.
-</code></pre>
-
-
-

One level of indentation -- 4 spaces or 1 tab -- is removed from -each line of the code block. For example, this:

-
-Here is an example of AppleScript:
-
-    tell application "Foo"
-        beep
-    end tell
-
-
-

will turn into:

-
-<p>Here is an example of AppleScript:</p>
-
-<pre><code>tell application "Foo"
-    beep
-end tell
-</code></pre>
-
-
-

A code block continues until it reaches a line that is not -indented (or the end of the article).

-

Within a code block, ampersands (&) and angle -brackets (< and >) are -automatically converted into HTML entities. This makes it very easy -to include example HTML source code using Markdown -- just paste it -and indent it, and Markdown will handle the hassle of encoding the -ampersands and angle brackets. For example, this:

-
-    <div class="footer">
-        &copy; 2004 Foo Corporation
-    </div>
-
-
-

will turn into:

-
-<pre><code>&lt;div class="footer"&gt;
-    &amp;copy; 2004 Foo Corporation
-&lt;/div&gt;
-</code></pre>
-
-
-

Regular Markdown syntax is not processed within code blocks. -E.g., asterisks are just literal asterisks within a code block. -This means it's also easy to use Markdown to write about Markdown's -own syntax.

-

Horizontal Rules

-

You can produce a horizontal rule tag (<hr -/>) by placing three or more hyphens, asterisks, or -underscores on a line by themselves. If you wish, you may use -spaces between the hyphens or asterisks. Each of the following -lines will produce a horizontal rule:

-
-* * *
-
-***
-
-*****
-
-- - -
-
----------------------------------------
-
-_ _ _
-
-
-
-

Span Elements

- -

Markdown supports two style of links: inline and -reference.

-

In both styles, the link text is delimited by [square -brackets].

-

To create an inline link, use a set of regular parentheses -immediately after the link text's closing square bracket. Inside -the parentheses, put the URL where you want the link to point, -along with an optional title for the link, surrounded in -quotes. For example:

-
-This is [an example](http://example.com/ "Title") inline link.
-
-[This link](http://example.net/) has no title attribute.
-
-
-

Will produce:

-
-<p>This is <a href="http://example.com/" title="Title">
-an example</a> inline link.</p>
-
-<p><a href="http://example.net/">This link</a> has no
-title attribute.</p>
-
-
-

If you're referring to a local resource on the same server, you -can use relative paths:

-
-See my [About](/about/) page for details.
-
-
-

Reference-style links use a second set of square brackets, -inside which you place a label of your choosing to identify the -link:

-
-This is [an example][id] reference-style link.
-
-
-

You can optionally use a space to separate the sets of -brackets:

-
-This is [an example] [id] reference-style link.
-
-
-

Then, anywhere in the document, you define your link label like -this, on a line by itself:

-
-[id]: http://example.com/  "Optional Title Here"
-
-
-

That is:

-
    -
  • Square brackets containing the link identifier (optionally -indented from the left margin using up to three spaces);
  • -
  • followed by a colon;
  • -
  • followed by one or more spaces (or tabs);
  • -
  • followed by the URL for the link;
  • -
  • optionally followed by a title attribute for the link, enclosed -in double or single quotes.
  • -
-

The link URL may, optionally, be surrounded by angle -brackets:

-
-[id]: <http://example.com/>  "Optional Title Here"
-
-
-

You can put the title attribute on the next line and use extra -spaces or tabs for padding, which tends to look better with longer -URLs:

-
-[id]: http://example.com/longish/path/to/resource/here
-    "Optional Title Here"
-
-
-

Link definitions are only used for creating links during -Markdown processing, and are stripped from your document in the -HTML output.

-

Link definition names may constist of letters, numbers, spaces, -and punctuation -- but they are not case sensitive. E.g. -these two links:

-
-[link text][a]
-[link text][A]
-
-
-

are equivalent.

-

The implicit link name shortcut allows you to omit the -name of the link, in which case the link text itself is used as the -name. Just use an empty set of square brackets -- e.g., to link the -word "Google" to the google.com web site, you could simply -write:

-
-[Google][]
-
-
-

And then define the link:

-
-[Google]: http://google.com/
-
-
-

Because link names may contain spaces, this shortcut even works -for multiple words in the link text:

-
-Visit [Daring Fireball][] for more information.
-
-
-

And then define the link:

-
-[Daring Fireball]: http://daringfireball.net/
-
-
-

Link definitions can be placed anywhere in your Markdown -document. I tend to put them immediately after each paragraph in -which they're used, but if you want, you can put them all at the -end of your document, sort of like footnotes.

-

Here's an example of reference links in action:

-
-I get 10 times more traffic from [Google] [1] than from
-[Yahoo] [2] or [MSN] [3].
-
-  [1]: http://google.com/        "Google"
-  [2]: http://search.yahoo.com/  "Yahoo Search"
-  [3]: http://search.msn.com/    "MSN Search"
-
-
-

Using the implicit link name shortcut, you could instead -write:

-
-I get 10 times more traffic from [Google][] than from
-[Yahoo][] or [MSN][].
-
-  [google]: http://google.com/        "Google"
-  [yahoo]:  http://search.yahoo.com/  "Yahoo Search"
-  [msn]:    http://search.msn.com/    "MSN Search"
-
-
-

Both of the above examples will produce the following HTML -output:

-
-<p>I get 10 times more traffic from <a href="http://google.com/"
-title="Google">Google</a> than from
-<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
-or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
-
-
-

For comparison, here is the same paragraph written using -Markdown's inline link style:

-
-I get 10 times more traffic from [Google](http://google.com/ "Google")
-than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
-[MSN](http://search.msn.com/ "MSN Search").
-
-
-

The point of reference-style links is not that they're easier to -write. The point is that with reference-style links, your document -source is vastly more readable. Compare the above examples: using -reference-style links, the paragraph itself is only 81 characters -long; with inline-style links, it's 176 characters; and as raw -HTML, it's 234 characters. In the raw HTML, there's more markup -than there is text.

-

With Markdown's reference-style links, a source document much -more closely resembles the final output, as rendered in a browser. -By allowing you to move the markup-related metadata out of the -paragraph, you can add links without interrupting the narrative -flow of your prose.

-

Emphasis

-

Markdown treats asterisks (*) and underscores -(_) as indicators of emphasis. Text wrapped with one -* or _ will be wrapped with an HTML -<em> tag; double *'s or -_'s will be wrapped with an HTML -<strong> tag. E.g., this input:

-
-*single asterisks*
-
-_single underscores_
-
-**double asterisks**
-
-__double underscores__
-
-
-

will produce:

-
-<em>single asterisks</em>
-
-<em>single underscores</em>
-
-<strong>double asterisks</strong>
-
-<strong>double underscores</strong>
-
-
-

You can use whichever style you prefer; the lone restriction is -that the same character must be used to open and close an emphasis -span.

-

Emphasis can be used in the middle of a word:

-
-un*fucking*believable
-
-
-

But if you surround an * or _ with -spaces, it'll be treated as a literal asterisk or underscore.

-

To produce a literal asterisk or underscore at a position where -it would otherwise be used as an emphasis delimiter, you can -backslash escape it:

-
-\*this text is surrounded by literal asterisks\*
-
-
-

Code

-

To indicate a span of code, wrap it with backtick quotes -(`). Unlike a pre-formatted code block, a code span -indicates code within a normal paragraph. For example:

-
-Use the `printf()` function.
-
-
-

will produce:

-
-<p>Use the <code>printf()</code> function.</p>
-
-
-

To include a literal backtick character within a code span, you -can use multiple backticks as the opening and closing -delimiters:

-
-``There is a literal backtick (`) here.``
-
-
-

which will produce this:

-
-<p><code>There is a literal backtick (`) here.</code></p>
-
-
-

The backtick delimiters surrounding a code span may include -spaces -- one after the opening, one before the closing. This -allows you to place literal backtick characters at the beginning or -end of a code span:

-
-A single backtick in a code span: `` ` ``
-
-A backtick-delimited string in a code span: `` `foo` ``
-
-
-

will produce:

-
-<p>A single backtick in a code span: <code>`</code></p>
-
-<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
-
-
-

With a code span, ampersands and angle brackets are encoded as -HTML entities automatically, which makes it easy to include example -HTML tags. Markdown will turn this:

-
-Please don't use any `<blink>` tags.
-
-
-

into:

-
-<p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
-
-
-

You can write this:

-
-`&#8212;` is the decimal-encoded equivalent of `&mdash;`.
-
-
-

to produce:

-
-<p><code>&amp;#8212;</code> is the decimal-encoded
-equivalent of <code>&amp;mdash;</code>.</p>
-
-
-

Images

-

Admittedly, it's fairly difficult to devise a "natural" syntax -for placing images into a plain text document format.

-

Markdown uses an image syntax that is intended to resemble the -syntax for links, allowing for two styles: inline and -reference.

-

Inline image syntax looks like this:

-
-![Alt text](/path/to/img.jpg)
-
-![Alt text](/path/to/img.jpg "Optional title")
-
-
-

That is:

-
    -
  • An exclamation mark: !;
  • -
  • followed by a set of square brackets, containing the -alt attribute text for the image;
  • -
  • followed by a set of parentheses, containing the URL or path to -the image, and an optional title attribute enclosed in -double or single quotes.
  • -
-

Reference-style image syntax looks like this:

-
-![Alt text][id]
-
-
-

Where "id" is the name of a defined image reference. Image -references are defined using syntax identical to link -references:

-
-[id]: url/to/image  "Optional title attribute"
-
-
-

As of this writing, Markdown has no syntax for specifying the -dimensions of an image; if this is important to you, you can simply -use regular HTML <img> tags.

-
-

Miscellaneous

- -

Markdown supports a shortcut style for creating "automatic" -links for URLs and email addresses: simply surround the URL or -email address with angle brackets. What this means is that if you -want to show the actual text of a URL or email address, and also -have it be a clickable link, you can do this:

-
-<http://example.com/>
-
-
-

Markdown will turn this into:

-
-<a href="http://example.com/">http://example.com/</a>
-
-
-

Automatic links for email addresses work similarly, except that -Markdown will also perform a bit of randomized decimal and hex -entity-encoding to help obscure your address from -address-harvesting spambots. For example, Markdown will turn -this:

-
-<address@example.com>
-
-
-

into something like this:

-
-<a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
-&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
-&#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
-&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
-
-
-

which will render in a browser as a clickable link to -"address@example.com".

-

(This sort of entity-encoding trick will indeed fool many, if -not most, address-harvesting bots, but it definitely won't fool all -of them. It's better than nothing, but an address published in this -way will probably eventually start receiving spam.)

-

Backslash Escapes

-

Markdown allows you to use backslash escapes to generate literal -characters which would otherwise have special meaning in Markdown's -formatting syntax. For example, if you wanted to surround a word -with literal asterisks (instead of an HTML <em> -tag), you can backslashes before the asterisks, like this:

-
-\*literal asterisks\*
-
-
-

Markdown provides backslash escapes for the following -characters:

-
-\   backslash
-`   backtick
-*   asterisk
-_   underscore
-{}  curly braces
-[]  square brackets
-()  parentheses
-#   hash mark
-+   plus sign
--   minus sign (hyphen)
-.   dot
-!   exclamation mark
-
-
- - diff --git a/MarkdownTest/Tests_2004/Nested blockquotes.html b/MarkdownTest/Tests_2004/Nested blockquotes.html deleted file mode 100644 index d8ec7f8..0000000 --- a/MarkdownTest/Tests_2004/Nested blockquotes.html +++ /dev/null @@ -1,9 +0,0 @@ -
-

foo

- -
-

bar

-
- -

foo

-
diff --git a/MarkdownTest/Tests_2004/Nested blockquotes.text b/MarkdownTest/Tests_2004/Nested blockquotes.text deleted file mode 100644 index ed3c624..0000000 --- a/MarkdownTest/Tests_2004/Nested blockquotes.text +++ /dev/null @@ -1,5 +0,0 @@ -> foo -> -> > bar -> -> foo diff --git a/MarkdownTest/Tests_2004/Nested blockquotes.text-out b/MarkdownTest/Tests_2004/Nested blockquotes.text-out deleted file mode 100644 index 291201e..0000000 --- a/MarkdownTest/Tests_2004/Nested blockquotes.text-out +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - -
-

foo

-
-

bar

-
-

foo

-
- - diff --git a/MarkdownTest/Tests_2004/Nested blockquotes.text-res b/MarkdownTest/Tests_2004/Nested blockquotes.text-res deleted file mode 100644 index 291201e..0000000 --- a/MarkdownTest/Tests_2004/Nested blockquotes.text-res +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - -
-

foo

-
-

bar

-
-

foo

-
- - diff --git a/MarkdownTest/Tests_2004/Ordered and unordered lists.html b/MarkdownTest/Tests_2004/Ordered and unordered lists.html deleted file mode 100644 index ce85c3a..0000000 --- a/MarkdownTest/Tests_2004/Ordered and unordered lists.html +++ /dev/null @@ -1,137 +0,0 @@ -

Unordered

- -

Asterisks tight:

- -
    -
  • asterisk 1
  • -
  • asterisk 2
  • -
  • asterisk 3
  • -
- -

Asterisks loose:

- -
    -
  • asterisk 1

  • -
  • asterisk 2

  • -
  • asterisk 3

  • -
- -
- -

Pluses tight:

- -
    -
  • Plus 1
  • -
  • Plus 2
  • -
  • Plus 3
  • -
- -

Pluses loose:

- -
    -
  • Plus 1

  • -
  • Plus 2

  • -
  • Plus 3

  • -
- -
- -

Minuses tight:

- -
    -
  • Minus 1
  • -
  • Minus 2
  • -
  • Minus 3
  • -
- -

Minuses loose:

- -
    -
  • Minus 1

  • -
  • Minus 2

  • -
  • Minus 3

  • -
- -

Ordered

- -

Tight:

- -
    -
  1. First
  2. -
  3. Second
  4. -
  5. Third
  6. -
- -

and:

- -
    -
  1. One
  2. -
  3. Two
  4. -
  5. Three
  6. -
- -

Loose using tabs:

- -
    -
  1. First

  2. -
  3. Second

  4. -
  5. Third

  6. -
- -

and using spaces:

- -
    -
  1. One

  2. -
  3. Two

  4. -
  5. Three

  6. -
- -

Multiple paragraphs:

- -
    -
  1. Item 1, graf one.

    - -

    Item 2. graf two. The quick brown fox jumped over the lazy dog's -back.

  2. -
  3. Item 2.

  4. -
  5. Item 3.

  6. -
- -

Nested

- -
    -
  • Tab -
      -
    • Tab -
        -
      • Tab
      • -
    • -
  • -
- -

Here's another:

- -
    -
  1. First
  2. -
  3. Second: -
      -
    • Fee
    • -
    • Fie
    • -
    • Foe
    • -
  4. -
  5. Third
  6. -
- -

Same thing but with paragraphs:

- -
    -
  1. First

  2. -
  3. Second:

    - -
      -
    • Fee
    • -
    • Fie
    • -
    • Foe
    • -
  4. -
  5. Third

  6. -
diff --git a/MarkdownTest/Tests_2004/Ordered and unordered lists.text b/MarkdownTest/Tests_2004/Ordered and unordered lists.text deleted file mode 100644 index 621db58..0000000 --- a/MarkdownTest/Tests_2004/Ordered and unordered lists.text +++ /dev/null @@ -1,122 +0,0 @@ -## Unordered - -Asterisks tight: - -* asterisk 1 -* asterisk 2 -* asterisk 3 - - -Asterisks loose: - -* asterisk 1 - -* asterisk 2 - -* asterisk 3 - -* * * - -Pluses tight: - -+ Plus 1 -+ Plus 2 -+ Plus 3 - - -Pluses loose: - -+ Plus 1 - -+ Plus 2 - -+ Plus 3 - -* * * - - -Minuses tight: - -- Minus 1 -- Minus 2 -- Minus 3 - - -Minuses loose: - -- Minus 1 - -- Minus 2 - -- Minus 3 - - -## Ordered - -Tight: - -1. First -2. Second -3. Third - -and: - -1. One -2. Two -3. Three - - -Loose using tabs: - -1. First - -2. Second - -3. Third - -and using spaces: - -1. One - -2. Two - -3. Three - -Multiple paragraphs: - -1. Item 1, graf one. - - Item 2. graf two. The quick brown fox jumped over the lazy dog's - back. - -2. Item 2. - -3. Item 3. - - - -## Nested - -* Tab - * Tab - * Tab - -Here's another: - -1. First -2. Second: - * Fee - * Fie - * Foe -3. Third - -Same thing but with paragraphs: - -1. First - -2. Second: - * Fee - * Fie - * Foe - -3. Third diff --git a/MarkdownTest/Tests_2004/Ordered and unordered lists.text-out b/MarkdownTest/Tests_2004/Ordered and unordered lists.text-out deleted file mode 100644 index 5e19e71..0000000 --- a/MarkdownTest/Tests_2004/Ordered and unordered lists.text-out +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - -

Unordered

-

Asterisks tight:

-
    -
  • asterisk 1
  • -
  • asterisk 2
  • -
  • asterisk 3
  • -
-

Asterisks loose:

-
    -
  • -

    asterisk 1

    -
  • -
  • -

    asterisk 2

    -
  • -
  • -

    asterisk 3

    -
  • -
-
-

Pluses tight:

-
    -
  • Plus 1
  • -
  • Plus 2
  • -
  • Plus 3
  • -
-

Pluses loose:

-
    -
  • -

    Plus 1

    -
  • -
  • -

    Plus 2

    -
  • -
  • -

    Plus 3

    -
  • -
-
-

Minuses tight:

-
    -
  • Minus 1
  • -
  • Minus 2
  • -
  • Minus 3
  • -
-

Minuses loose:

-
    -
  • -

    Minus 1

    -
  • -
  • -

    Minus 2

    -
  • -
  • -

    Minus 3

    -
  • -
-

Ordered

-

Tight:

-
    -
  1. First
  2. -
  3. Second
  4. -
  5. Third
  6. -
-

and:

-
    -
  1. One
  2. -
  3. Two
  4. -
  5. Three
  6. -
-

Loose using tabs:

-
    -
  1. -

    First

    -
  2. -
  3. -

    Second

    -
  4. -
  5. -

    Third

    -
  6. -
-

and using spaces:

-
    -
  1. -

    One

    -
  2. -
  3. -

    Two

    -
  4. -
  5. -

    Three

    -
  6. -
-

Multiple paragraphs:

-
    -
  1. -

    Item 1, graf one.

    -

    Item 2. graf two. The quick brown fox jumped over the lazy dog's -back.

    -
  2. -
  3. -

    Item 2.

    -
  4. -
  5. -

    Item 3.

    -
  6. -
-

Nested

-
    -
  • Tab -
      -
    • Tab -
        -
      • Tab
      • -
      -
    • -
    -
  • -
-

Here's another:

-
    -
  1. First
  2. -
  3. Second: -
      -
    • Fee
    • -
    • Fie
    • -
    • Foe
    • -
    -
  4. -
  5. Third
  6. -
-

Same thing but with paragraphs:

-
    -
  1. -

    First

    -
  2. -
  3. -

    Second:

    -
      -
    • Fee
    • -
    • Fie
    • -
    • Foe
    • -
    -
  4. -
  5. -

    Third

    -
  6. -
- - diff --git a/MarkdownTest/Tests_2004/Ordered and unordered lists.text-res b/MarkdownTest/Tests_2004/Ordered and unordered lists.text-res deleted file mode 100644 index 5e19e71..0000000 --- a/MarkdownTest/Tests_2004/Ordered and unordered lists.text-res +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - -

Unordered

-

Asterisks tight:

-
    -
  • asterisk 1
  • -
  • asterisk 2
  • -
  • asterisk 3
  • -
-

Asterisks loose:

-
    -
  • -

    asterisk 1

    -
  • -
  • -

    asterisk 2

    -
  • -
  • -

    asterisk 3

    -
  • -
-
-

Pluses tight:

-
    -
  • Plus 1
  • -
  • Plus 2
  • -
  • Plus 3
  • -
-

Pluses loose:

-
    -
  • -

    Plus 1

    -
  • -
  • -

    Plus 2

    -
  • -
  • -

    Plus 3

    -
  • -
-
-

Minuses tight:

-
    -
  • Minus 1
  • -
  • Minus 2
  • -
  • Minus 3
  • -
-

Minuses loose:

-
    -
  • -

    Minus 1

    -
  • -
  • -

    Minus 2

    -
  • -
  • -

    Minus 3

    -
  • -
-

Ordered

-

Tight:

-
    -
  1. First
  2. -
  3. Second
  4. -
  5. Third
  6. -
-

and:

-
    -
  1. One
  2. -
  3. Two
  4. -
  5. Three
  6. -
-

Loose using tabs:

-
    -
  1. -

    First

    -
  2. -
  3. -

    Second

    -
  4. -
  5. -

    Third

    -
  6. -
-

and using spaces:

-
    -
  1. -

    One

    -
  2. -
  3. -

    Two

    -
  4. -
  5. -

    Three

    -
  6. -
-

Multiple paragraphs:

-
    -
  1. -

    Item 1, graf one.

    -

    Item 2. graf two. The quick brown fox jumped over the lazy dog's -back.

    -
  2. -
  3. -

    Item 2.

    -
  4. -
  5. -

    Item 3.

    -
  6. -
-

Nested

-
    -
  • Tab -
      -
    • Tab -
        -
      • Tab
      • -
      -
    • -
    -
  • -
-

Here's another:

-
    -
  1. First
  2. -
  3. Second: -
      -
    • Fee
    • -
    • Fie
    • -
    • Foe
    • -
    -
  4. -
  5. Third
  6. -
-

Same thing but with paragraphs:

-
    -
  1. -

    First

    -
  2. -
  3. -

    Second:

    -
      -
    • Fee
    • -
    • Fie
    • -
    • Foe
    • -
    -
  4. -
  5. -

    Third

    -
  6. -
- - diff --git a/MarkdownTest/Tests_2004/Strong and em together.html b/MarkdownTest/Tests_2004/Strong and em together.html deleted file mode 100644 index 71ec78c..0000000 --- a/MarkdownTest/Tests_2004/Strong and em together.html +++ /dev/null @@ -1,7 +0,0 @@ -

This is strong and em.

- -

So is this word.

- -

This is strong and em.

- -

So is this word.

diff --git a/MarkdownTest/Tests_2004/Strong and em together.text b/MarkdownTest/Tests_2004/Strong and em together.text deleted file mode 100644 index 95ee690..0000000 --- a/MarkdownTest/Tests_2004/Strong and em together.text +++ /dev/null @@ -1,7 +0,0 @@ -***This is strong and em.*** - -So is ***this*** word. - -___This is strong and em.___ - -So is ___this___ word. diff --git a/MarkdownTest/Tests_2004/Strong and em together.text-out b/MarkdownTest/Tests_2004/Strong and em together.text-out deleted file mode 100644 index b596c19..0000000 --- a/MarkdownTest/Tests_2004/Strong and em together.text-out +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - -

This is strong and em.

-

So is this word.

-

This is strong and em.

-

So is this word.

- - diff --git a/MarkdownTest/Tests_2004/Strong and em together.text-res b/MarkdownTest/Tests_2004/Strong and em together.text-res deleted file mode 100644 index b596c19..0000000 --- a/MarkdownTest/Tests_2004/Strong and em together.text-res +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - -

This is strong and em.

-

So is this word.

-

This is strong and em.

-

So is this word.

- - diff --git a/MarkdownTest/Tests_2004/Tabs.html b/MarkdownTest/Tests_2004/Tabs.html deleted file mode 100644 index 3301ba8..0000000 --- a/MarkdownTest/Tests_2004/Tabs.html +++ /dev/null @@ -1,25 +0,0 @@ -
    -
  • this is a list item -indented with tabs

  • -
  • this is a list item -indented with spaces

  • -
- -

Code:

- -
this code block is indented by one tab
-
- -

And:

- -
    this code block is indented by two tabs
-
- -

And:

- -
+   this is an example list item
-    indented with tabs
-
-+   this is an example list item
-    indented with spaces
-
diff --git a/MarkdownTest/Tests_2004/Tabs.text b/MarkdownTest/Tests_2004/Tabs.text deleted file mode 100644 index 589d113..0000000 --- a/MarkdownTest/Tests_2004/Tabs.text +++ /dev/null @@ -1,21 +0,0 @@ -+ this is a list item - indented with tabs - -+ this is a list item - indented with spaces - -Code: - - this code block is indented by one tab - -And: - - this code block is indented by two tabs - -And: - - + this is an example list item - indented with tabs - - + this is an example list item - indented with spaces diff --git a/MarkdownTest/Tests_2004/Tabs.text-out b/MarkdownTest/Tests_2004/Tabs.text-out deleted file mode 100644 index 0cd92b1..0000000 --- a/MarkdownTest/Tests_2004/Tabs.text-out +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - -
    -
  • -

    this is a list item indented with tabs

    -
  • -
  • -

    this is a list item indented with spaces

    -
  • -
-

Code:

-
-this code block is indented by one tab
-
-
-

And:

-
-    this code block is indented by two tabs
-
-
-

And:

-
-+   this is an example list item
-    indented with tabs
-
-+   this is an example list item
-    indented with spaces
-
-
- - diff --git a/MarkdownTest/Tests_2004/Tabs.text-res b/MarkdownTest/Tests_2004/Tabs.text-res deleted file mode 100644 index 0cd92b1..0000000 --- a/MarkdownTest/Tests_2004/Tabs.text-res +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - -
    -
  • -

    this is a list item indented with tabs

    -
  • -
  • -

    this is a list item indented with spaces

    -
  • -
-

Code:

-
-this code block is indented by one tab
-
-
-

And:

-
-    this code block is indented by two tabs
-
-
-

And:

-
-+   this is an example list item
-    indented with tabs
-
-+   this is an example list item
-    indented with spaces
-
-
- - diff --git a/MarkdownTest/Tests_2004/Tidyness.html b/MarkdownTest/Tests_2004/Tidyness.html deleted file mode 100644 index f2a8ce7..0000000 --- a/MarkdownTest/Tests_2004/Tidyness.html +++ /dev/null @@ -1,8 +0,0 @@ -
-

A list within a blockquote:

-
    -
  • asterisk 1
  • -
  • asterisk 2
  • -
  • asterisk 3
  • -
-
diff --git a/MarkdownTest/Tests_2004/Tidyness.text b/MarkdownTest/Tests_2004/Tidyness.text deleted file mode 100644 index 5f18b8d..0000000 --- a/MarkdownTest/Tests_2004/Tidyness.text +++ /dev/null @@ -1,5 +0,0 @@ -> A list within a blockquote: -> -> * asterisk 1 -> * asterisk 2 -> * asterisk 3 diff --git a/MarkdownTest/Tests_2004/Tidyness.text-out b/MarkdownTest/Tests_2004/Tidyness.text-out deleted file mode 100644 index ebae4c4..0000000 --- a/MarkdownTest/Tests_2004/Tidyness.text-out +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - -
-

A list within a blockquote:

-
    -
  • asterisk 1
  • -
  • asterisk 2
  • -
  • asterisk 3
  • -
-
- - diff --git a/MarkdownTest/Tests_2004/Tidyness.text-res b/MarkdownTest/Tests_2004/Tidyness.text-res deleted file mode 100644 index ebae4c4..0000000 --- a/MarkdownTest/Tests_2004/Tidyness.text-res +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - -
-

A list within a blockquote:

-
    -
  • asterisk 1
  • -
  • asterisk 2
  • -
  • asterisk 3
  • -
-
- - diff --git a/MarkdownTest/Tests_2004/Yuri-Attributes.html b/MarkdownTest/Tests_2004/Yuri-Attributes.html deleted file mode 100644 index 057da2f..0000000 --- a/MarkdownTest/Tests_2004/Yuri-Attributes.html +++ /dev/null @@ -1,28 +0,0 @@ - - -

Lorem ipsum

-

Dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor - incididunt ut labore et dolore magna aliqua. -

-
    -
  • Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris - nisi ut aliquip ex ea commodo consequat. -

    - -
  • - -
  • Duis aute irure dolor in reprehenderit in voluptate velit esse - cillum dolore eu fugiat nulla pariatur2. Excepteur sint occaecat - cupidatat non proident, sunt in culpa qui officia deserunt mollit - anim id est laborum. -

    - -
  • -
-

Duis aute irure dolor in reprehenderit in voluptate - velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint - occaecat cupidatat non proident, sunt in culpa qui officia deserunt - mollit anim id est laborum. -

- - diff --git a/MarkdownTest/Tests_2004/Yuri-Attributes.text b/MarkdownTest/Tests_2004/Yuri-Attributes.text deleted file mode 100644 index 8ee512d..0000000 --- a/MarkdownTest/Tests_2004/Yuri-Attributes.text +++ /dev/null @@ -1,19 +0,0 @@ - -Lorem ipsum {@id=lorem} -================================= - -Dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor -incididunt ut labore et dolore magna aliqua. - -* Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris - nisi ut aliquip ex ea commodo consequat.{@class=first_item} - -* Duis aute irure dolor in reprehenderit in voluptate velit esse - cillum dolore eu fugiat nulla pariatur2. Excepteur sint occaecat - cupidatat non proident, sunt in culpa qui officia deserunt mollit - anim id est laborum. - -Duis aute **irure{@type=term}** dolor in reprehenderit in voluptate -velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint -occaecat cupidatat non proident, sunt in culpa qui officia deserunt -mollit anim id est laborum. diff --git a/MarkdownTest/Tests_2004/Yuri-Attributes.text-out b/MarkdownTest/Tests_2004/Yuri-Attributes.text-out deleted file mode 100644 index 38fd233..0000000 --- a/MarkdownTest/Tests_2004/Yuri-Attributes.text-out +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - -

Lorem ipsum

-

Dolor sit amet, consectetur adipisicing elit, sed do eiusmod -tempor incididunt ut labore et dolore magna aliqua.

-
    -
  • -

    Ut enim ad minim veniam, quis nostrud -exercitation ullamco laboris nisi ut aliquip ex ea commodo -consequat.

    -
  • -
  • -

    Duis aute irure dolor in reprehenderit in voluptate velit esse -cillum dolore eu fugiat nulla pariatur2. Excepteur sint occaecat -cupidatat non proident, sunt in culpa qui officia deserunt mollit -anim id est laborum.

    -
  • -
-

Duis aute irure dolor in -reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla -pariatur. Excepteur sint occaecat cupidatat non proident, sunt in -culpa qui officia deserunt mollit anim id est laborum.

- - diff --git a/MarkdownTest/Tests_2004/Yuri-Attributes.text-res b/MarkdownTest/Tests_2004/Yuri-Attributes.text-res deleted file mode 100644 index 38fd233..0000000 --- a/MarkdownTest/Tests_2004/Yuri-Attributes.text-res +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - -

Lorem ipsum

-

Dolor sit amet, consectetur adipisicing elit, sed do eiusmod -tempor incididunt ut labore et dolore magna aliqua.

-
    -
  • -

    Ut enim ad minim veniam, quis nostrud -exercitation ullamco laboris nisi ut aliquip ex ea commodo -consequat.

    -
  • -
  • -

    Duis aute irure dolor in reprehenderit in voluptate velit esse -cillum dolore eu fugiat nulla pariatur2. Excepteur sint occaecat -cupidatat non proident, sunt in culpa qui officia deserunt mollit -anim id est laborum.

    -
  • -
-

Duis aute irure dolor in -reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla -pariatur. Excepteur sint occaecat cupidatat non proident, sunt in -culpa qui officia deserunt mollit anim id est laborum.

- - diff --git a/MarkdownTest/Tests_2004/Yuri-Attributes.text~ b/MarkdownTest/Tests_2004/Yuri-Attributes.text~ deleted file mode 100644 index ba8fecd..0000000 --- a/MarkdownTest/Tests_2004/Yuri-Attributes.text~ +++ /dev/null @@ -1,24 +0,0 @@ - -Lorem ipsum {@id=lorem} -================================= - -Dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor -incididunt ut labore et dolore magna aliqua1. Ut enim ad minim veniam, -quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea -commodo consequat. Duis aute irure dolor in reprehenderit in voluptate -velit esse cillum dolore eu fugiat nulla pariatur2. Excepteur sint -occaecat cupidatat non proident, sunt in culpa qui officia deserunt -mollit anim id est laborum. - - - - * Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore3 magna aliqua. - -Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. - - 1. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.%G↩%@ - 2. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. - - Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. %G↩%@ - 3. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. %G↩%@ - diff --git a/MarkdownTest/Tests_2004/Yuri-Email.html b/MarkdownTest/Tests_2004/Yuri-Email.html deleted file mode 100644 index bf1d149..0000000 --- a/MarkdownTest/Tests_2004/Yuri-Email.html +++ /dev/null @@ -1,18 +0,0 @@ - -

Lorem ipsum yuri@domain.org, etc. -

-
    -
  • - An email address in a list -
  • - -
  • - yuri@domain.org -
  • - -
  • - Another item. -
  • -
- - diff --git a/MarkdownTest/Tests_2004/Yuri-Email.text b/MarkdownTest/Tests_2004/Yuri-Email.text deleted file mode 100644 index 8f9c779..0000000 --- a/MarkdownTest/Tests_2004/Yuri-Email.text +++ /dev/null @@ -1,7 +0,0 @@ -Lorem ipsum , etc. - -* An email address in a list -* -* Another item. - - diff --git a/MarkdownTest/Tests_2004/Yuri-Email.text-out b/MarkdownTest/Tests_2004/Yuri-Email.text-out deleted file mode 100644 index 2fc9c74..0000000 --- a/MarkdownTest/Tests_2004/Yuri-Email.text-out +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - -

Lorem ipsum yuri@domain.org, etc.

- - - diff --git a/MarkdownTest/Tests_2004/Yuri-Email.text-res b/MarkdownTest/Tests_2004/Yuri-Email.text-res deleted file mode 100644 index 2fc9c74..0000000 --- a/MarkdownTest/Tests_2004/Yuri-Email.text-res +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - -

Lorem ipsum yuri@domain.org, etc.

- - - diff --git a/MarkdownTest/Tests_2004/Yuri-Footnotes.html b/MarkdownTest/Tests_2004/Yuri-Footnotes.html deleted file mode 100644 index cadb040..0000000 --- a/MarkdownTest/Tests_2004/Yuri-Footnotes.html +++ /dev/null @@ -1,46 +0,0 @@ - -

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod - tempor incididunt ut labore et dolore magna aliqua1. Ut enim ad minim - veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea - commodo consequat. Duis aute irure dolor in reprehenderit in voluptate - velit esse cillum dolore eu fugiat nulla pariatur2. Excepteur sint - occaecat cupidatat non proident, sunt in culpa qui officia deserunt - mollit anim id est laborum. -

-
    -
  • - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do - eiusmod tempor incididunt ut labore et dolore3 magna aliqua. -
  • -
-

Duis aute irure dolor in reprehenderit in voluptate - velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint - occaecat cupidatat non proident, sunt in culpa qui officia deserunt - mollit anim id est laborum. -

- -

    -
  1. - Sed ut perspiciatis unde omnis iste natus error sit voluptatem - accusantium doloremque laudantium, totam rem aperiam, eaque ipsa - quae ab illo inventore veritatis et quasi architecto beatae vitae - dicta sunt explicabo. -
  2. - -
  3. - Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit - aut fugit, sed quia consequuntur magni dolores eos qui ratione - voluptatem sequi nesciunt.

    Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, - consectetur, adipisci velit, sed quia non numquam eius modi - tempora incidunt ut labore et dolore magnam aliquam quaerat - voluptatem. -

    - -
  4. - -
  5. - Ut enim ad minim veniam, quis nostrud exercitation ullamco - laboris nisi ut aliquip ex ea commodo consequat. -
  6. -
-
diff --git a/MarkdownTest/Tests_2004/Yuri-Footnotes.text b/MarkdownTest/Tests_2004/Yuri-Footnotes.text deleted file mode 100644 index 16fe402..0000000 --- a/MarkdownTest/Tests_2004/Yuri-Footnotes.text +++ /dev/null @@ -1,32 +0,0 @@ -Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod -tempor incididunt ut labore et dolore magna aliqua[^2]. Ut enim ad minim -veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea -commodo consequat. Duis aute irure dolor in reprehenderit in voluptate -velit esse cillum dolore eu fugiat nulla pariatur[^1]. Excepteur sint -occaecat cupidatat non proident, sunt in culpa qui officia deserunt -mollit anim id est laborum. - -[^1]: Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit - aut fugit, sed quia consequuntur magni dolores eos qui ratione - voluptatem sequi nesciunt. - - Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, - consectetur, adipisci velit, sed quia non numquam eius modi - tempora incidunt ut labore et dolore magnam aliquam quaerat - voluptatem. - -[^2]: Sed ut perspiciatis unde omnis iste natus error sit voluptatem - accusantium doloremque laudantium, totam rem aperiam, eaque ipsa - quae ab illo inventore veritatis et quasi architecto beatae vitae - dicta sunt explicabo. - -* Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do - eiusmod tempor incididunt ut labore et dolore[^foo] magna aliqua. - -[^foo]: Ut enim ad minim veniam, quis nostrud exercitation ullamco - laboris nisi ut aliquip ex ea commodo consequat. - -Duis aute irure dolor in reprehenderit in voluptate -velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint -occaecat cupidatat non proident, sunt in culpa qui officia deserunt -mollit anim id est laborum. diff --git a/MarkdownTest/Tests_2004/Yuri-Footnotes.text-out b/MarkdownTest/Tests_2004/Yuri-Footnotes.text-out deleted file mode 100644 index b934c10..0000000 --- a/MarkdownTest/Tests_2004/Yuri-Footnotes.text-out +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - -

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do -eiusmod tempor incididunt ut labore et dolore magna aliqua[^2]. Ut -enim ad minim veniam, quis nostrud exercitation ullamco laboris -nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in -reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla -pariatur[^1]. Excepteur sint occaecat cupidatat non proident, sunt -in culpa qui officia deserunt mollit anim id est laborum.

-

[^1]: Nemo enim ipsam voluptatem quia voluptas sit aspernatur -aut odit aut fugit, sed quia consequuntur magni dolores eos qui -ratione voluptatem sequi nesciunt.

-
-  Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, 
-  consectetur, adipisci velit, sed quia non numquam eius modi 
-  tempora incidunt ut labore et dolore magnam aliquam quaerat 
-  voluptatem.
-
-
-

[^2]: Sed ut perspiciatis unde omnis iste natus error sit -voluptatem accusantium doloremque laudantium, totam rem aperiam, -eaque ipsa quae ab illo inventore veritatis et quasi architecto -beatae vitae dicta sunt explicabo.

-
    -
  • Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed -do eiusmod tempor incididunt ut labore et dolore[^foo] magna -aliqua.
  • -
-

[^foo]: Ut enim ad minim veniam, quis nostrud exercitation -ullamco laboris nisi ut aliquip ex ea commodo consequat.

-

Duis aute irure dolor in reprehenderit in voluptate velit esse -cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat -cupidatat non proident, sunt in culpa qui officia deserunt mollit -anim id est laborum.

- - diff --git a/MarkdownTest/Tests_2004/Yuri-Footnotes.text-res b/MarkdownTest/Tests_2004/Yuri-Footnotes.text-res deleted file mode 100644 index 5752e27..0000000 --- a/MarkdownTest/Tests_2004/Yuri-Footnotes.text-res +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - -

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do -eiusmod tempor incididunt ut labore et dolore magna -aliqua1. Ut enim ad minim veniam, quis nostrud -exercitation ullamco laboris nisi ut aliquip ex ea commodo -consequat. Duis aute irure dolor in reprehenderit in voluptate -velit esse cillum dolore eu fugiat nulla pariatur2. Excepteur sint occaecat cupidatat non -proident, sunt in culpa qui officia deserunt mollit anim id est -laborum.

-
    -
  • Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed -do eiusmod tempor incididunt ut labore et dolore3 magna aliqua.
  • -
-

Duis aute irure dolor in reprehenderit in voluptate velit esse -cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat -cupidatat non proident, sunt in culpa qui officia deserunt mollit -anim id est laborum.

-
-
-
    -
  1. Sed ut perspiciatis unde omnis iste natus -error sit voluptatem accusantium doloremque laudantium, totam rem -aperiam, eaque ipsa quae ab illo inventore veritatis et quasi -architecto beatae vitae dicta sunt explicabo.
  2. -
  3. Nemo enim ipsam voluptatem quia voluptas sit -aspernatur aut odit aut fugit, sed quia consequuntur magni dolores -eos qui ratione voluptatem sequi nesciunt. -

    Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, -consectetur, adipisci velit, sed quia non numquam eius modi tempora -incidunt ut labore et dolore magnam aliquam quaerat voluptatem. -

    -
  4. -
  5. Ut enim ad minim veniam, quis nostrud -exercitation ullamco laboris nisi ut aliquip ex ea commodo -consequat.
  6. -
-
- - diff --git a/MarkdownTest/Tests_2004/Yuri-Links-in-Headers.html b/MarkdownTest/Tests_2004/Yuri-Links-in-Headers.html deleted file mode 100644 index 6afc56e..0000000 --- a/MarkdownTest/Tests_2004/Yuri-Links-in-Headers.html +++ /dev/null @@ -1,15 +0,0 @@ -

A plain header

- -

Let's first have a plain header

- -

An underlined header

- -

(That's also useful)

- -

A header with a link

- -

First with a hash

- -

Another with a link

- -

This time underlined

diff --git a/MarkdownTest/Tests_2004/Yuri-Links-in-Headers.text b/MarkdownTest/Tests_2004/Yuri-Links-in-Headers.text deleted file mode 100644 index d06a9e1..0000000 --- a/MarkdownTest/Tests_2004/Yuri-Links-in-Headers.text +++ /dev/null @@ -1,18 +0,0 @@ -## A plain header - -Let's first have a plain header - -An underlined header -==================== - -(That's also useful) - -# A header with a [link](http://www.link.com) - -First with a hash - -Another with a [link][a] ------------------------- -This time underlined - -[a]: http://www.link.com/ diff --git a/MarkdownTest/Tests_2004/Yuri-Links-in-Headers.text-out b/MarkdownTest/Tests_2004/Yuri-Links-in-Headers.text-out deleted file mode 100644 index 1c5cf77..0000000 --- a/MarkdownTest/Tests_2004/Yuri-Links-in-Headers.text-out +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - -

A plain header

-

Let's first have a plain header

-

An underlined header

-

(That's also useful)

-

A header with a link

-

First with a hash

-

Another with a link

-

This time underlined

- - diff --git a/MarkdownTest/Tests_2004/Yuri-Links-in-Headers.text-res b/MarkdownTest/Tests_2004/Yuri-Links-in-Headers.text-res deleted file mode 100644 index 1c5cf77..0000000 --- a/MarkdownTest/Tests_2004/Yuri-Links-in-Headers.text-res +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - -

A plain header

-

Let's first have a plain header

-

An underlined header

-

(That's also useful)

-

A header with a link

-

First with a hash

-

Another with a link

-

This time underlined

- - diff --git a/MarkdownTest/Tests_2007/Amps and angle encoding.html b/MarkdownTest/Tests_2007/Amps and angle encoding.html deleted file mode 100644 index 9606860..0000000 --- a/MarkdownTest/Tests_2007/Amps and angle encoding.html +++ /dev/null @@ -1,17 +0,0 @@ -

AT&T has an ampersand in their name.

- -

AT&T is another way to write it.

- -

This & that.

- -

4 < 5.

- -

6 > 5.

- -

Here's a link with an ampersand in the URL.

- -

Here's a link with an amersand in the link text: AT&T.

- -

Here's an inline link.

- -

Here's an inline link.

diff --git a/MarkdownTest/Tests_2007/Amps and angle encoding.text b/MarkdownTest/Tests_2007/Amps and angle encoding.text deleted file mode 100644 index 0e9527f..0000000 --- a/MarkdownTest/Tests_2007/Amps and angle encoding.text +++ /dev/null @@ -1,21 +0,0 @@ -AT&T has an ampersand in their name. - -AT&T is another way to write it. - -This & that. - -4 < 5. - -6 > 5. - -Here's a [link] [1] with an ampersand in the URL. - -Here's a link with an amersand in the link text: [AT&T] [2]. - -Here's an inline [link](/script?foo=1&bar=2). - -Here's an inline [link](). - - -[1]: http://example.com/?foo=1&bar=2 -[2]: http://att.com/ "AT&T" \ No newline at end of file diff --git a/MarkdownTest/Tests_2007/Auto links.html b/MarkdownTest/Tests_2007/Auto links.html deleted file mode 100644 index f8df985..0000000 --- a/MarkdownTest/Tests_2007/Auto links.html +++ /dev/null @@ -1,18 +0,0 @@ -

Link: http://example.com/.

- -

With an ampersand: http://example.com/?foo=1&bar=2

- - - -
-

Blockquoted: http://example.com/

-
- -

Auto-links should not occur here: <http://example.com/>

- -
or here: <http://example.com/>
-
diff --git a/MarkdownTest/Tests_2007/Auto links.text b/MarkdownTest/Tests_2007/Auto links.text deleted file mode 100644 index abbc488..0000000 --- a/MarkdownTest/Tests_2007/Auto links.text +++ /dev/null @@ -1,13 +0,0 @@ -Link: . - -With an ampersand: - -* In a list? -* -* It should. - -> Blockquoted: - -Auto-links should not occur here: `` - - or here: \ No newline at end of file diff --git a/MarkdownTest/Tests_2007/Backslash escapes.html b/MarkdownTest/Tests_2007/Backslash escapes.html deleted file mode 100644 index 29870da..0000000 --- a/MarkdownTest/Tests_2007/Backslash escapes.html +++ /dev/null @@ -1,118 +0,0 @@ -

These should all get escaped:

- -

Backslash: \

- -

Backtick: `

- -

Asterisk: *

- -

Underscore: _

- -

Left brace: {

- -

Right brace: }

- -

Left bracket: [

- -

Right bracket: ]

- -

Left paren: (

- -

Right paren: )

- -

Greater-than: >

- -

Hash: #

- -

Period: .

- -

Bang: !

- -

Plus: +

- -

Minus: -

- -

These should not, because they occur within a code block:

- -
Backslash: \\
-
-Backtick: \`
-
-Asterisk: \*
-
-Underscore: \_
-
-Left brace: \{
-
-Right brace: \}
-
-Left bracket: \[
-
-Right bracket: \]
-
-Left paren: \(
-
-Right paren: \)
-
-Greater-than: \>
-
-Hash: \#
-
-Period: \.
-
-Bang: \!
-
-Plus: \+
-
-Minus: \-
-
- -

Nor should these, which occur in code spans:

- -

Backslash: \\

- -

Backtick: \`

- -

Asterisk: \*

- -

Underscore: \_

- -

Left brace: \{

- -

Right brace: \}

- -

Left bracket: \[

- -

Right bracket: \]

- -

Left paren: \(

- -

Right paren: \)

- -

Greater-than: \>

- -

Hash: \#

- -

Period: \.

- -

Bang: \!

- -

Plus: \+

- -

Minus: \-

- - -

These should get escaped, even though they're matching pairs for -other Markdown constructs:

- -

*asterisks*

- -

_underscores_

- -

`backticks`

- -

This is a code span with a literal backslash-backtick sequence: \`

- -

This is a tag with unescaped backticks bar.

- -

This is a tag with backslashes bar.

diff --git a/MarkdownTest/Tests_2007/Backslash escapes.text b/MarkdownTest/Tests_2007/Backslash escapes.text deleted file mode 100644 index 5b014cb..0000000 --- a/MarkdownTest/Tests_2007/Backslash escapes.text +++ /dev/null @@ -1,120 +0,0 @@ -These should all get escaped: - -Backslash: \\ - -Backtick: \` - -Asterisk: \* - -Underscore: \_ - -Left brace: \{ - -Right brace: \} - -Left bracket: \[ - -Right bracket: \] - -Left paren: \( - -Right paren: \) - -Greater-than: \> - -Hash: \# - -Period: \. - -Bang: \! - -Plus: \+ - -Minus: \- - - - -These should not, because they occur within a code block: - - Backslash: \\ - - Backtick: \` - - Asterisk: \* - - Underscore: \_ - - Left brace: \{ - - Right brace: \} - - Left bracket: \[ - - Right bracket: \] - - Left paren: \( - - Right paren: \) - - Greater-than: \> - - Hash: \# - - Period: \. - - Bang: \! - - Plus: \+ - - Minus: \- - - -Nor should these, which occur in code spans: - -Backslash: `\\` - -Backtick: `` \` `` - -Asterisk: `\*` - -Underscore: `\_` - -Left brace: `\{` - -Right brace: `\}` - -Left bracket: `\[` - -Right bracket: `\]` - -Left paren: `\(` - -Right paren: `\)` - -Greater-than: `\>` - -Hash: `\#` - -Period: `\.` - -Bang: `\!` - -Plus: `\+` - -Minus: `\-` - - -These should get escaped, even though they're matching pairs for -other Markdown constructs: - -\*asterisks\* - -\_underscores\_ - -\`backticks\` - -This is a code span with a literal backslash-backtick sequence: `` \` `` - -This is a tag with unescaped backticks bar. - -This is a tag with backslashes bar. diff --git a/MarkdownTest/Tests_2007/Blockquotes with code blocks.html b/MarkdownTest/Tests_2007/Blockquotes with code blocks.html deleted file mode 100644 index 990202a..0000000 --- a/MarkdownTest/Tests_2007/Blockquotes with code blocks.html +++ /dev/null @@ -1,15 +0,0 @@ -
-

Example:

- -
sub status {
-    print "working";
-}
-
- -

Or:

- -
sub status {
-    return "working";
-}
-
-
diff --git a/MarkdownTest/Tests_2007/Blockquotes with code blocks.text b/MarkdownTest/Tests_2007/Blockquotes with code blocks.text deleted file mode 100644 index c31d171..0000000 --- a/MarkdownTest/Tests_2007/Blockquotes with code blocks.text +++ /dev/null @@ -1,11 +0,0 @@ -> Example: -> -> sub status { -> print "working"; -> } -> -> Or: -> -> sub status { -> return "working"; -> } diff --git a/MarkdownTest/Tests_2007/Code Blocks.html b/MarkdownTest/Tests_2007/Code Blocks.html deleted file mode 100644 index 32703f5..0000000 --- a/MarkdownTest/Tests_2007/Code Blocks.html +++ /dev/null @@ -1,18 +0,0 @@ -
code block on the first line
-
- -

Regular text.

- -
code block indented by spaces
-
- -

Regular text.

- -
the lines in this block  
-all contain trailing spaces  
-
- -

Regular Text.

- -
code block on the last line
-
diff --git a/MarkdownTest/Tests_2007/Code Blocks.text b/MarkdownTest/Tests_2007/Code Blocks.text deleted file mode 100644 index b54b092..0000000 --- a/MarkdownTest/Tests_2007/Code Blocks.text +++ /dev/null @@ -1,14 +0,0 @@ - code block on the first line - -Regular text. - - code block indented by spaces - -Regular text. - - the lines in this block - all contain trailing spaces - -Regular Text. - - code block on the last line \ No newline at end of file diff --git a/MarkdownTest/Tests_2007/Code Spans.html b/MarkdownTest/Tests_2007/Code Spans.html deleted file mode 100644 index b057457..0000000 --- a/MarkdownTest/Tests_2007/Code Spans.html +++ /dev/null @@ -1,5 +0,0 @@ -

<test a=" content of attribute ">

- -

Fix for backticks within HTML tag: like this

- -

Here's how you put `backticks` in a code span.

diff --git a/MarkdownTest/Tests_2007/Code Spans.text b/MarkdownTest/Tests_2007/Code Spans.text deleted file mode 100644 index 5c229c7..0000000 --- a/MarkdownTest/Tests_2007/Code Spans.text +++ /dev/null @@ -1,5 +0,0 @@ -`` - -Fix for backticks within HTML tag: like this - -Here's how you put `` `backticks` `` in a code span. \ No newline at end of file diff --git a/MarkdownTest/Tests_2007/Hard-wrapped paragraphs with list-like lines.html b/MarkdownTest/Tests_2007/Hard-wrapped paragraphs with list-like lines.html deleted file mode 100644 index e21ac79..0000000 --- a/MarkdownTest/Tests_2007/Hard-wrapped paragraphs with list-like lines.html +++ /dev/null @@ -1,8 +0,0 @@ -

In Markdown 1.0.0 and earlier. Version -8. This line turns into a list item. -Because a hard-wrapped line in the -middle of a paragraph looked like a -list item.

- -

Here's one with a bullet. -* criminey.

diff --git a/MarkdownTest/Tests_2007/Hard-wrapped paragraphs with list-like lines.text b/MarkdownTest/Tests_2007/Hard-wrapped paragraphs with list-like lines.text deleted file mode 100644 index f8a5b27..0000000 --- a/MarkdownTest/Tests_2007/Hard-wrapped paragraphs with list-like lines.text +++ /dev/null @@ -1,8 +0,0 @@ -In Markdown 1.0.0 and earlier. Version -8. This line turns into a list item. -Because a hard-wrapped line in the -middle of a paragraph looked like a -list item. - -Here's one with a bullet. -* criminey. diff --git a/MarkdownTest/Tests_2007/Horizontal rules.html b/MarkdownTest/Tests_2007/Horizontal rules.html deleted file mode 100644 index 2dc2ab6..0000000 --- a/MarkdownTest/Tests_2007/Horizontal rules.html +++ /dev/null @@ -1,71 +0,0 @@ -

Dashes:

- -
- -
- -
- -
- -
---
-
- -
- -
- -
- -
- -
- - -
-
- -

Asterisks:

- -
- -
- -
- -
- -
***
-
- -
- -
- -
- -
- -
* * *
-
- -

Underscores:

- -
- -
- -
- -
- -
___
-
- -
- -
- -
- -
- -
_ _ _
-
diff --git a/MarkdownTest/Tests_2007/Horizontal rules.text b/MarkdownTest/Tests_2007/Horizontal rules.text deleted file mode 100644 index 1594bda..0000000 --- a/MarkdownTest/Tests_2007/Horizontal rules.text +++ /dev/null @@ -1,67 +0,0 @@ -Dashes: - ---- - - --- - - --- - - --- - - --- - -- - - - - - - - - - - - - - - - - - - - - - - - - -Asterisks: - -*** - - *** - - *** - - *** - - *** - -* * * - - * * * - - * * * - - * * * - - * * * - - -Underscores: - -___ - - ___ - - ___ - - ___ - - ___ - -_ _ _ - - _ _ _ - - _ _ _ - - _ _ _ - - _ _ _ diff --git a/MarkdownTest/Tests_2007/Images.html b/MarkdownTest/Tests_2007/Images.html deleted file mode 100644 index 217f028..0000000 --- a/MarkdownTest/Tests_2007/Images.html +++ /dev/null @@ -1,21 +0,0 @@ -

Alt text

- -

Alt text

- -

Inline within a paragraph: alt text.

- -

alt text

- -

alt text

- -

alt text

- -

alt text.

- -

Empty

- -

this is a stupid URL

- -

alt text

- -

alt text

diff --git a/MarkdownTest/Tests_2007/Images.text b/MarkdownTest/Tests_2007/Images.text deleted file mode 100644 index 5707590..0000000 --- a/MarkdownTest/Tests_2007/Images.text +++ /dev/null @@ -1,26 +0,0 @@ -![Alt text](/path/to/img.jpg) - -![Alt text](/path/to/img.jpg "Optional title") - -Inline within a paragraph: [alt text](/url/). - -![alt text](/url/ "title preceded by two spaces") - -![alt text](/url/ "title has spaces afterward" ) - -![alt text]() - -![alt text]( "with a title"). - -![Empty]() - -![this is a stupid URL](http://example.com/(parens).jpg) - - -![alt text][foo] - - [foo]: /url/ - -![alt text][bar] - - [bar]: /url/ "Title here" \ No newline at end of file diff --git a/MarkdownTest/Tests_2007/Inline HTML (Advanced).html b/MarkdownTest/Tests_2007/Inline HTML (Advanced).html deleted file mode 100644 index 884f14c..0000000 --- a/MarkdownTest/Tests_2007/Inline HTML (Advanced).html +++ /dev/null @@ -1,30 +0,0 @@ -

Simple block on one line:

- -
foo
- -

And nested without indentation:

- -
-
-
-foo -
-
-
-
bar
-
- -

And with attributes:

- -
-
-
-
- -

This was broken in 1.0.2b7:

- -
-
-foo -
-
diff --git a/MarkdownTest/Tests_2007/Inline HTML (Advanced).text b/MarkdownTest/Tests_2007/Inline HTML (Advanced).text deleted file mode 100644 index 3633f81..0000000 --- a/MarkdownTest/Tests_2007/Inline HTML (Advanced).text +++ /dev/null @@ -1,30 +0,0 @@ -Simple block on one line: - -
foo
- -And nested without indentation: - -
-
-
-foo -
-
-
-
bar
-
- -And with attributes: - -
-
-
-
- -This was broken in 1.0.2b7: - -
-
-foo -
-
diff --git a/MarkdownTest/Tests_2007/Inline HTML (Simple).html b/MarkdownTest/Tests_2007/Inline HTML (Simple).html deleted file mode 100644 index 6bf78f8..0000000 --- a/MarkdownTest/Tests_2007/Inline HTML (Simple).html +++ /dev/null @@ -1,72 +0,0 @@ -

Here's a simple block:

- -
- foo -
- -

This should be a code block, though:

- -
<div>
-    foo
-</div>
-
- -

As should this:

- -
<div>foo</div>
-
- -

Now, nested:

- -
-
-
- foo -
-
-
- -

This should just be an HTML comment:

- - - -

Multiline:

- - - -

Code block:

- -
<!-- Comment -->
-
- -

Just plain comment, with trailing spaces on the line:

- - - -

Code:

- -
<hr />
-
- -

Hr's:

- -
- -
- -
- -
- -
- -
- -
- -
- -
diff --git a/MarkdownTest/Tests_2007/Inline HTML (Simple).text b/MarkdownTest/Tests_2007/Inline HTML (Simple).text deleted file mode 100644 index 14aa2dc..0000000 --- a/MarkdownTest/Tests_2007/Inline HTML (Simple).text +++ /dev/null @@ -1,69 +0,0 @@ -Here's a simple block: - -
- foo -
- -This should be a code block, though: - -
- foo -
- -As should this: - -
foo
- -Now, nested: - -
-
-
- foo -
-
-
- -This should just be an HTML comment: - - - -Multiline: - - - -Code block: - - - -Just plain comment, with trailing spaces on the line: - - - -Code: - -
- -Hr's: - -
- -
- -
- -
- -
- -
- -
- -
- -
- diff --git a/MarkdownTest/Tests_2007/Inline HTML comments.html b/MarkdownTest/Tests_2007/Inline HTML comments.html deleted file mode 100644 index 3f167a1..0000000 --- a/MarkdownTest/Tests_2007/Inline HTML comments.html +++ /dev/null @@ -1,13 +0,0 @@ -

Paragraph one.

- - - - - -

Paragraph two.

- - - -

The end.

diff --git a/MarkdownTest/Tests_2007/Inline HTML comments.text b/MarkdownTest/Tests_2007/Inline HTML comments.text deleted file mode 100644 index 41d830d..0000000 --- a/MarkdownTest/Tests_2007/Inline HTML comments.text +++ /dev/null @@ -1,13 +0,0 @@ -Paragraph one. - - - - - -Paragraph two. - - - -The end. diff --git a/MarkdownTest/Tests_2007/Links, inline style.html b/MarkdownTest/Tests_2007/Links, inline style.html deleted file mode 100644 index 9f351ef..0000000 --- a/MarkdownTest/Tests_2007/Links, inline style.html +++ /dev/null @@ -1,23 +0,0 @@ -

Just a URL.

- -

URL and title.

- -

URL and title.

- -

URL and title.

- -

URL and title.

- -

URL wrapped in angle brackets.

- -

URL w/ angle brackets + title.

- -

Empty.

- -

With parens in the URL

- -

(With outer parens and parens in url)

- -

With parens in the URL

- -

(With outer parens and parens in url)

diff --git a/MarkdownTest/Tests_2007/Links, inline style.text b/MarkdownTest/Tests_2007/Links, inline style.text deleted file mode 100644 index aba9658..0000000 --- a/MarkdownTest/Tests_2007/Links, inline style.text +++ /dev/null @@ -1,24 +0,0 @@ -Just a [URL](/url/). - -[URL and title](/url/ "title"). - -[URL and title](/url/ "title preceded by two spaces"). - -[URL and title](/url/ "title preceded by a tab"). - -[URL and title](/url/ "title has spaces afterward" ). - -[URL wrapped in angle brackets](). - -[URL w/ angle brackets + title]( "Here's the title"). - -[Empty](). - -[With parens in the URL](http://en.wikipedia.org/wiki/WIMP_(computing)) - -(With outer parens and [parens in url](/foo(bar))) - - -[With parens in the URL](/foo(bar) "and a title") - -(With outer parens and [parens in url](/foo(bar) "and a title")) diff --git a/MarkdownTest/Tests_2007/Links, reference style.html b/MarkdownTest/Tests_2007/Links, reference style.html deleted file mode 100644 index 8e70c32..0000000 --- a/MarkdownTest/Tests_2007/Links, reference style.html +++ /dev/null @@ -1,52 +0,0 @@ -

Foo bar.

- -

Foo bar.

- -

Foo bar.

- -

With embedded [brackets].

- -

Indented once.

- -

Indented twice.

- -

Indented thrice.

- -

Indented [four][] times.

- -
[four]: /url
-
- -
- -

this should work

- -

So should this.

- -

And this.

- -

And this.

- -

And this.

- -

But not [that] [].

- -

Nor [that][].

- -

Nor [that].

- -

[Something in brackets like this should work]

- -

[Same with this.]

- -

In this case, this points to something else.

- -

Backslashing should suppress [this] and [this].

- -
- -

Here's one where the link -breaks across lines.

- -

Here's another where the link -breaks across lines, but with a line-ending space.

diff --git a/MarkdownTest/Tests_2007/Links, reference style.text b/MarkdownTest/Tests_2007/Links, reference style.text deleted file mode 100644 index 341ec88..0000000 --- a/MarkdownTest/Tests_2007/Links, reference style.text +++ /dev/null @@ -1,71 +0,0 @@ -Foo [bar] [1]. - -Foo [bar][1]. - -Foo [bar] -[1]. - -[1]: /url/ "Title" - - -With [embedded [brackets]] [b]. - - -Indented [once][]. - -Indented [twice][]. - -Indented [thrice][]. - -Indented [four][] times. - - [once]: /url - - [twice]: /url - - [thrice]: /url - - [four]: /url - - -[b]: /url/ - -* * * - -[this] [this] should work - -So should [this][this]. - -And [this] []. - -And [this][]. - -And [this]. - -But not [that] []. - -Nor [that][]. - -Nor [that]. - -[Something in brackets like [this][] should work] - -[Same with [this].] - -In this case, [this](/somethingelse/) points to something else. - -Backslashing should suppress \[this] and [this\]. - -[this]: foo - - -* * * - -Here's one where the [link -breaks] across lines. - -Here's another where the [link -breaks] across lines, but with a line-ending space. - - -[link breaks]: /url/ diff --git a/MarkdownTest/Tests_2007/Links, shortcut references.html b/MarkdownTest/Tests_2007/Links, shortcut references.html deleted file mode 100755 index bf81e93..0000000 --- a/MarkdownTest/Tests_2007/Links, shortcut references.html +++ /dev/null @@ -1,9 +0,0 @@ -

This is the simple case.

- -

This one has a line -break.

- -

This one has a line -break with a line-ending space.

- -

this and the other

diff --git a/MarkdownTest/Tests_2007/Links, shortcut references.text b/MarkdownTest/Tests_2007/Links, shortcut references.text deleted file mode 100755 index 8c44c98..0000000 --- a/MarkdownTest/Tests_2007/Links, shortcut references.text +++ /dev/null @@ -1,20 +0,0 @@ -This is the [simple case]. - -[simple case]: /simple - - - -This one has a [line -break]. - -This one has a [line -break] with a line-ending space. - -[line break]: /foo - - -[this] [that] and the [other] - -[this]: /this -[that]: /that -[other]: /other diff --git a/MarkdownTest/Tests_2007/Literal quotes in titles.html b/MarkdownTest/Tests_2007/Literal quotes in titles.html deleted file mode 100644 index 611c1ac..0000000 --- a/MarkdownTest/Tests_2007/Literal quotes in titles.html +++ /dev/null @@ -1,3 +0,0 @@ -

Foo bar.

- -

Foo bar.

diff --git a/MarkdownTest/Tests_2007/Literal quotes in titles.text b/MarkdownTest/Tests_2007/Literal quotes in titles.text deleted file mode 100644 index 29d0e42..0000000 --- a/MarkdownTest/Tests_2007/Literal quotes in titles.text +++ /dev/null @@ -1,7 +0,0 @@ -Foo [bar][]. - -Foo [bar](/url/ "Title with "quotes" inside"). - - - [bar]: /url/ "Title with "quotes" inside" - diff --git a/MarkdownTest/Tests_2007/Markdown Documentation - Basics.html b/MarkdownTest/Tests_2007/Markdown Documentation - Basics.html deleted file mode 100644 index d5bdbb2..0000000 --- a/MarkdownTest/Tests_2007/Markdown Documentation - Basics.html +++ /dev/null @@ -1,314 +0,0 @@ -

Markdown: Basics

- - - -

Getting the Gist of Markdown's Formatting Syntax

- -

This page offers a brief overview of what it's like to use Markdown. -The syntax page provides complete, detailed documentation for -every feature, but Markdown should be very easy to pick up simply by -looking at a few examples of it in action. The examples on this page -are written in a before/after style, showing example syntax and the -HTML output produced by Markdown.

- -

It's also helpful to simply try Markdown out; the Dingus is a -web application that allows you type your own Markdown-formatted text -and translate it to XHTML.

- -

Note: This document is itself written using Markdown; you -can see the source for it by adding '.text' to the URL.

- -

Paragraphs, Headers, Blockquotes

- -

A paragraph is simply one or more consecutive lines of text, separated -by one or more blank lines. (A blank line is any line that looks like a -blank line -- a line containing nothing spaces or tabs is considered -blank.) Normal paragraphs should not be intended with spaces or tabs.

- -

Markdown offers two styles of headers: Setext and atx. -Setext-style headers for <h1> and <h2> are created by -"underlining" with equal signs (=) and hyphens (-), respectively. -To create an atx-style header, you put 1-6 hash marks (#) at the -beginning of the line -- the number of hashes equals the resulting -HTML header level.

- -

Blockquotes are indicated using email-style '>' angle brackets.

- -

Markdown:

- -
A First Level Header
-====================
-
-A Second Level Header
----------------------
-
-Now is the time for all good men to come to
-the aid of their country. This is just a
-regular paragraph.
-
-The quick brown fox jumped over the lazy
-dog's back.
-
-### Header 3
-
-> This is a blockquote.
-> 
-> This is the second paragraph in the blockquote.
->
-> ## This is an H2 in a blockquote
-
- -

Output:

- -
<h1>A First Level Header</h1>
-
-<h2>A Second Level Header</h2>
-
-<p>Now is the time for all good men to come to
-the aid of their country. This is just a
-regular paragraph.</p>
-
-<p>The quick brown fox jumped over the lazy
-dog's back.</p>
-
-<h3>Header 3</h3>
-
-<blockquote>
-    <p>This is a blockquote.</p>
-
-    <p>This is the second paragraph in the blockquote.</p>
-
-    <h2>This is an H2 in a blockquote</h2>
-</blockquote>
-
- -

Phrase Emphasis

- -

Markdown uses asterisks and underscores to indicate spans of emphasis.

- -

Markdown:

- -
Some of these words *are emphasized*.
-Some of these words _are emphasized also_.
-
-Use two asterisks for **strong emphasis**.
-Or, if you prefer, __use two underscores instead__.
-
- -

Output:

- -
<p>Some of these words <em>are emphasized</em>.
-Some of these words <em>are emphasized also</em>.</p>
-
-<p>Use two asterisks for <strong>strong emphasis</strong>.
-Or, if you prefer, <strong>use two underscores instead</strong>.</p>
-
- -

Lists

- -

Unordered (bulleted) lists use asterisks, pluses, and hyphens (*, -+, and -) as list markers. These three markers are -interchangable; this:

- -
*   Candy.
-*   Gum.
-*   Booze.
-
- -

this:

- -
+   Candy.
-+   Gum.
-+   Booze.
-
- -

and this:

- -
-   Candy.
--   Gum.
--   Booze.
-
- -

all produce the same output:

- -
<ul>
-<li>Candy.</li>
-<li>Gum.</li>
-<li>Booze.</li>
-</ul>
-
- -

Ordered (numbered) lists use regular numbers, followed by periods, as -list markers:

- -
1.  Red
-2.  Green
-3.  Blue
-
- -

Output:

- -
<ol>
-<li>Red</li>
-<li>Green</li>
-<li>Blue</li>
-</ol>
-
- -

If you put blank lines between items, you'll get <p> tags for the -list item text. You can create multi-paragraph list items by indenting -the paragraphs by 4 spaces or 1 tab:

- -
*   A list item.
-
-    With multiple paragraphs.
-
-*   Another item in the list.
-
- -

Output:

- -
<ul>
-<li><p>A list item.</p>
-<p>With multiple paragraphs.</p></li>
-<li><p>Another item in the list.</p></li>
-</ul>
-
- -

Links

- -

Markdown supports two styles for creating links: inline and -reference. With both styles, you use square brackets to delimit the -text you want to turn into a link.

- -

Inline-style links use parentheses immediately after the link text. -For example:

- -
This is an [example link](http://example.com/).
-
- -

Output:

- -
<p>This is an <a href="http://example.com/">
-example link</a>.</p>
-
- -

Optionally, you may include a title attribute in the parentheses:

- -
This is an [example link](http://example.com/ "With a Title").
-
- -

Output:

- -
<p>This is an <a href="http://example.com/" title="With a Title">
-example link</a>.</p>
-
- -

Reference-style links allow you to refer to your links by names, which -you define elsewhere in your document:

- -
I get 10 times more traffic from [Google][1] than from
-[Yahoo][2] or [MSN][3].
-
-[1]: http://google.com/        "Google"
-[2]: http://search.yahoo.com/  "Yahoo Search"
-[3]: http://search.msn.com/    "MSN Search"
-
- -

Output:

- -
<p>I get 10 times more traffic from <a href="http://google.com/"
-title="Google">Google</a> than from <a href="http://search.yahoo.com/"
-title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
-title="MSN Search">MSN</a>.</p>
-
- -

The title attribute is optional. Link names may contain letters, -numbers and spaces, but are not case sensitive:

- -
I start my morning with a cup of coffee and
-[The New York Times][NY Times].
-
-[ny times]: http://www.nytimes.com/
-
- -

Output:

- -
<p>I start my morning with a cup of coffee and
-<a href="http://www.nytimes.com/">The New York Times</a>.</p>
-
- -

Images

- -

Image syntax is very much like link syntax.

- -

Inline (titles are optional):

- -
![alt text](/path/to/img.jpg "Title")
-
- -

Reference-style:

- -
![alt text][id]
-
-[id]: /path/to/img.jpg "Title"
-
- -

Both of the above examples produce the same output:

- -
<img src="/path/to/img.jpg" alt="alt text" title="Title" />
-
- -

Code

- -

In a regular paragraph, you can create code span by wrapping text in -backtick quotes. Any ampersands (&) and angle brackets (< or ->) will automatically be translated into HTML entities. This makes -it easy to use Markdown to write about HTML example code:

- -
I strongly recommend against using any `<blink>` tags.
-
-I wish SmartyPants used named entities like `&mdash;`
-instead of decimal-encoded entites like `&#8212;`.
-
- -

Output:

- -
<p>I strongly recommend against using any
-<code>&lt;blink&gt;</code> tags.</p>
-
-<p>I wish SmartyPants used named entities like
-<code>&amp;mdash;</code> instead of decimal-encoded
-entites like <code>&amp;#8212;</code>.</p>
-
- -

To specify an entire block of pre-formatted code, indent every line of -the block by 4 spaces or 1 tab. Just like with code spans, &, <, -and > characters will be escaped automatically.

- -

Markdown:

- -
If you want your page to validate under XHTML 1.0 Strict,
-you've got to put paragraph tags in your blockquotes:
-
-    <blockquote>
-        <p>For example.</p>
-    </blockquote>
-
- -

Output:

- -
<p>If you want your page to validate under XHTML 1.0 Strict,
-you've got to put paragraph tags in your blockquotes:</p>
-
-<pre><code>&lt;blockquote&gt;
-    &lt;p&gt;For example.&lt;/p&gt;
-&lt;/blockquote&gt;
-</code></pre>
-
diff --git a/MarkdownTest/Tests_2007/Markdown Documentation - Basics.text b/MarkdownTest/Tests_2007/Markdown Documentation - Basics.text deleted file mode 100644 index 486055c..0000000 --- a/MarkdownTest/Tests_2007/Markdown Documentation - Basics.text +++ /dev/null @@ -1,306 +0,0 @@ -Markdown: Basics -================ - - - - -Getting the Gist of Markdown's Formatting Syntax ------------------------------------------------- - -This page offers a brief overview of what it's like to use Markdown. -The [syntax page] [s] provides complete, detailed documentation for -every feature, but Markdown should be very easy to pick up simply by -looking at a few examples of it in action. The examples on this page -are written in a before/after style, showing example syntax and the -HTML output produced by Markdown. - -It's also helpful to simply try Markdown out; the [Dingus] [d] is a -web application that allows you type your own Markdown-formatted text -and translate it to XHTML. - -**Note:** This document is itself written using Markdown; you -can [see the source for it by adding '.text' to the URL] [src]. - - [s]: /projects/markdown/syntax "Markdown Syntax" - [d]: /projects/markdown/dingus "Markdown Dingus" - [src]: /projects/markdown/basics.text - - -## Paragraphs, Headers, Blockquotes ## - -A paragraph is simply one or more consecutive lines of text, separated -by one or more blank lines. (A blank line is any line that looks like a -blank line -- a line containing nothing spaces or tabs is considered -blank.) Normal paragraphs should not be intended with spaces or tabs. - -Markdown offers two styles of headers: *Setext* and *atx*. -Setext-style headers for `

` and `

` are created by -"underlining" with equal signs (`=`) and hyphens (`-`), respectively. -To create an atx-style header, you put 1-6 hash marks (`#`) at the -beginning of the line -- the number of hashes equals the resulting -HTML header level. - -Blockquotes are indicated using email-style '`>`' angle brackets. - -Markdown: - - A First Level Header - ==================== - - A Second Level Header - --------------------- - - Now is the time for all good men to come to - the aid of their country. This is just a - regular paragraph. - - The quick brown fox jumped over the lazy - dog's back. - - ### Header 3 - - > This is a blockquote. - > - > This is the second paragraph in the blockquote. - > - > ## This is an H2 in a blockquote - - -Output: - -

A First Level Header

- -

A Second Level Header

- -

Now is the time for all good men to come to - the aid of their country. This is just a - regular paragraph.

- -

The quick brown fox jumped over the lazy - dog's back.

- -

Header 3

- -
-

This is a blockquote.

- -

This is the second paragraph in the blockquote.

- -

This is an H2 in a blockquote

-
- - - -### Phrase Emphasis ### - -Markdown uses asterisks and underscores to indicate spans of emphasis. - -Markdown: - - Some of these words *are emphasized*. - Some of these words _are emphasized also_. - - Use two asterisks for **strong emphasis**. - Or, if you prefer, __use two underscores instead__. - -Output: - -

Some of these words are emphasized. - Some of these words are emphasized also.

- -

Use two asterisks for strong emphasis. - Or, if you prefer, use two underscores instead.

- - - -## Lists ## - -Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`, -`+`, and `-`) as list markers. These three markers are -interchangable; this: - - * Candy. - * Gum. - * Booze. - -this: - - + Candy. - + Gum. - + Booze. - -and this: - - - Candy. - - Gum. - - Booze. - -all produce the same output: - -
    -
  • Candy.
  • -
  • Gum.
  • -
  • Booze.
  • -
- -Ordered (numbered) lists use regular numbers, followed by periods, as -list markers: - - 1. Red - 2. Green - 3. Blue - -Output: - -
    -
  1. Red
  2. -
  3. Green
  4. -
  5. Blue
  6. -
- -If you put blank lines between items, you'll get `

` tags for the -list item text. You can create multi-paragraph list items by indenting -the paragraphs by 4 spaces or 1 tab: - - * A list item. - - With multiple paragraphs. - - * Another item in the list. - -Output: - -

    -
  • A list item.

    -

    With multiple paragraphs.

  • -
  • Another item in the list.

  • -
- - - -### Links ### - -Markdown supports two styles for creating links: *inline* and -*reference*. With both styles, you use square brackets to delimit the -text you want to turn into a link. - -Inline-style links use parentheses immediately after the link text. -For example: - - This is an [example link](http://example.com/). - -Output: - -

This is an - example link.

- -Optionally, you may include a title attribute in the parentheses: - - This is an [example link](http://example.com/ "With a Title"). - -Output: - -

This is an - example link.

- -Reference-style links allow you to refer to your links by names, which -you define elsewhere in your document: - - I get 10 times more traffic from [Google][1] than from - [Yahoo][2] or [MSN][3]. - - [1]: http://google.com/ "Google" - [2]: http://search.yahoo.com/ "Yahoo Search" - [3]: http://search.msn.com/ "MSN Search" - -Output: - -

I get 10 times more traffic from Google than from Yahoo or MSN.

- -The title attribute is optional. Link names may contain letters, -numbers and spaces, but are *not* case sensitive: - - I start my morning with a cup of coffee and - [The New York Times][NY Times]. - - [ny times]: http://www.nytimes.com/ - -Output: - -

I start my morning with a cup of coffee and - The New York Times.

- - -### Images ### - -Image syntax is very much like link syntax. - -Inline (titles are optional): - - ![alt text](/path/to/img.jpg "Title") - -Reference-style: - - ![alt text][id] - - [id]: /path/to/img.jpg "Title" - -Both of the above examples produce the same output: - - alt text - - - -### Code ### - -In a regular paragraph, you can create code span by wrapping text in -backtick quotes. Any ampersands (`&`) and angle brackets (`<` or -`>`) will automatically be translated into HTML entities. This makes -it easy to use Markdown to write about HTML example code: - - I strongly recommend against using any `` tags. - - I wish SmartyPants used named entities like `—` - instead of decimal-encoded entites like `—`. - -Output: - -

I strongly recommend against using any - <blink> tags.

- -

I wish SmartyPants used named entities like - &mdash; instead of decimal-encoded - entites like &#8212;.

- - -To specify an entire block of pre-formatted code, indent every line of -the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`, -and `>` characters will be escaped automatically. - -Markdown: - - If you want your page to validate under XHTML 1.0 Strict, - you've got to put paragraph tags in your blockquotes: - -
-

For example.

-
- -Output: - -

If you want your page to validate under XHTML 1.0 Strict, - you've got to put paragraph tags in your blockquotes:

- -
<blockquote>
-        <p>For example.</p>
-    </blockquote>
-    
diff --git a/MarkdownTest/Tests_2007/Markdown Documentation - Syntax.html b/MarkdownTest/Tests_2007/Markdown Documentation - Syntax.html deleted file mode 100644 index 5c01306..0000000 --- a/MarkdownTest/Tests_2007/Markdown Documentation - Syntax.html +++ /dev/null @@ -1,942 +0,0 @@ -

Markdown: Syntax

- - - - - -

Note: This document is itself written using Markdown; you -can see the source for it by adding '.text' to the URL.

- -
- -

Overview

- -

Philosophy

- -

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

- -

Readability, however, is emphasized above all else. A Markdown-formatted -document should be publishable as-is, as plain text, without looking -like it's been marked up with tags or formatting instructions. While -Markdown's syntax has been influenced by several existing text-to-HTML -filters -- including Setext, atx, Textile, reStructuredText, -Grutatext, and EtText -- the single biggest source of -inspiration for Markdown's syntax is the format of plain text email.

- -

To this end, Markdown's syntax is comprised entirely of punctuation -characters, which punctuation characters have been carefully chosen so -as to look like what they mean. E.g., asterisks around a word actually -look like *emphasis*. Markdown lists look like, well, lists. Even -blockquotes look like quoted passages of text, assuming you've ever -used email.

- -

Inline HTML

- -

Markdown's syntax is intended for one purpose: to be used as a -format for writing for the web.

- -

Markdown is not a replacement for HTML, or even close to it. Its -syntax is very small, corresponding only to a very small subset of -HTML tags. The idea is not to create a syntax that makes it easier -to insert HTML tags. In my opinion, HTML tags are already easy to -insert. The idea for Markdown is to make it easy to read, write, and -edit prose. HTML is a publishing format; Markdown is a writing -format. Thus, Markdown's formatting syntax only addresses issues that -can be conveyed in plain text.

- -

For any markup that is not covered by Markdown's syntax, you simply -use HTML itself. There's no need to preface it or delimit it to -indicate that you're switching from Markdown to HTML; you just use -the tags.

- -

The only restrictions are that block-level HTML elements -- e.g. <div>, -<table>, <pre>, <p>, etc. -- must be separated from surrounding -content by blank lines, and the start and end tags of the block should -not be indented with tabs or spaces. Markdown is smart enough not -to add extra (unwanted) <p> tags around HTML block-level tags.

- -

For example, to add an HTML table to a Markdown article:

- -
This is a regular paragraph.
-
-<table>
-    <tr>
-        <td>Foo</td>
-    </tr>
-</table>
-
-This is another regular paragraph.
-
- -

Note that Markdown formatting syntax is not processed within block-level -HTML tags. E.g., you can't use Markdown-style *emphasis* inside an -HTML block.

- -

Span-level HTML tags -- e.g. <span>, <cite>, or <del> -- can be -used anywhere in a Markdown paragraph, list item, or header. If you -want, you can even use HTML tags instead of Markdown formatting; e.g. if -you'd prefer to use HTML <a> or <img> tags instead of Markdown's -link or image syntax, go right ahead.

- -

Unlike block-level HTML tags, Markdown syntax is processed within -span-level tags.

- -

Automatic Escaping for Special Characters

- -

In HTML, there are two characters that demand special treatment: < -and &. Left angle brackets are used to start tags; ampersands are -used to denote HTML entities. If you want to use them as literal -characters, you must escape them as entities, e.g. &lt;, and -&amp;.

- -

Ampersands in particular are bedeviling for web writers. If you want to -write about 'AT&T', you need to write 'AT&amp;T'. You even need to -escape ampersands within URLs. Thus, if you want to link to:

- -
http://images.google.com/images?num=30&q=larry+bird
-
- -

you need to encode the URL as:

- -
http://images.google.com/images?num=30&amp;q=larry+bird
-
- -

in your anchor tag href attribute. Needless to say, this is easy to -forget, and is probably the single most common source of HTML validation -errors in otherwise well-marked-up web sites.

- -

Markdown allows you to use these characters naturally, taking care of -all the necessary escaping for you. If you use an ampersand as part of -an HTML entity, it remains unchanged; otherwise it will be translated -into &amp;.

- -

So, if you want to include a copyright symbol in your article, you can write:

- -
&copy;
-
- -

and Markdown will leave it alone. But if you write:

- -
AT&T
-
- -

Markdown will translate it to:

- -
AT&amp;T
-
- -

Similarly, because Markdown supports inline HTML, if you use -angle brackets as delimiters for HTML tags, Markdown will treat them as -such. But if you write:

- -
4 < 5
-
- -

Markdown will translate it to:

- -
4 &lt; 5
-
- -

However, inside Markdown code spans and blocks, angle brackets and -ampersands are always encoded automatically. This makes it easy to use -Markdown to write about HTML code. (As opposed to raw HTML, which is a -terrible format for writing about HTML syntax, because every single < -and & in your example code needs to be escaped.)

- -
- -

Block Elements

- -

Paragraphs and Line Breaks

- -

A paragraph is simply one or more consecutive lines of text, separated -by one or more blank lines. (A blank line is any line that looks like a -blank line -- a line containing nothing but spaces or tabs is considered -blank.) Normal paragraphs should not be intended with spaces or tabs.

- -

The implication of the "one or more consecutive lines of text" rule is -that Markdown supports "hard-wrapped" text paragraphs. This differs -significantly from most other text-to-HTML formatters (including Movable -Type's "Convert Line Breaks" option) which translate every line break -character in a paragraph into a <br /> tag.

- -

When you do want to insert a <br /> break tag using Markdown, you -end a line with two or more spaces, then type return.

- -

Yes, this takes a tad more effort to create a <br />, but a simplistic -"every line break is a <br />" rule wouldn't work for Markdown. -Markdown's email-style blockquoting and multi-paragraph list items -work best -- and look better -- when you format them with hard breaks.

- - - -

Markdown supports two styles of headers, Setext and atx.

- -

Setext-style headers are "underlined" using equal signs (for first-level -headers) and dashes (for second-level headers). For example:

- -
This is an H1
-=============
-
-This is an H2
--------------
-
- -

Any number of underlining ='s or -'s will work.

- -

Atx-style headers use 1-6 hash characters at the start of the line, -corresponding to header levels 1-6. For example:

- -
# This is an H1
-
-## This is an H2
-
-###### This is an H6
-
- -

Optionally, you may "close" atx-style headers. This is purely -cosmetic -- you can use this if you think it looks better. The -closing hashes don't even need to match the number of hashes -used to open the header. (The number of opening hashes -determines the header level.) :

- -
# This is an H1 #
-
-## This is an H2 ##
-
-### This is an H3 ######
-
- -

Blockquotes

- -

Markdown uses email-style > characters for blockquoting. If you're -familiar with quoting passages of text in an email message, then you -know how to create a blockquote in Markdown. It looks best if you hard -wrap the text and put a > before every line:

- -
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
-> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
-> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
-> 
-> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
-> id sem consectetuer libero luctus adipiscing.
-
- -

Markdown allows you to be lazy and only put the > before the first -line of a hard-wrapped paragraph:

- -
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
-consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
-Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
-
-> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
-id sem consectetuer libero luctus adipiscing.
-
- -

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by -adding additional levels of >:

- -
> This is the first level of quoting.
->
-> > This is nested blockquote.
->
-> Back to the first level.
-
- -

Blockquotes can contain other Markdown elements, including headers, lists, -and code blocks:

- -
> ## This is a header.
-> 
-> 1.   This is the first list item.
-> 2.   This is the second list item.
-> 
-> Here's some example code:
-> 
->     return shell_exec("echo $input | $markdown_script");
-
- -

Any decent text editor should make email-style quoting easy. For -example, with BBEdit, you can make a selection and choose Increase -Quote Level from the Text menu.

- -

Lists

- -

Markdown supports ordered (numbered) and unordered (bulleted) lists.

- -

Unordered lists use asterisks, pluses, and hyphens -- interchangably --- as list markers:

- -
*   Red
-*   Green
-*   Blue
-
- -

is equivalent to:

- -
+   Red
-+   Green
-+   Blue
-
- -

and:

- -
-   Red
--   Green
--   Blue
-
- -

Ordered lists use numbers followed by periods:

- -
1.  Bird
-2.  McHale
-3.  Parish
-
- -

It's important to note that the actual numbers you use to mark the -list have no effect on the HTML output Markdown produces. The HTML -Markdown produces from the above list is:

- -
<ol>
-<li>Bird</li>
-<li>McHale</li>
-<li>Parish</li>
-</ol>
-
- -

If you instead wrote the list in Markdown like this:

- -
1.  Bird
-1.  McHale
-1.  Parish
-
- -

or even:

- -
3. Bird
-1. McHale
-8. Parish
-
- -

you'd get the exact same HTML output. The point is, if you want to, -you can use ordinal numbers in your ordered Markdown lists, so that -the numbers in your source match the numbers in your published HTML. -But if you want to be lazy, you don't have to.

- -

If you do use lazy list numbering, however, you should still start the -list with the number 1. At some point in the future, Markdown may support -starting ordered lists at an arbitrary number.

- -

List markers typically start at the left margin, but may be indented by -up to three spaces. List markers must be followed by one or more spaces -or a tab.

- -

To make lists look nice, you can wrap items with hanging indents:

- -
*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
-    Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
-    viverra nec, fringilla in, laoreet vitae, risus.
-*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
-    Suspendisse id sem consectetuer libero luctus adipiscing.
-
- -

But if you want to be lazy, you don't have to:

- -
*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
-Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
-viverra nec, fringilla in, laoreet vitae, risus.
-*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
-Suspendisse id sem consectetuer libero luctus adipiscing.
-
- -

If list items are separated by blank lines, Markdown will wrap the -items in <p> tags in the HTML output. For example, this input:

- -
*   Bird
-*   Magic
-
- -

will turn into:

- -
<ul>
-<li>Bird</li>
-<li>Magic</li>
-</ul>
-
- -

But this:

- -
*   Bird
-
-*   Magic
-
- -

will turn into:

- -
<ul>
-<li><p>Bird</p></li>
-<li><p>Magic</p></li>
-</ul>
-
- -

List items may consist of multiple paragraphs. Each subsequent -paragraph in a list item must be intended by either 4 spaces -or one tab:

- -
1.  This is a list item with two paragraphs. Lorem ipsum dolor
-    sit amet, consectetuer adipiscing elit. Aliquam hendrerit
-    mi posuere lectus.
-
-    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
-    vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
-    sit amet velit.
-
-2.  Suspendisse id sem consectetuer libero luctus adipiscing.
-
- -

It looks nice if you indent every line of the subsequent -paragraphs, but here again, Markdown will allow you to be -lazy:

- -
*   This is a list item with two paragraphs.
-
-    This is the second paragraph in the list item. You're
-only required to indent the first line. Lorem ipsum dolor
-sit amet, consectetuer adipiscing elit.
-
-*   Another item in the same list.
-
- -

To put a blockquote within a list item, the blockquote's > -delimiters need to be indented:

- -
*   A list item with a blockquote:
-
-    > This is a blockquote
-    > inside a list item.
-
- -

To put a code block within a list item, the code block needs -to be indented twice -- 8 spaces or two tabs:

- -
*   A list item with a code block:
-
-        <code goes here>
-
- -

It's worth noting that it's possible to trigger an ordered list by -accident, by writing something like this:

- -
1986. What a great season.
-
- -

In other words, a number-period-space sequence at the beginning of a -line. To avoid this, you can backslash-escape the period:

- -
1986\. What a great season.
-
- -

Code Blocks

- -

Pre-formatted code blocks are used for writing about programming or -markup source code. Rather than forming normal paragraphs, the lines -of a code block are interpreted literally. Markdown wraps a code block -in both <pre> and <code> tags.

- -

To produce a code block in Markdown, simply indent every line of the -block by at least 4 spaces or 1 tab. For example, given this input:

- -
This is a normal paragraph:
-
-    This is a code block.
-
- -

Markdown will generate:

- -
<p>This is a normal paragraph:</p>
-
-<pre><code>This is a code block.
-</code></pre>
-
- -

One level of indentation -- 4 spaces or 1 tab -- is removed from each -line of the code block. For example, this:

- -
Here is an example of AppleScript:
-
-    tell application "Foo"
-        beep
-    end tell
-
- -

will turn into:

- -
<p>Here is an example of AppleScript:</p>
-
-<pre><code>tell application "Foo"
-    beep
-end tell
-</code></pre>
-
- -

A code block continues until it reaches a line that is not indented -(or the end of the article).

- -

Within a code block, ampersands (&) and angle brackets (< and >) -are automatically converted into HTML entities. This makes it very -easy to include example HTML source code using Markdown -- just paste -it and indent it, and Markdown will handle the hassle of encoding the -ampersands and angle brackets. For example, this:

- -
    <div class="footer">
-        &copy; 2004 Foo Corporation
-    </div>
-
- -

will turn into:

- -
<pre><code>&lt;div class="footer"&gt;
-    &amp;copy; 2004 Foo Corporation
-&lt;/div&gt;
-</code></pre>
-
- -

Regular Markdown syntax is not processed within code blocks. E.g., -asterisks are just literal asterisks within a code block. This means -it's also easy to use Markdown to write about Markdown's own syntax.

- -

Horizontal Rules

- -

You can produce a horizontal rule tag (<hr />) by placing three or -more hyphens, asterisks, or underscores on a line by themselves. If you -wish, you may use spaces between the hyphens or asterisks. Each of the -following lines will produce a horizontal rule:

- -
* * *
-
-***
-
-*****
-
-- - -
-
----------------------------------------
-
-_ _ _
-
- -
- -

Span Elements

- - - -

Markdown supports two style of links: inline and reference.

- -

In both styles, the link text is delimited by [square brackets].

- -

To create an inline link, use a set of regular parentheses immediately -after the link text's closing square bracket. Inside the parentheses, -put the URL where you want the link to point, along with an optional -title for the link, surrounded in quotes. For example:

- -
This is [an example](http://example.com/ "Title") inline link.
-
-[This link](http://example.net/) has no title attribute.
-
- -

Will produce:

- -
<p>This is <a href="http://example.com/" title="Title">
-an example</a> inline link.</p>
-
-<p><a href="http://example.net/">This link</a> has no
-title attribute.</p>
-
- -

If you're referring to a local resource on the same server, you can -use relative paths:

- -
See my [About](/about/) page for details.
-
- -

Reference-style links use a second set of square brackets, inside -which you place a label of your choosing to identify the link:

- -
This is [an example][id] reference-style link.
-
- -

You can optionally use a space to separate the sets of brackets:

- -
This is [an example] [id] reference-style link.
-
- -

Then, anywhere in the document, you define your link label like this, -on a line by itself:

- -
[id]: http://example.com/  "Optional Title Here"
-
- -

That is:

- -
    -
  • Square brackets containing the link identifier (optionally -indented from the left margin using up to three spaces);
  • -
  • followed by a colon;
  • -
  • followed by one or more spaces (or tabs);
  • -
  • followed by the URL for the link;
  • -
  • optionally followed by a title attribute for the link, enclosed -in double or single quotes.
  • -
- -

The link URL may, optionally, be surrounded by angle brackets:

- -
[id]: <http://example.com/>  "Optional Title Here"
-
- -

You can put the title attribute on the next line and use extra spaces -or tabs for padding, which tends to look better with longer URLs:

- -
[id]: http://example.com/longish/path/to/resource/here
-    "Optional Title Here"
-
- -

Link definitions are only used for creating links during Markdown -processing, and are stripped from your document in the HTML output.

- -

Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are not case sensitive. E.g. these two links:

- -
[link text][a]
-[link text][A]
-
- -

are equivalent.

- -

The implicit link name shortcut allows you to omit the name of the -link, in which case the link text itself is used as the name. -Just use an empty set of square brackets -- e.g., to link the word -"Google" to the google.com web site, you could simply write:

- -
[Google][]
-
- -

And then define the link:

- -
[Google]: http://google.com/
-
- -

Because link names may contain spaces, this shortcut even works for -multiple words in the link text:

- -
Visit [Daring Fireball][] for more information.
-
- -

And then define the link:

- -
[Daring Fireball]: http://daringfireball.net/
-
- -

Link definitions can be placed anywhere in your Markdown document. I -tend to put them immediately after each paragraph in which they're -used, but if you want, you can put them all at the end of your -document, sort of like footnotes.

- -

Here's an example of reference links in action:

- -
I get 10 times more traffic from [Google] [1] than from
-[Yahoo] [2] or [MSN] [3].
-
-  [1]: http://google.com/        "Google"
-  [2]: http://search.yahoo.com/  "Yahoo Search"
-  [3]: http://search.msn.com/    "MSN Search"
-
- -

Using the implicit link name shortcut, you could instead write:

- -
I get 10 times more traffic from [Google][] than from
-[Yahoo][] or [MSN][].
-
-  [google]: http://google.com/        "Google"
-  [yahoo]:  http://search.yahoo.com/  "Yahoo Search"
-  [msn]:    http://search.msn.com/    "MSN Search"
-
- -

Both of the above examples will produce the following HTML output:

- -
<p>I get 10 times more traffic from <a href="http://google.com/"
-title="Google">Google</a> than from
-<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
-or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
-
- -

For comparison, here is the same paragraph written using -Markdown's inline link style:

- -
I get 10 times more traffic from [Google](http://google.com/ "Google")
-than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
-[MSN](http://search.msn.com/ "MSN Search").
-
- -

The point of reference-style links is not that they're easier to -write. The point is that with reference-style links, your document -source is vastly more readable. Compare the above examples: using -reference-style links, the paragraph itself is only 81 characters -long; with inline-style links, it's 176 characters; and as raw HTML, -it's 234 characters. In the raw HTML, there's more markup than there -is text.

- -

With Markdown's reference-style links, a source document much more -closely resembles the final output, as rendered in a browser. By -allowing you to move the markup-related metadata out of the paragraph, -you can add links without interrupting the narrative flow of your -prose.

- -

Emphasis

- -

Markdown treats asterisks (*) and underscores (_) as indicators of -emphasis. Text wrapped with one * or _ will be wrapped with an -HTML <em> tag; double *'s or _'s will be wrapped with an HTML -<strong> tag. E.g., this input:

- -
*single asterisks*
-
-_single underscores_
-
-**double asterisks**
-
-__double underscores__
-
- -

will produce:

- -
<em>single asterisks</em>
-
-<em>single underscores</em>
-
-<strong>double asterisks</strong>
-
-<strong>double underscores</strong>
-
- -

You can use whichever style you prefer; the lone restriction is that -the same character must be used to open and close an emphasis span.

- -

Emphasis can be used in the middle of a word:

- -
un*fucking*believable
-
- -

But if you surround an * or _ with spaces, it'll be treated as a -literal asterisk or underscore.

- -

To produce a literal asterisk or underscore at a position where it -would otherwise be used as an emphasis delimiter, you can backslash -escape it:

- -
\*this text is surrounded by literal asterisks\*
-
- -

Code

- -

To indicate a span of code, wrap it with backtick quotes (`). -Unlike a pre-formatted code block, a code span indicates code within a -normal paragraph. For example:

- -
Use the `printf()` function.
-
- -

will produce:

- -
<p>Use the <code>printf()</code> function.</p>
-
- -

To include a literal backtick character within a code span, you can use -multiple backticks as the opening and closing delimiters:

- -
``There is a literal backtick (`) here.``
-
- -

which will produce this:

- -
<p><code>There is a literal backtick (`) here.</code></p>
-
- -

The backtick delimiters surrounding a code span may include spaces -- -one after the opening, one before the closing. This allows you to place -literal backtick characters at the beginning or end of a code span:

- -
A single backtick in a code span: `` ` ``
-
-A backtick-delimited string in a code span: `` `foo` ``
-
- -

will produce:

- -
<p>A single backtick in a code span: <code>`</code></p>
-
-<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
-
- -

With a code span, ampersands and angle brackets are encoded as HTML -entities automatically, which makes it easy to include example HTML -tags. Markdown will turn this:

- -
Please don't use any `<blink>` tags.
-
- -

into:

- -
<p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
-
- -

You can write this:

- -
`&#8212;` is the decimal-encoded equivalent of `&mdash;`.
-
- -

to produce:

- -
<p><code>&amp;#8212;</code> is the decimal-encoded
-equivalent of <code>&amp;mdash;</code>.</p>
-
- -

Images

- -

Admittedly, it's fairly difficult to devise a "natural" syntax for -placing images into a plain text document format.

- -

Markdown uses an image syntax that is intended to resemble the syntax -for links, allowing for two styles: inline and reference.

- -

Inline image syntax looks like this:

- -
![Alt text](/path/to/img.jpg)
-
-![Alt text](/path/to/img.jpg "Optional title")
-
- -

That is:

- -
    -
  • An exclamation mark: !;
  • -
  • followed by a set of square brackets, containing the alt -attribute text for the image;
  • -
  • followed by a set of parentheses, containing the URL or path to -the image, and an optional title attribute enclosed in double -or single quotes.
  • -
- -

Reference-style image syntax looks like this:

- -
![Alt text][id]
-
- -

Where "id" is the name of a defined image reference. Image references -are defined using syntax identical to link references:

- -
[id]: url/to/image  "Optional title attribute"
-
- -

As of this writing, Markdown has no syntax for specifying the -dimensions of an image; if this is important to you, you can simply -use regular HTML <img> tags.

- -
- -

Miscellaneous

- - - -

Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

- -
<http://example.com/>
-
- -

Markdown will turn this into:

- -
<a href="http://example.com/">http://example.com/</a>
-
- -

Automatic links for email addresses work similarly, except that -Markdown will also perform a bit of randomized decimal and hex -entity-encoding to help obscure your address from address-harvesting -spambots. For example, Markdown will turn this:

- -
<address@example.com>
-
- -

into something like this:

- -
<a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
-&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
-&#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
-&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
-
- -

which will render in a browser as a clickable link to "address@example.com".

- -

(This sort of entity-encoding trick will indeed fool many, if not -most, address-harvesting bots, but it definitely won't fool all of -them. It's better than nothing, but an address published in this way -will probably eventually start receiving spam.)

- -

Backslash Escapes

- -

Markdown allows you to use backslash escapes to generate literal -characters which would otherwise have special meaning in Markdown's -formatting syntax. For example, if you wanted to surround a word with -literal asterisks (instead of an HTML <em> tag), you can backslashes -before the asterisks, like this:

- -
\*literal asterisks\*
-
- -

Markdown provides backslash escapes for the following characters:

- -
\   backslash
-`   backtick
-*   asterisk
-_   underscore
-{}  curly braces
-[]  square brackets
-()  parentheses
-#   hash mark
-+   plus sign
--   minus sign (hyphen)
-.   dot
-!   exclamation mark
-
diff --git a/MarkdownTest/Tests_2007/Markdown Documentation - Syntax.text b/MarkdownTest/Tests_2007/Markdown Documentation - Syntax.text deleted file mode 100644 index 57360a1..0000000 --- a/MarkdownTest/Tests_2007/Markdown Documentation - Syntax.text +++ /dev/null @@ -1,888 +0,0 @@ -Markdown: Syntax -================ - - - - -* [Overview](#overview) - * [Philosophy](#philosophy) - * [Inline HTML](#html) - * [Automatic Escaping for Special Characters](#autoescape) -* [Block Elements](#block) - * [Paragraphs and Line Breaks](#p) - * [Headers](#header) - * [Blockquotes](#blockquote) - * [Lists](#list) - * [Code Blocks](#precode) - * [Horizontal Rules](#hr) -* [Span Elements](#span) - * [Links](#link) - * [Emphasis](#em) - * [Code](#code) - * [Images](#img) -* [Miscellaneous](#misc) - * [Backslash Escapes](#backslash) - * [Automatic Links](#autolink) - - -**Note:** This document is itself written using Markdown; you -can [see the source for it by adding '.text' to the URL][src]. - - [src]: /projects/markdown/syntax.text - -* * * - -

Overview

- -

Philosophy

- -Markdown is intended to be as easy-to-read and easy-to-write as is feasible. - -Readability, however, is emphasized above all else. A Markdown-formatted -document should be publishable as-is, as plain text, without looking -like it's been marked up with tags or formatting instructions. While -Markdown's syntax has been influenced by several existing text-to-HTML -filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4], -[Grutatext] [5], and [EtText] [6] -- the single biggest source of -inspiration for Markdown's syntax is the format of plain text email. - - [1]: http://docutils.sourceforge.net/mirror/setext.html - [2]: http://www.aaronsw.com/2002/atx/ - [3]: http://textism.com/tools/textile/ - [4]: http://docutils.sourceforge.net/rst.html - [5]: http://www.triptico.com/software/grutatxt.html - [6]: http://ettext.taint.org/doc/ - -To this end, Markdown's syntax is comprised entirely of punctuation -characters, which punctuation characters have been carefully chosen so -as to look like what they mean. E.g., asterisks around a word actually -look like \*emphasis\*. Markdown lists look like, well, lists. Even -blockquotes look like quoted passages of text, assuming you've ever -used email. - - - -

Inline HTML

- -Markdown's syntax is intended for one purpose: to be used as a -format for *writing* for the web. - -Markdown is not a replacement for HTML, or even close to it. Its -syntax is very small, corresponding only to a very small subset of -HTML tags. The idea is *not* to create a syntax that makes it easier -to insert HTML tags. In my opinion, HTML tags are already easy to -insert. The idea for Markdown is to make it easy to read, write, and -edit prose. HTML is a *publishing* format; Markdown is a *writing* -format. Thus, Markdown's formatting syntax only addresses issues that -can be conveyed in plain text. - -For any markup that is not covered by Markdown's syntax, you simply -use HTML itself. There's no need to preface it or delimit it to -indicate that you're switching from Markdown to HTML; you just use -the tags. - -The only restrictions are that block-level HTML elements -- e.g. `
`, -``, `
`, `

`, etc. -- must be separated from surrounding -content by blank lines, and the start and end tags of the block should -not be indented with tabs or spaces. Markdown is smart enough not -to add extra (unwanted) `

` tags around HTML block-level tags. - -For example, to add an HTML table to a Markdown article: - - This is a regular paragraph. - -

- - - -
Foo
- - This is another regular paragraph. - -Note that Markdown formatting syntax is not processed within block-level -HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an -HTML block. - -Span-level HTML tags -- e.g. ``, ``, or `` -- can be -used anywhere in a Markdown paragraph, list item, or header. If you -want, you can even use HTML tags instead of Markdown formatting; e.g. if -you'd prefer to use HTML `` or `` tags instead of Markdown's -link or image syntax, go right ahead. - -Unlike block-level HTML tags, Markdown syntax *is* processed within -span-level tags. - - -

Automatic Escaping for Special Characters

- -In HTML, there are two characters that demand special treatment: `<` -and `&`. Left angle brackets are used to start tags; ampersands are -used to denote HTML entities. If you want to use them as literal -characters, you must escape them as entities, e.g. `<`, and -`&`. - -Ampersands in particular are bedeviling for web writers. If you want to -write about 'AT&T', you need to write '`AT&T`'. You even need to -escape ampersands within URLs. Thus, if you want to link to: - - http://images.google.com/images?num=30&q=larry+bird - -you need to encode the URL as: - - http://images.google.com/images?num=30&q=larry+bird - -in your anchor tag `href` attribute. Needless to say, this is easy to -forget, and is probably the single most common source of HTML validation -errors in otherwise well-marked-up web sites. - -Markdown allows you to use these characters naturally, taking care of -all the necessary escaping for you. If you use an ampersand as part of -an HTML entity, it remains unchanged; otherwise it will be translated -into `&`. - -So, if you want to include a copyright symbol in your article, you can write: - - © - -and Markdown will leave it alone. But if you write: - - AT&T - -Markdown will translate it to: - - AT&T - -Similarly, because Markdown supports [inline HTML](#html), if you use -angle brackets as delimiters for HTML tags, Markdown will treat them as -such. But if you write: - - 4 < 5 - -Markdown will translate it to: - - 4 < 5 - -However, inside Markdown code spans and blocks, angle brackets and -ampersands are *always* encoded automatically. This makes it easy to use -Markdown to write about HTML code. (As opposed to raw HTML, which is a -terrible format for writing about HTML syntax, because every single `<` -and `&` in your example code needs to be escaped.) - - -* * * - - -

Block Elements

- - -

Paragraphs and Line Breaks

- -A paragraph is simply one or more consecutive lines of text, separated -by one or more blank lines. (A blank line is any line that looks like a -blank line -- a line containing nothing but spaces or tabs is considered -blank.) Normal paragraphs should not be intended with spaces or tabs. - -The implication of the "one or more consecutive lines of text" rule is -that Markdown supports "hard-wrapped" text paragraphs. This differs -significantly from most other text-to-HTML formatters (including Movable -Type's "Convert Line Breaks" option) which translate every line break -character in a paragraph into a `
` tag. - -When you *do* want to insert a `
` break tag using Markdown, you -end a line with two or more spaces, then type return. - -Yes, this takes a tad more effort to create a `
`, but a simplistic -"every line break is a `
`" rule wouldn't work for Markdown. -Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l] -work best -- and look better -- when you format them with hard breaks. - - [bq]: #blockquote - [l]: #list - - - - - -Markdown supports two styles of headers, [Setext] [1] and [atx] [2]. - -Setext-style headers are "underlined" using equal signs (for first-level -headers) and dashes (for second-level headers). For example: - - This is an H1 - ============= - - This is an H2 - ------------- - -Any number of underlining `=`'s or `-`'s will work. - -Atx-style headers use 1-6 hash characters at the start of the line, -corresponding to header levels 1-6. For example: - - # This is an H1 - - ## This is an H2 - - ###### This is an H6 - -Optionally, you may "close" atx-style headers. This is purely -cosmetic -- you can use this if you think it looks better. The -closing hashes don't even need to match the number of hashes -used to open the header. (The number of opening hashes -determines the header level.) : - - # This is an H1 # - - ## This is an H2 ## - - ### This is an H3 ###### - - -

Blockquotes

- -Markdown uses email-style `>` characters for blockquoting. If you're -familiar with quoting passages of text in an email message, then you -know how to create a blockquote in Markdown. It looks best if you hard -wrap the text and put a `>` before every line: - - > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, - > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. - > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. - > - > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse - > id sem consectetuer libero luctus adipiscing. - -Markdown allows you to be lazy and only put the `>` before the first -line of a hard-wrapped paragraph: - - > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, - consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. - Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. - - > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse - id sem consectetuer libero luctus adipiscing. - -Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by -adding additional levels of `>`: - - > This is the first level of quoting. - > - > > This is nested blockquote. - > - > Back to the first level. - -Blockquotes can contain other Markdown elements, including headers, lists, -and code blocks: - - > ## This is a header. - > - > 1. This is the first list item. - > 2. This is the second list item. - > - > Here's some example code: - > - > return shell_exec("echo $input | $markdown_script"); - -Any decent text editor should make email-style quoting easy. For -example, with BBEdit, you can make a selection and choose Increase -Quote Level from the Text menu. - - -

Lists

- -Markdown supports ordered (numbered) and unordered (bulleted) lists. - -Unordered lists use asterisks, pluses, and hyphens -- interchangably --- as list markers: - - * Red - * Green - * Blue - -is equivalent to: - - + Red - + Green - + Blue - -and: - - - Red - - Green - - Blue - -Ordered lists use numbers followed by periods: - - 1. Bird - 2. McHale - 3. Parish - -It's important to note that the actual numbers you use to mark the -list have no effect on the HTML output Markdown produces. The HTML -Markdown produces from the above list is: - -
    -
  1. Bird
  2. -
  3. McHale
  4. -
  5. Parish
  6. -
- -If you instead wrote the list in Markdown like this: - - 1. Bird - 1. McHale - 1. Parish - -or even: - - 3. Bird - 1. McHale - 8. Parish - -you'd get the exact same HTML output. The point is, if you want to, -you can use ordinal numbers in your ordered Markdown lists, so that -the numbers in your source match the numbers in your published HTML. -But if you want to be lazy, you don't have to. - -If you do use lazy list numbering, however, you should still start the -list with the number 1. At some point in the future, Markdown may support -starting ordered lists at an arbitrary number. - -List markers typically start at the left margin, but may be indented by -up to three spaces. List markers must be followed by one or more spaces -or a tab. - -To make lists look nice, you can wrap items with hanging indents: - - * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. - Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, - viverra nec, fringilla in, laoreet vitae, risus. - * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. - Suspendisse id sem consectetuer libero luctus adipiscing. - -But if you want to be lazy, you don't have to: - - * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. - Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, - viverra nec, fringilla in, laoreet vitae, risus. - * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. - Suspendisse id sem consectetuer libero luctus adipiscing. - -If list items are separated by blank lines, Markdown will wrap the -items in `

` tags in the HTML output. For example, this input: - - * Bird - * Magic - -will turn into: - -

    -
  • Bird
  • -
  • Magic
  • -
- -But this: - - * Bird - - * Magic - -will turn into: - -
    -
  • Bird

  • -
  • Magic

  • -
- -List items may consist of multiple paragraphs. Each subsequent -paragraph in a list item must be intended by either 4 spaces -or one tab: - - 1. This is a list item with two paragraphs. Lorem ipsum dolor - sit amet, consectetuer adipiscing elit. Aliquam hendrerit - mi posuere lectus. - - Vestibulum enim wisi, viverra nec, fringilla in, laoreet - vitae, risus. Donec sit amet nisl. Aliquam semper ipsum - sit amet velit. - - 2. Suspendisse id sem consectetuer libero luctus adipiscing. - -It looks nice if you indent every line of the subsequent -paragraphs, but here again, Markdown will allow you to be -lazy: - - * This is a list item with two paragraphs. - - This is the second paragraph in the list item. You're - only required to indent the first line. Lorem ipsum dolor - sit amet, consectetuer adipiscing elit. - - * Another item in the same list. - -To put a blockquote within a list item, the blockquote's `>` -delimiters need to be indented: - - * A list item with a blockquote: - - > This is a blockquote - > inside a list item. - -To put a code block within a list item, the code block needs -to be indented *twice* -- 8 spaces or two tabs: - - * A list item with a code block: - - - - -It's worth noting that it's possible to trigger an ordered list by -accident, by writing something like this: - - 1986. What a great season. - -In other words, a *number-period-space* sequence at the beginning of a -line. To avoid this, you can backslash-escape the period: - - 1986\. What a great season. - - - -

Code Blocks

- -Pre-formatted code blocks are used for writing about programming or -markup source code. Rather than forming normal paragraphs, the lines -of a code block are interpreted literally. Markdown wraps a code block -in both `
` and `` tags.
-
-To produce a code block in Markdown, simply indent every line of the
-block by at least 4 spaces or 1 tab. For example, given this input:
-
-    This is a normal paragraph:
-
-        This is a code block.
-
-Markdown will generate:
-
-    

This is a normal paragraph:

- -
This is a code block.
-    
- -One level of indentation -- 4 spaces or 1 tab -- is removed from each -line of the code block. For example, this: - - Here is an example of AppleScript: - - tell application "Foo" - beep - end tell - -will turn into: - -

Here is an example of AppleScript:

- -
tell application "Foo"
-        beep
-    end tell
-    
- -A code block continues until it reaches a line that is not indented -(or the end of the article). - -Within a code block, ampersands (`&`) and angle brackets (`<` and `>`) -are automatically converted into HTML entities. This makes it very -easy to include example HTML source code using Markdown -- just paste -it and indent it, and Markdown will handle the hassle of encoding the -ampersands and angle brackets. For example, this: - - - -will turn into: - -
<div class="footer">
-        &copy; 2004 Foo Corporation
-    </div>
-    
- -Regular Markdown syntax is not processed within code blocks. E.g., -asterisks are just literal asterisks within a code block. This means -it's also easy to use Markdown to write about Markdown's own syntax. - - - -

Horizontal Rules

- -You can produce a horizontal rule tag (`
`) by placing three or -more hyphens, asterisks, or underscores on a line by themselves. If you -wish, you may use spaces between the hyphens or asterisks. Each of the -following lines will produce a horizontal rule: - - * * * - - *** - - ***** - - - - - - - --------------------------------------- - - _ _ _ - - -* * * - -

Span Elements

- - - -Markdown supports two style of links: *inline* and *reference*. - -In both styles, the link text is delimited by [square brackets]. - -To create an inline link, use a set of regular parentheses immediately -after the link text's closing square bracket. Inside the parentheses, -put the URL where you want the link to point, along with an *optional* -title for the link, surrounded in quotes. For example: - - This is [an example](http://example.com/ "Title") inline link. - - [This link](http://example.net/) has no title attribute. - -Will produce: - -

This is - an example inline link.

- -

This link has no - title attribute.

- -If you're referring to a local resource on the same server, you can -use relative paths: - - See my [About](/about/) page for details. - -Reference-style links use a second set of square brackets, inside -which you place a label of your choosing to identify the link: - - This is [an example][id] reference-style link. - -You can optionally use a space to separate the sets of brackets: - - This is [an example] [id] reference-style link. - -Then, anywhere in the document, you define your link label like this, -on a line by itself: - - [id]: http://example.com/ "Optional Title Here" - -That is: - -* Square brackets containing the link identifier (optionally - indented from the left margin using up to three spaces); -* followed by a colon; -* followed by one or more spaces (or tabs); -* followed by the URL for the link; -* optionally followed by a title attribute for the link, enclosed - in double or single quotes. - -The link URL may, optionally, be surrounded by angle brackets: - - [id]: "Optional Title Here" - -You can put the title attribute on the next line and use extra spaces -or tabs for padding, which tends to look better with longer URLs: - - [id]: http://example.com/longish/path/to/resource/here - "Optional Title Here" - -Link definitions are only used for creating links during Markdown -processing, and are stripped from your document in the HTML output. - -Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links: - - [link text][a] - [link text][A] - -are equivalent. - -The *implicit link name* shortcut allows you to omit the name of the -link, in which case the link text itself is used as the name. -Just use an empty set of square brackets -- e.g., to link the word -"Google" to the google.com web site, you could simply write: - - [Google][] - -And then define the link: - - [Google]: http://google.com/ - -Because link names may contain spaces, this shortcut even works for -multiple words in the link text: - - Visit [Daring Fireball][] for more information. - -And then define the link: - - [Daring Fireball]: http://daringfireball.net/ - -Link definitions can be placed anywhere in your Markdown document. I -tend to put them immediately after each paragraph in which they're -used, but if you want, you can put them all at the end of your -document, sort of like footnotes. - -Here's an example of reference links in action: - - I get 10 times more traffic from [Google] [1] than from - [Yahoo] [2] or [MSN] [3]. - - [1]: http://google.com/ "Google" - [2]: http://search.yahoo.com/ "Yahoo Search" - [3]: http://search.msn.com/ "MSN Search" - -Using the implicit link name shortcut, you could instead write: - - I get 10 times more traffic from [Google][] than from - [Yahoo][] or [MSN][]. - - [google]: http://google.com/ "Google" - [yahoo]: http://search.yahoo.com/ "Yahoo Search" - [msn]: http://search.msn.com/ "MSN Search" - -Both of the above examples will produce the following HTML output: - -

I get 10 times more traffic from Google than from - Yahoo - or MSN.

- -For comparison, here is the same paragraph written using -Markdown's inline link style: - - I get 10 times more traffic from [Google](http://google.com/ "Google") - than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or - [MSN](http://search.msn.com/ "MSN Search"). - -The point of reference-style links is not that they're easier to -write. The point is that with reference-style links, your document -source is vastly more readable. Compare the above examples: using -reference-style links, the paragraph itself is only 81 characters -long; with inline-style links, it's 176 characters; and as raw HTML, -it's 234 characters. In the raw HTML, there's more markup than there -is text. - -With Markdown's reference-style links, a source document much more -closely resembles the final output, as rendered in a browser. By -allowing you to move the markup-related metadata out of the paragraph, -you can add links without interrupting the narrative flow of your -prose. - - -

Emphasis

- -Markdown treats asterisks (`*`) and underscores (`_`) as indicators of -emphasis. Text wrapped with one `*` or `_` will be wrapped with an -HTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML -`` tag. E.g., this input: - - *single asterisks* - - _single underscores_ - - **double asterisks** - - __double underscores__ - -will produce: - - single asterisks - - single underscores - - double asterisks - - double underscores - -You can use whichever style you prefer; the lone restriction is that -the same character must be used to open and close an emphasis span. - -Emphasis can be used in the middle of a word: - - un*fucking*believable - -But if you surround an `*` or `_` with spaces, it'll be treated as a -literal asterisk or underscore. - -To produce a literal asterisk or underscore at a position where it -would otherwise be used as an emphasis delimiter, you can backslash -escape it: - - \*this text is surrounded by literal asterisks\* - - - -

Code

- -To indicate a span of code, wrap it with backtick quotes (`` ` ``). -Unlike a pre-formatted code block, a code span indicates code within a -normal paragraph. For example: - - Use the `printf()` function. - -will produce: - -

Use the printf() function.

- -To include a literal backtick character within a code span, you can use -multiple backticks as the opening and closing delimiters: - - ``There is a literal backtick (`) here.`` - -which will produce this: - -

There is a literal backtick (`) here.

- -The backtick delimiters surrounding a code span may include spaces -- -one after the opening, one before the closing. This allows you to place -literal backtick characters at the beginning or end of a code span: - - A single backtick in a code span: `` ` `` - - A backtick-delimited string in a code span: `` `foo` `` - -will produce: - -

A single backtick in a code span: `

- -

A backtick-delimited string in a code span: `foo`

- -With a code span, ampersands and angle brackets are encoded as HTML -entities automatically, which makes it easy to include example HTML -tags. Markdown will turn this: - - Please don't use any `` tags. - -into: - -

Please don't use any <blink> tags.

- -You can write this: - - `—` is the decimal-encoded equivalent of `—`. - -to produce: - -

&#8212; is the decimal-encoded - equivalent of &mdash;.

- - - -

Images

- -Admittedly, it's fairly difficult to devise a "natural" syntax for -placing images into a plain text document format. - -Markdown uses an image syntax that is intended to resemble the syntax -for links, allowing for two styles: *inline* and *reference*. - -Inline image syntax looks like this: - - ![Alt text](/path/to/img.jpg) - - ![Alt text](/path/to/img.jpg "Optional title") - -That is: - -* An exclamation mark: `!`; -* followed by a set of square brackets, containing the `alt` - attribute text for the image; -* followed by a set of parentheses, containing the URL or path to - the image, and an optional `title` attribute enclosed in double - or single quotes. - -Reference-style image syntax looks like this: - - ![Alt text][id] - -Where "id" is the name of a defined image reference. Image references -are defined using syntax identical to link references: - - [id]: url/to/image "Optional title attribute" - -As of this writing, Markdown has no syntax for specifying the -dimensions of an image; if this is important to you, you can simply -use regular HTML `` tags. - - -* * * - - -

Miscellaneous

- - - -Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this: - - - -Markdown will turn this into: - - http://example.com/ - -Automatic links for email addresses work similarly, except that -Markdown will also perform a bit of randomized decimal and hex -entity-encoding to help obscure your address from address-harvesting -spambots. For example, Markdown will turn this: - - - -into something like this: - - address@exa - mple.com - -which will render in a browser as a clickable link to "address@example.com". - -(This sort of entity-encoding trick will indeed fool many, if not -most, address-harvesting bots, but it definitely won't fool all of -them. It's better than nothing, but an address published in this way -will probably eventually start receiving spam.) - - - -

Backslash Escapes

- -Markdown allows you to use backslash escapes to generate literal -characters which would otherwise have special meaning in Markdown's -formatting syntax. For example, if you wanted to surround a word with -literal asterisks (instead of an HTML `` tag), you can backslashes -before the asterisks, like this: - - \*literal asterisks\* - -Markdown provides backslash escapes for the following characters: - - \ backslash - ` backtick - * asterisk - _ underscore - {} curly braces - [] square brackets - () parentheses - # hash mark - + plus sign - - minus sign (hyphen) - . dot - ! exclamation mark - diff --git a/MarkdownTest/Tests_2007/Nested blockquotes.html b/MarkdownTest/Tests_2007/Nested blockquotes.html deleted file mode 100644 index d8ec7f8..0000000 --- a/MarkdownTest/Tests_2007/Nested blockquotes.html +++ /dev/null @@ -1,9 +0,0 @@ -
-

foo

- -
-

bar

-
- -

foo

-
diff --git a/MarkdownTest/Tests_2007/Nested blockquotes.text b/MarkdownTest/Tests_2007/Nested blockquotes.text deleted file mode 100644 index ed3c624..0000000 --- a/MarkdownTest/Tests_2007/Nested blockquotes.text +++ /dev/null @@ -1,5 +0,0 @@ -> foo -> -> > bar -> -> foo diff --git a/MarkdownTest/Tests_2007/Ordered and unordered lists.html b/MarkdownTest/Tests_2007/Ordered and unordered lists.html deleted file mode 100644 index ba71eab..0000000 --- a/MarkdownTest/Tests_2007/Ordered and unordered lists.html +++ /dev/null @@ -1,148 +0,0 @@ -

Unordered

- -

Asterisks tight:

- -
    -
  • asterisk 1
  • -
  • asterisk 2
  • -
  • asterisk 3
  • -
- -

Asterisks loose:

- -
    -
  • asterisk 1

  • -
  • asterisk 2

  • -
  • asterisk 3

  • -
- -
- -

Pluses tight:

- -
    -
  • Plus 1
  • -
  • Plus 2
  • -
  • Plus 3
  • -
- -

Pluses loose:

- -
    -
  • Plus 1

  • -
  • Plus 2

  • -
  • Plus 3

  • -
- -
- -

Minuses tight:

- -
    -
  • Minus 1
  • -
  • Minus 2
  • -
  • Minus 3
  • -
- -

Minuses loose:

- -
    -
  • Minus 1

  • -
  • Minus 2

  • -
  • Minus 3

  • -
- -

Ordered

- -

Tight:

- -
    -
  1. First
  2. -
  3. Second
  4. -
  5. Third
  6. -
- -

and:

- -
    -
  1. One
  2. -
  3. Two
  4. -
  5. Three
  6. -
- -

Loose using tabs:

- -
    -
  1. First

  2. -
  3. Second

  4. -
  5. Third

  6. -
- -

and using spaces:

- -
    -
  1. One

  2. -
  3. Two

  4. -
  5. Three

  6. -
- -

Multiple paragraphs:

- -
    -
  1. Item 1, graf one.

    - -

    Item 2. graf two. The quick brown fox jumped over the lazy dog's -back.

  2. -
  3. Item 2.

  4. -
  5. Item 3.

  6. -
- -

Nested

- -
    -
  • Tab -
      -
    • Tab -
        -
      • Tab
      • -
    • -
  • -
- -

Here's another:

- -
    -
  1. First
  2. -
  3. Second: -
      -
    • Fee
    • -
    • Fie
    • -
    • Foe
    • -
  4. -
  5. Third
  6. -
- -

Same thing but with paragraphs:

- -
    -
  1. First

  2. -
  3. Second:

    - -
      -
    • Fee
    • -
    • Fie
    • -
    • Foe
    • -
  4. -
  5. Third

  6. -
- - -

This was an error in Markdown 1.0.1:

- -
    -
  • this

    - -
    • sub
    - -

    that

  • -
diff --git a/MarkdownTest/Tests_2007/Ordered and unordered lists.text b/MarkdownTest/Tests_2007/Ordered and unordered lists.text deleted file mode 100644 index 7f3b497..0000000 --- a/MarkdownTest/Tests_2007/Ordered and unordered lists.text +++ /dev/null @@ -1,131 +0,0 @@ -## Unordered - -Asterisks tight: - -* asterisk 1 -* asterisk 2 -* asterisk 3 - - -Asterisks loose: - -* asterisk 1 - -* asterisk 2 - -* asterisk 3 - -* * * - -Pluses tight: - -+ Plus 1 -+ Plus 2 -+ Plus 3 - - -Pluses loose: - -+ Plus 1 - -+ Plus 2 - -+ Plus 3 - -* * * - - -Minuses tight: - -- Minus 1 -- Minus 2 -- Minus 3 - - -Minuses loose: - -- Minus 1 - -- Minus 2 - -- Minus 3 - - -## Ordered - -Tight: - -1. First -2. Second -3. Third - -and: - -1. One -2. Two -3. Three - - -Loose using tabs: - -1. First - -2. Second - -3. Third - -and using spaces: - -1. One - -2. Two - -3. Three - -Multiple paragraphs: - -1. Item 1, graf one. - - Item 2. graf two. The quick brown fox jumped over the lazy dog's - back. - -2. Item 2. - -3. Item 3. - - - -## Nested - -* Tab - * Tab - * Tab - -Here's another: - -1. First -2. Second: - * Fee - * Fie - * Foe -3. Third - -Same thing but with paragraphs: - -1. First - -2. Second: - * Fee - * Fie - * Foe - -3. Third - - -This was an error in Markdown 1.0.1: - -* this - - * sub - - that diff --git a/MarkdownTest/Tests_2007/Strong and em together.html b/MarkdownTest/Tests_2007/Strong and em together.html deleted file mode 100644 index 71ec78c..0000000 --- a/MarkdownTest/Tests_2007/Strong and em together.html +++ /dev/null @@ -1,7 +0,0 @@ -

This is strong and em.

- -

So is this word.

- -

This is strong and em.

- -

So is this word.

diff --git a/MarkdownTest/Tests_2007/Strong and em together.text b/MarkdownTest/Tests_2007/Strong and em together.text deleted file mode 100644 index 95ee690..0000000 --- a/MarkdownTest/Tests_2007/Strong and em together.text +++ /dev/null @@ -1,7 +0,0 @@ -***This is strong and em.*** - -So is ***this*** word. - -___This is strong and em.___ - -So is ___this___ word. diff --git a/MarkdownTest/Tests_2007/Tabs.html b/MarkdownTest/Tests_2007/Tabs.html deleted file mode 100644 index 3301ba8..0000000 --- a/MarkdownTest/Tests_2007/Tabs.html +++ /dev/null @@ -1,25 +0,0 @@ -
    -
  • this is a list item -indented with tabs

  • -
  • this is a list item -indented with spaces

  • -
- -

Code:

- -
this code block is indented by one tab
-
- -

And:

- -
    this code block is indented by two tabs
-
- -

And:

- -
+   this is an example list item
-    indented with tabs
-
-+   this is an example list item
-    indented with spaces
-
diff --git a/MarkdownTest/Tests_2007/Tabs.text b/MarkdownTest/Tests_2007/Tabs.text deleted file mode 100644 index 589d113..0000000 --- a/MarkdownTest/Tests_2007/Tabs.text +++ /dev/null @@ -1,21 +0,0 @@ -+ this is a list item - indented with tabs - -+ this is a list item - indented with spaces - -Code: - - this code block is indented by one tab - -And: - - this code block is indented by two tabs - -And: - - + this is an example list item - indented with tabs - - + this is an example list item - indented with spaces diff --git a/MarkdownTest/Tests_2007/Tidyness.html b/MarkdownTest/Tests_2007/Tidyness.html deleted file mode 100644 index f2a8ce7..0000000 --- a/MarkdownTest/Tests_2007/Tidyness.html +++ /dev/null @@ -1,8 +0,0 @@ -
-

A list within a blockquote:

-
    -
  • asterisk 1
  • -
  • asterisk 2
  • -
  • asterisk 3
  • -
-
diff --git a/MarkdownTest/Tests_2007/Tidyness.text b/MarkdownTest/Tests_2007/Tidyness.text deleted file mode 100644 index 5f18b8d..0000000 --- a/MarkdownTest/Tests_2007/Tidyness.text +++ /dev/null @@ -1,5 +0,0 @@ -> A list within a blockquote: -> -> * asterisk 1 -> * asterisk 2 -> * asterisk 3 diff --git a/MarkdownTest/readme.txt b/MarkdownTest/readme.txt deleted file mode 100644 index 68047b5..0000000 --- a/MarkdownTest/readme.txt +++ /dev/null @@ -1 +0,0 @@ -MarkdownTest_1.0_2007-05-09 updated for the new version of tidy. diff --git a/README.md b/README.md new file mode 100644 index 0000000..c2c573e --- /dev/null +++ b/README.md @@ -0,0 +1,64 @@ +[Python-Markdown][] +=================== + +[![Build Status][build-button]][build] +[![Coverage Status][codecov-button]][codecov] +[![Latest Version][mdversion-button]][md-pypi] +[![Python Versions][pyversion-button]][md-pypi] +[![BSD License][bsdlicense-button]][bsdlicense] +[![Code of Conduct][codeofconduct-button]][Code of Conduct] + +[build-button]: https://github.com/Python-Markdown/markdown/workflows/CI/badge.svg?event=push +[build]: https://github.com/Python-Markdown/markdown/actions?query=workflow%3ACI+event%3Apush +[codecov-button]: https://codecov.io/gh/Python-Markdown/markdown/branch/master/graph/badge.svg +[codecov]: https://codecov.io/gh/Python-Markdown/markdown +[mdversion-button]: https://img.shields.io/pypi/v/Markdown.svg +[md-pypi]: https://pypi.org/project/Markdown/ +[pyversion-button]: https://img.shields.io/pypi/pyversions/Markdown.svg +[bsdlicense-button]: https://img.shields.io/badge/license-BSD-yellow.svg +[bsdlicense]: https://opensource.org/licenses/BSD-3-Clause +[codeofconduct-button]: https://img.shields.io/badge/code%20of%20conduct-contributor%20covenant-green.svg?style=flat-square +[Code of Conduct]: https://github.com/Python-Markdown/markdown/blob/master/CODE_OF_CONDUCT.md + +This is a Python implementation of John Gruber's [Markdown][]. +It is almost completely compliant with the reference implementation, +though there are a few known issues. See [Features][] for information +on what exactly is supported and what is not. Additional features are +supported by the [Available Extensions][]. + +[Python-Markdown]: https://Python-Markdown.github.io/ +[Markdown]: https://daringfireball.net/projects/markdown/ +[Features]: https://Python-Markdown.github.io#Features +[Available Extensions]: https://Python-Markdown.github.io/extensions + +Documentation +------------- + +```bash +pip install markdown +``` +```python +import markdown +html = markdown.markdown(your_text_string) +``` + +For more advanced [installation] and [usage] documentation, see the `docs/` directory +of the distribution or the project website at . + +[installation]: https://python-markdown.github.io/install/ +[usage]: https://python-markdown.github.io/reference/ + +See the change log at . + +Support +------- + +You may report bugs, ask for help, and discuss various other issues on the [bug tracker][]. + +[bug tracker]: https://github.com/Python-Markdown/markdown/issues + +Code of Conduct +--------------- + +Everyone interacting in the Python-Markdown project's code bases, issue trackers, +and mailing lists is expected to follow the [Code of Conduct]. diff --git a/bin/markdown b/bin/markdown deleted file mode 100755 index 8d04cc9..0000000 --- a/bin/markdown +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python -""" -Python Markdown, the Command Line Script -======================================== - -This is the command line script for Python Markdown. - -Basic use from the command line: - - markdown source.txt > destination.html - -Run "markdown --help" to see more options. - -See markdown/__init__.py for information on using Python Markdown as a module. - -## Authors and License - -Started by [Manfred Stienstra](http://www.dwerg.net/). Continued and -maintained by [Yuri Takhteyev](http://www.freewisdom.org), [Waylan -Limberg](http://achinghead.com/) and [Artem Yunusov](http://blog.splyer.com). - -Contact: markdown@freewisdom.org - -Copyright 2007, 2008 The Python Markdown Project (v. 1.7 and later) -Copyright 200? Django Software Foundation (OrderedDict implementation) -Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) -Copyright 2004 Manfred Stienstra (the original version) - -License: BSD (see docs/LICENSE for details). -""" - -import logging -from markdown import COMMAND_LINE_LOGGING_LEVEL -from markdown import commandline - -# Setup a logger manually for compatibility with Python 2.3 -logger = logging.getLogger('MARKDOWN') -logger.setLevel(COMMAND_LINE_LOGGING_LEVEL) -logger.addHandler(logging.StreamHandler()) - -if __name__ == '__main__': - commandline.run() diff --git a/checklinks.sh b/checklinks.sh new file mode 100755 index 0000000..dd9262b --- /dev/null +++ b/checklinks.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +echo "Checking links in documentation..." + +# List of files in docs dir +docs=$(find . -path './docs/*.md') +# List of files in project root (README, etc) +extras=$(find . -maxdepth 1 -name '*.md') +# Combined list of files to check +files=("${docs[@]}" "${extras[@]}") + +let "fails=0" +let "count=0" + +for file in ${files[@]}; do + let "count++" + markdown-link-check -q "$file" + if [ $? -ne 0 ]; then + let "fails++" + fi +done + +echo -e "\n\033[0;33m$count files checked." + +if [ $fails -gt 0 ]; then + echo -e "\033[0;31mERROR: $fails files with dead links found!" + exit 1 +else + echo -e "\033[0;32mCongratulations! No dead links found." + exit 0 +fi diff --git a/checkspelling.sh b/checkspelling.sh new file mode 100755 index 0000000..acd504e --- /dev/null +++ b/checkspelling.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +echo "Building docs..." +mkdocs build --strict +if [ $? -ne 0 ]; then + exit 1 +fi +echo "Compiling Dictionary..." +aspell --lang=en create master ./tmp <.spell-dict +if [ $? -ne 0 ]; then + exit 1 +fi +echo "Checking spelling..." + +let "fails=0" + +for file in $(find site/ -type f -name "*.html"); do + words=$(aspell list --lang=en --mode=html --add-html-skip=code --extra-dicts=./tmp <$file) + if [ "$words" ]; then + uniquewords=$(tr ' ' '\n' <<< "${words[@]}" | sort -u | tr '\n' ' ') + let "fails++" + echo "Misspelled words in '$file':" + echo "-----------------------------------------------------------------" + for word in ${uniquewords[@]}; do + echo $word + done + echo "-----------------------------------------------------------------" + fi +done +rm -f ./tmp +rm -rf site + +if [ $fails -gt 0 ]; then + echo "$fails files with misspelled words." + exit 1 +else + exit 0 +fi diff --git a/doc-requirements.txt b/doc-requirements.txt new file mode 100644 index 0000000..45acbd4 --- /dev/null +++ b/doc-requirements.txt @@ -0,0 +1,2 @@ +mkdocs>=1.0 +mkdocs-nature diff --git a/docs/AUTHORS b/docs/AUTHORS deleted file mode 100644 index 2843b56..0000000 --- a/docs/AUTHORS +++ /dev/null @@ -1,44 +0,0 @@ -Primary Authors -=============== - -Yuri Takteyev , who has written much of the current code -while procrastingating his Ph.D. - -Waylan Limberg , who has written most of the available -extensions and later was asked to join Yuri, fixing nummrious bugs, adding -documentation and making general improvements to the existing codebase, -included a complete refactor of the core. - -Artem Yunusov, who as part of a 2008 GSoC project, has refactored inline -patterns, replaced the NanoDOM with ElementTree support and made various other -improvements. - -Manfed Stienstra , who wrote the original version of -the script and is responsible for various parts of the existing codebase. - -David Wolever, who refactored the extension API and made other improvements -as he helped to integrate Markdown into Dr.Project. - -Other Contributors -================== - -The incomplete list of individuals below have provided patches or otherwise -contributed to the project in various ways. We would like to thank everyone -who has contributed to the progect in any way. - -Eric Abrahamsen -Jeff Balogh -Sergej Chodarev -Chris Clark -Tiago Cogumbreiro -Kjell Magne Fauske -G. Clark Haynes -Daniel Krech -Steward Midwinter -Jack Miller -Neale Pickett -Paul Stansifer -John Szakmeister -Malcolm Tredinnick -Ben Wilson -and many others who helped by reporting bugs diff --git a/docs/CHANGE_LOG b/docs/CHANGE_LOG deleted file mode 100644 index e005ff8..0000000 --- a/docs/CHANGE_LOG +++ /dev/null @@ -1,180 +0,0 @@ -PYTHON MARKDOWN CHANGELOG -========================= - -Sept 28, 2009: Released version 2.0.2-Final. - -May 20, 2009: Released version 2.0.1-Final. - -Mar 30, 2009: Released version 2.0-Final. - -Mar 8, 2009: Release Candidate 2.0-rc-1. - -Feb 2009: Added support for multi-level lists to new Blockprocessors. - -Jan 2009: Added HTML 4 output as an option (thanks Eric Abrahamsen) - -Nov 2008: Added Definistion List ext. Replaced old core with BlockProcessors. -Broken up into multiple files. - -Oct 2008: Changed logging behavior to work better with other systems. -Refactored tree tarversing. Added treap implementation, then replaced with -OrderedDEict. Renamed various processors to better reflect what they actually -do. Refactored footnote ext to match php Extra's output. - -Sept 2008: Moved prettifyTree to a Postprocessor, replaced wikilink ext -with wikilinks (note the s) ext (uses bracketed links instead of CamelCase) -and various bug fixes. - -August 18 2008: Reorganized directory structure. Added a 'docs' dir -and moved all extensions into a 'markdown-extensions' package. -Added additional documentation and a few bug fixes. (v2.0-beta) - -August 4 2008: Updated included extensions to ElementTree. Added a -seperate commanline script. (v2.0-alpha) - -July 2008: Switched from home-grown NanoDOM to ElementTree and -various related bugs (thanks Artem Yunusov). - -June 2008: Fixed issues with nested inline patterns and cleaned -up testing framework (thanks Artem Yunusov). - -May 2008: Added a number of additional extensions to the -distribution and other minor changes. Moved repo to git from svn. - -Mar 2008: Refactored extension api to accept either an -extension name (as a string) or an instance of an extension -(Thanks David Wolever). Fixed various bugs and added doc strings. - -Feb 2008: Various bugfixes mostly regarding extensions. - -Feb 18, 2008: Version 1.7. - -Feb 13, 2008: A little code cleanup and better documentation -and inheritance for pre/post proccessors. - -Feb 9, 2008: Doublequotes no longer html escaped and rawhtml -honors , <@foo>, and <%foo> for those who run markdown on -template syntax. - -Dec 12, 2007: Updated docs. Removed encoding arg from Markdown -and markdown as per list discussion. Clean up in prep for 1.7. - -Nov 29, 2007: Added support for images inside links. Also fixed -a few bugs in the footnote extension. - -Nov 19, 2007: `message` now uses python's logging module. Also removed -limit imposed by recursion in _process_section(). You can now parse as -long of a document as your memory can handle. - -Nov 5, 2007: Moved safe_mode code to a textPostprocessor and added -escaping option. - -Nov 3, 2007: Fixed convert method to accept empty strings. - -Oct 30, 2007: Fixed BOM removal (thanks Malcolm Tredinnick). Fixed -infinite loop in bracket regex for inline links. - -Oct 11, 2007: LineBreaks is now an inlinePattern. Fixed HR in -blockquotes. Refactored _processSection method (see tracker #1793419). - -Oct 9, 2007: Added textPreprocessor (from 1.6b). - -Oct 8, 2008: Fixed Lazy Blockquote. Fixed code block on first line. -Fixed empty inline image link. - -Oct 7, 2007: Limit recursion on inlinePatterns. Added a 'safe' tag -to htmlStash. - -March 18, 2007: Fixed or merged a bunch of minor bugs, including -multi-line comments and markup inside links. (Tracker #s: 1683066, -1671153, 1661751, 1627935, 1544371, 1458139.) -> v. 1.6b - -Oct 10, 2006: Fixed a bug that caused some text to be lost after -comments. Added "safe mode" (user's html tags are removed). - -Sept 6, 2006: Added exception for PHP tags when handling html blocks. - -August 7, 2006: Incorporated Sergej Chodarev's patch to fix a problem -with ampersand normalization and html blocks. - -July 10, 2006: Switched to using optparse. Added proper support for -unicode. - -July 9, 2006: Fixed the " % _escape_cdata(text, encoding)) - elif tag is ProcessingInstruction: - write("" % _escape_cdata(text, encoding)) - else: - tag = qnames[tag] - if tag is None: - if text: - write(_escape_cdata(text, encoding)) - for e in elem: - _serialize_html(write, e, encoding, qnames, None) - else: - write("<" + tag) - items = elem.items() - if items or namespaces: - items.sort() # lexical order - for k, v in items: - if isinstance(k, QName): - k = k.text - if isinstance(v, QName): - v = qnames[v.text] - else: - v = _escape_attrib_html(v, encoding) - # FIXME: handle boolean attributes - write(" %s=\"%s\"" % (qnames[k], v)) - if namespaces: - items = namespaces.items() - items.sort(key=lambda x: x[1]) # sort on prefix - for v, k in items: - if k: - k = ":" + k - write(" xmlns%s=\"%s\"" % ( - k.encode(encoding), - _escape_attrib(v, encoding) - )) - write(">") - tag = tag.lower() - if text: - if tag == "script" or tag == "style": - write(_encode(text, encoding)) - else: - write(_escape_cdata(text, encoding)) - for e in elem: - _serialize_html(write, e, encoding, qnames, None) - if tag not in HTML_EMPTY: - write("") - if elem.tail: - write(_escape_cdata(elem.tail, encoding)) - -def write_html(root, f, - # keyword arguments - encoding="us-ascii", - default_namespace=None): - assert root is not None - if not hasattr(f, "write"): - f = open(f, "wb") - write = f.write - if not encoding: - encoding = "us-ascii" - qnames, namespaces = _namespaces( - root, encoding, default_namespace - ) - _serialize_html( - write, root, encoding, qnames, namespaces - ) - -# -------------------------------------------------------------------- -# serialization support - -def _namespaces(elem, encoding, default_namespace=None): - # identify namespaces used in this tree - - # maps qnames to *encoded* prefix:local names - qnames = {None: None} - - # maps uri:s to prefixes - namespaces = {} - if default_namespace: - namespaces[default_namespace] = "" - - def encode(text): - return text.encode(encoding) - - def add_qname(qname): - # calculate serialized qname representation - try: - if qname[:1] == "{": - uri, tag = qname[1:].split("}", 1) - prefix = namespaces.get(uri) - if prefix is None: - prefix = _namespace_map.get(uri) - if prefix is None: - prefix = "ns%d" % len(namespaces) - if prefix != "xml": - namespaces[uri] = prefix - if prefix: - qnames[qname] = encode("%s:%s" % (prefix, tag)) - else: - qnames[qname] = encode(tag) # default element - else: - if default_namespace: - # FIXME: can this be handled in XML 1.0? - raise ValueError( - "cannot use non-qualified names with " - "default_namespace option" - ) - qnames[qname] = encode(qname) - except TypeError: - _raise_serialization_error(qname) - - # populate qname and namespaces table - try: - iterate = elem.iter - except AttributeError: - iterate = elem.getiterator # cET compatibility - for elem in iterate(): - tag = elem.tag - if isinstance(tag, QName) and tag.text not in qnames: - add_qname(tag.text) - elif isinstance(tag, basestring): - if tag not in qnames: - add_qname(tag) - elif tag is not None and tag is not Comment and tag is not PI: - _raise_serialization_error(tag) - for key, value in elem.items(): - if isinstance(key, QName): - key = key.text - if key not in qnames: - add_qname(key) - if isinstance(value, QName) and value.text not in qnames: - add_qname(value.text) - text = elem.text - if isinstance(text, QName) and text.text not in qnames: - add_qname(text.text) - return qnames, namespaces - -def to_html_string(element, encoding=None): - class dummy: - pass - data = [] - file = dummy() - file.write = data.append - write_html(ElementTree(element).getroot(),file,encoding) - return "".join(data) diff --git a/markdown/htmlparser.py b/markdown/htmlparser.py new file mode 100644 index 0000000..3512d1a --- /dev/null +++ b/markdown/htmlparser.py @@ -0,0 +1,323 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2020 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + +import re +import importlib.util +import sys + + +# Import a copy of the html.parser lib as `htmlparser` so we can monkeypatch it. +# Users can still do `from html import parser` and get the default behavior. +spec = importlib.util.find_spec('html.parser') +htmlparser = importlib.util.module_from_spec(spec) +spec.loader.exec_module(htmlparser) +sys.modules['htmlparser'] = htmlparser + +# Monkeypatch HTMLParser to only accept `?>` to close Processing Instructions. +htmlparser.piclose = re.compile(r'\?>') +# Monkeypatch HTMLParser to only recognize entity references with a closing semicolon. +htmlparser.entityref = re.compile(r'&([a-zA-Z][-.a-zA-Z0-9]*);') +# Monkeypatch HTMLParser to no longer support partial entities. We are always feeding a complete block, +# so the 'incomplete' functionality is unnecessary. As the entityref regex is run right before incomplete, +# and the two regex are the same, then incomplete will simply never match and we avoid the logic within. +htmlparser.incomplete = htmlparser.entityref +# Monkeypatch HTMLParser to not accept a backtick in a tag name, attribute name, or bare value. +htmlparser.locatestarttagend_tolerant = re.compile(r""" + <[a-zA-Z][^`\t\n\r\f />\x00]* # tag name <= added backtick here + (?:[\s/]* # optional whitespace before attribute name + (?:(?<=['"\s/])[^`\s/>][^\s/=>]* # attribute name <= added backtick here + (?:\s*=+\s* # value indicator + (?:'[^']*' # LITA-enclosed value + |"[^"]*" # LIT-enclosed value + |(?!['"])[^`>\s]* # bare value <= added backtick here + ) + (?:\s*,)* # possibly followed by a comma + )?(?:\s|/(?!>))* + )* + )? + \s* # trailing whitespace +""", re.VERBOSE) + +# Match a blank line at the start of a block of text (two newlines). +# The newlines may be preceded by additional whitespace. +blank_line_re = re.compile(r'^([ ]*\n){2}') + + +class HTMLExtractor(htmlparser.HTMLParser): + """ + Extract raw HTML from text. + + The raw HTML is stored in the `htmlStash` of the Markdown instance passed + to `md` and the remaining text is stored in `cleandoc` as a list of strings. + """ + + def __init__(self, md, *args, **kwargs): + if 'convert_charrefs' not in kwargs: + kwargs['convert_charrefs'] = False + + # Block tags that should contain no content (self closing) + self.empty_tags = set(['hr']) + + # This calls self.reset + super().__init__(*args, **kwargs) + self.md = md + + def reset(self): + """Reset this instance. Loses all unprocessed data.""" + self.inraw = False + self.intail = False + self.stack = [] # When inraw==True, stack contains a list of tags + self._cache = [] + self.cleandoc = [] + super().reset() + + def close(self): + """Handle any buffered data.""" + super().close() + if len(self.rawdata): + # Temp fix for https://bugs.python.org/issue41989 + # TODO: remove this when the bug is fixed in all supported Python versions. + if self.convert_charrefs and not self.cdata_elem: # pragma: no cover + self.handle_data(htmlparser.unescape(self.rawdata)) + else: + self.handle_data(self.rawdata) + # Handle any unclosed tags. + if len(self._cache): + self.cleandoc.append(self.md.htmlStash.store(''.join(self._cache))) + self._cache = [] + + @property + def line_offset(self): + """Returns char index in self.rawdata for the start of the current line. """ + if self.lineno > 1 and '\n' in self.rawdata: + m = re.match(r'([^\n]*\n){{{}}}'.format(self.lineno-1), self.rawdata) + if m: + return m.end() + else: # pragma: no cover + # Value of self.lineno must exceed total number of lines. + # Find index of beginning of last line. + return self.rawdata.rfind('\n') + return 0 + + def at_line_start(self): + """ + Returns True if current position is at start of line. + + Allows for up to three blank spaces at start of line. + """ + if self.offset == 0: + return True + if self.offset > 3: + return False + # Confirm up to first 3 chars are whitespace + return self.rawdata[self.line_offset:self.line_offset + self.offset].strip() == '' + + def get_endtag_text(self, tag): + """ + Returns the text of the end tag. + + If it fails to extract the actual text from the raw data, it builds a closing tag with `tag`. + """ + # Attempt to extract actual tag from raw source text + start = self.line_offset + self.offset + m = htmlparser.endendtag.search(self.rawdata, start) + if m: + return self.rawdata[start:m.end()] + else: # pragma: no cover + # Failed to extract from raw data. Assume well formed and lowercase. + return ''.format(tag) + + def handle_starttag(self, tag, attrs): + # Handle tags that should always be empty and do not specify a closing tag + if tag in self.empty_tags: + self.handle_startendtag(tag, attrs) + return + + if self.md.is_block_level(tag) and (self.intail or (self.at_line_start() and not self.inraw)): + # Started a new raw block. Prepare stack. + self.inraw = True + self.cleandoc.append('\n') + + text = self.get_starttag_text() + if self.inraw: + self.stack.append(tag) + self._cache.append(text) + else: + self.cleandoc.append(text) + if tag in self.CDATA_CONTENT_ELEMENTS: + # This is presumably a standalone tag in a code span (see #1036). + self.clear_cdata_mode() + + def handle_endtag(self, tag): + text = self.get_endtag_text(tag) + + if self.inraw: + self._cache.append(text) + if tag in self.stack: + # Remove tag from stack + while self.stack: + if self.stack.pop() == tag: + break + if len(self.stack) == 0: + # End of raw block. + if blank_line_re.match(self.rawdata[self.line_offset + self.offset + len(text):]): + # Preserve blank line and end of raw block. + self._cache.append('\n') + else: + # More content exists after endtag. + self.intail = True + # Reset stack. + self.inraw = False + self.cleandoc.append(self.md.htmlStash.store(''.join(self._cache))) + # Insert blank line between this and next line. + self.cleandoc.append('\n\n') + self._cache = [] + else: + self.cleandoc.append(text) + + def handle_data(self, data): + if self.intail and '\n' in data: + self.intail = False + if self.inraw: + self._cache.append(data) + else: + self.cleandoc.append(data) + + def handle_empty_tag(self, data, is_block): + """ Handle empty tags (``). """ + if self.inraw or self.intail: + # Append this to the existing raw block + self._cache.append(data) + elif self.at_line_start() and is_block: + # Handle this as a standalone raw block + if blank_line_re.match(self.rawdata[self.line_offset + self.offset + len(data):]): + # Preserve blank line after tag in raw block. + data += '\n' + else: + # More content exists after tag. + self.intail = True + item = self.cleandoc[-1] if self.cleandoc else '' + # If we only have one newline before block element, add another + if not item.endswith('\n\n') and item.endswith('\n'): + self.cleandoc.append('\n') + self.cleandoc.append(self.md.htmlStash.store(data)) + # Insert blank line between this and next line. + self.cleandoc.append('\n\n') + else: + self.cleandoc.append(data) + + def handle_startendtag(self, tag, attrs): + self.handle_empty_tag(self.get_starttag_text(), is_block=self.md.is_block_level(tag)) + + def handle_charref(self, name): + self.handle_empty_tag('&#{};'.format(name), is_block=False) + + def handle_entityref(self, name): + self.handle_empty_tag('&{};'.format(name), is_block=False) + + def handle_comment(self, data): + self.handle_empty_tag(''.format(data), is_block=True) + + def handle_decl(self, data): + self.handle_empty_tag(''.format(data), is_block=True) + + def handle_pi(self, data): + self.handle_empty_tag(''.format(data), is_block=True) + + def unknown_decl(self, data): + end = ']]>' if data.startswith('CDATA[') else ']>' + self.handle_empty_tag(''.""" + return self.__starttag_text + + def parse_starttag(self, i): # pragma: no cover + self.__starttag_text = None + endpos = self.check_for_whole_start_tag(i) + if endpos < 0: + return endpos + rawdata = self.rawdata + self.__starttag_text = rawdata[i:endpos] + + # Now parse the data between i+1 and j into a tag and attrs + attrs = [] + match = htmlparser.tagfind_tolerant.match(rawdata, i+1) + assert match, 'unexpected call to parse_starttag()' + k = match.end() + self.lasttag = tag = match.group(1).lower() + while k < endpos: + m = htmlparser.attrfind_tolerant.match(rawdata, k) + if not m: + break + attrname, rest, attrvalue = m.group(1, 2, 3) + if not rest: + attrvalue = None + elif attrvalue[:1] == '\'' == attrvalue[-1:] or \ + attrvalue[:1] == '"' == attrvalue[-1:]: # noqa: E127 + attrvalue = attrvalue[1:-1] + if attrvalue: + attrvalue = htmlparser.unescape(attrvalue) + attrs.append((attrname.lower(), attrvalue)) + k = m.end() + + end = rawdata[k:endpos].strip() + if end not in (">", "/>"): + lineno, offset = self.getpos() + if "\n" in self.__starttag_text: + lineno = lineno + self.__starttag_text.count("\n") + offset = len(self.__starttag_text) \ + - self.__starttag_text.rfind("\n") # noqa: E127 + else: + offset = offset + len(self.__starttag_text) + self.handle_data(rawdata[i:endpos]) + return endpos + if end.endswith('/>'): + # XHTML-style empty tag: + self.handle_startendtag(tag, attrs) + else: + # *** set cdata_mode first so we can override it in handle_starttag (see #1036) *** + if tag in self.CDATA_CONTENT_ELEMENTS: + self.set_cdata_mode(tag) + self.handle_starttag(tag, attrs) + return endpos diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py index 917a9d3..eb313bd 100644 --- a/markdown/inlinepatterns.py +++ b/markdown/inlinepatterns.py @@ -1,4 +1,23 @@ """ +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). + INLINE PATTERNS ============================================================================= @@ -41,71 +60,129 @@ So, we apply the expressions in the following order: * finally we apply strong and emphasis """ -import markdown +from . import util +from collections import namedtuple import re -from urlparse import urlparse, urlunparse -import sys -if sys.version >= "3.0": - from html import entities as htmlentitydefs -else: - import htmlentitydefs +import xml.etree.ElementTree as etree +try: # pragma: no cover + from html import entities +except ImportError: # pragma: no cover + import htmlentitydefs as entities + + +def build_inlinepatterns(md, **kwargs): + """ Build the default set of inline patterns for Markdown. """ + inlinePatterns = util.Registry() + inlinePatterns.register(BacktickInlineProcessor(BACKTICK_RE), 'backtick', 190) + inlinePatterns.register(EscapeInlineProcessor(ESCAPE_RE, md), 'escape', 180) + inlinePatterns.register(ReferenceInlineProcessor(REFERENCE_RE, md), 'reference', 170) + inlinePatterns.register(LinkInlineProcessor(LINK_RE, md), 'link', 160) + inlinePatterns.register(ImageInlineProcessor(IMAGE_LINK_RE, md), 'image_link', 150) + inlinePatterns.register( + ImageReferenceInlineProcessor(IMAGE_REFERENCE_RE, md), 'image_reference', 140 + ) + inlinePatterns.register( + ShortReferenceInlineProcessor(REFERENCE_RE, md), 'short_reference', 130 + ) + inlinePatterns.register( + ShortImageReferenceInlineProcessor(IMAGE_REFERENCE_RE, md), 'short_image_ref', 125 + ) + inlinePatterns.register(AutolinkInlineProcessor(AUTOLINK_RE, md), 'autolink', 120) + inlinePatterns.register(AutomailInlineProcessor(AUTOMAIL_RE, md), 'automail', 110) + inlinePatterns.register(SubstituteTagInlineProcessor(LINE_BREAK_RE, 'br'), 'linebreak', 100) + inlinePatterns.register(HtmlInlineProcessor(HTML_RE, md), 'html', 90) + inlinePatterns.register(HtmlInlineProcessor(ENTITY_RE, md), 'entity', 80) + inlinePatterns.register(SimpleTextInlineProcessor(NOT_STRONG_RE), 'not_strong', 70) + inlinePatterns.register(AsteriskProcessor(r'\*'), 'em_strong', 60) + inlinePatterns.register(UnderscoreProcessor(r'_'), 'em_strong2', 50) + return inlinePatterns + """ The actual regular expressions for patterns ----------------------------------------------------------------------------- """ -NOBRACKET = r'[^\]\[]*' -BRK = ( r'\[(' - + (NOBRACKET + r'(\[')*6 - + (NOBRACKET+ r'\])*')*6 - + NOBRACKET + r')\]' ) NOIMG = r'(?|((?:(?:\(.*?\))|[^\(\)]))*?)\s*((['"])(.*?)\12)?\)''' -# [text](url) or [text]() +# __strong _em__ +SMART_STRONG_EM_RE = r'(?) or [text](url "title") +LINK_RE = NOIMG + r'\[' -IMAGE_LINK_RE = r'\!' + BRK + r'\s*\((<.*?>|([^\)]*))\)' # ![alttxt](http://x.com/) or ![alttxt]() -REFERENCE_RE = NOIMG + BRK+ r'\s*\[([^\]]*)\]' # [Google][3] -IMAGE_REFERENCE_RE = r'\!' + BRK + '\s*\[([^\]]*)\]' # ![alt text][2] -NOT_STRONG_RE = r'((^| )(\*|_)( |$))' # stand-alone * or _ -AUTOLINK_RE = r'<((?:f|ht)tps?://[^>]*)>' # -AUTOMAIL_RE = r'<([^> \!]*@[^> ]*)>' # +IMAGE_LINK_RE = r'\!\[' + +# [Google][3] +REFERENCE_RE = LINK_RE + +# ![alt text][2] +IMAGE_REFERENCE_RE = IMAGE_LINK_RE + +# stand-alone * or _ +NOT_STRONG_RE = r'((^|\s)(\*|_)(\s|$))' + +# +AUTOLINK_RE = r'<((?:[Ff]|[Hh][Tt])[Tt][Pp][Ss]?://[^<>]*)>' -HTML_RE = r'(\<([a-zA-Z/][^\>]*?|\!--.*?--)\>)' # <...> -ENTITY_RE = r'(&[\#a-zA-Z0-9]*;)' # & -LINE_BREAK_RE = r' \n' # two spaces at end of line -LINE_BREAK_2_RE = r' $' # two spaces at end of text +# +AUTOMAIL_RE = r'<([^<> !]+@[^@<> ]+)>' + +# <...> +HTML_RE = r'(<(\/?[a-zA-Z][^<>@ ]*( [^<>]*)?|!--(?:(?!).)*--)>)' + +# "&" (decimal) or "&" (hex) or "&" (named) +ENTITY_RE = r'(&(?:\#[0-9]+|\#x[0-9a-fA-F]+|[a-zA-Z0-9]+);)' + +# two spaces at end of line +LINE_BREAK_RE = r' \n' def dequote(string): """Remove quotes from around a string.""" - if ( ( string.startswith('"') and string.endswith('"')) - or (string.startswith("'") and string.endswith("'")) ): + if ((string.startswith('"') and string.endswith('"')) or + (string.startswith("'") and string.endswith("'"))): return string[1:-1] else: return string -ATTR_RE = re.compile("\{@([^\}]*)=([^\}]*)}") # {@id=123} -def handleAttributes(text, parent): - """Set values of an element based on attribute definitions ({@id=123}).""" - def attributeCallback(match): - parent.set(match.group(1), match.group(2).replace('\n', ' ')) - return ATTR_RE.sub(attributeCallback, text) +class EmStrongItem(namedtuple('EmStrongItem', ['pattern', 'builder', 'tags'])): + """Emphasis/strong pattern item.""" """ @@ -113,10 +190,13 @@ The pattern classes ----------------------------------------------------------------------------- """ -class Pattern: + +class Pattern: # pragma: no cover """Base class that inline patterns subclass. """ - def __init__ (self, pattern, markdown_instance=None): + ANCESTOR_EXCLUDES = tuple() + + def __init__(self, pattern, md=None): """ Create an instant of an inline pattern. @@ -126,14 +206,12 @@ class Pattern: """ self.pattern = pattern - self.compiled_re = re.compile("^(.*?)%s(.*?)$" % pattern, re.DOTALL) + self.compiled_re = re.compile(r"^(.*?)%s(.*)$" % pattern, + re.DOTALL | re.UNICODE) - # Api for Markdown to pass safe_mode into instance - self.safe_mode = False - if markdown_instance: - self.markdown = markdown_instance + self.md = md - def getCompiledRegExp (self): + def getCompiledRegExp(self): """ Return a compiled regular expression. """ return self.compiled_re @@ -147,57 +225,163 @@ class Pattern: * m: A re match object containing a match of the pattern. """ - pass + pass # pragma: no cover def type(self): """ Return class name, to define pattern type """ return self.__class__.__name__ -BasePattern = Pattern # for backward compatibility + def unescape(self, text): + """ Return unescaped text given text with an inline placeholder. """ + try: + stash = self.md.treeprocessors['inline'].stashed_nodes + except KeyError: # pragma: no cover + return text + + def get_stash(m): + id = m.group(1) + if id in stash: + value = stash.get(id) + if isinstance(value, str): + return value + else: + # An etree Element - return text content only + return ''.join(value.itertext()) + return util.INLINE_PLACEHOLDER_RE.sub(get_stash, text) + + +class InlineProcessor(Pattern): + """ + Base class that inline patterns subclass. + + This is the newer style inline processor that uses a more + efficient and flexible search approach. + """ + + def __init__(self, pattern, md=None): + """ + Create an instant of an inline pattern. + + Keyword arguments: + + * pattern: A regular expression that matches a pattern + + """ + self.pattern = pattern + self.compiled_re = re.compile(pattern, re.DOTALL | re.UNICODE) + + # Api for Markdown to pass safe_mode into instance + self.safe_mode = False + self.md = md + + def handleMatch(self, m, data): + """Return a ElementTree element from the given match and the + start and end index of the matched text. + + If `start` and/or `end` are returned as `None`, it will be + assumed that the processor did not find a valid region of text. + + Subclasses should override this method. + + Keyword arguments: + + * m: A re match object containing a match of the pattern. + * data: The buffer current under analysis -class SimpleTextPattern (Pattern): + Returns: + + * el: The ElementTree element, text or None. + * start: The start of the region that has been matched or None. + * end: The end of the region that has been matched or None. + + """ + pass # pragma: no cover + + +class SimpleTextPattern(Pattern): # pragma: no cover """ Return a simple text of group(2) of a Pattern. """ def handleMatch(self, m): - text = m.group(2) - if text == markdown.INLINE_PLACEHOLDER_PREFIX: - return None - return text + return m.group(2) + + +class SimpleTextInlineProcessor(InlineProcessor): + """ Return a simple text of group(1) of a Pattern. """ + def handleMatch(self, m, data): + return m.group(1), m.start(0), m.end(0) + + +class EscapeInlineProcessor(InlineProcessor): + """ Return an escaped character. """ -class SimpleTagPattern (Pattern): + def handleMatch(self, m, data): + char = m.group(1) + if char in self.md.ESCAPED_CHARS: + return '{}{}{}'.format(util.STX, ord(char), util.ETX), m.start(0), m.end(0) + else: + return None, m.start(0), m.end(0) + + +class SimpleTagPattern(Pattern): # pragma: no cover """ Return element of type `tag` with a text attribute of group(3) of a Pattern. """ - def __init__ (self, pattern, tag): + def __init__(self, pattern, tag): Pattern.__init__(self, pattern) self.tag = tag def handleMatch(self, m): - el = markdown.etree.Element(self.tag) + el = etree.Element(self.tag) el.text = m.group(3) return el -class SubstituteTagPattern (SimpleTagPattern): - """ Return a eLement of type `tag` with no children. """ - def handleMatch (self, m): - return markdown.etree.Element(self.tag) +class SimpleTagInlineProcessor(InlineProcessor): + """ + Return element of type `tag` with a text attribute of group(2) + of a Pattern. + """ + def __init__(self, pattern, tag): + InlineProcessor.__init__(self, pattern) + self.tag = tag -class BacktickPattern (Pattern): - """ Return a `` element containing the matching text. """ - def __init__ (self, pattern): - Pattern.__init__(self, pattern) - self.tag = "code" + def handleMatch(self, m, data): # pragma: no cover + el = etree.Element(self.tag) + el.text = m.group(2) + return el, m.start(0), m.end(0) + +class SubstituteTagPattern(SimpleTagPattern): # pragma: no cover + """ Return an element of type `tag` with no children. """ def handleMatch(self, m): - el = markdown.etree.Element(self.tag) - el.text = markdown.AtomicString(m.group(3).strip()) - return el + return etree.Element(self.tag) + + +class SubstituteTagInlineProcessor(SimpleTagInlineProcessor): + """ Return an element of type `tag` with no children. """ + def handleMatch(self, m, data): + return etree.Element(self.tag), m.start(0), m.end(0) + + +class BacktickInlineProcessor(InlineProcessor): + """ Return a `` element containing the matching text. """ + def __init__(self, pattern): + InlineProcessor.__init__(self, pattern) + self.ESCAPED_BSLASH = '{}{}{}'.format(util.STX, ord('\\'), util.ETX) + self.tag = 'code' + + def handleMatch(self, m, data): + if m.group(3): + el = etree.Element(self.tag) + el.text = util.AtomicString(util.code_escape(m.group(3).strip())) + return el, m.start(0), m.end(0) + else: + return m.group(1).replace('\\\\', self.ESCAPED_BSLASH), m.start(0), m.end(0) -class DoubleTagPattern (SimpleTagPattern): +class DoubleTagPattern(SimpleTagPattern): # pragma: no cover """Return a ElementTree element nested in tag2 nested in tag1. Useful for strong emphasis etc. @@ -205,117 +389,432 @@ class DoubleTagPattern (SimpleTagPattern): """ def handleMatch(self, m): tag1, tag2 = self.tag.split(",") - el1 = markdown.etree.Element(tag1) - el2 = markdown.etree.SubElement(el1, tag2) + el1 = etree.Element(tag1) + el2 = etree.SubElement(el1, tag2) el2.text = m.group(3) + if len(m.groups()) == 5: + el2.tail = m.group(4) return el1 -class HtmlPattern (Pattern): +class DoubleTagInlineProcessor(SimpleTagInlineProcessor): + """Return a ElementTree element nested in tag2 nested in tag1. + + Useful for strong emphasis etc. + + """ + def handleMatch(self, m, data): # pragma: no cover + tag1, tag2 = self.tag.split(",") + el1 = etree.Element(tag1) + el2 = etree.SubElement(el1, tag2) + el2.text = m.group(2) + if len(m.groups()) == 3: + el2.tail = m.group(3) + return el1, m.start(0), m.end(0) + + +class HtmlInlineProcessor(InlineProcessor): """ Store raw inline html and return a placeholder. """ - def handleMatch (self, m): - rawhtml = m.group(2) - inline = True - place_holder = self.markdown.htmlStash.store(rawhtml) - return place_holder + def handleMatch(self, m, data): + rawhtml = self.unescape(m.group(1)) + place_holder = self.md.htmlStash.store(rawhtml) + return place_holder, m.start(0), m.end(0) + + def unescape(self, text): + """ Return unescaped text given text with an inline placeholder. """ + try: + stash = self.md.treeprocessors['inline'].stashed_nodes + except KeyError: # pragma: no cover + return text + + def get_stash(m): + id = m.group(1) + value = stash.get(id) + if value is not None: + try: + return self.md.serializer(value) + except Exception: + return r'\%s' % value + + return util.INLINE_PLACEHOLDER_RE.sub(get_stash, text) + + +class AsteriskProcessor(InlineProcessor): + """Emphasis processor for handling strong and em matches inside asterisks.""" + + PATTERNS = [ + EmStrongItem(re.compile(EM_STRONG_RE, re.DOTALL | re.UNICODE), 'double', 'strong,em'), + EmStrongItem(re.compile(STRONG_EM_RE, re.DOTALL | re.UNICODE), 'double', 'em,strong'), + EmStrongItem(re.compile(STRONG_EM3_RE, re.DOTALL | re.UNICODE), 'double2', 'strong,em'), + EmStrongItem(re.compile(STRONG_RE, re.DOTALL | re.UNICODE), 'single', 'strong'), + EmStrongItem(re.compile(EMPHASIS_RE, re.DOTALL | re.UNICODE), 'single', 'em') + ] + + def build_single(self, m, tag, idx): + """Return single tag.""" + el1 = etree.Element(tag) + text = m.group(2) + self.parse_sub_patterns(text, el1, None, idx) + return el1 + def build_double(self, m, tags, idx): + """Return double tag.""" -class LinkPattern (Pattern): - """ Return a link element from the given match. """ - def handleMatch(self, m): - el = markdown.etree.Element("a") - el.text = m.group(2) - title = m.group(11) - href = m.group(9) + tag1, tag2 = tags.split(",") + el1 = etree.Element(tag1) + el2 = etree.Element(tag2) + text = m.group(2) + self.parse_sub_patterns(text, el2, None, idx) + el1.append(el2) + if len(m.groups()) == 3: + text = m.group(3) + self.parse_sub_patterns(text, el1, el2, idx) + return el1 - if href: - if href[0] == "<": - href = href[1:-1] - el.set("href", self.sanitize_url(href.strip())) - else: - el.set("href", "") + def build_double2(self, m, tags, idx): + """Return double tags (variant 2): `text text`.""" - if title: - title = dequote(title) #.replace('"', """) - el.set("title", title) - return el + tag1, tag2 = tags.split(",") + el1 = etree.Element(tag1) + el2 = etree.Element(tag2) + text = m.group(2) + self.parse_sub_patterns(text, el1, None, idx) + text = m.group(3) + el1.append(el2) + self.parse_sub_patterns(text, el2, None, idx) + return el1 - def sanitize_url(self, url): + def parse_sub_patterns(self, data, parent, last, idx): """ - Sanitize a url against xss attacks in "safe_mode". - - Rather than specifically blacklisting `javascript:alert("XSS")` and all - its aliases (see ), we whitelist known - safe url formats. Most urls contain a network location, however some - are known not to (i.e.: mailto links). Script urls do not contain a - location. Additionally, for `javascript:...`, the scheme would be - "javascript" but some aliases will appear to `urlparse()` to have no - scheme. On top of that relative links (i.e.: "foo/bar.html") have no - scheme. Therefore we must check "path", "parameters", "query" and - "fragment" for any literal colons. We don't check "scheme" for colons - because it *should* never have any and "netloc" must allow the form: - `username:password@host:port`. + Parses sub patterns. + + `data` (`str`): + text to evaluate. + + `parent` (`etree.Element`): + Parent to attach text and sub elements to. + + `last` (`etree.Element`): + Last appended child to parent. Can also be None if parent has no children. + + `idx` (`int`): + Current pattern index that was used to evaluate the parent. """ - locless_schemes = ['', 'mailto', 'news'] - scheme, netloc, path, params, query, fragment = url = urlparse(url) - safe_url = False - if netloc != '' or scheme in locless_schemes: - safe_url = True - - for part in url[2:]: - if ":" in part: - safe_url = False - - if self.markdown.safeMode and not safe_url: - return '' + + offset = 0 + pos = 0 + + length = len(data) + while pos < length: + # Find the start of potential emphasis or strong tokens + if self.compiled_re.match(data, pos): + matched = False + # See if the we can match an emphasis/strong pattern + for index, item in enumerate(self.PATTERNS): + # Only evaluate patterns that are after what was used on the parent + if index <= idx: + continue + m = item.pattern.match(data, pos) + if m: + # Append child nodes to parent + # Text nodes should be appended to the last + # child if present, and if not, it should + # be added as the parent's text node. + text = data[offset:m.start(0)] + if text: + if last is not None: + last.tail = text + else: + parent.text = text + el = self.build_element(m, item.builder, item.tags, index) + parent.append(el) + last = el + # Move our position past the matched hunk + offset = pos = m.end(0) + matched = True + if not matched: + # We matched nothing, move on to the next character + pos += 1 + else: + # Increment position as no potential emphasis start was found. + pos += 1 + + # Append any leftover text as a text node. + text = data[offset:] + if text: + if last is not None: + last.tail = text + else: + parent.text = text + + def build_element(self, m, builder, tags, index): + """Element builder.""" + + if builder == 'double2': + return self.build_double2(m, tags, index) + elif builder == 'double': + return self.build_double(m, tags, index) else: - return urlunparse(url) + return self.build_single(m, tags, index) + + def handleMatch(self, m, data): + """Parse patterns.""" + + el = None + start = None + end = None + + for index, item in enumerate(self.PATTERNS): + m1 = item.pattern.match(data, m.start(0)) + if m1: + start = m1.start(0) + end = m1.end(0) + el = self.build_element(m1, item.builder, item.tags, index) + break + return el, start, end -class ImagePattern(LinkPattern): + +class UnderscoreProcessor(AsteriskProcessor): + """Emphasis processor for handling strong and em matches inside underscores.""" + + PATTERNS = [ + EmStrongItem(re.compile(EM_STRONG2_RE, re.DOTALL | re.UNICODE), 'double', 'strong,em'), + EmStrongItem(re.compile(STRONG_EM2_RE, re.DOTALL | re.UNICODE), 'double', 'em,strong'), + EmStrongItem(re.compile(SMART_STRONG_EM_RE, re.DOTALL | re.UNICODE), 'double2', 'strong,em'), + EmStrongItem(re.compile(SMART_STRONG_RE, re.DOTALL | re.UNICODE), 'single', 'strong'), + EmStrongItem(re.compile(SMART_EMPHASIS_RE, re.DOTALL | re.UNICODE), 'single', 'em') + ] + + +class LinkInlineProcessor(InlineProcessor): + """ Return a link element from the given match. """ + RE_LINK = re.compile(r'''\(\s*(?:(<[^<>]*>)\s*(?:('[^']*'|"[^"]*")\s*)?\))?''', re.DOTALL | re.UNICODE) + RE_TITLE_CLEAN = re.compile(r'\s') + + def handleMatch(self, m, data): + text, index, handled = self.getText(data, m.end(0)) + + if not handled: + return None, None, None + + href, title, index, handled = self.getLink(data, index) + if not handled: + return None, None, None + + el = etree.Element("a") + el.text = text + + el.set("href", href) + + if title is not None: + el.set("title", title) + + return el, m.start(0), index + + def getLink(self, data, index): + """Parse data between `()` of `[Text]()` allowing recursive `()`. """ + + href = '' + title = None + handled = False + + m = self.RE_LINK.match(data, pos=index) + if m and m.group(1): + # Matches [Text]( "title") + href = m.group(1)[1:-1].strip() + if m.group(2): + title = m.group(2)[1:-1] + index = m.end(0) + handled = True + elif m: + # Track bracket nesting and index in string + bracket_count = 1 + backtrack_count = 1 + start_index = m.end() + index = start_index + last_bracket = -1 + + # Primary (first found) quote tracking. + quote = None + start_quote = -1 + exit_quote = -1 + ignore_matches = False + + # Secondary (second found) quote tracking. + alt_quote = None + start_alt_quote = -1 + exit_alt_quote = -1 + + # Track last character + last = '' + + for pos in range(index, len(data)): + c = data[pos] + if c == '(': + # Count nested ( + # Don't increment the bracket count if we are sure we're in a title. + if not ignore_matches: + bracket_count += 1 + elif backtrack_count > 0: + backtrack_count -= 1 + elif c == ')': + # Match nested ) to ( + # Don't decrement if we are sure we are in a title that is unclosed. + if ((exit_quote != -1 and quote == last) or (exit_alt_quote != -1 and alt_quote == last)): + bracket_count = 0 + elif not ignore_matches: + bracket_count -= 1 + elif backtrack_count > 0: + backtrack_count -= 1 + # We've found our backup end location if the title doesn't resolve. + if backtrack_count == 0: + last_bracket = index + 1 + + elif c in ("'", '"'): + # Quote has started + if not quote: + # We'll assume we are now in a title. + # Brackets are quoted, so no need to match them (except for the final one). + ignore_matches = True + backtrack_count = bracket_count + bracket_count = 1 + start_quote = index + 1 + quote = c + # Secondary quote (in case the first doesn't resolve): [text](link'"title") + elif c != quote and not alt_quote: + start_alt_quote = index + 1 + alt_quote = c + # Update primary quote match + elif c == quote: + exit_quote = index + 1 + # Update secondary quote match + elif alt_quote and c == alt_quote: + exit_alt_quote = index + 1 + + index += 1 + + # Link is closed, so let's break out of the loop + if bracket_count == 0: + # Get the title if we closed a title string right before link closed + if exit_quote >= 0 and quote == last: + href = data[start_index:start_quote - 1] + title = ''.join(data[start_quote:exit_quote - 1]) + elif exit_alt_quote >= 0 and alt_quote == last: + href = data[start_index:start_alt_quote - 1] + title = ''.join(data[start_alt_quote:exit_alt_quote - 1]) + else: + href = data[start_index:index - 1] + break + + if c != ' ': + last = c + + # We have a scenario: [test](link"notitle) + # When we enter a string, we stop tracking bracket resolution in the main counter, + # but we do keep a backup counter up until we discover where we might resolve all brackets + # if the title string fails to resolve. + if bracket_count != 0 and backtrack_count == 0: + href = data[start_index:last_bracket - 1] + index = last_bracket + bracket_count = 0 + + handled = bracket_count == 0 + + if title is not None: + title = self.RE_TITLE_CLEAN.sub(' ', dequote(self.unescape(title.strip()))) + + href = self.unescape(href).strip() + + return href, title, index, handled + + def getText(self, data, index): + """Parse the content between `[]` of the start of an image or link + resolving nested square brackets. + + """ + bracket_count = 1 + text = [] + for pos in range(index, len(data)): + c = data[pos] + if c == ']': + bracket_count -= 1 + elif c == '[': + bracket_count += 1 + index += 1 + if bracket_count == 0: + break + text.append(c) + return ''.join(text), index, bracket_count == 0 + + +class ImageInlineProcessor(LinkInlineProcessor): """ Return a img element from the given match. """ - def handleMatch(self, m): - el = markdown.etree.Element("img") - src_parts = m.group(9).split() - if src_parts: - src = src_parts[0] - if src[0] == "<" and src[-1] == ">": - src = src[1:-1] - el.set('src', self.sanitize_url(src)) - else: - el.set('src', "") - if len(src_parts) > 1: - el.set('title', dequote(" ".join(src_parts[1:]))) - if markdown.ENABLE_ATTRIBUTES: - truealt = handleAttributes(m.group(2), el) - else: - truealt = m.group(2) + def handleMatch(self, m, data): + text, index, handled = self.getText(data, m.end(0)) + if not handled: + return None, None, None - el.set('alt', truealt) - return el + src, title, index, handled = self.getLink(data, index) + if not handled: + return None, None, None -class ReferencePattern(LinkPattern): + el = etree.Element("img") + + el.set("src", src) + + if title is not None: + el.set("title", title) + + el.set('alt', self.unescape(text)) + return el, m.start(0), index + + +class ReferenceInlineProcessor(LinkInlineProcessor): """ Match to a stored reference and return link element. """ - def handleMatch(self, m): - if m.group(9): - id = m.group(9).lower() - else: - # if we got something like "[Google][]" - # we'll use "google" as the id - id = m.group(2).lower() + NEWLINE_CLEANUP_RE = re.compile(r'\s+', re.MULTILINE) - if not id in self.markdown.references: # ignore undefined refs - return None - href, title = self.markdown.references[id] + RE_LINK = re.compile(r'\s?\[([^\]]*)\]', re.DOTALL | re.UNICODE) - text = m.group(2) - return self.makeTag(href, title, text) + def handleMatch(self, m, data): + text, index, handled = self.getText(data, m.end(0)) + if not handled: + return None, None, None + + id, end, handled = self.evalId(data, index, text) + if not handled: + return None, None, None + + # Clean up linebreaks in id + id = self.NEWLINE_CLEANUP_RE.sub(' ', id) + if id not in self.md.references: # ignore undefined refs + return None, m.start(0), end + + href, title = self.md.references[id] + + return self.makeTag(href, title, text), m.start(0), end + + def evalId(self, data, index, text): + """ + Evaluate the id portion of [ref][id]. + + If [ref][] use [ref]. + """ + m = self.RE_LINK.match(data, pos=index) + if not m: + return None, index, False + else: + id = m.group(1).lower() + end = m.end(0) + if not id: + id = text.lower() + return id, end, True def makeTag(self, href, title, text): - el = markdown.etree.Element('a') + el = etree.Element('a') - el.set('href', self.sanitize_url(href)) + el.set('href', href) if title: el.set('title', title) @@ -323,49 +822,65 @@ class ReferencePattern(LinkPattern): return el -class ImageReferencePattern (ReferencePattern): +class ShortReferenceInlineProcessor(ReferenceInlineProcessor): + """Short form of reference: [google]. """ + def evalId(self, data, index, text): + """Evaluate the id from of [ref] """ + + return text.lower(), index, True + + +class ImageReferenceInlineProcessor(ReferenceInlineProcessor): """ Match to a stored reference and return img element. """ def makeTag(self, href, title, text): - el = markdown.etree.Element("img") - el.set("src", self.sanitize_url(href)) + el = etree.Element("img") + el.set("src", href) if title: el.set("title", title) - el.set("alt", text) + el.set("alt", self.unescape(text)) return el -class AutolinkPattern (Pattern): +class ShortImageReferenceInlineProcessor(ImageReferenceInlineProcessor): + """ Short form of inage reference: ![ref]. """ + def evalId(self, data, index, text): + """Evaluate the id from of [ref] """ + + return text.lower(), index, True + + +class AutolinkInlineProcessor(InlineProcessor): """ Return a link Element given an autolink (``). """ - def handleMatch(self, m): - el = markdown.etree.Element("a") - el.set('href', m.group(2)) - el.text = markdown.AtomicString(m.group(2)) - return el + def handleMatch(self, m, data): + el = etree.Element("a") + el.set('href', self.unescape(m.group(1))) + el.text = util.AtomicString(m.group(1)) + return el, m.start(0), m.end(0) + -class AutomailPattern (Pattern): +class AutomailInlineProcessor(InlineProcessor): """ Return a mailto link Element given an automail link (``). """ - def handleMatch(self, m): - el = markdown.etree.Element('a') - email = m.group(2) + def handleMatch(self, m, data): + el = etree.Element('a') + email = self.unescape(m.group(1)) if email.startswith("mailto:"): email = email[len("mailto:"):] def codepoint2name(code): """Return entity definition by code, or the code if not defined.""" - entity = htmlentitydefs.codepoint2name.get(code) + entity = entities.codepoint2name.get(code) if entity: - return "%s%s;" % (markdown.AMP_SUBSTITUTE, entity) + return "{}{};".format(util.AMP_SUBSTITUTE, entity) else: - return "%s#%d;" % (markdown.AMP_SUBSTITUTE, code) + return "%s#%d;" % (util.AMP_SUBSTITUTE, code) letters = [codepoint2name(ord(letter)) for letter in email] - el.text = markdown.AtomicString(''.join(letters)) + el.text = util.AtomicString(''.join(letters)) mailto = "mailto:" + email - mailto = "".join([markdown.AMP_SUBSTITUTE + '#%d;' % + mailto = "".join([util.AMP_SUBSTITUTE + '#%d;' % ord(letter) for letter in mailto]) el.set('href', mailto) - return el - + return el, m.start(0), m.end(0) diff --git a/markdown/odict.py b/markdown/odict.py deleted file mode 100644 index bf3ef07..0000000 --- a/markdown/odict.py +++ /dev/null @@ -1,162 +0,0 @@ -class OrderedDict(dict): - """ - A dictionary that keeps its keys in the order in which they're inserted. - - Copied from Django's SortedDict with some modifications. - - """ - def __new__(cls, *args, **kwargs): - instance = super(OrderedDict, cls).__new__(cls, *args, **kwargs) - instance.keyOrder = [] - return instance - - def __init__(self, data=None): - if data is None: - data = {} - super(OrderedDict, self).__init__(data) - if isinstance(data, dict): - self.keyOrder = data.keys() - else: - self.keyOrder = [] - for key, value in data: - if key not in self.keyOrder: - self.keyOrder.append(key) - - def __deepcopy__(self, memo): - from copy import deepcopy - return self.__class__([(key, deepcopy(value, memo)) - for key, value in self.iteritems()]) - - def __setitem__(self, key, value): - super(OrderedDict, self).__setitem__(key, value) - if key not in self.keyOrder: - self.keyOrder.append(key) - - def __delitem__(self, key): - super(OrderedDict, self).__delitem__(key) - self.keyOrder.remove(key) - - def __iter__(self): - for k in self.keyOrder: - yield k - - def pop(self, k, *args): - result = super(OrderedDict, self).pop(k, *args) - try: - self.keyOrder.remove(k) - except ValueError: - # Key wasn't in the dictionary in the first place. No problem. - pass - return result - - def popitem(self): - result = super(OrderedDict, self).popitem() - self.keyOrder.remove(result[0]) - return result - - def items(self): - return zip(self.keyOrder, self.values()) - - def iteritems(self): - for key in self.keyOrder: - yield key, super(OrderedDict, self).__getitem__(key) - - def keys(self): - return self.keyOrder[:] - - def iterkeys(self): - return iter(self.keyOrder) - - def values(self): - return [super(OrderedDict, self).__getitem__(k) for k in self.keyOrder] - - def itervalues(self): - for key in self.keyOrder: - yield super(OrderedDict, self).__getitem__(key) - - def update(self, dict_): - for k, v in dict_.items(): - self.__setitem__(k, v) - - def setdefault(self, key, default): - if key not in self.keyOrder: - self.keyOrder.append(key) - return super(OrderedDict, self).setdefault(key, default) - - def value_for_index(self, index): - """Return the value of the item at the given zero-based index.""" - return self[self.keyOrder[index]] - - def insert(self, index, key, value): - """Insert the key, value pair before the item with the given index.""" - if key in self.keyOrder: - n = self.keyOrder.index(key) - del self.keyOrder[n] - if n < index: - index -= 1 - self.keyOrder.insert(index, key) - super(OrderedDict, self).__setitem__(key, value) - - def copy(self): - """Return a copy of this object.""" - # This way of initializing the copy means it works for subclasses, too. - obj = self.__class__(self) - obj.keyOrder = self.keyOrder[:] - return obj - - def __repr__(self): - """ - Replace the normal dict.__repr__ with a version that returns the keys - in their sorted order. - """ - return '{%s}' % ', '.join(['%r: %r' % (k, v) for k, v in self.items()]) - - def clear(self): - super(OrderedDict, self).clear() - self.keyOrder = [] - - def index(self, key): - """ Return the index of a given key. """ - return self.keyOrder.index(key) - - def index_for_location(self, location): - """ Return index or None for a given location. """ - if location == '_begin': - i = 0 - elif location == '_end': - i = None - elif location.startswith('<') or location.startswith('>'): - i = self.index(location[1:]) - if location.startswith('>'): - if i >= len(self): - # last item - i = None - else: - i += 1 - else: - raise ValueError('Not a valid location: "%s". Location key ' - 'must start with a ">" or "<".' % location) - return i - - def add(self, key, value, location): - """ Insert by key location. """ - i = self.index_for_location(location) - if i is not None: - self.insert(i, key, value) - else: - self.__setitem__(key, value) - - def link(self, key, location): - """ Change location of an existing item. """ - n = self.keyOrder.index(key) - del self.keyOrder[n] - i = self.index_for_location(location) - try: - if i is not None: - self.keyOrder.insert(i, key) - else: - self.keyOrder.append(key) - except Error: - # restore to prevent data loss and reraise - self.keyOrder.insert(n, key) - raise Error diff --git a/markdown/postprocessors.py b/markdown/postprocessors.py index 80227bb..498f7e8 100644 --- a/markdown/postprocessors.py +++ b/markdown/postprocessors.py @@ -1,4 +1,23 @@ """ +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). + POST-PROCESSORS ============================================================================= @@ -8,15 +27,20 @@ processing. """ +from collections import OrderedDict +from . import util +import re + -import markdown +def build_postprocessors(md, **kwargs): + """ Build the default postprocessors for Markdown. """ + postprocessors = util.Registry() + postprocessors.register(RawHtmlPostprocessor(md), 'raw_html', 30) + postprocessors.register(AndSubstitutePostprocessor(), 'amp_substitute', 20) + return postprocessors -class Processor: - def __init__(self, markdown_instance=None): - if markdown_instance: - self.markdown = markdown_instance -class Postprocessor(Processor): +class Postprocessor(util.Processor): """ Postprocessors are run after the ElementTree it converted back into text. @@ -34,44 +58,80 @@ class Postprocessor(Processor): (possibly modified) string. """ - pass + pass # pragma: no cover class RawHtmlPostprocessor(Postprocessor): """ Restore raw html to the document. """ + BLOCK_LEVEL_REGEX = re.compile(r'^\<\/?([^ >]+)') + def run(self, text): - """ Iterate over html stash and restore "safe" html. """ - for i in range(self.markdown.htmlStash.html_counter): - html, safe = self.markdown.htmlStash.rawHtmlBlocks[i] - if self.markdown.safeMode and not safe: - if str(self.markdown.safeMode).lower() == 'escape': - html = self.escape(html) - elif str(self.markdown.safeMode).lower() == 'remove': - html = '' + """ Iterate over html stash and restore html. """ + replacements = OrderedDict() + for i in range(self.md.htmlStash.html_counter): + html = self.stash_to_string(self.md.htmlStash.rawHtmlBlocks[i]) + if self.isblocklevel(html): + replacements["

{}

".format( + self.md.htmlStash.get_placeholder(i))] = html + replacements[self.md.htmlStash.get_placeholder(i)] = html + + def substitute_match(m): + key = m.group(0) + + if key not in replacements: + if key[3:-4] in replacements: + return f'

{ replacements[key[3:-4]] }

' else: - html = markdown.HTML_REMOVED_TEXT - if safe or not self.markdown.safeMode: - text = text.replace("

%s

" % - (markdown.preprocessors.HTML_PLACEHOLDER % i), - html + "\n") - text = text.replace(markdown.preprocessors.HTML_PLACEHOLDER % i, - html) - return text + return key + + return replacements[key] - def escape(self, html): - """ Basic html escaping """ - html = html.replace('&', '&') - html = html.replace('<', '<') - html = html.replace('>', '>') - return html.replace('"', '"') + if replacements: + base_placeholder = util.HTML_PLACEHOLDER % r'([0-9]+)' + pattern = re.compile(f'

{ base_placeholder }

|{ base_placeholder }') + processed_text = pattern.sub(substitute_match, text) + else: + return text + + if processed_text == text: + return processed_text + else: + return self.run(processed_text) + + def isblocklevel(self, html): + m = self.BLOCK_LEVEL_REGEX.match(html) + if m: + if m.group(1)[0] in ('!', '?', '@', '%'): + # Comment, php etc... + return True + return self.md.is_block_level(m.group(1)) + return False + + def stash_to_string(self, text): + """ Convert a stashed object to a string. """ + return str(text) class AndSubstitutePostprocessor(Postprocessor): """ Restore valid entities """ - def __init__(self): - pass def run(self, text): - text = text.replace(markdown.AMP_SUBSTITUTE, "&") + text = text.replace(util.AMP_SUBSTITUTE, "&") return text + + +@util.deprecated( + "This class will be removed in the future; " + "use 'treeprocessors.UnescapeTreeprocessor' instead." +) +class UnescapePostprocessor(Postprocessor): + """ Restore escaped chars """ + + RE = re.compile(r'{}(\d+){}'.format(util.STX, util.ETX)) + + def unescape(self, m): + return chr(int(m.group(1))) + + def run(self, text): + return self.RE.sub(self.unescape, text) diff --git a/markdown/preprocessors.py b/markdown/preprocessors.py index ef04cab..e1023c5 100644 --- a/markdown/preprocessors.py +++ b/markdown/preprocessors.py @@ -1,24 +1,44 @@ - """ +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). + PRE-PROCESSORS ============================================================================= Preprocessors work on source text before we start doing anything too -complicated. +complicated. """ +from . import util +from .htmlparser import HTMLExtractor import re -import markdown -HTML_PLACEHOLDER_PREFIX = markdown.STX+"wzxhzdk:" -HTML_PLACEHOLDER = HTML_PLACEHOLDER_PREFIX + "%d" + markdown.ETX -class Processor: - def __init__(self, markdown_instance=None): - if markdown_instance: - self.markdown = markdown_instance +def build_preprocessors(md, **kwargs): + """ Build the default set of preprocessors used by Markdown. """ + preprocessors = util.Registry() + preprocessors.register(NormalizeWhitespace(md), 'normalize_whitespace', 30) + preprocessors.register(HtmlBlockPreprocessor(md), 'html_block', 20) + return preprocessors + -class Preprocessor (Processor): +class Preprocessor(util.Processor): """ Preprocessors are run after the text is broken into lines. @@ -36,180 +56,27 @@ class Preprocessor (Processor): the (possibly modified) list of lines. """ - pass + pass # pragma: no cover -class HtmlStash: - """ - This class is used for stashing HTML objects that we extract - in the beginning and replace with place-holders. - """ - def __init__ (self): - """ Create a HtmlStash. """ - self.html_counter = 0 # for counting inline html segments - self.rawHtmlBlocks=[] +class NormalizeWhitespace(Preprocessor): + """ Normalize whitespace for consistent parsing. """ - def store(self, html, safe=False): - """ - Saves an HTML segment for later reinsertion. Returns a - placeholder string that needs to be inserted into the - document. - - Keyword arguments: - - * html: an html segment - * safe: label an html segment as safe for safemode - - Returns : a placeholder string - - """ - self.rawHtmlBlocks.append((html, safe)) - placeholder = HTML_PLACEHOLDER % self.html_counter - self.html_counter += 1 - return placeholder - - def reset(self): - self.html_counter = 0 - self.rawHtmlBlocks = [] + def run(self, lines): + source = '\n'.join(lines) + source = source.replace(util.STX, "").replace(util.ETX, "") + source = source.replace("\r\n", "\n").replace("\r", "\n") + "\n\n" + source = source.expandtabs(self.md.tab_length) + source = re.sub(r'(?<=\n) +\n', '\n', source) + return source.split('\n') class HtmlBlockPreprocessor(Preprocessor): """Remove html blocks from the text and store them for later retrieval.""" - right_tag_patterns = ["", "%s>"] - - def _get_left_tag(self, block): - return block[1:].replace(">", " ", 1).split()[0].lower() - - def _get_right_tag(self, left_tag, block): - for p in self.right_tag_patterns: - tag = p % left_tag - i = block.rfind(tag) - if i > 2: - return tag.lstrip("<").rstrip(">"), i + len(p)-2 + len(left_tag) - return block.rstrip()[-len(left_tag)-2:-1].lower(), len(block) - - def _equal_tags(self, left_tag, right_tag): - if left_tag == 'div' or left_tag[0] in ['?', '@', '%']: # handle PHP, etc. - return True - if ("/" + left_tag) == right_tag: - return True - if (right_tag == "--" and left_tag == "--"): - return True - elif left_tag == right_tag[1:] \ - and right_tag[0] != "<": - return True - else: - return False - - def _is_oneliner(self, tag): - return (tag in ['hr', 'hr/']) - def run(self, lines): - text = "\n".join(lines) - new_blocks = [] - text = text.split("\n\n") - items = [] - left_tag = '' - right_tag = '' - in_tag = False # flag - - while text: - block = text[0] - if block.startswith("\n"): - block = block[1:] - text = text[1:] - - if block.startswith("\n"): - block = block[1:] - - if not in_tag: - if block.startswith("<"): - left_tag = self._get_left_tag(block) - right_tag, data_index = self._get_right_tag(left_tag, block) - - if block[1] == "!": - # is a comment block - left_tag = "--" - right_tag, data_index = self._get_right_tag(left_tag, block) - # keep checking conditions below and maybe just append - - if data_index < len(block) \ - and markdown.isBlockLevel(left_tag): - text.insert(0, block[data_index:]) - block = block[:data_index] - - if not (markdown.isBlockLevel(left_tag) \ - or block[1] in ["!", "?", "@", "%"]): - new_blocks.append(block) - continue - - if self._is_oneliner(left_tag): - new_blocks.append(block.strip()) - continue - - if block.rstrip().endswith(">") \ - and self._equal_tags(left_tag, right_tag): - new_blocks.append( - self.markdown.htmlStash.store(block.strip())) - continue - else: #if not block[1] == "!": - # if is block level tag and is not complete - - if markdown.isBlockLevel(left_tag) or left_tag == "--" \ - and not block.rstrip().endswith(">"): - items.append(block.strip()) - in_tag = True - else: - new_blocks.append( - self.markdown.htmlStash.store(block.strip())) - - continue - - new_blocks.append(block) - - else: - items.append(block.strip()) - - right_tag, data_index = self._get_right_tag(left_tag, block) - - if self._equal_tags(left_tag, right_tag): - # if find closing tag - in_tag = False - new_blocks.append( - self.markdown.htmlStash.store('\n\n'.join(items))) - items = [] - - if items: - new_blocks.append(self.markdown.htmlStash.store('\n\n'.join(items))) - new_blocks.append('\n') - - new_text = "\n\n".join(new_blocks) - return new_text.split("\n") - - -class ReferencePreprocessor(Preprocessor): - """ Remove reference definitions from text and store for later use. """ - - RE = re.compile(r'^(\ ?\ ?\ ?)\[([^\]]*)\]:\s*([^ ]*)(.*)$', re.DOTALL) - - def run (self, lines): - new_text = []; - for line in lines: - m = self.RE.match(line) - if m: - id = m.group(2).strip().lower() - t = m.group(4).strip() # potential title - if not t: - self.markdown.references[id] = (m.group(3), t) - elif (len(t) >= 2 - and (t[0] == t[-1] == "\"" - or t[0] == t[-1] == "\'" - or (t[0] == "(" and t[-1] == ")") ) ): - self.markdown.references[id] = (m.group(3), t[1:-1]) - else: - new_text.append(line) - else: - new_text.append(line) - - return new_text #+ "\n" + source = '\n'.join(lines) + parser = HTMLExtractor(self.md) + parser.feed(source) + parser.close() + return ''.join(parser.cleandoc).split('\n') diff --git a/markdown/serializers.py b/markdown/serializers.py new file mode 100644 index 0000000..59bab18 --- /dev/null +++ b/markdown/serializers.py @@ -0,0 +1,189 @@ +# markdown/searializers.py +# +# Add x/html serialization to Elementree +# Taken from ElementTree 1.3 preview with slight modifications +# +# Copyright (c) 1999-2007 by Fredrik Lundh. All rights reserved. +# +# fredrik@pythonware.com +# https://www.pythonware.com/ +# +# -------------------------------------------------------------------- +# The ElementTree toolkit is +# +# Copyright (c) 1999-2007 by Fredrik Lundh +# +# By obtaining, using, and/or copying this software and/or its +# associated documentation, you agree that you have read, understood, +# and will comply with the following terms and conditions: +# +# Permission to use, copy, modify, and distribute this software and +# its associated documentation for any purpose and without fee is +# hereby granted, provided that the above copyright notice appears in +# all copies, and that both that copyright notice and this permission +# notice appear in supporting documentation, and that the name of +# Secret Labs AB or the author not be used in advertising or publicity +# pertaining to distribution of the software without specific, written +# prior permission. +# +# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD +# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- +# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR +# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY +# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. +# -------------------------------------------------------------------- + + +from xml.etree.ElementTree import ProcessingInstruction +from xml.etree.ElementTree import Comment, ElementTree, QName +import re + +__all__ = ['to_html_string', 'to_xhtml_string'] + +HTML_EMPTY = ("area", "base", "basefont", "br", "col", "frame", "hr", + "img", "input", "isindex", "link", "meta", "param") +RE_AMP = re.compile(r'&(?!(?:\#[0-9]+|\#x[0-9a-f]+|[0-9a-z]+);)', re.I) + +try: + HTML_EMPTY = set(HTML_EMPTY) +except NameError: # pragma: no cover + pass + + +def _raise_serialization_error(text): # pragma: no cover + raise TypeError( + "cannot serialize {!r} (type {})".format(text, type(text).__name__) + ) + + +def _escape_cdata(text): + # escape character data + try: + # it's worth avoiding do-nothing calls for strings that are + # shorter than 500 character, or so. assume that's, by far, + # the most common case in most applications. + if "&" in text: + # Only replace & when not part of an entity + text = RE_AMP.sub('&', text) + if "<" in text: + text = text.replace("<", "<") + if ">" in text: + text = text.replace(">", ">") + return text + except (TypeError, AttributeError): # pragma: no cover + _raise_serialization_error(text) + + +def _escape_attrib(text): + # escape attribute value + try: + if "&" in text: + # Only replace & when not part of an entity + text = RE_AMP.sub('&', text) + if "<" in text: + text = text.replace("<", "<") + if ">" in text: + text = text.replace(">", ">") + if "\"" in text: + text = text.replace("\"", """) + if "\n" in text: + text = text.replace("\n", " ") + return text + except (TypeError, AttributeError): # pragma: no cover + _raise_serialization_error(text) + + +def _escape_attrib_html(text): + # escape attribute value + try: + if "&" in text: + # Only replace & when not part of an entity + text = RE_AMP.sub('&', text) + if "<" in text: + text = text.replace("<", "<") + if ">" in text: + text = text.replace(">", ">") + if "\"" in text: + text = text.replace("\"", """) + return text + except (TypeError, AttributeError): # pragma: no cover + _raise_serialization_error(text) + + +def _serialize_html(write, elem, format): + tag = elem.tag + text = elem.text + if tag is Comment: + write("" % _escape_cdata(text)) + elif tag is ProcessingInstruction: + write("" % _escape_cdata(text)) + elif tag is None: + if text: + write(_escape_cdata(text)) + for e in elem: + _serialize_html(write, e, format) + else: + namespace_uri = None + if isinstance(tag, QName): + # QNAME objects store their data as a string: `{uri}tag` + if tag.text[:1] == "{": + namespace_uri, tag = tag.text[1:].split("}", 1) + else: + raise ValueError('QName objects must define a tag.') + write("<" + tag) + items = elem.items() + if items: + items = sorted(items) # lexical order + for k, v in items: + if isinstance(k, QName): + # Assume a text only QName + k = k.text + if isinstance(v, QName): + # Assume a text only QName + v = v.text + else: + v = _escape_attrib_html(v) + if k == v and format == 'html': + # handle boolean attributes + write(" %s" % v) + else: + write(' {}="{}"'.format(k, v)) + if namespace_uri: + write(' xmlns="%s"' % (_escape_attrib(namespace_uri))) + if format == "xhtml" and tag.lower() in HTML_EMPTY: + write(" />") + else: + write(">") + if text: + if tag.lower() in ["script", "style"]: + write(text) + else: + write(_escape_cdata(text)) + for e in elem: + _serialize_html(write, e, format) + if tag.lower() not in HTML_EMPTY: + write("") + if elem.tail: + write(_escape_cdata(elem.tail)) + + +def _write_html(root, format="html"): + assert root is not None + data = [] + write = data.append + _serialize_html(write, root, format) + return "".join(data) + + +# -------------------------------------------------------------------- +# public functions + +def to_html_string(element): + return _write_html(ElementTree(element).getroot(), format="html") + + +def to_xhtml_string(element): + return _write_html(ElementTree(element).getroot(), format="xhtml") diff --git a/markdown/test_tools.py b/markdown/test_tools.py new file mode 100644 index 0000000..2ce0e74 --- /dev/null +++ b/markdown/test_tools.py @@ -0,0 +1,220 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + +import os +import sys +import unittest +import textwrap +from . import markdown, Markdown, util + +try: + import tidylib +except ImportError: + tidylib = None + +__all__ = ['TestCase', 'LegacyTestCase', 'Kwargs'] + + +class TestCase(unittest.TestCase): + """ + A unittest.TestCase subclass with helpers for testing Markdown output. + + Define `default_kwargs` as a dict of keywords to pass to Markdown for each + test. The defaults can be overridden on individual tests. + + The `assertMarkdownRenders` method accepts the source text, the expected + output, and any keywords to pass to Markdown. The `default_kwargs` are used + except where overridden by `kwargs`. The output and expected output are passed + to `TestCase.assertMultiLineEqual`. An AssertionError is raised with a diff + if the actual output does not equal the expected output. + + The `dedent` method is available to dedent triple-quoted strings if + necessary. + + In all other respects, behaves as unittest.TestCase. + """ + + default_kwargs = {} + + def assertMarkdownRenders(self, source, expected, expected_attrs=None, **kwargs): + """ + Test that source Markdown text renders to expected output with given keywords. + + `expected_attrs` accepts a dict. Each key should be the name of an attribute + on the `Markdown` instance and the value should be the expected value after + the source text is parsed by Markdown. After the expected output is tested, + the expected value for each attribute is compared against the actual + attribute of the `Markdown` instance using `TestCase.assertEqual`. + """ + + expected_attrs = expected_attrs or {} + kws = self.default_kwargs.copy() + kws.update(kwargs) + md = Markdown(**kws) + output = md.convert(source) + self.assertMultiLineEqual(output, expected) + for key, value in expected_attrs.items(): + self.assertEqual(getattr(md, key), value) + + def dedent(self, text): + """ + Dedent text. + """ + + # TODO: If/when actual output ends with a newline, then use: + # return textwrap.dedent(text.strip('/n')) + return textwrap.dedent(text).strip() + + +class recursionlimit: + """ + A context manager which temporarily modifies the Python recursion limit. + + The testing framework, coverage, etc. may add an arbitrary number of levels to the depth. To maintain consistency + in the tests, the current stack depth is determined when called, then added to the provided limit. + + Example usage: + + with recursionlimit(20): + # test code here + + See https://stackoverflow.com/a/50120316/866026 + """ + + def __init__(self, limit): + self.limit = util._get_stack_depth() + limit + self.old_limit = sys.getrecursionlimit() + + def __enter__(self): + sys.setrecursionlimit(self.limit) + + def __exit__(self, type, value, tb): + sys.setrecursionlimit(self.old_limit) + + +######################### +# Legacy Test Framework # +######################### + + +class Kwargs(dict): + """ A dict like class for holding keyword arguments. """ + pass + + +def _normalize_whitespace(text): + """ Normalize whitespace for a string of html using tidylib. """ + output, errors = tidylib.tidy_fragment(text, options={ + 'drop_empty_paras': 0, + 'fix_backslash': 0, + 'fix_bad_comments': 0, + 'fix_uri': 0, + 'join_styles': 0, + 'lower_literals': 0, + 'merge_divs': 0, + 'output_xhtml': 1, + 'quote_ampersand': 0, + 'newline': 'LF' + }) + return output + + +class LegacyTestMeta(type): + def __new__(cls, name, bases, dct): + + def generate_test(infile, outfile, normalize, kwargs): + def test(self): + with open(infile, encoding="utf-8") as f: + input = f.read() + with open(outfile, encoding="utf-8") as f: + # Normalize line endings + # (on Windows, git may have altered line endings). + expected = f.read().replace("\r\n", "\n") + output = markdown(input, **kwargs) + if tidylib and normalize: + try: + expected = _normalize_whitespace(expected) + output = _normalize_whitespace(output) + except OSError: + self.skipTest("Tidylib's c library not available.") + elif normalize: + self.skipTest('Tidylib not available.') + self.assertMultiLineEqual(output, expected) + return test + + location = dct.get('location', '') + exclude = dct.get('exclude', []) + normalize = dct.get('normalize', False) + input_ext = dct.get('input_ext', '.txt') + output_ext = dct.get('output_ext', '.html') + kwargs = dct.get('default_kwargs', Kwargs()) + + if os.path.isdir(location): + for file in os.listdir(location): + infile = os.path.join(location, file) + if os.path.isfile(infile): + tname, ext = os.path.splitext(file) + if ext == input_ext: + outfile = os.path.join(location, tname + output_ext) + tname = tname.replace(' ', '_').replace('-', '_') + kws = kwargs.copy() + if tname in dct: + kws.update(dct[tname]) + test_name = 'test_%s' % tname + if tname not in exclude: + dct[test_name] = generate_test(infile, outfile, normalize, kws) + else: + dct[test_name] = unittest.skip('Excluded')(lambda: None) + + return type.__new__(cls, name, bases, dct) + + +class LegacyTestCase(unittest.TestCase, metaclass=LegacyTestMeta): + """ + A `unittest.TestCase` subclass for running Markdown's legacy file-based tests. + + A subclass should define various properties which point to a directory of + text-based test files and define various behaviors/defaults for those tests. + The following properties are supported: + + location: A path to the directory of test files. An absolute path is preferred. + exclude: A list of tests to exclude. Each test name should comprise the filename + without an extension. + normalize: A boolean value indicating if the HTML should be normalized. + Default: `False`. + input_ext: A string containing the file extension of input files. Default: `.txt`. + ouput_ext: A string containing the file extension of expected output files. + Default: `html`. + default_kwargs: A `Kwargs` instance which stores the default set of keyword + arguments for all test files in the directory. + + In addition, properties can be defined for each individual set of test files within + the directory. The property should be given the name of the file without the file + extension. Any spaces and dashes in the filename should be replaced with + underscores. The value of the property should be a `Kwargs` instance which + contains the keyword arguments that should be passed to `Markdown` for that + test file. The keyword arguments will "update" the `default_kwargs`. + + When the class instance is created, it will walk the given directory and create + a separate unitttest for each set of test files using the naming scheme: + `test_filename`. One unittest will be run for each set of input and output files. + """ + pass diff --git a/markdown/treeprocessors.py b/markdown/treeprocessors.py index 1dc612a..e9f48ca 100644 --- a/markdown/treeprocessors.py +++ b/markdown/treeprocessors.py @@ -1,16 +1,47 @@ -import markdown +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + import re +import xml.etree.ElementTree as etree +from . import util +from . import inlinepatterns + + +def build_treeprocessors(md, **kwargs): + """ Build the default treeprocessors for Markdown. """ + treeprocessors = util.Registry() + treeprocessors.register(InlineProcessor(md), 'inline', 20) + treeprocessors.register(PrettifyTreeprocessor(md), 'prettify', 10) + treeprocessors.register(UnescapeTreeprocessor(md), 'unescape', 0) + return treeprocessors + def isString(s): """ Check if it's string """ - return isinstance(s, unicode) or isinstance(s, str) + if not isinstance(s, util.AtomicString): + return isinstance(s, str) + return False -class Processor: - def __init__(self, markdown_instance=None): - if markdown_instance: - self.markdown = markdown_instance -class Treeprocessor(Processor): +class Treeprocessor(util.Processor): """ Treeprocessors are run on the ElementTree object before serialization. @@ -24,11 +55,11 @@ class Treeprocessor(Processor): def run(self, root): """ Subclasses of Treeprocessor should implement a `run` method, which - takes a root ElementTree. This method can return another ElementTree - object, and the existing root ElementTree will be replaced, or it can + takes a root ElementTree. This method can return another ElementTree + object, and the existing root ElementTree will be replaced, or it can modify the current tree and return None. """ - pass + pass # pragma: no cover class InlineProcessor(Treeprocessor): @@ -36,18 +67,20 @@ class InlineProcessor(Treeprocessor): A Treeprocessor that traverses a tree, applying inline patterns. """ - def __init__ (self, md): - self.__placeholder_prefix = markdown.INLINE_PLACEHOLDER_PREFIX - self.__placeholder_suffix = markdown.ETX + def __init__(self, md): + self.__placeholder_prefix = util.INLINE_PLACEHOLDER_PREFIX + self.__placeholder_suffix = util.ETX self.__placeholder_length = 4 + len(self.__placeholder_prefix) \ + len(self.__placeholder_suffix) - self.__placeholder_re = re.compile(markdown.INLINE_PLACEHOLDER % r'([0-9]{4})') - self.markdown = md + self.__placeholder_re = util.INLINE_PLACEHOLDER_RE + self.md = md + self.inlinePatterns = md.inlinePatterns + self.ancestors = [] def __makePlaceholder(self, type): """ Generate a placeholder """ id = "%04d" % len(self.stashed_nodes) - hash = markdown.INLINE_PLACEHOLDER % id + hash = util.INLINE_PLACEHOLDER % id return hash, id def __findPlaceholder(self, data, index): @@ -60,8 +93,8 @@ class InlineProcessor(Treeprocessor): * index: index, from which we start search Returns: placeholder id and string index, after the found placeholder. - """ + """ m = self.__placeholder_re.search(data, index) if m: return m.group(1), m.end() @@ -87,12 +120,13 @@ class InlineProcessor(Treeprocessor): Returns: String with placeholders. """ - if not isinstance(data, markdown.AtomicString): + if not isinstance(data, util.AtomicString): startIndex = 0 - while patternIndex < len(self.markdown.inlinePatterns): + count = len(self.inlinePatterns) + while patternIndex < count: data, matched, startIndex = self.__applyPattern( - self.markdown.inlinePatterns.value_for_index(patternIndex), - data, patternIndex, startIndex) + self.inlinePatterns[patternIndex], data, patternIndex, startIndex + ) if not matched: patternIndex += 1 return data @@ -118,19 +152,18 @@ class InlineProcessor(Treeprocessor): text = subnode.tail subnode.tail = None - childResult = self.__processPlaceholders(text, subnode) + childResult = self.__processPlaceholders(text, subnode, isText) if not isText and node is not subnode: - pos = node.getchildren().index(subnode) - node.remove(subnode) + pos = list(node).index(subnode) + 1 else: pos = 0 childResult.reverse() for newChild in childResult: - node.insert(pos, newChild) + node.insert(pos, newChild[0]) - def __processPlaceholders(self, data, parent): + def __processPlaceholders(self, data, parent, isText=True): """ Process string with placeholders and generate ElementTree tree. @@ -140,20 +173,25 @@ class InlineProcessor(Treeprocessor): * parent: Element, which contains processing inline data Returns: list with ElementTree elements with applied inline patterns. + """ def linkText(text): if text: if result: - if result[-1].tail: - result[-1].tail += text + if result[-1][0].tail: + result[-1][0].tail += text + else: + result[-1][0].tail = text + elif not isText: + if parent.tail: + parent.tail += text else: - result[-1].tail = text + parent.tail = text else: if parent.text: parent.text += text else: parent.text = text - result = [] strartIndex = 0 while data: @@ -168,28 +206,33 @@ class InlineProcessor(Treeprocessor): text = data[strartIndex:index] linkText(text) - if not isString(node): # it's Element - for child in [node] + node.getchildren(): + if not isString(node): # it's Element + for child in [node] + list(node): if child.tail: if child.tail.strip(): - self.__processElementText(node, child, False) + self.__processElementText( + node, child, False + ) if child.text: if child.text.strip(): self.__processElementText(child, child) - else: # it's just a string + else: # it's just a string linkText(node) strartIndex = phEndIndex continue strartIndex = phEndIndex - result.append(node) + result.append((node, self.ancestors[:])) - else: # wrong placeholder - end = index + len(prefix) + else: # wrong placeholder + end = index + len(self.__placeholder_prefix) linkText(data[strartIndex:end]) strartIndex = end else: text = data[strartIndex:] + if isinstance(data, util.AtomicString): + # We don't want to loose the AtomicString + text = util.AtomicString(text) linkText(text) data = "" @@ -205,94 +248,149 @@ class InlineProcessor(Treeprocessor): * data: the text to be processed * pattern: the pattern to be checked * patternIndex: index of current pattern - * startIndex: string index, from which we starting search + * startIndex: string index, from which we start searching Returns: String with placeholders instead of ElementTree elements. """ - match = pattern.getCompiledRegExp().match(data[startIndex:]) - leftData = data[:startIndex] + new_style = isinstance(pattern, inlinepatterns.InlineProcessor) + + for exclude in pattern.ANCESTOR_EXCLUDES: + if exclude.lower() in self.ancestors: + return data, False, 0 + + if new_style: + match = None + # Since handleMatch may reject our first match, + # we iterate over the buffer looking for matches + # until we can't find any more. + for match in pattern.getCompiledRegExp().finditer(data, startIndex): + node, start, end = pattern.handleMatch(match, data) + if start is None or end is None: + startIndex += match.end(0) + match = None + continue + break + else: # pragma: no cover + match = pattern.getCompiledRegExp().match(data[startIndex:]) + leftData = data[:startIndex] if not match: return data, False, 0 - node = pattern.handleMatch(match) + if not new_style: # pragma: no cover + node = pattern.handleMatch(match) + start = match.start(0) + end = match.end(0) if node is None: - return data, True, len(leftData) + match.span(len(match.groups()))[0] + return data, True, end if not isString(node): - if not isinstance(node.text, markdown.AtomicString): + if not isinstance(node.text, util.AtomicString): # We need to process current node too - for child in [node] + node.getchildren(): + for child in [node] + list(node): if not isString(node): if child.text: - child.text = self.__handleInline(child.text, - patternIndex + 1) + self.ancestors.append(child.tag.lower()) + child.text = self.__handleInline( + child.text, patternIndex + 1 + ) + self.ancestors.pop() if child.tail: - child.tail = self.__handleInline(child.tail, - patternIndex) + child.tail = self.__handleInline( + child.tail, patternIndex + ) placeholder = self.__stashNode(node, pattern.type()) - return "%s%s%s%s" % (leftData, - match.group(1), - placeholder, match.groups()[-1]), True, 0 - - def run(self, tree): + if new_style: + return "{}{}{}".format(data[:start], + placeholder, data[end:]), True, 0 + else: # pragma: no cover + return "{}{}{}{}".format(leftData, + match.group(1), + placeholder, match.groups()[-1]), True, 0 + + def __build_ancestors(self, parent, parents): + """Build the ancestor list.""" + ancestors = [] + while parent is not None: + if parent is not None: + ancestors.append(parent.tag.lower()) + parent = self.parent_map.get(parent) + ancestors.reverse() + parents.extend(ancestors) + + def run(self, tree, ancestors=None): """Apply inline patterns to a parsed Markdown tree. Iterate over ElementTree, find elements with inline tag, apply inline patterns and append newly created Elements to tree. If you don't - want process your data with inline paterns, instead of normal string, - use subclass AtomicString: + want to process your data with inline patterns, instead of normal + string, use subclass AtomicString: - node.text = markdown.AtomicString("data won't be processed with inline patterns") + node.text = markdown.AtomicString("This will not be processed.") Arguments: - * markdownTree: ElementTree object, representing Markdown tree. + * tree: ElementTree object, representing Markdown tree. + * ancestors: List of parent tag names that precede the tree node (if needed). Returns: ElementTree object with applied inline patterns. """ self.stashed_nodes = {} - stack = [tree] + # Ensure a valid parent list, but copy passed in lists + # to ensure we don't have the user accidentally change it on us. + tree_parents = [] if ancestors is None else ancestors[:] + + self.parent_map = {c: p for p in tree.iter() for c in p} + stack = [(tree, tree_parents)] while stack: - currElement = stack.pop() + currElement, parents = stack.pop() + + self.ancestors = parents + self.__build_ancestors(currElement, self.ancestors) + insertQueue = [] - for child in currElement.getchildren(): - if child.text and not isinstance(child.text, markdown.AtomicString): + for child in currElement: + if child.text and not isinstance( + child.text, util.AtomicString + ): + self.ancestors.append(child.tag.lower()) text = child.text child.text = None - lst = self.__processPlaceholders(self.__handleInline( - text), child) + lst = self.__processPlaceholders( + self.__handleInline(text), child + ) + for item in lst: + self.parent_map[item[0]] = child stack += lst insertQueue.append((child, lst)) - - if child.getchildren(): - stack.append(child) + self.ancestors.pop() + if child.tail: + tail = self.__handleInline(child.tail) + dumby = etree.Element('d') + child.tail = None + tailResult = self.__processPlaceholders(tail, dumby, False) + if dumby.tail: + child.tail = dumby.tail + pos = list(currElement).index(child) + 1 + tailResult.reverse() + for newChild in tailResult: + self.parent_map[newChild[0]] = currElement + currElement.insert(pos, newChild[0]) + if len(child): + self.parent_map[child] = currElement + stack.append((child, self.ancestors[:])) for element, lst in insertQueue: - if element.text: - element.text = \ - markdown.inlinepatterns.handleAttributes(element.text, - element) - i = 0 - for newChild in lst: - # Processing attributes - if newChild.tail: - newChild.tail = \ - markdown.inlinepatterns.handleAttributes(newChild.tail, - element) - if newChild.text: - newChild.text = \ - markdown.inlinepatterns.handleAttributes(newChild.text, - newChild) + for i, obj in enumerate(lst): + newChild = obj[0] element.insert(i, newChild) - i += 1 return tree @@ -303,15 +401,13 @@ class PrettifyTreeprocessor(Treeprocessor): """ Recursively add linebreaks to ElementTree children. """ i = "\n" - if markdown.isBlockLevel(elem.tag) and elem.tag not in ['code', 'pre']: + if self.md.is_block_level(elem.tag) and elem.tag not in ['code', 'pre']: if (not elem.text or not elem.text.strip()) \ - and len(elem) and markdown.isBlockLevel(elem[0].tag): + and len(elem) and self.md.is_block_level(elem[0].tag): elem.text = i for e in elem: - if markdown.isBlockLevel(e.tag): + if self.md.is_block_level(e.tag): self._prettifyETree(e) - if not elem.tail or not elem.tail.strip(): - elem.tail = i if not elem.tail or not elem.tail.strip(): elem.tail = i @@ -319,11 +415,44 @@ class PrettifyTreeprocessor(Treeprocessor): """ Add linebreaks to ElementTree root object. """ self._prettifyETree(root) - # Do
's seperately as they are often in the middle of + # Do
's separately as they are often in the middle of # inline content and missed by _prettifyETree. - brs = root.getiterator('br') + brs = root.iter('br') for br in brs: if not br.tail or not br.tail.strip(): br.tail = '\n' else: br.tail = '\n%s' % br.tail + # Clean up extra empty lines at end of code blocks. + pres = root.iter('pre') + for pre in pres: + if len(pre) and pre[0].tag == 'code': + code = pre[0] + # Only prettify code containing text only + if not len(code) and code.text is not None: + code.text = util.AtomicString(code.text.rstrip() + '\n') + + +class UnescapeTreeprocessor(Treeprocessor): + """ Restore escaped chars """ + + RE = re.compile(r'{}(\d+){}'.format(util.STX, util.ETX)) + + def _unescape(self, m): + return chr(int(m.group(1))) + + def unescape(self, text): + return self.RE.sub(self._unescape, text) + + def run(self, root): + """ Loop over all elements and unescape all text. """ + for elem in root.iter(): + # Unescape text content + if elem.text and not elem.tag == 'code': + elem.text = self.unescape(elem.text) + # Unescape tail content + if elem.tail: + elem.tail = self.unescape(elem.tail) + # Unescape attribute values + for key, value in elem.items(): + elem.set(key, self.unescape(value)) diff --git a/markdown/util.py b/markdown/util.py new file mode 100644 index 0000000..e6b08e5 --- /dev/null +++ b/markdown/util.py @@ -0,0 +1,358 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + +import re +import sys +import warnings +from collections import namedtuple +from functools import wraps, lru_cache +from itertools import count + + +""" +Constants you might want to modify +----------------------------------------------------------------------------- +""" + + +BLOCK_LEVEL_ELEMENTS = [ + # Elements which are invalid to wrap in a `

` tag. + # See https://w3c.github.io/html/grouping-content.html#the-p-element + 'address', 'article', 'aside', 'blockquote', 'details', 'div', 'dl', + 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', + 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'main', 'menu', 'nav', 'ol', + 'p', 'pre', 'section', 'table', 'ul', + # Other elements which Markdown should not be mucking up the contents of. + 'canvas', 'colgroup', 'dd', 'body', 'dt', 'group', 'iframe', 'li', 'legend', + 'math', 'map', 'noscript', 'output', 'object', 'option', 'progress', 'script', + 'style', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'tr', 'video' +] + +# Placeholders +STX = '\u0002' # Use STX ("Start of text") for start-of-placeholder +ETX = '\u0003' # Use ETX ("End of text") for end-of-placeholder +INLINE_PLACEHOLDER_PREFIX = STX+"klzzwxh:" +INLINE_PLACEHOLDER = INLINE_PLACEHOLDER_PREFIX + "%s" + ETX +INLINE_PLACEHOLDER_RE = re.compile(INLINE_PLACEHOLDER % r'([0-9]+)') +AMP_SUBSTITUTE = STX+"amp"+ETX +HTML_PLACEHOLDER = STX + "wzxhzdk:%s" + ETX +HTML_PLACEHOLDER_RE = re.compile(HTML_PLACEHOLDER % r'([0-9]+)') +TAG_PLACEHOLDER = STX + "hzzhzkh:%s" + ETX + + +""" +Constants you probably do not need to change +----------------------------------------------------------------------------- +""" + +RTL_BIDI_RANGES = ( + ('\u0590', '\u07FF'), + # Hebrew (0590-05FF), Arabic (0600-06FF), + # Syriac (0700-074F), Arabic supplement (0750-077F), + # Thaana (0780-07BF), Nko (07C0-07FF). + ('\u2D30', '\u2D7F') # Tifinagh +) + + +""" +AUXILIARY GLOBAL FUNCTIONS +============================================================================= +""" + + +@lru_cache(maxsize=None) +def get_installed_extensions(): + if sys.version_info >= (3, 10): + from importlib import metadata + else: # " in text: + text = text.replace(">", ">") + return text + + +def _get_stack_depth(size=2): + """Get current stack depth, performantly. + """ + frame = sys._getframe(size) + + for size in count(size): + frame = frame.f_back + if not frame: + return size + + +def nearing_recursion_limit(): + """Return true if current stack depth is within 100 of maximum limit.""" + return sys.getrecursionlimit() - _get_stack_depth() < 100 + + +""" +MISC AUXILIARY CLASSES +============================================================================= +""" + + +class AtomicString(str): + """A string which should not be further processed.""" + pass + + +class Processor: + def __init__(self, md=None): + self.md = md + + +class HtmlStash: + """ + This class is used for stashing HTML objects that we extract + in the beginning and replace with place-holders. + """ + + def __init__(self): + """ Create a HtmlStash. """ + self.html_counter = 0 # for counting inline html segments + self.rawHtmlBlocks = [] + self.tag_counter = 0 + self.tag_data = [] # list of dictionaries in the order tags appear + + def store(self, html): + """ + Saves an HTML segment for later reinsertion. Returns a + placeholder string that needs to be inserted into the + document. + + Keyword arguments: + + * html: an html segment + + Returns : a placeholder string + + """ + self.rawHtmlBlocks.append(html) + placeholder = self.get_placeholder(self.html_counter) + self.html_counter += 1 + return placeholder + + def reset(self): + self.html_counter = 0 + self.rawHtmlBlocks = [] + + def get_placeholder(self, key): + return HTML_PLACEHOLDER % key + + def store_tag(self, tag, attrs, left_index, right_index): + """Store tag data and return a placeholder.""" + self.tag_data.append({'tag': tag, 'attrs': attrs, + 'left_index': left_index, + 'right_index': right_index}) + placeholder = TAG_PLACEHOLDER % str(self.tag_counter) + self.tag_counter += 1 # equal to the tag's index in self.tag_data + return placeholder + + +# Used internally by `Registry` for each item in its sorted list. +# Provides an easier to read API when editing the code later. +# For example, `item.name` is more clear than `item[0]`. +_PriorityItem = namedtuple('PriorityItem', ['name', 'priority']) + + +class Registry: + """ + A priority sorted registry. + + A `Registry` instance provides two public methods to alter the data of the + registry: `register` and `deregister`. Use `register` to add items and + `deregister` to remove items. See each method for specifics. + + When registering an item, a "name" and a "priority" must be provided. All + items are automatically sorted by "priority" from highest to lowest. The + "name" is used to remove ("deregister") and get items. + + A `Registry` instance it like a list (which maintains order) when reading + data. You may iterate over the items, get an item and get a count (length) + of all items. You may also check that the registry contains an item. + + When getting an item you may use either the index of the item or the + string-based "name". For example: + + registry = Registry() + registry.register(SomeItem(), 'itemname', 20) + # Get the item by index + item = registry[0] + # Get the item by name + item = registry['itemname'] + + When checking that the registry contains an item, you may use either the + string-based "name", or a reference to the actual item. For example: + + someitem = SomeItem() + registry.register(someitem, 'itemname', 20) + # Contains the name + assert 'itemname' in registry + # Contains the item instance + assert someitem in registry + + The method `get_index_for_name` is also available to obtain the index of + an item using that item's assigned "name". + """ + + def __init__(self): + self._data = {} + self._priority = [] + self._is_sorted = False + + def __contains__(self, item): + if isinstance(item, str): + # Check if an item exists by this name. + return item in self._data.keys() + # Check if this instance exists. + return item in self._data.values() + + def __iter__(self): + self._sort() + return iter([self._data[k] for k, p in self._priority]) + + def __getitem__(self, key): + self._sort() + if isinstance(key, slice): + data = Registry() + for k, p in self._priority[key]: + data.register(self._data[k], k, p) + return data + if isinstance(key, int): + return self._data[self._priority[key].name] + return self._data[key] + + def __len__(self): + return len(self._priority) + + def __repr__(self): + return '<{}({})>'.format(self.__class__.__name__, list(self)) + + def get_index_for_name(self, name): + """ + Return the index of the given name. + """ + if name in self: + self._sort() + return self._priority.index( + [x for x in self._priority if x.name == name][0] + ) + raise ValueError('No item named "{}" exists.'.format(name)) + + def register(self, item, name, priority): + """ + Add an item to the registry with the given name and priority. + + Parameters: + + * `item`: The item being registered. + * `name`: A string used to reference the item. + * `priority`: An integer or float used to sort against all items. + + If an item is registered with a "name" which already exists, the + existing item is replaced with the new item. Treat carefully as the + old item is lost with no way to recover it. The new item will be + sorted according to its priority and will **not** retain the position + of the old item. + """ + if name in self: + # Remove existing item of same name first + self.deregister(name) + self._is_sorted = False + self._data[name] = item + self._priority.append(_PriorityItem(name, priority)) + + def deregister(self, name, strict=True): + """ + Remove an item from the registry. + + Set `strict=False` to fail silently. + """ + try: + index = self.get_index_for_name(name) + del self._priority[index] + del self._data[name] + except ValueError: + if strict: + raise + + def _sort(self): + """ + Sort the registry by priority from highest to lowest. + + This method is called internally and should never be explicitly called. + """ + if not self._is_sorted: + self._priority.sort(key=lambda item: item.priority, reverse=True) + self._is_sorted = True diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..4c53ac3 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,64 @@ +site_name: Python-Markdown +site_url: https://Python-Markdown.github.io/ +repo_url: https://github.com/Python-Markdown/markdown +site_author: "The Python-Markdown Project" +copyright: "Copyright © 2010-2017" + +use_directory_urls: true + +theme: + name: nature + icon: py.png + release: !!python/name:markdown.__version__ + issue_tracker: https://github.com/Python-Markdown/markdown/issues + +nav: + - Python-Markdown: index.md + - Installation: install.md + - Library Reference: reference.md + - Command Line: cli.md + - Extensions: extensions/index.md + - Officially Supported Extensions: + - Abbreviations: extensions/abbreviations.md + - Admonition: extensions/admonition.md + - Attribute Lists: extensions/attr_list.md + - CodeHilite: extensions/code_hilite.md + - Definition Lists: extensions/definition_lists.md + - Extra: extensions/extra.md + - Fenced Code Blocks: extensions/fenced_code_blocks.md + - Footnotes: extensions/footnotes.md + - Legacy Attributes: extensions/legacy_attrs.md + - Legacy Emphasis: extensions/legacy_em.md + - Meta-Data: extensions/meta_data.md + - New Line to Break: extensions/nl2br.md + - Markdown in HTML: extensions/md_in_html.md + - Sane Lists: extensions/sane_lists.md + - SmartyPants: extensions/smarty.md + - Table of Contents: extensions/toc.md + - Tables: extensions/tables.md + - WikiLinks: extensions/wikilinks.md + - Extension API: extensions/api.md + - Test Tools: test_tools.md + - Contributing to Python-Markdown: contributing.md + - Change Log: change_log/index.md + - Release Notes for v.3.4: change_log/release-3.4.md + - Release Notes for v.3.3: change_log/release-3.3.md + - Release Notes for v.3.2: change_log/release-3.2.md + - Release Notes for v.3.1: change_log/release-3.1.md + - Release Notes for v.3.0: change_log/release-3.0.md + - Release Notes for v.2.6: change_log/release-2.6.md + - Release Notes for v.2.5: change_log/release-2.5.md + - Release Notes for v.2.4: change_log/release-2.4.md + - Release Notes for v.2.3: change_log/release-2.3.md + - Release Notes for v.2.2: change_log/release-2.2.md + - Release Notes for v.2.1: change_log/release-2.1.md + - Release Notes for v.2.0: change_log/release-2.0.md + - Authors: authors.md + +markdown_extensions: + - extra + - admonition + - smarty + - codehilite + - toc: + permalink: true diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..39d9d77 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,4 @@ +[build-system] +# Minimum requirements for the build system to execute. +requires = ["setuptools>=36.6", "wheel"] +build-backend = "setuptools.build_meta" diff --git a/regression-tests.py b/regression-tests.py deleted file mode 100755 index 7601061..0000000 --- a/regression-tests.py +++ /dev/null @@ -1,234 +0,0 @@ -#!/usr/bin/python -""" -Python-Markdown Regression Tests -================================ - -Tests of the various APIs with the python markdown lib. - -""" - -import unittest -from doctest import DocTestSuite -import os -import markdown - -class TestMarkdown(unittest.TestCase): - """ Tests basics of the Markdown class. """ - - def setUp(self): - """ Create instance of Markdown. """ - self.md = markdown.Markdown() - - def testBlankInput(self): - """ Test blank input. """ - self.assertEqual(self.md.convert(''), '') - - def testWhitespaceOnly(self): - """ Test input of only whitespace. """ - self.assertEqual(self.md.convert(' '), '') - - def testSimpleInput(self): - """ Test simple input. """ - self.assertEqual(self.md.convert('foo'), '

foo

') - -class TestBlockParser(unittest.TestCase): - """ Tests of the BlockParser class. """ - - def setUp(self): - """ Create instance of BlockParser. """ - self.parser = markdown.Markdown().parser - - def testParseChunk(self): - """ Test BlockParser.parseChunk. """ - root = markdown.etree.Element("div") - text = 'foo' - self.parser.parseChunk(root, text) - self.assertEqual(markdown.etree.tostring(root), "

foo

") - - def testParseDocument(self): - """ Test BlockParser.parseDocument. """ - lines = ['#foo', '', 'bar', '', ' baz'] - tree = self.parser.parseDocument(lines) - self.assert_(isinstance(tree, markdown.etree.ElementTree)) - self.assert_(markdown.etree.iselement(tree.getroot())) - self.assertEqual(markdown.etree.tostring(tree.getroot()), - "

foo

bar

baz\n
") - - -class TestBlockParserState(unittest.TestCase): - """ Tests of the State class for BlockParser. """ - - def setUp(self): - self.state = markdown.blockparser.State() - - def testBlankState(self): - """ Test State when empty. """ - self.assertEqual(self.state, []) - - def testSetSate(self): - """ Test State.set(). """ - self.state.set('a_state') - self.assertEqual(self.state, ['a_state']) - self.state.set('state2') - self.assertEqual(self.state, ['a_state', 'state2']) - - def testIsSate(self): - """ Test State.isstate(). """ - self.assertEqual(self.state.isstate('anything'), False) - self.state.set('a_state') - self.assertEqual(self.state.isstate('a_state'), True) - self.state.set('state2') - self.assertEqual(self.state.isstate('state2'), True) - self.assertEqual(self.state.isstate('a_state'), False) - self.assertEqual(self.state.isstate('missing'), False) - - def testReset(self): - """ Test State.reset(). """ - self.state.set('a_state') - self.state.reset() - self.assertEqual(self.state, []) - self.state.set('state1') - self.state.set('state2') - self.state.reset() - self.assertEqual(self.state, ['state1']) - -class TestHtmlStash(unittest.TestCase): - """ Test Markdown's HtmlStash. """ - - def setUp(self): - self.stash = markdown.preprocessors.HtmlStash() - self.placeholder = self.stash.store('foo') - - def testSimpleStore(self): - """ Test HtmlStash.store. """ - self.assertEqual(self.placeholder, - markdown.preprocessors.HTML_PLACEHOLDER % 0) - self.assertEqual(self.stash.html_counter, 1) - self.assertEqual(self.stash.rawHtmlBlocks, [('foo', False)]) - - def testStoreMore(self): - """ Test HtmlStash.store with additional blocks. """ - placeholder = self.stash.store('bar') - self.assertEqual(placeholder, - markdown.preprocessors.HTML_PLACEHOLDER % 1) - self.assertEqual(self.stash.html_counter, 2) - self.assertEqual(self.stash.rawHtmlBlocks, - [('foo', False), ('bar', False)]) - - def testSafeStore(self): - """ Test HtmlStash.store with 'safe' html. """ - self.stash.store('bar', True) - self.assertEqual(self.stash.rawHtmlBlocks, - [('foo', False), ('bar', True)]) - - def testReset(self): - """ Test HtmlStash.reset. """ - self.stash.reset() - self.assertEqual(self.stash.html_counter, 0) - self.assertEqual(self.stash.rawHtmlBlocks, []) - -class TestOrderedDict(unittest.TestCase): - """ Test OrderedDict storage class. """ - - def setUp(self): - self.odict = markdown.odict.OrderedDict() - self.odict['first'] = 'This' - self.odict['third'] = 'a' - self.odict['fourth'] = 'self' - self.odict['fifth'] = 'test' - - def testValues(self): - """ Test output of OrderedDict.values(). """ - self.assertEqual(self.odict.values(), ['This', 'a', 'self', 'test']) - - def testKeys(self): - """ Test output of OrderedDict.keys(). """ - self.assertEqual(self.odict.keys(), - ['first', 'third', 'fourth', 'fifth']) - - def testItems(self): - """ Test output of OrderedDict.items(). """ - self.assertEqual(self.odict.items(), - [('first', 'This'), ('third', 'a'), - ('fourth', 'self'), ('fifth', 'test')]) - - def testAddBefore(self): - """ Test adding an OrderedDict item before a given key. """ - self.odict.add('second', 'is', 'first') - self.assertEqual(self.odict.items(), - [('first', 'This'), ('second', 'is'), ('third', 'a'), - ('fourth', 'self'), ('fifth', 'test')]) - - def testAddAfterEnd(self): - """ Test adding an OrderedDict item after the last key. """ - self.odict.add('sixth', '.', '>fifth') - self.assertEqual(self.odict.items(), - [('first', 'This'), ('third', 'a'), - ('fourth', 'self'), ('fifth', 'test'), ('sixth', '.')]) - - def testAdd_begin(self): - """ Test adding an OrderedDict item using "_begin". """ - self.odict.add('zero', 'CRAZY', '_begin') - self.assertEqual(self.odict.items(), - [('zero', 'CRAZY'), ('first', 'This'), ('third', 'a'), - ('fourth', 'self'), ('fifth', 'test')]) - - def testAdd_end(self): - """ Test adding an OrderedDict item using "_end". """ - self.odict.add('sixth', '.', '_end') - self.assertEqual(self.odict.items(), - [('first', 'This'), ('third', 'a'), - ('fourth', 'self'), ('fifth', 'test'), ('sixth', '.')]) - - def testAddBadLocation(self): - """ Test Error on bad location in OrderedDict.add(). """ - self.assertRaises(ValueError, self.odict.add, 'sixth', '.', '=4.4;python_version<'3.10'"], + extras_require={ + 'testing': [ + 'coverage', + 'pyyaml', + ], + }, + entry_points={ + 'console_scripts': [ + '%s = markdown.__main__:run' % SCRIPT_NAME, + ], + # Register the built in extensions + 'markdown.extensions': [ + 'abbr = markdown.extensions.abbr:AbbrExtension', + 'admonition = markdown.extensions.admonition:AdmonitionExtension', + 'attr_list = markdown.extensions.attr_list:AttrListExtension', + 'codehilite = markdown.extensions.codehilite:CodeHiliteExtension', + 'def_list = markdown.extensions.def_list:DefListExtension', + 'extra = markdown.extensions.extra:ExtraExtension', + 'fenced_code = markdown.extensions.fenced_code:FencedCodeExtension', + 'footnotes = markdown.extensions.footnotes:FootnoteExtension', + 'md_in_html = markdown.extensions.md_in_html:MarkdownInHtmlExtension', + 'meta = markdown.extensions.meta:MetaExtension', + 'nl2br = markdown.extensions.nl2br:Nl2BrExtension', + 'sane_lists = markdown.extensions.sane_lists:SaneListExtension', + 'smarty = markdown.extensions.smarty:SmartyExtension', + 'tables = markdown.extensions.tables:TableExtension', + 'toc = markdown.extensions.toc:TocExtension', + 'wikilinks = markdown.extensions.wikilinks:WikiLinkExtension', + 'legacy_attrs = markdown.extensions.legacy_attrs:LegacyAttrExtension', + 'legacy_em = markdown.extensions.legacy_em:LegacyEmExtension', + ] + }, + classifiers=[ + 'Development Status :: %s' % DEVSTATUS, + 'License :: OSI Approved :: BSD License', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: Implementation :: CPython', + 'Programming Language :: Python :: Implementation :: PyPy', + 'Topic :: Communications :: Email :: Filters', + 'Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries', + 'Topic :: Internet :: WWW/HTTP :: Site Management', + 'Topic :: Software Development :: Documentation', + 'Topic :: Software Development :: Libraries :: Python Modules', + 'Topic :: Text Processing :: Filters', + 'Topic :: Text Processing :: Markup :: HTML', + 'Topic :: Text Processing :: Markup :: Markdown' + ] +) diff --git a/test-markdown.py b/test-markdown.py deleted file mode 100755 index e5dd870..0000000 --- a/test-markdown.py +++ /dev/null @@ -1,347 +0,0 @@ -#!/usr/bin/env python - -import os, difflib, time, gc, codecs, platform, sys -from pprint import pprint -import textwrap - -# Setup a logger manually for compatibility with Python 2.3 -import logging -logging.getLogger('MARKDOWN').addHandler(logging.StreamHandler()) -import markdown - -TEST_DIR = "tests" -TMP_DIR = "./tmp/" -WRITE_BENCHMARK = True -WRITE_BENCHMARK = False -ACTUALLY_MEASURE_MEMORY = True - -###################################################################### - -if platform.system().lower() == "darwin": # Darwin - _proc_status = '/proc/%d/stat' % os.getpid() -else: # Linux - _proc_status = '/proc/%d/status' % os.getpid() - -_scale = {'kB': 1024.0, 'mB': 1024.0*1024.0, - 'KB': 1024.0, 'MB': 1024.0*1024.0} - -def _VmB(VmKey): - '''Private. - ''' - global _proc_status, _scale - # get pseudo file /proc//status - try: - t = open(_proc_status) - v = t.read() - t.close() - except: - return 0.0 # non-Linux? - # get VmKey line e.g. 'VmRSS: 9999 kB\n ...' - i = v.index(VmKey) - v = v[i:].split(None, 3) # whitespace - if len(v) < 3: - return 0.0 # invalid format? - # convert Vm value to bytes - return float(v[1]) * _scale[v[2]] - - -def memory(since=0.0): - '''Return memory usage in bytes. - ''' - if ACTUALLY_MEASURE_MEMORY : - return _VmB('VmSize:') - since - - -def resident(since=0.0): - '''Return resident memory usage in bytes. - ''' - return _VmB('VmRSS:') - since - - -def stacksize(since=0.0): - '''Return stack size in bytes. - ''' - return _VmB('VmStk:') - since - - -############################################################ - -DIFF_FILE_TEMPLATE = """ - - - - - - -

Results Summary

- - - - - - - - - - - - - """ - -FOOTER = """ - - -""" - -DIFF_TABLE_TEMPLATE = """ -
- SecondsMemory
- - - - - - - - - - - - - - %s - -
- ExpectedActual
-""" - - -def smart_split(text) : - result = [] - for x in text.splitlines() : - for y in textwrap.wrap(textwrap.dedent(x), 40): - result.append(y) - return result - - -differ = difflib.Differ() -try : - htmldiff = difflib.HtmlDiff() -except: - htmldiff = None - -class TestRunner : - - def __init__ (self) : - self.failedTests = [] - if not os.path.exists(TMP_DIR): - os.mkdir(TMP_DIR) - - def test_directory(self, dir, measure_time=False, safe_mode=False, encoding="utf-8", output_format='xhtml1') : - self.encoding = encoding - benchmark_file_name = os.path.join(dir, "benchmark.dat") - self.saved_benchmarks = {} - - if measure_time : - if os.path.exists(benchmark_file_name) : - file = open(benchmark_file_name) - for line in file.readlines() : - test, str_time, str_mem = line.strip().split(":") - self.saved_benchmarks[test] = (float(str_time), float(str_mem)) - repeat = range(10) - else : - repeat = (0,) - - # First, determine from the name of the directory if any extensions - # need to be loaded. - - parts = os.path.split(dir)[-1].split("-x-") - if len(parts) > 1 : - extensions = parts[1].split("-") - print extensions - else : - extensions = [] - - mem = memory() - start = time.clock() - self.md = markdown.Markdown(extensions=extensions, safe_mode = safe_mode, output_format=output_format) - construction_time = time.clock() - start - construction_mem = memory(mem) - - self.benchmark_buffer = "construction:%f:%f\n" % (construction_time, - construction_mem) - - html_diff_file_path = os.path.join(TMP_DIR, os.path.split(dir)[-1]) + ".html" - self.html_diff_file = codecs.open(html_diff_file_path, "w", encoding=encoding) - self.html_diff_file.write(DIFF_FILE_TEMPLATE) - - self.diffs_buffer = "" - - tests = [x.replace(".txt", "") - for x in os.listdir(dir) if x.endswith(".txt")] - tests.sort() - for test in tests : - self.run_test(dir, test, repeat) - - self.html_diff_file.write("") - - if sys.version < "3.0": - self.html_diff_file.write(self.diffs_buffer.decode("utf-8")) - - self.html_diff_file.write(FOOTER) - self.html_diff_file.close() - print "Diff written to %s" % html_diff_file_path - - benchmark_output_file_name = benchmark_file_name - - if not WRITE_BENCHMARK: - benchmark_output_file_name += ".tmp" - - self.benchmark_file = open(benchmark_output_file_name, "w") - self.benchmark_file.write(self.benchmark_buffer) - self.benchmark_file.close() - - -#################### - - - def run_test(self, dir, test, repeat): - - print "--- %s ---" % test - self.html_diff_file.write("%s" % test) - input_file = os.path.join(dir, test + ".txt") - output_file = os.path.join(dir, test + ".html") - - expected_output = codecs.open(output_file, encoding=self.encoding).read() - input = codecs.open(input_file, encoding=self.encoding).read() - actual_output = "" - actual_lines = [] - self.md.source = "" - gc.collect() - mem = memory() - start = time.clock() - for x in repeat: - actual_output = self.md.convert(input) - conversion_time = time.clock() - start - conversion_mem = memory(mem) - self.md.reset() - - expected_lines = [x.encode("utf-8") for x in smart_split(expected_output)] - actual_lines = [x.encode("utf-8") for x in smart_split(actual_output)] - - #diff = difflib.ndiff(expected_output.split("\n"), - # actual_output.split("\n")) - - diff = [x for x in differ.compare(expected_lines, - actual_lines) - if not x.startswith(" ")] - - if not diff: - self.html_diff_file.write("OK") - else : - self.failedTests.append(test) - self.html_diff_file.write("" + - "FAILED" % test) - print "MISMATCH on %s/%s.txt" % (dir, test) - print - for line in diff : - print line - if htmldiff!=None : - htmlDiff = htmldiff.make_table(expected_lines, actual_lines, - context=True) - htmlDiff = "\n".join( [x for x in htmlDiff.splitlines() - if x.strip().startswith("")] ) - self.diffs_buffer += "

%s

" % (test, test) - self.diffs_buffer += DIFF_TABLE_TEMPLATE % htmlDiff - - expected_time, expected_mem = self.saved_benchmarks.get(test, ("na", "na")) - - self.html_diff_file.write(get_benchmark_html(conversion_time, expected_time)) - self.html_diff_file.write(get_benchmark_html(conversion_mem, expected_mem)) - self.html_diff_file.write("\n") - - self.benchmark_buffer += "%s:%f:%f\n" % (test, - conversion_time, conversion_mem) - - - - - -def get_benchmark_html (actual, expected) : - buffer = "" - if not expected == "na": - if actual > expected * 1.5: - tdiff = "failed" - elif actual * 1.5 < expected : - tdiff = "ok" - else : - tdiff = "same" - if ( (actual <= 0 and expected < 0.015) or - (expected <= 0 and actual < 0.015)) : - tdiff = "same" - else : - tdiff = "same" - buffer += "%.2f" % (tdiff, actual) - if not expected == "na": - buffer += "%.2f" % (expected) - return buffer - - -def run_tests() : - - tester = TestRunner() - #test.test_directory("tests/basic") - tester.test_directory("tests/markdown-test", measure_time=True) - tester.test_directory("tests/misc", measure_time=True) - tester.test_directory("tests/extensions-x-tables") - tester.test_directory("tests/extensions-x-footnotes") - #tester.test_directory("tests/extensions-x-ext1-ext2") - tester.test_directory("tests/safe_mode", measure_time=True, safe_mode="escape") - tester.test_directory("tests/extensions-x-wikilinks") - tester.test_directory("tests/extensions-x-toc") - tester.test_directory("tests/extensions-x-def_list") - tester.test_directory("tests/extensions-x-abbr") - tester.test_directory("tests/html4", output_format='html4') - - try: - import pygments - except ImportError: - # Dependancy not avalable - skip test - pass - else: - tester.test_directory("tests/extensions-x-codehilite") - - print "\n### Final result ###" - if len(tester.failedTests): - print "%d failed tests: %s" % (len(tester.failedTests), str(tester.failedTests)) - else: - print "All tests passed, no errors!" - -run_tests() - - - - diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..564ba3b --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,20 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" diff --git a/tests/basic/amps-and-angle-encoding.html b/tests/basic/amps-and-angle-encoding.html new file mode 100644 index 0000000..2c466c1 --- /dev/null +++ b/tests/basic/amps-and-angle-encoding.html @@ -0,0 +1,9 @@ +

AT&T has an ampersand in their name.

+

AT&T is another way to write it.

+

This & that.

+

4 < 5.

+

6 > 5.

+

Here's a link with an ampersand in the URL.

+

Here's a link with an amersand in the link text: AT&T.

+

Here's an inline link.

+

Here's an inline link.

\ No newline at end of file diff --git a/tests/basic/amps-and-angle-encoding.txt b/tests/basic/amps-and-angle-encoding.txt new file mode 100644 index 0000000..0e9527f --- /dev/null +++ b/tests/basic/amps-and-angle-encoding.txt @@ -0,0 +1,21 @@ +AT&T has an ampersand in their name. + +AT&T is another way to write it. + +This & that. + +4 < 5. + +6 > 5. + +Here's a [link] [1] with an ampersand in the URL. + +Here's a link with an amersand in the link text: [AT&T] [2]. + +Here's an inline [link](/script?foo=1&bar=2). + +Here's an inline [link](). + + +[1]: http://example.com/?foo=1&bar=2 +[2]: http://att.com/ "AT&T" \ No newline at end of file diff --git a/tests/basic/angle-links-and-img.html b/tests/basic/angle-links-and-img.html new file mode 100644 index 0000000..1ca3b0b --- /dev/null +++ b/tests/basic/angle-links-and-img.html @@ -0,0 +1,4 @@ +

link +image +link +image

\ No newline at end of file diff --git a/tests/basic/angle-links-and-img.txt b/tests/basic/angle-links-and-img.txt new file mode 100644 index 0000000..1dbf404 --- /dev/null +++ b/tests/basic/angle-links-and-img.txt @@ -0,0 +1,4 @@ +[link]( "title") +![image]() +[link]() +![image]() diff --git a/tests/basic/auto-links.html b/tests/basic/auto-links.html new file mode 100644 index 0000000..7481fe2 --- /dev/null +++ b/tests/basic/auto-links.html @@ -0,0 +1,15 @@ +

Link: http://example.com/.

+

Https link: https://example.com

+

Ftp link: ftp://example.com

+

With an ampersand: http://example.com/?foo=1&bar=2

+ +
+

Blockquoted: http://example.com/

+
+

Auto-links should not occur here: <http://example.com/>

+
or here: <http://example.com/>
+
\ No newline at end of file diff --git a/tests/basic/auto-links.txt b/tests/basic/auto-links.txt new file mode 100644 index 0000000..a188b40 --- /dev/null +++ b/tests/basic/auto-links.txt @@ -0,0 +1,17 @@ +Link: . + +Https link: + +Ftp link: + +With an ampersand: + +* In a list? +* +* It should. + +> Blockquoted: + +Auto-links should not occur here: `` + + or here: diff --git a/tests/basic/backlash-escapes.html b/tests/basic/backlash-escapes.html new file mode 100644 index 0000000..876775f --- /dev/null +++ b/tests/basic/backlash-escapes.html @@ -0,0 +1,67 @@ +

These should all get escaped:

+

Backslash: \

+

Backtick: `

+

Asterisk: *

+

Underscore: _

+

Left brace: {

+

Right brace: }

+

Left bracket: [

+

Right bracket: ]

+

Left paren: (

+

Right paren: )

+

Greater-than: >

+

Hash: #

+

Period: .

+

Bang: !

+

Plus: +

+

Minus: -

+

These should not, because they occur within a code block:

+
Backslash: \\
+
+Backtick: \`
+
+Asterisk: \*
+
+Underscore: \_
+
+Left brace: \{
+
+Right brace: \}
+
+Left bracket: \[
+
+Right bracket: \]
+
+Left paren: \(
+
+Right paren: \)
+
+Greater-than: \>
+
+Hash: \#
+
+Period: \.
+
+Bang: \!
+
+Plus: \+
+
+Minus: \-
+
+

Nor should these, which occur in code spans:

+

Backslash: \\

+

Backtick: \`

+

Asterisk: \*

+

Underscore: \_

+

Left brace: \{

+

Right brace: \}

+

Left bracket: \[

+

Right bracket: \]

+

Left paren: \(

+

Right paren: \)

+

Greater-than: \>

+

Hash: \#

+

Period: \.

+

Bang: \!

+

Plus: \+

+

Minus: \-

\ No newline at end of file diff --git a/tests/basic/backlash-escapes.txt b/tests/basic/backlash-escapes.txt new file mode 100644 index 0000000..16447a0 --- /dev/null +++ b/tests/basic/backlash-escapes.txt @@ -0,0 +1,104 @@ +These should all get escaped: + +Backslash: \\ + +Backtick: \` + +Asterisk: \* + +Underscore: \_ + +Left brace: \{ + +Right brace: \} + +Left bracket: \[ + +Right bracket: \] + +Left paren: \( + +Right paren: \) + +Greater-than: \> + +Hash: \# + +Period: \. + +Bang: \! + +Plus: \+ + +Minus: \- + + + +These should not, because they occur within a code block: + + Backslash: \\ + + Backtick: \` + + Asterisk: \* + + Underscore: \_ + + Left brace: \{ + + Right brace: \} + + Left bracket: \[ + + Right bracket: \] + + Left paren: \( + + Right paren: \) + + Greater-than: \> + + Hash: \# + + Period: \. + + Bang: \! + + Plus: \+ + + Minus: \- + + +Nor should these, which occur in code spans: + +Backslash: `\\` + +Backtick: `` \` `` + +Asterisk: `\*` + +Underscore: `\_` + +Left brace: `\{` + +Right brace: `\}` + +Left bracket: `\[` + +Right bracket: `\]` + +Left paren: `\(` + +Right paren: `\)` + +Greater-than: `\>` + +Hash: `\#` + +Period: `\.` + +Bang: `\!` + +Plus: `\+` + +Minus: `\-` diff --git a/tests/basic/blockquotes-with-code-blocks.html b/tests/basic/blockquotes-with-code-blocks.html new file mode 100644 index 0000000..5fc98b1 --- /dev/null +++ b/tests/basic/blockquotes-with-code-blocks.html @@ -0,0 +1,12 @@ +
+

Example:

+
sub status {
+    print "working";
+}
+
+

Or:

+
sub status {
+    return "working";
+}
+
+
\ No newline at end of file diff --git a/tests/basic/blockquotes-with-code-blocks.txt b/tests/basic/blockquotes-with-code-blocks.txt new file mode 100644 index 0000000..c31d171 --- /dev/null +++ b/tests/basic/blockquotes-with-code-blocks.txt @@ -0,0 +1,11 @@ +> Example: +> +> sub status { +> print "working"; +> } +> +> Or: +> +> sub status { +> return "working"; +> } diff --git a/tests/basic/codeblock-in-list.html b/tests/basic/codeblock-in-list.html new file mode 100644 index 0000000..49edd56 --- /dev/null +++ b/tests/basic/codeblock-in-list.html @@ -0,0 +1,14 @@ +
    +
  • +

    A list item with a code block

    +
    Some *code*
    +
    +
  • +
  • +

    Another list item

    +
    More code
    +
    +And more code
    +
    +
  • +
\ No newline at end of file diff --git a/tests/basic/codeblock-in-list.txt b/tests/basic/codeblock-in-list.txt new file mode 100644 index 0000000..87d4e3b --- /dev/null +++ b/tests/basic/codeblock-in-list.txt @@ -0,0 +1,10 @@ +* A list item with a code block + + Some *code* + +* Another list item + + More code + + And more code + diff --git a/tests/basic/hard-wrapped.html b/tests/basic/hard-wrapped.html new file mode 100644 index 0000000..e28e900 --- /dev/null +++ b/tests/basic/hard-wrapped.html @@ -0,0 +1,7 @@ +

In Markdown 1.0.0 and earlier. Version +8. This line turns into a list item. +Because a hard-wrapped line in the +middle of a paragraph looked like a +list item.

+

Here's one with a bullet. +* criminey.

\ No newline at end of file diff --git a/tests/basic/hard-wrapped.txt b/tests/basic/hard-wrapped.txt new file mode 100644 index 0000000..f8a5b27 --- /dev/null +++ b/tests/basic/hard-wrapped.txt @@ -0,0 +1,8 @@ +In Markdown 1.0.0 and earlier. Version +8. This line turns into a list item. +Because a hard-wrapped line in the +middle of a paragraph looked like a +list item. + +Here's one with a bullet. +* criminey. diff --git a/tests/basic/horizontal-rules.html b/tests/basic/horizontal-rules.html new file mode 100644 index 0000000..478e8c5 --- /dev/null +++ b/tests/basic/horizontal-rules.html @@ -0,0 +1,39 @@ +

Dashes:

+
+
+
+
+
---
+
+
+
+
+
+
- - -
+
+

Asterisks:

+
+
+
+
+
***
+
+
+
+
+
+
* * *
+
+

Underscores:

+
+
+
+
+
___
+
+
+
+
+
+
_ _ _
+
\ No newline at end of file diff --git a/tests/basic/horizontal-rules.txt b/tests/basic/horizontal-rules.txt new file mode 100644 index 0000000..1594bda --- /dev/null +++ b/tests/basic/horizontal-rules.txt @@ -0,0 +1,67 @@ +Dashes: + +--- + + --- + + --- + + --- + + --- + +- - - + + - - - + + - - - + + - - - + + - - - + + +Asterisks: + +*** + + *** + + *** + + *** + + *** + +* * * + + * * * + + * * * + + * * * + + * * * + + +Underscores: + +___ + + ___ + + ___ + + ___ + + ___ + +_ _ _ + + _ _ _ + + _ _ _ + + _ _ _ + + _ _ _ diff --git a/tests/basic/links-inline.html b/tests/basic/links-inline.html new file mode 100644 index 0000000..707937a --- /dev/null +++ b/tests/basic/links-inline.html @@ -0,0 +1,5 @@ +

Just a URL.

+

URL and title.

+

URL and title.

+

URL and title.

+

Empty.

\ No newline at end of file diff --git a/tests/basic/links-inline.txt b/tests/basic/links-inline.txt new file mode 100644 index 0000000..4d0c1c2 --- /dev/null +++ b/tests/basic/links-inline.txt @@ -0,0 +1,9 @@ +Just a [URL](/url/). + +[URL and title](/url/ "title"). + +[URL and title](/url/ "title preceded by two spaces"). + +[URL and title](/url/ "title preceded by a tab"). + +[Empty](). diff --git a/tests/basic/links-reference.html b/tests/basic/links-reference.html new file mode 100644 index 0000000..63f242d --- /dev/null +++ b/tests/basic/links-reference.html @@ -0,0 +1,22 @@ +

Foo bar.

+

Foo bar.

+

Foo bar.

+

With embedded [brackets].

+

Indented once.

+

Indented twice.

+

Indented thrice.

+

Indented [four][] times.

+
[four]: /url
+
+

With angle brackets.

+

And without.

+

With line +breaks

+

and line +breaks with one space.

+

and [line
+breaks[] with two spaces.

+

short ref

+

short +ref

+

a ref

\ No newline at end of file diff --git a/tests/basic/links-reference.txt b/tests/basic/links-reference.txt new file mode 100644 index 0000000..3d636e5 --- /dev/null +++ b/tests/basic/links-reference.txt @@ -0,0 +1,61 @@ +Foo [bar] [1]. + +Foo [bar][1]. + +Foo [bar] +[1]. + +[1]: /url/ "Title" + + +With [embedded [brackets]] [b]. + + +Indented [once][]. + +Indented [twice][]. + +Indented [thrice][]. + +Indented [four][] times. + + [once]: /url + + [twice]: /url + + [thrice]: /url + + [four]: /url + + +[b]: /url/ + +With [angle brackets][]. + +And [without][]. + +[angle brackets]: "Angle Brackets" +[without]: http://example.com/ "Without angle brackets." + +With [line +breaks][] + +and [line +breaks][] with one space. + +and [line +breaks[] with two spaces. + +[line breaks]: http://example.com "Yes this works" + +[short ref] + +[short +ref] + +[short ref]: http://example.com "No more hanging empty bracket!" + +[a ref] + +[a ref]: http://example.com + "Title on next line." diff --git a/tests/basic/literal-quotes.html b/tests/basic/literal-quotes.html new file mode 100644 index 0000000..0342589 --- /dev/null +++ b/tests/basic/literal-quotes.html @@ -0,0 +1,2 @@ +

Foo bar.

+

Foo bar.

\ No newline at end of file diff --git a/tests/basic/literal-quotes.txt b/tests/basic/literal-quotes.txt new file mode 100644 index 0000000..29d0e42 --- /dev/null +++ b/tests/basic/literal-quotes.txt @@ -0,0 +1,7 @@ +Foo [bar][]. + +Foo [bar](/url/ "Title with "quotes" inside"). + + + [bar]: /url/ "Title with "quotes" inside" + diff --git a/tests/basic/markdown-documentation-basics.html b/tests/basic/markdown-documentation-basics.html new file mode 100644 index 0000000..fd2e687 --- /dev/null +++ b/tests/basic/markdown-documentation-basics.html @@ -0,0 +1,243 @@ +

Markdown: Basics

+ + +

Getting the Gist of Markdown's Formatting Syntax

+

This page offers a brief overview of what it's like to use Markdown. +The syntax page provides complete, detailed documentation for +every feature, but Markdown should be very easy to pick up simply by +looking at a few examples of it in action. The examples on this page +are written in a before/after style, showing example syntax and the +HTML output produced by Markdown.

+

It's also helpful to simply try Markdown out; the Dingus is a +web application that allows you type your own Markdown-formatted text +and translate it to XHTML.

+

Note: This document is itself written using Markdown; you +can see the source for it by adding '.text' to the URL.

+

Paragraphs, Headers, Blockquotes

+

A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing spaces or tabs is considered +blank.) Normal paragraphs should not be indented with spaces or tabs.

+

Markdown offers two styles of headers: Setext and atx. +Setext-style headers for <h1> and <h2> are created by +"underlining" with equal signs (=) and hyphens (-), respectively. +To create an atx-style header, you put 1-6 hash marks (#) at the +beginning of the line -- the number of hashes equals the resulting +HTML header level.

+

Blockquotes are indicated using email-style '>' angle brackets.

+

Markdown:

+
A First Level Header
+====================
+
+A Second Level Header
+---------------------
+
+Now is the time for all good men to come to
+the aid of their country. This is just a
+regular paragraph.
+
+The quick brown fox jumped over the lazy
+dog's back.
+
+### Header 3
+
+> This is a blockquote.
+> 
+> This is the second paragraph in the blockquote.
+>
+> ## This is an H2 in a blockquote
+
+

Output:

+
<h1>A First Level Header</h1>
+
+<h2>A Second Level Header</h2>
+
+<p>Now is the time for all good men to come to
+the aid of their country. This is just a
+regular paragraph.</p>
+
+<p>The quick brown fox jumped over the lazy
+dog's back.</p>
+
+<h3>Header 3</h3>
+
+<blockquote>
+    <p>This is a blockquote.</p>
+
+    <p>This is the second paragraph in the blockquote.</p>
+
+    <h2>This is an H2 in a blockquote</h2>
+</blockquote>
+
+

Phrase Emphasis

+

Markdown uses asterisks and underscores to indicate spans of emphasis.

+

Markdown:

+
Some of these words *are emphasized*.
+Some of these words _are emphasized also_.
+
+Use two asterisks for **strong emphasis**.
+Or, if you prefer, __use two underscores instead__.
+
+

Output:

+
<p>Some of these words <em>are emphasized</em>.
+Some of these words <em>are emphasized also</em>.</p>
+
+<p>Use two asterisks for <strong>strong emphasis</strong>.
+Or, if you prefer, <strong>use two underscores instead</strong>.</p>
+
+

Lists

+

Unordered (bulleted) lists use asterisks, pluses, and hyphens (*, ++, and -) as list markers. These three markers are +interchangeable; this:

+
*   Candy.
+*   Gum.
+*   Booze.
+
+

this:

+
+   Candy.
++   Gum.
++   Booze.
+
+

and this:

+
-   Candy.
+-   Gum.
+-   Booze.
+
+

all produce the same output:

+
<ul>
+<li>Candy.</li>
+<li>Gum.</li>
+<li>Booze.</li>
+</ul>
+
+

Ordered (numbered) lists use regular numbers, followed by periods, as +list markers:

+
1.  Red
+2.  Green
+3.  Blue
+
+

Output:

+
<ol>
+<li>Red</li>
+<li>Green</li>
+<li>Blue</li>
+</ol>
+
+

If you put blank lines between items, you'll get <p> tags for the +list item text. You can create multi-paragraph list items by indenting +the paragraphs by 4 spaces or 1 tab:

+
*   A list item.
+
+    With multiple paragraphs.
+
+*   Another item in the list.
+
+

Output:

+
<ul>
+<li><p>A list item.</p>
+<p>With multiple paragraphs.</p></li>
+<li><p>Another item in the list.</p></li>
+</ul>
+
+

Links

+

Markdown supports two styles for creating links: inline and +reference. With both styles, you use square brackets to delimit the +text you want to turn into a link.

+

Inline-style links use parentheses immediately after the link text. +For example:

+
This is an [example link](http://example.com/).
+
+

Output:

+
<p>This is an <a href="http://example.com/">
+example link</a>.</p>
+
+

Optionally, you may include a title attribute in the parentheses:

+
This is an [example link](http://example.com/ "With a Title").
+
+

Output:

+
<p>This is an <a href="http://example.com/" title="With a Title">
+example link</a>.</p>
+
+

Reference-style links allow you to refer to your links by names, which +you define elsewhere in your document:

+
I get 10 times more traffic from [Google][1] than from
+[Yahoo][2] or [MSN][3].
+
+[1]: http://google.com/        "Google"
+[2]: http://search.yahoo.com/  "Yahoo Search"
+[3]: http://search.msn.com/    "MSN Search"
+
+

Output:

+
<p>I get 10 times more traffic from <a href="http://google.com/"
+title="Google">Google</a> than from <a href="http://search.yahoo.com/"
+title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
+title="MSN Search">MSN</a>.</p>
+
+

The title attribute is optional. Link names may contain letters, +numbers and spaces, but are not case sensitive:

+
I start my morning with a cup of coffee and
+[The New York Times][NY Times].
+
+[ny times]: http://www.nytimes.com/
+
+

Output:

+
<p>I start my morning with a cup of coffee and
+<a href="http://www.nytimes.com/">The New York Times</a>.</p>
+
+

Images

+

Image syntax is very much like link syntax.

+

Inline (titles are optional):

+
![alt text](/path/to/img.jpg "Title")
+
+

Reference-style:

+
![alt text][id]
+
+[id]: /path/to/img.jpg "Title"
+
+

Both of the above examples produce the same output:

+
<img src="/path/to/img.jpg" alt="alt text" title="Title" />
+
+

Code

+

In a regular paragraph, you can create code span by wrapping text in +backtick quotes. Any ampersands (&) and angle brackets (< or +>) will automatically be translated into HTML entities. This makes +it easy to use Markdown to write about HTML example code:

+
I strongly recommend against using any `<blink>` tags.
+
+I wish SmartyPants used named entities like `&mdash;`
+instead of decimal-encoded entities like `&#8212;`.
+
+

Output:

+
<p>I strongly recommend against using any
+<code>&lt;blink&gt;</code> tags.</p>
+
+<p>I wish SmartyPants used named entities like
+<code>&amp;mdash;</code> instead of decimal-encoded
+entities like <code>&amp;#8212;</code>.</p>
+
+

To specify an entire block of pre-formatted code, indent every line of +the block by 4 spaces or 1 tab. Just like with code spans, &, <, +and > characters will be escaped automatically.

+

Markdown:

+
If you want your page to validate under XHTML 1.0 Strict,
+you've got to put paragraph tags in your blockquotes:
+
+    <blockquote>
+        <p>For example.</p>
+    </blockquote>
+
+

Output:

+
<p>If you want your page to validate under XHTML 1.0 Strict,
+you've got to put paragraph tags in your blockquotes:</p>
+
+<pre><code>&lt;blockquote&gt;
+    &lt;p&gt;For example.&lt;/p&gt;
+&lt;/blockquote&gt;
+</code></pre>
+
\ No newline at end of file diff --git a/tests/basic/markdown-documentation-basics.txt b/tests/basic/markdown-documentation-basics.txt new file mode 100644 index 0000000..b0932f3 --- /dev/null +++ b/tests/basic/markdown-documentation-basics.txt @@ -0,0 +1,306 @@ +Markdown: Basics +================ + + + + +Getting the Gist of Markdown's Formatting Syntax +------------------------------------------------ + +This page offers a brief overview of what it's like to use Markdown. +The [syntax page] [s] provides complete, detailed documentation for +every feature, but Markdown should be very easy to pick up simply by +looking at a few examples of it in action. The examples on this page +are written in a before/after style, showing example syntax and the +HTML output produced by Markdown. + +It's also helpful to simply try Markdown out; the [Dingus] [d] is a +web application that allows you type your own Markdown-formatted text +and translate it to XHTML. + +**Note:** This document is itself written using Markdown; you +can [see the source for it by adding '.text' to the URL] [src]. + + [s]: /projects/markdown/syntax "Markdown Syntax" + [d]: /projects/markdown/dingus "Markdown Dingus" + [src]: /projects/markdown/basics.text + + +## Paragraphs, Headers, Blockquotes ## + +A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing spaces or tabs is considered +blank.) Normal paragraphs should not be indented with spaces or tabs. + +Markdown offers two styles of headers: *Setext* and *atx*. +Setext-style headers for `

` and `

` are created by +"underlining" with equal signs (`=`) and hyphens (`-`), respectively. +To create an atx-style header, you put 1-6 hash marks (`#`) at the +beginning of the line -- the number of hashes equals the resulting +HTML header level. + +Blockquotes are indicated using email-style '`>`' angle brackets. + +Markdown: + + A First Level Header + ==================== + + A Second Level Header + --------------------- + + Now is the time for all good men to come to + the aid of their country. This is just a + regular paragraph. + + The quick brown fox jumped over the lazy + dog's back. + + ### Header 3 + + > This is a blockquote. + > + > This is the second paragraph in the blockquote. + > + > ## This is an H2 in a blockquote + + +Output: + +

A First Level Header

+ +

A Second Level Header

+ +

Now is the time for all good men to come to + the aid of their country. This is just a + regular paragraph.

+ +

The quick brown fox jumped over the lazy + dog's back.

+ +

Header 3

+ +
+

This is a blockquote.

+ +

This is the second paragraph in the blockquote.

+ +

This is an H2 in a blockquote

+
+ + + +### Phrase Emphasis ### + +Markdown uses asterisks and underscores to indicate spans of emphasis. + +Markdown: + + Some of these words *are emphasized*. + Some of these words _are emphasized also_. + + Use two asterisks for **strong emphasis**. + Or, if you prefer, __use two underscores instead__. + +Output: + +

Some of these words are emphasized. + Some of these words are emphasized also.

+ +

Use two asterisks for strong emphasis. + Or, if you prefer, use two underscores instead.

+ + + +## Lists ## + +Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`, +`+`, and `-`) as list markers. These three markers are +interchangeable; this: + + * Candy. + * Gum. + * Booze. + +this: + + + Candy. + + Gum. + + Booze. + +and this: + + - Candy. + - Gum. + - Booze. + +all produce the same output: + +
    +
  • Candy.
  • +
  • Gum.
  • +
  • Booze.
  • +
+ +Ordered (numbered) lists use regular numbers, followed by periods, as +list markers: + + 1. Red + 2. Green + 3. Blue + +Output: + +
    +
  1. Red
  2. +
  3. Green
  4. +
  5. Blue
  6. +
+ +If you put blank lines between items, you'll get `

` tags for the +list item text. You can create multi-paragraph list items by indenting +the paragraphs by 4 spaces or 1 tab: + + * A list item. + + With multiple paragraphs. + + * Another item in the list. + +Output: + +

    +
  • A list item.

    +

    With multiple paragraphs.

  • +
  • Another item in the list.

  • +
+ + + +### Links ### + +Markdown supports two styles for creating links: *inline* and +*reference*. With both styles, you use square brackets to delimit the +text you want to turn into a link. + +Inline-style links use parentheses immediately after the link text. +For example: + + This is an [example link](http://example.com/). + +Output: + +

This is an + example link.

+ +Optionally, you may include a title attribute in the parentheses: + + This is an [example link](http://example.com/ "With a Title"). + +Output: + +

This is an + example link.

+ +Reference-style links allow you to refer to your links by names, which +you define elsewhere in your document: + + I get 10 times more traffic from [Google][1] than from + [Yahoo][2] or [MSN][3]. + + [1]: http://google.com/ "Google" + [2]: http://search.yahoo.com/ "Yahoo Search" + [3]: http://search.msn.com/ "MSN Search" + +Output: + +

I get 10 times more traffic from Google than from Yahoo or MSN.

+ +The title attribute is optional. Link names may contain letters, +numbers and spaces, but are *not* case sensitive: + + I start my morning with a cup of coffee and + [The New York Times][NY Times]. + + [ny times]: http://www.nytimes.com/ + +Output: + +

I start my morning with a cup of coffee and + The New York Times.

+ + +### Images ### + +Image syntax is very much like link syntax. + +Inline (titles are optional): + + ![alt text](/path/to/img.jpg "Title") + +Reference-style: + + ![alt text][id] + + [id]: /path/to/img.jpg "Title" + +Both of the above examples produce the same output: + + alt text + + + +### Code ### + +In a regular paragraph, you can create code span by wrapping text in +backtick quotes. Any ampersands (`&`) and angle brackets (`<` or +`>`) will automatically be translated into HTML entities. This makes +it easy to use Markdown to write about HTML example code: + + I strongly recommend against using any `` tags. + + I wish SmartyPants used named entities like `—` + instead of decimal-encoded entities like `—`. + +Output: + +

I strongly recommend against using any + <blink> tags.

+ +

I wish SmartyPants used named entities like + &mdash; instead of decimal-encoded + entities like &#8212;.

+ + +To specify an entire block of pre-formatted code, indent every line of +the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`, +and `>` characters will be escaped automatically. + +Markdown: + + If you want your page to validate under XHTML 1.0 Strict, + you've got to put paragraph tags in your blockquotes: + +
+

For example.

+
+ +Output: + +

If you want your page to validate under XHTML 1.0 Strict, + you've got to put paragraph tags in your blockquotes:

+ +
<blockquote>
+        <p>For example.</p>
+    </blockquote>
+    
diff --git a/tests/basic/markdown-syntax.html b/tests/basic/markdown-syntax.html new file mode 100644 index 0000000..cd7ba17 --- /dev/null +++ b/tests/basic/markdown-syntax.html @@ -0,0 +1,728 @@ +

Markdown: Syntax

+ + + +

Note: This document is itself written using Markdown; you +can see the source for it by adding '.text' to the URL.

+
+

Overview

+ +

Philosophy

+ +

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

+

Readability, however, is emphasized above all else. A Markdown-formatted +document should be publishable as-is, as plain text, without looking +like it's been marked up with tags or formatting instructions. While +Markdown's syntax has been influenced by several existing text-to-HTML +filters -- including Setext, atx, Textile, reStructuredText, +Grutatext, and EtText -- the single biggest source of +inspiration for Markdown's syntax is the format of plain text email.

+

To this end, Markdown's syntax is comprised entirely of punctuation +characters, which punctuation characters have been carefully chosen so +as to look like what they mean. E.g., asterisks around a word actually +look like *emphasis*. Markdown lists look like, well, lists. Even +blockquotes look like quoted passages of text, assuming you've ever +used email.

+

Inline HTML

+ +

Markdown's syntax is intended for one purpose: to be used as a +format for writing for the web.

+

Markdown is not a replacement for HTML, or even close to it. Its +syntax is very small, corresponding only to a very small subset of +HTML tags. The idea is not to create a syntax that makes it easier +to insert HTML tags. In my opinion, HTML tags are already easy to +insert. The idea for Markdown is to make it easy to read, write, and +edit prose. HTML is a publishing format; Markdown is a writing +format. Thus, Markdown's formatting syntax only addresses issues that +can be conveyed in plain text.

+

For any markup that is not covered by Markdown's syntax, you simply +use HTML itself. There's no need to preface it or delimit it to +indicate that you're switching from Markdown to HTML; you just use +the tags.

+

The only restrictions are that block-level HTML elements -- e.g. <div>, +<table>, <pre>, <p>, etc. -- must be separated from surrounding +content by blank lines, and the start and end tags of the block should +not be indented with tabs or spaces. Markdown is smart enough not +to add extra (unwanted) <p> tags around HTML block-level tags.

+

For example, to add an HTML table to a Markdown article:

+
This is a regular paragraph.
+
+<table>
+    <tr>
+        <td>Foo</td>
+    </tr>
+</table>
+
+This is another regular paragraph.
+
+

Note that Markdown formatting syntax is not processed within block-level +HTML tags. E.g., you can't use Markdown-style *emphasis* inside an +HTML block.

+

Span-level HTML tags -- e.g. <span>, <cite>, or <del> -- can be +used anywhere in a Markdown paragraph, list item, or header. If you +want, you can even use HTML tags instead of Markdown formatting; e.g. if +you'd prefer to use HTML <a> or <img> tags instead of Markdown's +link or image syntax, go right ahead.

+

Unlike block-level HTML tags, Markdown syntax is processed within +span-level tags.

+

Automatic Escaping for Special Characters

+ +

In HTML, there are two characters that demand special treatment: < +and &. Left angle brackets are used to start tags; ampersands are +used to denote HTML entities. If you want to use them as literal +characters, you must escape them as entities, e.g. &lt;, and +&amp;.

+

Ampersands in particular are bedeviling for web writers. If you want to +write about 'AT&T', you need to write 'AT&amp;T'. You even need to +escape ampersands within URLs. Thus, if you want to link to:

+
http://images.google.com/images?num=30&q=larry+bird
+
+

you need to encode the URL as:

+
http://images.google.com/images?num=30&amp;q=larry+bird
+
+

in your anchor tag href attribute. Needless to say, this is easy to +forget, and is probably the single most common source of HTML validation +errors in otherwise well-marked-up web sites.

+

Markdown allows you to use these characters naturally, taking care of +all the necessary escaping for you. If you use an ampersand as part of +an HTML entity, it remains unchanged; otherwise it will be translated +into &amp;.

+

So, if you want to include a copyright symbol in your article, you can write:

+
&copy;
+
+

and Markdown will leave it alone. But if you write:

+
AT&T
+
+

Markdown will translate it to:

+
AT&amp;T
+
+

Similarly, because Markdown supports inline HTML, if you use +angle brackets as delimiters for HTML tags, Markdown will treat them as +such. But if you write:

+
4 < 5
+
+

Markdown will translate it to:

+
4 &lt; 5
+
+

However, inside Markdown code spans and blocks, angle brackets and +ampersands are always encoded automatically. This makes it easy to use +Markdown to write about HTML code. (As opposed to raw HTML, which is a +terrible format for writing about HTML syntax, because every single < +and & in your example code needs to be escaped.)

+
+

Block Elements

+ +

Paragraphs and Line Breaks

+ +

A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing but spaces or tabs is considered +blank.) Normal paragraphs should not be indented with spaces or tabs.

+

The implication of the "one or more consecutive lines of text" rule is +that Markdown supports "hard-wrapped" text paragraphs. This differs +significantly from most other text-to-HTML formatters (including Movable +Type's "Convert Line Breaks" option) which translate every line break +character in a paragraph into a <br /> tag.

+

When you do want to insert a <br /> break tag using Markdown, you +end a line with two or more spaces, then type return.

+

Yes, this takes a tad more effort to create a <br />, but a simplistic +"every line break is a <br />" rule wouldn't work for Markdown. +Markdown's email-style blockquoting and multi-paragraph list items +work best -- and look better -- when you format them with hard breaks.

+ + +

Markdown supports two styles of headers, Setext and atx.

+

Setext-style headers are "underlined" using equal signs (for first-level +headers) and dashes (for second-level headers). For example:

+
This is an H1
+=============
+
+This is an H2
+-------------
+
+

Any number of underlining ='s or -'s will work.

+

Atx-style headers use 1-6 hash characters at the start of the line, +corresponding to header levels 1-6. For example:

+
# This is an H1
+
+## This is an H2
+
+###### This is an H6
+
+

Optionally, you may "close" atx-style headers. This is purely +cosmetic -- you can use this if you think it looks better. The +closing hashes don't even need to match the number of hashes +used to open the header. (The number of opening hashes +determines the header level.) :

+
# This is an H1 #
+
+## This is an H2 ##
+
+### This is an H3 ######
+
+

Blockquotes

+ +

Markdown uses email-style > characters for blockquoting. If you're +familiar with quoting passages of text in an email message, then you +know how to create a blockquote in Markdown. It looks best if you hard +wrap the text and put a > before every line:

+
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
+> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
+> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
+> 
+> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
+> id sem consectetuer libero luctus adipiscing.
+
+

Markdown allows you to be lazy and only put the > before the first +line of a hard-wrapped paragraph:

+
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
+consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
+Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
+
+> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
+id sem consectetuer libero luctus adipiscing.
+
+

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by +adding additional levels of >:

+
> This is the first level of quoting.
+>
+> > This is nested blockquote.
+>
+> Back to the first level.
+
+

Blockquotes can contain other Markdown elements, including headers, lists, +and code blocks:

+
> ## This is a header.
+> 
+> 1.   This is the first list item.
+> 2.   This is the second list item.
+> 
+> Here's some example code:
+> 
+>     return shell_exec("echo $input | $markdown_script");
+
+

Any decent text editor should make email-style quoting easy. For +example, with BBEdit, you can make a selection and choose Increase +Quote Level from the Text menu.

+

Lists

+ +

Markdown supports ordered (numbered) and unordered (bulleted) lists.

+

Unordered lists use asterisks, pluses, and hyphens -- interchangeably +-- as list markers:

+
*   Red
+*   Green
+*   Blue
+
+

is equivalent to:

+
+   Red
++   Green
++   Blue
+
+

and:

+
-   Red
+-   Green
+-   Blue
+
+

Ordered lists use numbers followed by periods:

+
1.  Bird
+2.  McHale
+3.  Parish
+
+

It's important to note that the actual numbers you use to mark the +list have no effect on the HTML output Markdown produces. The HTML +Markdown produces from the above list is:

+
<ol>
+<li>Bird</li>
+<li>McHale</li>
+<li>Parish</li>
+</ol>
+
+

If you instead wrote the list in Markdown like this:

+
1.  Bird
+1.  McHale
+1.  Parish
+
+

or even:

+
3. Bird
+1. McHale
+8. Parish
+
+

you'd get the exact same HTML output. The point is, if you want to, +you can use ordinal numbers in your ordered Markdown lists, so that +the numbers in your source match the numbers in your published HTML. +But if you want to be lazy, you don't have to.

+

If you do use lazy list numbering, however, you should still start the +list with the number 1. At some point in the future, Markdown may support +starting ordered lists at an arbitrary number.

+

List markers typically start at the left margin, but may be indented by +up to three spaces. List markers must be followed by one or more spaces +or a tab.

+

To make lists look nice, you can wrap items with hanging indents:

+
*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+    Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
+    viverra nec, fringilla in, laoreet vitae, risus.
+*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
+    Suspendisse id sem consectetuer libero luctus adipiscing.
+
+

But if you want to be lazy, you don't have to:

+
*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
+viverra nec, fringilla in, laoreet vitae, risus.
+*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
+Suspendisse id sem consectetuer libero luctus adipiscing.
+
+

If list items are separated by blank lines, Markdown will wrap the +items in <p> tags in the HTML output. For example, this input:

+
*   Bird
+*   Magic
+
+

will turn into:

+
<ul>
+<li>Bird</li>
+<li>Magic</li>
+</ul>
+
+

But this:

+
*   Bird
+
+*   Magic
+
+

will turn into:

+
<ul>
+<li><p>Bird</p></li>
+<li><p>Magic</p></li>
+</ul>
+
+

List items may consist of multiple paragraphs. Each subsequent +paragraph in a list item must be indented by either 4 spaces +or one tab:

+
1.  This is a list item with two paragraphs. Lorem ipsum dolor
+    sit amet, consectetuer adipiscing elit. Aliquam hendrerit
+    mi posuere lectus.
+
+    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
+    vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
+    sit amet velit.
+
+2.  Suspendisse id sem consectetuer libero luctus adipiscing.
+
+

It looks nice if you indent every line of the subsequent +paragraphs, but here again, Markdown will allow you to be +lazy:

+
*   This is a list item with two paragraphs.
+
+    This is the second paragraph in the list item. You're
+only required to indent the first line. Lorem ipsum dolor
+sit amet, consectetuer adipiscing elit.
+
+*   Another item in the same list.
+
+

To put a blockquote within a list item, the blockquote's > +delimiters need to be indented:

+
*   A list item with a blockquote:
+
+    > This is a blockquote
+    > inside a list item.
+
+

To put a code block within a list item, the code block needs +to be indented twice -- 8 spaces or two tabs:

+
*   A list item with a code block:
+
+        <code goes here>
+
+

It's worth noting that it's possible to trigger an ordered list by +accident, by writing something like this:

+
1986. What a great season.
+
+

In other words, a number-period-space sequence at the beginning of a +line. To avoid this, you can backslash-escape the period:

+
1986\. What a great season.
+
+

Code Blocks

+ +

Pre-formatted code blocks are used for writing about programming or +markup source code. Rather than forming normal paragraphs, the lines +of a code block are interpreted literally. Markdown wraps a code block +in both <pre> and <code> tags.

+

To produce a code block in Markdown, simply indent every line of the +block by at least 4 spaces or 1 tab. For example, given this input:

+
This is a normal paragraph:
+
+    This is a code block.
+
+

Markdown will generate:

+
<p>This is a normal paragraph:</p>
+
+<pre><code>This is a code block.
+</code></pre>
+
+

One level of indentation -- 4 spaces or 1 tab -- is removed from each +line of the code block. For example, this:

+
Here is an example of AppleScript:
+
+    tell application "Foo"
+        beep
+    end tell
+
+

will turn into:

+
<p>Here is an example of AppleScript:</p>
+
+<pre><code>tell application "Foo"
+    beep
+end tell
+</code></pre>
+
+

A code block continues until it reaches a line that is not indented +(or the end of the article).

+

Within a code block, ampersands (&) and angle brackets (< and >) +are automatically converted into HTML entities. This makes it very +easy to include example HTML source code using Markdown -- just paste +it and indent it, and Markdown will handle the hassle of encoding the +ampersands and angle brackets. For example, this:

+
    <div class="footer">
+        &copy; 2004 Foo Corporation
+    </div>
+
+

will turn into:

+
<pre><code>&lt;div class="footer"&gt;
+    &amp;copy; 2004 Foo Corporation
+&lt;/div&gt;
+</code></pre>
+
+

Regular Markdown syntax is not processed within code blocks. E.g., +asterisks are just literal asterisks within a code block. This means +it's also easy to use Markdown to write about Markdown's own syntax.

+

Horizontal Rules

+ +

You can produce a horizontal rule tag (<hr />) by placing three or +more hyphens, asterisks, or underscores on a line by themselves. If you +wish, you may use spaces between the hyphens or asterisks. Each of the +following lines will produce a horizontal rule:

+
* * *
+
+***
+
+*****
+
+- - -
+
+---------------------------------------
+
+_ _ _
+
+
+

Span Elements

+ + + +

Markdown supports two style of links: inline and reference.

+

In both styles, the link text is delimited by [square brackets].

+

To create an inline link, use a set of regular parentheses immediately +after the link text's closing square bracket. Inside the parentheses, +put the URL where you want the link to point, along with an optional +title for the link, surrounded in quotes. For example:

+
This is [an example](http://example.com/ "Title") inline link.
+
+[This link](http://example.net/) has no title attribute.
+
+

Will produce:

+
<p>This is <a href="http://example.com/" title="Title">
+an example</a> inline link.</p>
+
+<p><a href="http://example.net/">This link</a> has no
+title attribute.</p>
+
+

If you're referring to a local resource on the same server, you can +use relative paths:

+
See my [About](/about/) page for details.
+
+

Reference-style links use a second set of square brackets, inside +which you place a label of your choosing to identify the link:

+
This is [an example][id] reference-style link.
+
+

You can optionally use a space to separate the sets of brackets:

+
This is [an example] [id] reference-style link.
+
+

Then, anywhere in the document, you define your link label like this, +on a line by itself:

+
[id]: http://example.com/  "Optional Title Here"
+
+

That is:

+
    +
  • Square brackets containing the link identifier (optionally + indented from the left margin using up to three spaces);
  • +
  • followed by a colon;
  • +
  • followed by one or more spaces (or tabs);
  • +
  • followed by the URL for the link;
  • +
  • optionally followed by a title attribute for the link, enclosed + in double or single quotes.
  • +
+

The link URL may, optionally, be surrounded by angle brackets:

+
[id]: <http://example.com/>  "Optional Title Here"
+
+

You can put the title attribute on the next line and use extra spaces +or tabs for padding, which tends to look better with longer URLs:

+
[id]: http://example.com/longish/path/to/resource/here
+    "Optional Title Here"
+
+

Link definitions are only used for creating links during Markdown +processing, and are stripped from your document in the HTML output.

+

Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are not case sensitive. E.g. these two links:

+
[link text][a]
+[link text][A]
+
+

are equivalent.

+

The implicit link name shortcut allows you to omit the name of the +link, in which case the link text itself is used as the name. +Just use an empty set of square brackets -- e.g., to link the word +"Google" to the google.com web site, you could simply write:

+
[Google][]
+
+

And then define the link:

+
[Google]: http://google.com/
+
+

Because link names may contain spaces, this shortcut even works for +multiple words in the link text:

+
Visit [Daring Fireball][] for more information.
+
+

And then define the link:

+
[Daring Fireball]: http://daringfireball.net/
+
+

Link definitions can be placed anywhere in your Markdown document. I +tend to put them immediately after each paragraph in which they're +used, but if you want, you can put them all at the end of your +document, sort of like footnotes.

+

Here's an example of reference links in action:

+
I get 10 times more traffic from [Google] [1] than from
+[Yahoo] [2] or [MSN] [3].
+
+  [1]: http://google.com/        "Google"
+  [2]: http://search.yahoo.com/  "Yahoo Search"
+  [3]: http://search.msn.com/    "MSN Search"
+
+

Using the implicit link name shortcut, you could instead write:

+
I get 10 times more traffic from [Google][] than from
+[Yahoo][] or [MSN][].
+
+  [google]: http://google.com/        "Google"
+  [yahoo]:  http://search.yahoo.com/  "Yahoo Search"
+  [msn]:    http://search.msn.com/    "MSN Search"
+
+

Both of the above examples will produce the following HTML output:

+
<p>I get 10 times more traffic from <a href="http://google.com/"
+title="Google">Google</a> than from
+<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
+or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
+
+

For comparison, here is the same paragraph written using +Markdown's inline link style:

+
I get 10 times more traffic from [Google](http://google.com/ "Google")
+than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
+[MSN](http://search.msn.com/ "MSN Search").
+
+

The point of reference-style links is not that they're easier to +write. The point is that with reference-style links, your document +source is vastly more readable. Compare the above examples: using +reference-style links, the paragraph itself is only 81 characters +long; with inline-style links, it's 176 characters; and as raw HTML, +it's 234 characters. In the raw HTML, there's more markup than there +is text.

+

With Markdown's reference-style links, a source document much more +closely resembles the final output, as rendered in a browser. By +allowing you to move the markup-related metadata out of the paragraph, +you can add links without interrupting the narrative flow of your +prose.

+

Emphasis

+ +

Markdown treats asterisks (*) and underscores (_) as indicators of +emphasis. Text wrapped with one * or _ will be wrapped with an +HTML <em> tag; double *'s or _'s will be wrapped with an HTML +<strong> tag. E.g., this input:

+
*single asterisks*
+
+_single underscores_
+
+**double asterisks**
+
+__double underscores__
+
+

will produce:

+
<em>single asterisks</em>
+
+<em>single underscores</em>
+
+<strong>double asterisks</strong>
+
+<strong>double underscores</strong>
+
+

You can use whichever style you prefer; the lone restriction is that +the same character must be used to open and close an emphasis span.

+

Emphasis can be used in the middle of a word:

+
un*fucking*believable
+
+

But if you surround an * or _ with spaces, it'll be treated as a +literal asterisk or underscore.

+

To produce a literal asterisk or underscore at a position where it +would otherwise be used as an emphasis delimiter, you can backslash +escape it:

+
\*this text is surrounded by literal asterisks\*
+
+

Code

+ +

To indicate a span of code, wrap it with backtick quotes (`). +Unlike a pre-formatted code block, a code span indicates code within a +normal paragraph. For example:

+
Use the `printf()` function.
+
+

will produce:

+
<p>Use the <code>printf()</code> function.</p>
+
+

To include a literal backtick character within a code span, you can use +multiple backticks as the opening and closing delimiters:

+
``There is a literal backtick (`) here.``
+
+

which will produce this:

+
<p><code>There is a literal backtick (`) here.</code></p>
+
+

The backtick delimiters surrounding a code span may include spaces -- +one after the opening, one before the closing. This allows you to place +literal backtick characters at the beginning or end of a code span:

+
A single backtick in a code span: `` ` ``
+
+A backtick-delimited string in a code span: `` `foo` ``
+
+

will produce:

+
<p>A single backtick in a code span: <code>`</code></p>
+
+<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
+
+

With a code span, ampersands and angle brackets are encoded as HTML +entities automatically, which makes it easy to include example HTML +tags. Markdown will turn this:

+
Please don't use any `<blink>` tags.
+
+

into:

+
<p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
+
+

You can write this:

+
`&#8212;` is the decimal-encoded equivalent of `&mdash;`.
+
+

to produce:

+
<p><code>&amp;#8212;</code> is the decimal-encoded
+equivalent of <code>&amp;mdash;</code>.</p>
+
+

Images

+ +

Admittedly, it's fairly difficult to devise a "natural" syntax for +placing images into a plain text document format.

+

Markdown uses an image syntax that is intended to resemble the syntax +for links, allowing for two styles: inline and reference.

+

Inline image syntax looks like this:

+
![Alt text](/path/to/img.jpg)
+
+![Alt text](/path/to/img.jpg "Optional title")
+
+

That is:

+
    +
  • An exclamation mark: !;
  • +
  • followed by a set of square brackets, containing the alt + attribute text for the image;
  • +
  • followed by a set of parentheses, containing the URL or path to + the image, and an optional title attribute enclosed in double + or single quotes.
  • +
+

Reference-style image syntax looks like this:

+
![Alt text][id]
+
+

Where "id" is the name of a defined image reference. Image references +are defined using syntax identical to link references:

+
[id]: url/to/image  "Optional title attribute"
+
+

As of this writing, Markdown has no syntax for specifying the +dimensions of an image; if this is important to you, you can simply +use regular HTML <img> tags.

+
+

Miscellaneous

+ + + +

Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

+
<http://example.com/>
+
+

Markdown will turn this into:

+
<a href="http://example.com/">http://example.com/</a>
+
+

Automatic links for email addresses work similarly, except that +Markdown will also perform a bit of randomized decimal and hex +entity-encoding to help obscure your address from address-harvesting +spambots. For example, Markdown will turn this:

+
<address@example.com>
+
+

into something like this:

+
<a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
+&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
+&#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
+&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
+
+

which will render in a browser as a clickable link to "address@example.com".

+

(This sort of entity-encoding trick will indeed fool many, if not +most, address-harvesting bots, but it definitely won't fool all of +them. It's better than nothing, but an address published in this way +will probably eventually start receiving spam.)

+

Backslash Escapes

+ +

Markdown allows you to use backslash escapes to generate literal +characters which would otherwise have special meaning in Markdown's +formatting syntax. For example, if you wanted to surround a word with +literal asterisks (instead of an HTML <em> tag), you can backslashes +before the asterisks, like this:

+
\*literal asterisks\*
+
+

Markdown provides backslash escapes for the following characters:

+
\   backslash
+`   backtick
+*   asterisk
+_   underscore
+{}  curly braces
+[]  square brackets
+()  parentheses
+#   hash mark
++   plus sign
+-   minus sign (hyphen)
+.   dot
+!   exclamation mark
+
\ No newline at end of file diff --git a/tests/basic/markdown-syntax.txt b/tests/basic/markdown-syntax.txt new file mode 100644 index 0000000..38f6e78 --- /dev/null +++ b/tests/basic/markdown-syntax.txt @@ -0,0 +1,888 @@ +Markdown: Syntax +================ + + + + +* [Overview](#overview) + * [Philosophy](#philosophy) + * [Inline HTML](#html) + * [Automatic Escaping for Special Characters](#autoescape) +* [Block Elements](#block) + * [Paragraphs and Line Breaks](#p) + * [Headers](#header) + * [Blockquotes](#blockquote) + * [Lists](#list) + * [Code Blocks](#precode) + * [Horizontal Rules](#hr) +* [Span Elements](#span) + * [Links](#link) + * [Emphasis](#em) + * [Code](#code) + * [Images](#img) +* [Miscellaneous](#misc) + * [Backslash Escapes](#backslash) + * [Automatic Links](#autolink) + + +**Note:** This document is itself written using Markdown; you +can [see the source for it by adding '.text' to the URL][src]. + + [src]: /projects/markdown/syntax.text + +* * * + +

Overview

+ +

Philosophy

+ +Markdown is intended to be as easy-to-read and easy-to-write as is feasible. + +Readability, however, is emphasized above all else. A Markdown-formatted +document should be publishable as-is, as plain text, without looking +like it's been marked up with tags or formatting instructions. While +Markdown's syntax has been influenced by several existing text-to-HTML +filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4], +[Grutatext] [5], and [EtText] [6] -- the single biggest source of +inspiration for Markdown's syntax is the format of plain text email. + + [1]: http://docutils.sourceforge.net/mirror/setext.html + [2]: http://www.aaronsw.com/2002/atx/ + [3]: http://textism.com/tools/textile/ + [4]: http://docutils.sourceforge.net/rst.html + [5]: http://www.triptico.com/software/grutatxt.html + [6]: http://ettext.taint.org/doc/ + +To this end, Markdown's syntax is comprised entirely of punctuation +characters, which punctuation characters have been carefully chosen so +as to look like what they mean. E.g., asterisks around a word actually +look like \*emphasis\*. Markdown lists look like, well, lists. Even +blockquotes look like quoted passages of text, assuming you've ever +used email. + + + +

Inline HTML

+ +Markdown's syntax is intended for one purpose: to be used as a +format for *writing* for the web. + +Markdown is not a replacement for HTML, or even close to it. Its +syntax is very small, corresponding only to a very small subset of +HTML tags. The idea is *not* to create a syntax that makes it easier +to insert HTML tags. In my opinion, HTML tags are already easy to +insert. The idea for Markdown is to make it easy to read, write, and +edit prose. HTML is a *publishing* format; Markdown is a *writing* +format. Thus, Markdown's formatting syntax only addresses issues that +can be conveyed in plain text. + +For any markup that is not covered by Markdown's syntax, you simply +use HTML itself. There's no need to preface it or delimit it to +indicate that you're switching from Markdown to HTML; you just use +the tags. + +The only restrictions are that block-level HTML elements -- e.g. `
`, +``, `
`, `

`, etc. -- must be separated from surrounding +content by blank lines, and the start and end tags of the block should +not be indented with tabs or spaces. Markdown is smart enough not +to add extra (unwanted) `

` tags around HTML block-level tags. + +For example, to add an HTML table to a Markdown article: + + This is a regular paragraph. + +

+ + + +
Foo
+ + This is another regular paragraph. + +Note that Markdown formatting syntax is not processed within block-level +HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an +HTML block. + +Span-level HTML tags -- e.g. ``, ``, or `` -- can be +used anywhere in a Markdown paragraph, list item, or header. If you +want, you can even use HTML tags instead of Markdown formatting; e.g. if +you'd prefer to use HTML `` or `` tags instead of Markdown's +link or image syntax, go right ahead. + +Unlike block-level HTML tags, Markdown syntax *is* processed within +span-level tags. + + +

Automatic Escaping for Special Characters

+ +In HTML, there are two characters that demand special treatment: `<` +and `&`. Left angle brackets are used to start tags; ampersands are +used to denote HTML entities. If you want to use them as literal +characters, you must escape them as entities, e.g. `<`, and +`&`. + +Ampersands in particular are bedeviling for web writers. If you want to +write about 'AT&T', you need to write '`AT&T`'. You even need to +escape ampersands within URLs. Thus, if you want to link to: + + http://images.google.com/images?num=30&q=larry+bird + +you need to encode the URL as: + + http://images.google.com/images?num=30&q=larry+bird + +in your anchor tag `href` attribute. Needless to say, this is easy to +forget, and is probably the single most common source of HTML validation +errors in otherwise well-marked-up web sites. + +Markdown allows you to use these characters naturally, taking care of +all the necessary escaping for you. If you use an ampersand as part of +an HTML entity, it remains unchanged; otherwise it will be translated +into `&`. + +So, if you want to include a copyright symbol in your article, you can write: + + © + +and Markdown will leave it alone. But if you write: + + AT&T + +Markdown will translate it to: + + AT&T + +Similarly, because Markdown supports [inline HTML](#html), if you use +angle brackets as delimiters for HTML tags, Markdown will treat them as +such. But if you write: + + 4 < 5 + +Markdown will translate it to: + + 4 < 5 + +However, inside Markdown code spans and blocks, angle brackets and +ampersands are *always* encoded automatically. This makes it easy to use +Markdown to write about HTML code. (As opposed to raw HTML, which is a +terrible format for writing about HTML syntax, because every single `<` +and `&` in your example code needs to be escaped.) + + +* * * + + +

Block Elements

+ + +

Paragraphs and Line Breaks

+ +A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing but spaces or tabs is considered +blank.) Normal paragraphs should not be indented with spaces or tabs. + +The implication of the "one or more consecutive lines of text" rule is +that Markdown supports "hard-wrapped" text paragraphs. This differs +significantly from most other text-to-HTML formatters (including Movable +Type's "Convert Line Breaks" option) which translate every line break +character in a paragraph into a `
` tag. + +When you *do* want to insert a `
` break tag using Markdown, you +end a line with two or more spaces, then type return. + +Yes, this takes a tad more effort to create a `
`, but a simplistic +"every line break is a `
`" rule wouldn't work for Markdown. +Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l] +work best -- and look better -- when you format them with hard breaks. + + [bq]: #blockquote + [l]: #list + + + + + +Markdown supports two styles of headers, [Setext] [1] and [atx] [2]. + +Setext-style headers are "underlined" using equal signs (for first-level +headers) and dashes (for second-level headers). For example: + + This is an H1 + ============= + + This is an H2 + ------------- + +Any number of underlining `=`'s or `-`'s will work. + +Atx-style headers use 1-6 hash characters at the start of the line, +corresponding to header levels 1-6. For example: + + # This is an H1 + + ## This is an H2 + + ###### This is an H6 + +Optionally, you may "close" atx-style headers. This is purely +cosmetic -- you can use this if you think it looks better. The +closing hashes don't even need to match the number of hashes +used to open the header. (The number of opening hashes +determines the header level.) : + + # This is an H1 # + + ## This is an H2 ## + + ### This is an H3 ###### + + +

Blockquotes

+ +Markdown uses email-style `>` characters for blockquoting. If you're +familiar with quoting passages of text in an email message, then you +know how to create a blockquote in Markdown. It looks best if you hard +wrap the text and put a `>` before every line: + + > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, + > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. + > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + > + > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse + > id sem consectetuer libero luctus adipiscing. + +Markdown allows you to be lazy and only put the `>` before the first +line of a hard-wrapped paragraph: + + > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, + consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. + Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + + > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse + id sem consectetuer libero luctus adipiscing. + +Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by +adding additional levels of `>`: + + > This is the first level of quoting. + > + > > This is nested blockquote. + > + > Back to the first level. + +Blockquotes can contain other Markdown elements, including headers, lists, +and code blocks: + + > ## This is a header. + > + > 1. This is the first list item. + > 2. This is the second list item. + > + > Here's some example code: + > + > return shell_exec("echo $input | $markdown_script"); + +Any decent text editor should make email-style quoting easy. For +example, with BBEdit, you can make a selection and choose Increase +Quote Level from the Text menu. + + +

Lists

+ +Markdown supports ordered (numbered) and unordered (bulleted) lists. + +Unordered lists use asterisks, pluses, and hyphens -- interchangeably +-- as list markers: + + * Red + * Green + * Blue + +is equivalent to: + + + Red + + Green + + Blue + +and: + + - Red + - Green + - Blue + +Ordered lists use numbers followed by periods: + + 1. Bird + 2. McHale + 3. Parish + +It's important to note that the actual numbers you use to mark the +list have no effect on the HTML output Markdown produces. The HTML +Markdown produces from the above list is: + +
    +
  1. Bird
  2. +
  3. McHale
  4. +
  5. Parish
  6. +
+ +If you instead wrote the list in Markdown like this: + + 1. Bird + 1. McHale + 1. Parish + +or even: + + 3. Bird + 1. McHale + 8. Parish + +you'd get the exact same HTML output. The point is, if you want to, +you can use ordinal numbers in your ordered Markdown lists, so that +the numbers in your source match the numbers in your published HTML. +But if you want to be lazy, you don't have to. + +If you do use lazy list numbering, however, you should still start the +list with the number 1. At some point in the future, Markdown may support +starting ordered lists at an arbitrary number. + +List markers typically start at the left margin, but may be indented by +up to three spaces. List markers must be followed by one or more spaces +or a tab. + +To make lists look nice, you can wrap items with hanging indents: + + * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. + * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +But if you want to be lazy, you don't have to: + + * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. + * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +If list items are separated by blank lines, Markdown will wrap the +items in `

` tags in the HTML output. For example, this input: + + * Bird + * Magic + +will turn into: + +

    +
  • Bird
  • +
  • Magic
  • +
+ +But this: + + * Bird + + * Magic + +will turn into: + +
    +
  • Bird

  • +
  • Magic

  • +
+ +List items may consist of multiple paragraphs. Each subsequent +paragraph in a list item must be indented by either 4 spaces +or one tab: + + 1. This is a list item with two paragraphs. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. Aliquam hendrerit + mi posuere lectus. + + Vestibulum enim wisi, viverra nec, fringilla in, laoreet + vitae, risus. Donec sit amet nisl. Aliquam semper ipsum + sit amet velit. + + 2. Suspendisse id sem consectetuer libero luctus adipiscing. + +It looks nice if you indent every line of the subsequent +paragraphs, but here again, Markdown will allow you to be +lazy: + + * This is a list item with two paragraphs. + + This is the second paragraph in the list item. You're + only required to indent the first line. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. + + * Another item in the same list. + +To put a blockquote within a list item, the blockquote's `>` +delimiters need to be indented: + + * A list item with a blockquote: + + > This is a blockquote + > inside a list item. + +To put a code block within a list item, the code block needs +to be indented *twice* -- 8 spaces or two tabs: + + * A list item with a code block: + + + + +It's worth noting that it's possible to trigger an ordered list by +accident, by writing something like this: + + 1986. What a great season. + +In other words, a *number-period-space* sequence at the beginning of a +line. To avoid this, you can backslash-escape the period: + + 1986\. What a great season. + + + +

Code Blocks

+ +Pre-formatted code blocks are used for writing about programming or +markup source code. Rather than forming normal paragraphs, the lines +of a code block are interpreted literally. Markdown wraps a code block +in both `
` and `` tags.
+
+To produce a code block in Markdown, simply indent every line of the
+block by at least 4 spaces or 1 tab. For example, given this input:
+
+    This is a normal paragraph:
+
+        This is a code block.
+
+Markdown will generate:
+
+    

This is a normal paragraph:

+ +
This is a code block.
+    
+ +One level of indentation -- 4 spaces or 1 tab -- is removed from each +line of the code block. For example, this: + + Here is an example of AppleScript: + + tell application "Foo" + beep + end tell + +will turn into: + +

Here is an example of AppleScript:

+ +
tell application "Foo"
+        beep
+    end tell
+    
+ +A code block continues until it reaches a line that is not indented +(or the end of the article). + +Within a code block, ampersands (`&`) and angle brackets (`<` and `>`) +are automatically converted into HTML entities. This makes it very +easy to include example HTML source code using Markdown -- just paste +it and indent it, and Markdown will handle the hassle of encoding the +ampersands and angle brackets. For example, this: + + + +will turn into: + +
<div class="footer">
+        &copy; 2004 Foo Corporation
+    </div>
+    
+ +Regular Markdown syntax is not processed within code blocks. E.g., +asterisks are just literal asterisks within a code block. This means +it's also easy to use Markdown to write about Markdown's own syntax. + + + +

Horizontal Rules

+ +You can produce a horizontal rule tag (`
`) by placing three or +more hyphens, asterisks, or underscores on a line by themselves. If you +wish, you may use spaces between the hyphens or asterisks. Each of the +following lines will produce a horizontal rule: + + * * * + + *** + + ***** + + - - - + + --------------------------------------- + + _ _ _ + + +* * * + +

Span Elements

+ + + +Markdown supports two style of links: *inline* and *reference*. + +In both styles, the link text is delimited by [square brackets]. + +To create an inline link, use a set of regular parentheses immediately +after the link text's closing square bracket. Inside the parentheses, +put the URL where you want the link to point, along with an *optional* +title for the link, surrounded in quotes. For example: + + This is [an example](http://example.com/ "Title") inline link. + + [This link](http://example.net/) has no title attribute. + +Will produce: + +

This is + an example inline link.

+ +

This link has no + title attribute.

+ +If you're referring to a local resource on the same server, you can +use relative paths: + + See my [About](/about/) page for details. + +Reference-style links use a second set of square brackets, inside +which you place a label of your choosing to identify the link: + + This is [an example][id] reference-style link. + +You can optionally use a space to separate the sets of brackets: + + This is [an example] [id] reference-style link. + +Then, anywhere in the document, you define your link label like this, +on a line by itself: + + [id]: http://example.com/ "Optional Title Here" + +That is: + +* Square brackets containing the link identifier (optionally + indented from the left margin using up to three spaces); +* followed by a colon; +* followed by one or more spaces (or tabs); +* followed by the URL for the link; +* optionally followed by a title attribute for the link, enclosed + in double or single quotes. + +The link URL may, optionally, be surrounded by angle brackets: + + [id]: "Optional Title Here" + +You can put the title attribute on the next line and use extra spaces +or tabs for padding, which tends to look better with longer URLs: + + [id]: http://example.com/longish/path/to/resource/here + "Optional Title Here" + +Link definitions are only used for creating links during Markdown +processing, and are stripped from your document in the HTML output. + +Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links: + + [link text][a] + [link text][A] + +are equivalent. + +The *implicit link name* shortcut allows you to omit the name of the +link, in which case the link text itself is used as the name. +Just use an empty set of square brackets -- e.g., to link the word +"Google" to the google.com web site, you could simply write: + + [Google][] + +And then define the link: + + [Google]: http://google.com/ + +Because link names may contain spaces, this shortcut even works for +multiple words in the link text: + + Visit [Daring Fireball][] for more information. + +And then define the link: + + [Daring Fireball]: http://daringfireball.net/ + +Link definitions can be placed anywhere in your Markdown document. I +tend to put them immediately after each paragraph in which they're +used, but if you want, you can put them all at the end of your +document, sort of like footnotes. + +Here's an example of reference links in action: + + I get 10 times more traffic from [Google] [1] than from + [Yahoo] [2] or [MSN] [3]. + + [1]: http://google.com/ "Google" + [2]: http://search.yahoo.com/ "Yahoo Search" + [3]: http://search.msn.com/ "MSN Search" + +Using the implicit link name shortcut, you could instead write: + + I get 10 times more traffic from [Google][] than from + [Yahoo][] or [MSN][]. + + [google]: http://google.com/ "Google" + [yahoo]: http://search.yahoo.com/ "Yahoo Search" + [msn]: http://search.msn.com/ "MSN Search" + +Both of the above examples will produce the following HTML output: + +

I get 10 times more traffic from Google than from + Yahoo + or MSN.

+ +For comparison, here is the same paragraph written using +Markdown's inline link style: + + I get 10 times more traffic from [Google](http://google.com/ "Google") + than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or + [MSN](http://search.msn.com/ "MSN Search"). + +The point of reference-style links is not that they're easier to +write. The point is that with reference-style links, your document +source is vastly more readable. Compare the above examples: using +reference-style links, the paragraph itself is only 81 characters +long; with inline-style links, it's 176 characters; and as raw HTML, +it's 234 characters. In the raw HTML, there's more markup than there +is text. + +With Markdown's reference-style links, a source document much more +closely resembles the final output, as rendered in a browser. By +allowing you to move the markup-related metadata out of the paragraph, +you can add links without interrupting the narrative flow of your +prose. + + +

Emphasis

+ +Markdown treats asterisks (`*`) and underscores (`_`) as indicators of +emphasis. Text wrapped with one `*` or `_` will be wrapped with an +HTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML +`` tag. E.g., this input: + + *single asterisks* + + _single underscores_ + + **double asterisks** + + __double underscores__ + +will produce: + + single asterisks + + single underscores + + double asterisks + + double underscores + +You can use whichever style you prefer; the lone restriction is that +the same character must be used to open and close an emphasis span. + +Emphasis can be used in the middle of a word: + + un*fucking*believable + +But if you surround an `*` or `_` with spaces, it'll be treated as a +literal asterisk or underscore. + +To produce a literal asterisk or underscore at a position where it +would otherwise be used as an emphasis delimiter, you can backslash +escape it: + + \*this text is surrounded by literal asterisks\* + + + +

Code

+ +To indicate a span of code, wrap it with backtick quotes (`` ` ``). +Unlike a pre-formatted code block, a code span indicates code within a +normal paragraph. For example: + + Use the `printf()` function. + +will produce: + +

Use the printf() function.

+ +To include a literal backtick character within a code span, you can use +multiple backticks as the opening and closing delimiters: + + ``There is a literal backtick (`) here.`` + +which will produce this: + +

There is a literal backtick (`) here.

+ +The backtick delimiters surrounding a code span may include spaces -- +one after the opening, one before the closing. This allows you to place +literal backtick characters at the beginning or end of a code span: + + A single backtick in a code span: `` ` `` + + A backtick-delimited string in a code span: `` `foo` `` + +will produce: + +

A single backtick in a code span: `

+ +

A backtick-delimited string in a code span: `foo`

+ +With a code span, ampersands and angle brackets are encoded as HTML +entities automatically, which makes it easy to include example HTML +tags. Markdown will turn this: + + Please don't use any `` tags. + +into: + +

Please don't use any <blink> tags.

+ +You can write this: + + `—` is the decimal-encoded equivalent of `—`. + +to produce: + +

&#8212; is the decimal-encoded + equivalent of &mdash;.

+ + + +

Images

+ +Admittedly, it's fairly difficult to devise a "natural" syntax for +placing images into a plain text document format. + +Markdown uses an image syntax that is intended to resemble the syntax +for links, allowing for two styles: *inline* and *reference*. + +Inline image syntax looks like this: + + ![Alt text](/path/to/img.jpg) + + ![Alt text](/path/to/img.jpg "Optional title") + +That is: + +* An exclamation mark: `!`; +* followed by a set of square brackets, containing the `alt` + attribute text for the image; +* followed by a set of parentheses, containing the URL or path to + the image, and an optional `title` attribute enclosed in double + or single quotes. + +Reference-style image syntax looks like this: + + ![Alt text][id] + +Where "id" is the name of a defined image reference. Image references +are defined using syntax identical to link references: + + [id]: url/to/image "Optional title attribute" + +As of this writing, Markdown has no syntax for specifying the +dimensions of an image; if this is important to you, you can simply +use regular HTML `` tags. + + +* * * + + +

Miscellaneous

+ + + +Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this: + + + +Markdown will turn this into: + + http://example.com/ + +Automatic links for email addresses work similarly, except that +Markdown will also perform a bit of randomized decimal and hex +entity-encoding to help obscure your address from address-harvesting +spambots. For example, Markdown will turn this: + + + +into something like this: + + address@exa + mple.com + +which will render in a browser as a clickable link to "address@example.com". + +(This sort of entity-encoding trick will indeed fool many, if not +most, address-harvesting bots, but it definitely won't fool all of +them. It's better than nothing, but an address published in this way +will probably eventually start receiving spam.) + + + +

Backslash Escapes

+ +Markdown allows you to use backslash escapes to generate literal +characters which would otherwise have special meaning in Markdown's +formatting syntax. For example, if you wanted to surround a word with +literal asterisks (instead of an HTML `` tag), you can backslashes +before the asterisks, like this: + + \*literal asterisks\* + +Markdown provides backslash escapes for the following characters: + + \ backslash + ` backtick + * asterisk + _ underscore + {} curly braces + [] square brackets + () parentheses + # hash mark + + plus sign + - minus sign (hyphen) + . dot + ! exclamation mark + diff --git a/tests/basic/nested-blockquotes.html b/tests/basic/nested-blockquotes.html new file mode 100644 index 0000000..f1b017e --- /dev/null +++ b/tests/basic/nested-blockquotes.html @@ -0,0 +1,7 @@ +
+

foo

+
+

bar

+
+

foo

+
\ No newline at end of file diff --git a/tests/basic/nested-blockquotes.txt b/tests/basic/nested-blockquotes.txt new file mode 100644 index 0000000..ed3c624 --- /dev/null +++ b/tests/basic/nested-blockquotes.txt @@ -0,0 +1,5 @@ +> foo +> +> > bar +> +> foo diff --git a/tests/basic/ordered-and-unordered-list.html b/tests/basic/ordered-and-unordered-list.html new file mode 100644 index 0000000..090c43c --- /dev/null +++ b/tests/basic/ordered-and-unordered-list.html @@ -0,0 +1,146 @@ +

Unordered

+

Asterisks tight:

+
    +
  • asterisk 1
  • +
  • asterisk 2
  • +
  • asterisk 3
  • +
+

Asterisks loose:

+
    +
  • +

    asterisk 1

    +
  • +
  • +

    asterisk 2

    +
  • +
  • +

    asterisk 3

    +
  • +
+
+

Pluses tight:

+
    +
  • Plus 1
  • +
  • Plus 2
  • +
  • Plus 3
  • +
+

Pluses loose:

+
    +
  • +

    Plus 1

    +
  • +
  • +

    Plus 2

    +
  • +
  • +

    Plus 3

    +
  • +
+
+

Minuses tight:

+
    +
  • Minus 1
  • +
  • Minus 2
  • +
  • Minus 3
  • +
+

Minuses loose:

+
    +
  • +

    Minus 1

    +
  • +
  • +

    Minus 2

    +
  • +
  • +

    Minus 3

    +
  • +
+

Ordered

+

Tight:

+
    +
  1. First
  2. +
  3. Second
  4. +
  5. Third
  6. +
+

and:

+
    +
  1. One
  2. +
  3. Two
  4. +
  5. Three
  6. +
+

Loose using tabs:

+
    +
  1. +

    First

    +
  2. +
  3. +

    Second

    +
  4. +
  5. +

    Third

    +
  6. +
+

and using spaces:

+
    +
  1. +

    One

    +
  2. +
  3. +

    Two

    +
  4. +
  5. +

    Three

    +
  6. +
+

Multiple paragraphs:

+
    +
  1. +

    Item 1, graf one.

    +

    Item 2. graf two. The quick brown fox jumped over the lazy dog's +back.

    +
  2. +
  3. +

    Item 2.

    +
  4. +
  5. +

    Item 3.

    +
  6. +
+

Nested

+
    +
  • Tab
      +
    • Tab
        +
      • Tab
      • +
      +
    • +
    +
  • +
+

Here's another:

+
    +
  1. First
  2. +
  3. Second:
      +
    • Fee
    • +
    • Fie
    • +
    • Foe
    • +
    +
  4. +
  5. Third
  6. +
+

Same thing but with paragraphs:

+
    +
  1. +

    First

    +
  2. +
  3. +

    Second:

    +
      +
    • Fee
    • +
    • Fie
    • +
    • Foe
    • +
    +
  4. +
  5. +

    Third

    +
  6. +
\ No newline at end of file diff --git a/tests/basic/ordered-and-unordered-list.txt b/tests/basic/ordered-and-unordered-list.txt new file mode 100644 index 0000000..621db58 --- /dev/null +++ b/tests/basic/ordered-and-unordered-list.txt @@ -0,0 +1,122 @@ +## Unordered + +Asterisks tight: + +* asterisk 1 +* asterisk 2 +* asterisk 3 + + +Asterisks loose: + +* asterisk 1 + +* asterisk 2 + +* asterisk 3 + +* * * + +Pluses tight: + ++ Plus 1 ++ Plus 2 ++ Plus 3 + + +Pluses loose: + ++ Plus 1 + ++ Plus 2 + ++ Plus 3 + +* * * + + +Minuses tight: + +- Minus 1 +- Minus 2 +- Minus 3 + + +Minuses loose: + +- Minus 1 + +- Minus 2 + +- Minus 3 + + +## Ordered + +Tight: + +1. First +2. Second +3. Third + +and: + +1. One +2. Two +3. Three + + +Loose using tabs: + +1. First + +2. Second + +3. Third + +and using spaces: + +1. One + +2. Two + +3. Three + +Multiple paragraphs: + +1. Item 1, graf one. + + Item 2. graf two. The quick brown fox jumped over the lazy dog's + back. + +2. Item 2. + +3. Item 3. + + + +## Nested + +* Tab + * Tab + * Tab + +Here's another: + +1. First +2. Second: + * Fee + * Fie + * Foe +3. Third + +Same thing but with paragraphs: + +1. First + +2. Second: + * Fee + * Fie + * Foe + +3. Third diff --git a/tests/basic/strong-and-em-together.html b/tests/basic/strong-and-em-together.html new file mode 100644 index 0000000..7bf5163 --- /dev/null +++ b/tests/basic/strong-and-em-together.html @@ -0,0 +1,4 @@ +

This is strong and em.

+

So is this word.

+

This is strong and em.

+

So is this word.

\ No newline at end of file diff --git a/tests/basic/strong-and-em-together.txt b/tests/basic/strong-and-em-together.txt new file mode 100644 index 0000000..95ee690 --- /dev/null +++ b/tests/basic/strong-and-em-together.txt @@ -0,0 +1,7 @@ +***This is strong and em.*** + +So is ***this*** word. + +___This is strong and em.___ + +So is ___this___ word. diff --git a/tests/basic/tabs.html b/tests/basic/tabs.html new file mode 100644 index 0000000..3c11f14 --- /dev/null +++ b/tests/basic/tabs.html @@ -0,0 +1,23 @@ +
    +
  • +

    this is a list item + indented with tabs

    +
  • +
  • +

    this is a list item + indented with spaces

    +
  • +
+

Code:

+
this code block is indented by one tab
+
+

And:

+
    this code block is indented by two tabs
+
+

And:

+
+   this is an example list item
+    indented with tabs
+
++   this is an example list item
+    indented with spaces
+
\ No newline at end of file diff --git a/tests/basic/tabs.txt b/tests/basic/tabs.txt new file mode 100644 index 0000000..589d113 --- /dev/null +++ b/tests/basic/tabs.txt @@ -0,0 +1,21 @@ ++ this is a list item + indented with tabs + ++ this is a list item + indented with spaces + +Code: + + this code block is indented by one tab + +And: + + this code block is indented by two tabs + +And: + + + this is an example list item + indented with tabs + + + this is an example list item + indented with spaces diff --git a/tests/basic/tidyness.html b/tests/basic/tidyness.html new file mode 100644 index 0000000..52b2eaf --- /dev/null +++ b/tests/basic/tidyness.html @@ -0,0 +1,8 @@ +
+

A list within a blockquote:

+
    +
  • asterisk 1
  • +
  • asterisk 2
  • +
  • asterisk 3
  • +
+
\ No newline at end of file diff --git a/tests/basic/tidyness.txt b/tests/basic/tidyness.txt new file mode 100644 index 0000000..5f18b8d --- /dev/null +++ b/tests/basic/tidyness.txt @@ -0,0 +1,5 @@ +> A list within a blockquote: +> +> * asterisk 1 +> * asterisk 2 +> * asterisk 3 diff --git a/tests/extensions-x-abbr/abbr.html b/tests/extensions-x-abbr/abbr.html deleted file mode 100644 index 456524e..0000000 --- a/tests/extensions-x-abbr/abbr.html +++ /dev/null @@ -1,4 +0,0 @@ -

An ABBR: "REF". -ref and REFERENCE should be ignored.

-

The HTML specification -is maintained by the W3C.

\ No newline at end of file diff --git a/tests/extensions-x-abbr/abbr.txt b/tests/extensions-x-abbr/abbr.txt deleted file mode 100644 index 991bf15..0000000 --- a/tests/extensions-x-abbr/abbr.txt +++ /dev/null @@ -1,13 +0,0 @@ -An ABBR: "REF". -ref and REFERENCE should be ignored. - -*[REF]: Reference -*[ABBR]: This gets overriden by the next one. -*[ABBR]: Abbreviation - -The HTML specification -is maintained by the W3C. - -*[HTML]: Hyper Text Markup Language -*[W3C]: World Wide Web Consortium - diff --git a/tests/extensions-x-codehilite/code.html b/tests/extensions-x-codehilite/code.html deleted file mode 100644 index 6a8ee91..0000000 --- a/tests/extensions-x-codehilite/code.html +++ /dev/null @@ -1,16 +0,0 @@ -

Some text

-
1
-2
-3
-4
-5
-6
def __init__ (self, pattern) :
-    self.pattern = pattern
-    self.compiled_re = re.compile("^(.*)%s(.*)$" % pattern, re.DOTALL)
-
-def getCompiledRegExp (self) :
-    return self.compiled_re
-
-
- -

More text

\ No newline at end of file diff --git a/tests/extensions-x-codehilite/code.txt b/tests/extensions-x-codehilite/code.txt deleted file mode 100644 index 6c62e6a..0000000 --- a/tests/extensions-x-codehilite/code.txt +++ /dev/null @@ -1,12 +0,0 @@ - -Some text - - #!python - def __init__ (self, pattern) : - self.pattern = pattern - self.compiled_re = re.compile("^(.*)%s(.*)$" % pattern, re.DOTALL) - - def getCompiledRegExp (self) : - return self.compiled_re - -More text \ No newline at end of file diff --git a/tests/extensions-x-def_list/loose_def_list.html b/tests/extensions-x-def_list/loose_def_list.html deleted file mode 100644 index 98fdec8..0000000 --- a/tests/extensions-x-def_list/loose_def_list.html +++ /dev/null @@ -1,21 +0,0 @@ -

some text

-
-
term 1
-
-

def 1-1

-
-
-

def 2-2

-
-
term 2
-
term 3
-
-

def 2-1 -line 2 of def 2-1

-
-
-

def 2-2

-

par 2 of def2-2

-
-
-

more text

\ No newline at end of file diff --git a/tests/extensions-x-def_list/loose_def_list.txt b/tests/extensions-x-def_list/loose_def_list.txt deleted file mode 100644 index 24cd6a4..0000000 --- a/tests/extensions-x-def_list/loose_def_list.txt +++ /dev/null @@ -1,20 +0,0 @@ -some text - -term 1 - -: def 1-1 - -: def 2-2 - -term 2 -term 3 - -: def 2-1 - line 2 of def 2-1 - -: def 2-2 - - par 2 of def2-2 - -more text - diff --git a/tests/extensions-x-def_list/markdown-syntax.html b/tests/extensions-x-def_list/markdown-syntax.html deleted file mode 100644 index 2f63b4b..0000000 --- a/tests/extensions-x-def_list/markdown-syntax.html +++ /dev/null @@ -1,728 +0,0 @@ -

Markdown: Syntax

- - - -

Note: This document is itself written using Markdown; you -can see the source for it by adding '.text' to the URL.

-
-

Overview

- -

Philosophy

- -

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

-

Readability, however, is emphasized above all else. A Markdown-formatted -document should be publishable as-is, as plain text, without looking -like it's been marked up with tags or formatting instructions. While -Markdown's syntax has been influenced by several existing text-to-HTML -filters -- including Setext, atx, Textile, reStructuredText, -Grutatext, and EtText -- the single biggest source of -inspiration for Markdown's syntax is the format of plain text email.

-

To this end, Markdown's syntax is comprised entirely of punctuation -characters, which punctuation characters have been carefully chosen so -as to look like what they mean. E.g., asterisks around a word actually -look like *emphasis*. Markdown lists look like, well, lists. Even -blockquotes look like quoted passages of text, assuming you've ever -used email.

-

Inline HTML

- -

Markdown's syntax is intended for one purpose: to be used as a -format for writing for the web.

-

Markdown is not a replacement for HTML, or even close to it. Its -syntax is very small, corresponding only to a very small subset of -HTML tags. The idea is not to create a syntax that makes it easier -to insert HTML tags. In my opinion, HTML tags are already easy to -insert. The idea for Markdown is to make it easy to read, write, and -edit prose. HTML is a publishing format; Markdown is a writing -format. Thus, Markdown's formatting syntax only addresses issues that -can be conveyed in plain text.

-

For any markup that is not covered by Markdown's syntax, you simply -use HTML itself. There's no need to preface it or delimit it to -indicate that you're switching from Markdown to HTML; you just use -the tags.

-

The only restrictions are that block-level HTML elements -- e.g. <div>, -<table>, <pre>, <p>, etc. -- must be separated from surrounding -content by blank lines, and the start and end tags of the block should -not be indented with tabs or spaces. Markdown is smart enough not -to add extra (unwanted) <p> tags around HTML block-level tags.

-

For example, to add an HTML table to a Markdown article:

-
This is a regular paragraph.
-
-<table>
-    <tr>
-        <td>Foo</td>
-    </tr>
-</table>
-
-This is another regular paragraph.
-
-

Note that Markdown formatting syntax is not processed within block-level -HTML tags. E.g., you can't use Markdown-style *emphasis* inside an -HTML block.

-

Span-level HTML tags -- e.g. <span>, <cite>, or <del> -- can be -used anywhere in a Markdown paragraph, list item, or header. If you -want, you can even use HTML tags instead of Markdown formatting; e.g. if -you'd prefer to use HTML <a> or <img> tags instead of Markdown's -link or image syntax, go right ahead.

-

Unlike block-level HTML tags, Markdown syntax is processed within -span-level tags.

-

Automatic Escaping for Special Characters

- -

In HTML, there are two characters that demand special treatment: < -and &. Left angle brackets are used to start tags; ampersands are -used to denote HTML entities. If you want to use them as literal -characters, you must escape them as entities, e.g. &lt;, and -&amp;.

-

Ampersands in particular are bedeviling for web writers. If you want to -write about 'AT&T', you need to write 'AT&amp;T'. You even need to -escape ampersands within URLs. Thus, if you want to link to:

-
http://images.google.com/images?num=30&q=larry+bird
-
-

you need to encode the URL as:

-
http://images.google.com/images?num=30&amp;q=larry+bird
-
-

in your anchor tag href attribute. Needless to say, this is easy to -forget, and is probably the single most common source of HTML validation -errors in otherwise well-marked-up web sites.

-

Markdown allows you to use these characters naturally, taking care of -all the necessary escaping for you. If you use an ampersand as part of -an HTML entity, it remains unchanged; otherwise it will be translated -into &amp;.

-

So, if you want to include a copyright symbol in your article, you can write:

-
&copy;
-
-

and Markdown will leave it alone. But if you write:

-
AT&T
-
-

Markdown will translate it to:

-
AT&amp;T
-
-

Similarly, because Markdown supports inline HTML, if you use -angle brackets as delimiters for HTML tags, Markdown will treat them as -such. But if you write:

-
4 < 5
-
-

Markdown will translate it to:

-
4 &lt; 5
-
-

However, inside Markdown code spans and blocks, angle brackets and -ampersands are always encoded automatically. This makes it easy to use -Markdown to write about HTML code. (As opposed to raw HTML, which is a -terrible format for writing about HTML syntax, because every single < -and & in your example code needs to be escaped.)

-
-

Block Elements

- -

Paragraphs and Line Breaks

- -

A paragraph is simply one or more consecutive lines of text, separated -by one or more blank lines. (A blank line is any line that looks like a -blank line -- a line containing nothing but spaces or tabs is considered -blank.) Normal paragraphs should not be intended with spaces or tabs.

-

The implication of the "one or more consecutive lines of text" rule is -that Markdown supports "hard-wrapped" text paragraphs. This differs -significantly from most other text-to-HTML formatters (including Movable -Type's "Convert Line Breaks" option) which translate every line break -character in a paragraph into a <br /> tag.

-

When you do want to insert a <br /> break tag using Markdown, you -end a line with two or more spaces, then type return.

-

Yes, this takes a tad more effort to create a <br />, but a simplistic -"every line break is a <br />" rule wouldn't work for Markdown. -Markdown's email-style blockquoting and multi-paragraph list items -work best -- and look better -- when you format them with hard breaks.

- - -

Markdown supports two styles of headers, Setext and atx.

-

Setext-style headers are "underlined" using equal signs (for first-level -headers) and dashes (for second-level headers). For example:

-
This is an H1
-=============
-
-This is an H2
--------------
-
-

Any number of underlining ='s or -'s will work.

-

Atx-style headers use 1-6 hash characters at the start of the line, -corresponding to header levels 1-6. For example:

-
# This is an H1
-
-## This is an H2
-
-###### This is an H6
-
-

Optionally, you may "close" atx-style headers. This is purely -cosmetic -- you can use this if you think it looks better. The -closing hashes don't even need to match the number of hashes -used to open the header. (The number of opening hashes -determines the header level.) :

-
# This is an H1 #
-
-## This is an H2 ##
-
-### This is an H3 ######
-
-

Blockquotes

- -

Markdown uses email-style > characters for blockquoting. If you're -familiar with quoting passages of text in an email message, then you -know how to create a blockquote in Markdown. It looks best if you hard -wrap the text and put a > before every line:

-
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
-> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
-> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
-> 
-> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
-> id sem consectetuer libero luctus adipiscing.
-
-

Markdown allows you to be lazy and only put the > before the first -line of a hard-wrapped paragraph:

-
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
-consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
-Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
-
-> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
-id sem consectetuer libero luctus adipiscing.
-
-

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by -adding additional levels of >:

-
> This is the first level of quoting.
->
-> > This is nested blockquote.
->
-> Back to the first level.
-
-

Blockquotes can contain other Markdown elements, including headers, lists, -and code blocks:

-
> ## This is a header.
-> 
-> 1.   This is the first list item.
-> 2.   This is the second list item.
-> 
-> Here's some example code:
-> 
->     return shell_exec("echo $input | $markdown_script");
-
-

Any decent text editor should make email-style quoting easy. For -example, with BBEdit, you can make a selection and choose Increase -Quote Level from the Text menu.

-

Lists

- -

Markdown supports ordered (numbered) and unordered (bulleted) lists.

-

Unordered lists use asterisks, pluses, and hyphens -- interchangably --- as list markers:

-
*   Red
-*   Green
-*   Blue
-
-

is equivalent to:

-
+   Red
-+   Green
-+   Blue
-
-

and:

-
-   Red
--   Green
--   Blue
-
-

Ordered lists use numbers followed by periods:

-
1.  Bird
-2.  McHale
-3.  Parish
-
-

It's important to note that the actual numbers you use to mark the -list have no effect on the HTML output Markdown produces. The HTML -Markdown produces from the above list is:

-
<ol>
-<li>Bird</li>
-<li>McHale</li>
-<li>Parish</li>
-</ol>
-
-

If you instead wrote the list in Markdown like this:

-
1.  Bird
-1.  McHale
-1.  Parish
-
-

or even:

-
3. Bird
-1. McHale
-8. Parish
-
-

you'd get the exact same HTML output. The point is, if you want to, -you can use ordinal numbers in your ordered Markdown lists, so that -the numbers in your source match the numbers in your published HTML. -But if you want to be lazy, you don't have to.

-

If you do use lazy list numbering, however, you should still start the -list with the number 1. At some point in the future, Markdown may support -starting ordered lists at an arbitrary number.

-

List markers typically start at the left margin, but may be indented by -up to three spaces. List markers must be followed by one or more spaces -or a tab.

-

To make lists look nice, you can wrap items with hanging indents:

-
*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
-    Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
-    viverra nec, fringilla in, laoreet vitae, risus.
-*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
-    Suspendisse id sem consectetuer libero luctus adipiscing.
-
-

But if you want to be lazy, you don't have to:

-
*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
-Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
-viverra nec, fringilla in, laoreet vitae, risus.
-*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
-Suspendisse id sem consectetuer libero luctus adipiscing.
-
-

If list items are separated by blank lines, Markdown will wrap the -items in <p> tags in the HTML output. For example, this input:

-
*   Bird
-*   Magic
-
-

will turn into:

-
<ul>
-<li>Bird</li>
-<li>Magic</li>
-</ul>
-
-

But this:

-
*   Bird
-
-*   Magic
-
-

will turn into:

-
<ul>
-<li><p>Bird</p></li>
-<li><p>Magic</p></li>
-</ul>
-
-

List items may consist of multiple paragraphs. Each subsequent -paragraph in a list item must be intended by either 4 spaces -or one tab:

-
1.  This is a list item with two paragraphs. Lorem ipsum dolor
-    sit amet, consectetuer adipiscing elit. Aliquam hendrerit
-    mi posuere lectus.
-
-    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
-    vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
-    sit amet velit.
-
-2.  Suspendisse id sem consectetuer libero luctus adipiscing.
-
-

It looks nice if you indent every line of the subsequent -paragraphs, but here again, Markdown will allow you to be -lazy:

-
*   This is a list item with two paragraphs.
-
-    This is the second paragraph in the list item. You're
-only required to indent the first line. Lorem ipsum dolor
-sit amet, consectetuer adipiscing elit.
-
-*   Another item in the same list.
-
-

To put a blockquote within a list item, the blockquote's > -delimiters need to be indented:

-
*   A list item with a blockquote:
-
-    > This is a blockquote
-    > inside a list item.
-
-

To put a code block within a list item, the code block needs -to be indented twice -- 8 spaces or two tabs:

-
*   A list item with a code block:
-
-        <code goes here>
-
-

It's worth noting that it's possible to trigger an ordered list by -accident, by writing something like this:

-
1986. What a great season.
-
-

In other words, a number-period-space sequence at the beginning of a -line. To avoid this, you can backslash-escape the period:

-
1986\. What a great season.
-
-

Code Blocks

- -

Pre-formatted code blocks are used for writing about programming or -markup source code. Rather than forming normal paragraphs, the lines -of a code block are interpreted literally. Markdown wraps a code block -in both <pre> and <code> tags.

-

To produce a code block in Markdown, simply indent every line of the -block by at least 4 spaces or 1 tab. For example, given this input:

-
This is a normal paragraph:
-
-    This is a code block.
-
-

Markdown will generate:

-
<p>This is a normal paragraph:</p>
-
-<pre><code>This is a code block.
-</code></pre>
-
-

One level of indentation -- 4 spaces or 1 tab -- is removed from each -line of the code block. For example, this:

-
Here is an example of AppleScript:
-
-    tell application "Foo"
-        beep
-    end tell
-
-

will turn into:

-
<p>Here is an example of AppleScript:</p>
-
-<pre><code>tell application "Foo"
-    beep
-end tell
-</code></pre>
-
-

A code block continues until it reaches a line that is not indented -(or the end of the article).

-

Within a code block, ampersands (&) and angle brackets (< and >) -are automatically converted into HTML entities. This makes it very -easy to include example HTML source code using Markdown -- just paste -it and indent it, and Markdown will handle the hassle of encoding the -ampersands and angle brackets. For example, this:

-
    <div class="footer">
-        &copy; 2004 Foo Corporation
-    </div>
-
-

will turn into:

-
<pre><code>&lt;div class="footer"&gt;
-    &amp;copy; 2004 Foo Corporation
-&lt;/div&gt;
-</code></pre>
-
-

Regular Markdown syntax is not processed within code blocks. E.g., -asterisks are just literal asterisks within a code block. This means -it's also easy to use Markdown to write about Markdown's own syntax.

-

Horizontal Rules

- -

You can produce a horizontal rule tag (<hr />) by placing three or -more hyphens, asterisks, or underscores on a line by themselves. If you -wish, you may use spaces between the hyphens or asterisks. Each of the -following lines will produce a horizontal rule:

-
* * *
-
-***
-
-*****
-
-- - -
-
----------------------------------------
-
-_ _ _
-
-
-

Span Elements

- - - -

Markdown supports two style of links: inline and reference.

-

In both styles, the link text is delimited by [square brackets].

-

To create an inline link, use a set of regular parentheses immediately -after the link text's closing square bracket. Inside the parentheses, -put the URL where you want the link to point, along with an optional -title for the link, surrounded in quotes. For example:

-
This is [an example](http://example.com/ "Title") inline link.
-
-[This link](http://example.net/) has no title attribute.
-
-

Will produce:

-
<p>This is <a href="http://example.com/" title="Title">
-an example</a> inline link.</p>
-
-<p><a href="http://example.net/">This link</a> has no
-title attribute.</p>
-
-

If you're referring to a local resource on the same server, you can -use relative paths:

-
See my [About](/about/) page for details.
-
-

Reference-style links use a second set of square brackets, inside -which you place a label of your choosing to identify the link:

-
This is [an example][id] reference-style link.
-
-

You can optionally use a space to separate the sets of brackets:

-
This is [an example] [id] reference-style link.
-
-

Then, anywhere in the document, you define your link label like this, -on a line by itself:

-
[id]: http://example.com/  "Optional Title Here"
-
-

That is:

-
    -
  • Square brackets containing the link identifier (optionally -indented from the left margin using up to three spaces);
  • -
  • followed by a colon;
  • -
  • followed by one or more spaces (or tabs);
  • -
  • followed by the URL for the link;
  • -
  • optionally followed by a title attribute for the link, enclosed -in double or single quotes.
  • -
-

The link URL may, optionally, be surrounded by angle brackets:

-
[id]: <http://example.com/>  "Optional Title Here"
-
-

You can put the title attribute on the next line and use extra spaces -or tabs for padding, which tends to look better with longer URLs:

-
[id]: http://example.com/longish/path/to/resource/here
-    "Optional Title Here"
-
-

Link definitions are only used for creating links during Markdown -processing, and are stripped from your document in the HTML output.

-

Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are not case sensitive. E.g. these two links:

-
[link text][a]
-[link text][A]
-
-

are equivalent.

-

The implicit link name shortcut allows you to omit the name of the -link, in which case the link text itself is used as the name. -Just use an empty set of square brackets -- e.g., to link the word -"Google" to the google.com web site, you could simply write:

-
[Google][]
-
-

And then define the link:

-
[Google]: http://google.com/
-
-

Because link names may contain spaces, this shortcut even works for -multiple words in the link text:

-
Visit [Daring Fireball][] for more information.
-
-

And then define the link:

-
[Daring Fireball]: http://daringfireball.net/
-
-

Link definitions can be placed anywhere in your Markdown document. I -tend to put them immediately after each paragraph in which they're -used, but if you want, you can put them all at the end of your -document, sort of like footnotes.

-

Here's an example of reference links in action:

-
I get 10 times more traffic from [Google] [1] than from
-[Yahoo] [2] or [MSN] [3].
-
-  [1]: http://google.com/        "Google"
-  [2]: http://search.yahoo.com/  "Yahoo Search"
-  [3]: http://search.msn.com/    "MSN Search"
-
-

Using the implicit link name shortcut, you could instead write:

-
I get 10 times more traffic from [Google][] than from
-[Yahoo][] or [MSN][].
-
-  [google]: http://google.com/        "Google"
-  [yahoo]:  http://search.yahoo.com/  "Yahoo Search"
-  [msn]:    http://search.msn.com/    "MSN Search"
-
-

Both of the above examples will produce the following HTML output:

-
<p>I get 10 times more traffic from <a href="http://google.com/"
-title="Google">Google</a> than from
-<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
-or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
-
-

For comparison, here is the same paragraph written using -Markdown's inline link style:

-
I get 10 times more traffic from [Google](http://google.com/ "Google")
-than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
-[MSN](http://search.msn.com/ "MSN Search").
-
-

The point of reference-style links is not that they're easier to -write. The point is that with reference-style links, your document -source is vastly more readable. Compare the above examples: using -reference-style links, the paragraph itself is only 81 characters -long; with inline-style links, it's 176 characters; and as raw HTML, -it's 234 characters. In the raw HTML, there's more markup than there -is text.

-

With Markdown's reference-style links, a source document much more -closely resembles the final output, as rendered in a browser. By -allowing you to move the markup-related metadata out of the paragraph, -you can add links without interrupting the narrative flow of your -prose.

-

Emphasis

- -

Markdown treats asterisks (*) and underscores (_) as indicators of -emphasis. Text wrapped with one * or _ will be wrapped with an -HTML <em> tag; double *'s or _'s will be wrapped with an HTML -<strong> tag. E.g., this input:

-
*single asterisks*
-
-_single underscores_
-
-**double asterisks**
-
-__double underscores__
-
-

will produce:

-
<em>single asterisks</em>
-
-<em>single underscores</em>
-
-<strong>double asterisks</strong>
-
-<strong>double underscores</strong>
-
-

You can use whichever style you prefer; the lone restriction is that -the same character must be used to open and close an emphasis span.

-

Emphasis can be used in the middle of a word:

-
un*fucking*believable
-
-

But if you surround an * or _ with spaces, it'll be treated as a -literal asterisk or underscore.

-

To produce a literal asterisk or underscore at a position where it -would otherwise be used as an emphasis delimiter, you can backslash -escape it:

-
\*this text is surrounded by literal asterisks\*
-
-

Code

- -

To indicate a span of code, wrap it with backtick quotes (`). -Unlike a pre-formatted code block, a code span indicates code within a -normal paragraph. For example:

-
Use the `printf()` function.
-
-

will produce:

-
<p>Use the <code>printf()</code> function.</p>
-
-

To include a literal backtick character within a code span, you can use -multiple backticks as the opening and closing delimiters:

-
``There is a literal backtick (`) here.``
-
-

which will produce this:

-
<p><code>There is a literal backtick (`) here.</code></p>
-
-

The backtick delimiters surrounding a code span may include spaces -- -one after the opening, one before the closing. This allows you to place -literal backtick characters at the beginning or end of a code span:

-
A single backtick in a code span: `` ` ``
-
-A backtick-delimited string in a code span: `` `foo` ``
-
-

will produce:

-
<p>A single backtick in a code span: <code>`</code></p>
-
-<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
-
-

With a code span, ampersands and angle brackets are encoded as HTML -entities automatically, which makes it easy to include example HTML -tags. Markdown will turn this:

-
Please don't use any `<blink>` tags.
-
-

into:

-
<p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
-
-

You can write this:

-
`&#8212;` is the decimal-encoded equivalent of `&mdash;`.
-
-

to produce:

-
<p><code>&amp;#8212;</code> is the decimal-encoded
-equivalent of <code>&amp;mdash;</code>.</p>
-
-

Images

- -

Admittedly, it's fairly difficult to devise a "natural" syntax for -placing images into a plain text document format.

-

Markdown uses an image syntax that is intended to resemble the syntax -for links, allowing for two styles: inline and reference.

-

Inline image syntax looks like this:

-
![Alt text](/path/to/img.jpg)
-
-![Alt text](/path/to/img.jpg "Optional title")
-
-

That is:

-
    -
  • An exclamation mark: !;
  • -
  • followed by a set of square brackets, containing the alt -attribute text for the image;
  • -
  • followed by a set of parentheses, containing the URL or path to -the image, and an optional title attribute enclosed in double -or single quotes.
  • -
-

Reference-style image syntax looks like this:

-
![Alt text][id]
-
-

Where "id" is the name of a defined image reference. Image references -are defined using syntax identical to link references:

-
[id]: url/to/image  "Optional title attribute"
-
-

As of this writing, Markdown has no syntax for specifying the -dimensions of an image; if this is important to you, you can simply -use regular HTML <img> tags.

-
-

Miscellaneous

- - - -

Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

-
<http://example.com/>
-
-

Markdown will turn this into:

-
<a href="http://example.com/">http://example.com/</a>
-
-

Automatic links for email addresses work similarly, except that -Markdown will also perform a bit of randomized decimal and hex -entity-encoding to help obscure your address from address-harvesting -spambots. For example, Markdown will turn this:

-
<address@example.com>
-
-

into something like this:

-
<a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
-&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
-&#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
-&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
-
-

which will render in a browser as a clickable link to "address@example.com".

-

(This sort of entity-encoding trick will indeed fool many, if not -most, address-harvesting bots, but it definitely won't fool all of -them. It's better than nothing, but an address published in this way -will probably eventually start receiving spam.)

-

Backslash Escapes

- -

Markdown allows you to use backslash escapes to generate literal -characters which would otherwise have special meaning in Markdown's -formatting syntax. For example, if you wanted to surround a word with -literal asterisks (instead of an HTML <em> tag), you can backslashes -before the asterisks, like this:

-
\*literal asterisks\*
-
-

Markdown provides backslash escapes for the following characters:

-
\   backslash
-`   backtick
-*   asterisk
-_   underscore
-{}  curly braces
-[]  square brackets
-()  parentheses
-#   hash mark
-+   plus sign
--   minus sign (hyphen)
-.   dot
-!   exclamation mark
-
\ No newline at end of file diff --git a/tests/extensions-x-def_list/markdown-syntax.txt b/tests/extensions-x-def_list/markdown-syntax.txt deleted file mode 100644 index dabd75c..0000000 --- a/tests/extensions-x-def_list/markdown-syntax.txt +++ /dev/null @@ -1,888 +0,0 @@ -Markdown: Syntax -================ - - - - -* [Overview](#overview) - * [Philosophy](#philosophy) - * [Inline HTML](#html) - * [Automatic Escaping for Special Characters](#autoescape) -* [Block Elements](#block) - * [Paragraphs and Line Breaks](#p) - * [Headers](#header) - * [Blockquotes](#blockquote) - * [Lists](#list) - * [Code Blocks](#precode) - * [Horizontal Rules](#hr) -* [Span Elements](#span) - * [Links](#link) - * [Emphasis](#em) - * [Code](#code) - * [Images](#img) -* [Miscellaneous](#misc) - * [Backslash Escapes](#backslash) - * [Automatic Links](#autolink) - - -**Note:** This document is itself written using Markdown; you -can [see the source for it by adding '.text' to the URL][src]. - - [src]: /projects/markdown/syntax.text - -* * * - -

Overview

- -

Philosophy

- -Markdown is intended to be as easy-to-read and easy-to-write as is feasible. - -Readability, however, is emphasized above all else. A Markdown-formatted -document should be publishable as-is, as plain text, without looking -like it's been marked up with tags or formatting instructions. While -Markdown's syntax has been influenced by several existing text-to-HTML -filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4], -[Grutatext] [5], and [EtText] [6] -- the single biggest source of -inspiration for Markdown's syntax is the format of plain text email. - - [1]: http://docutils.sourceforge.net/mirror/setext.html - [2]: http://www.aaronsw.com/2002/atx/ - [3]: http://textism.com/tools/textile/ - [4]: http://docutils.sourceforge.net/rst.html - [5]: http://www.triptico.com/software/grutatxt.html - [6]: http://ettext.taint.org/doc/ - -To this end, Markdown's syntax is comprised entirely of punctuation -characters, which punctuation characters have been carefully chosen so -as to look like what they mean. E.g., asterisks around a word actually -look like \*emphasis\*. Markdown lists look like, well, lists. Even -blockquotes look like quoted passages of text, assuming you've ever -used email. - - - -

Inline HTML

- -Markdown's syntax is intended for one purpose: to be used as a -format for *writing* for the web. - -Markdown is not a replacement for HTML, or even close to it. Its -syntax is very small, corresponding only to a very small subset of -HTML tags. The idea is *not* to create a syntax that makes it easier -to insert HTML tags. In my opinion, HTML tags are already easy to -insert. The idea for Markdown is to make it easy to read, write, and -edit prose. HTML is a *publishing* format; Markdown is a *writing* -format. Thus, Markdown's formatting syntax only addresses issues that -can be conveyed in plain text. - -For any markup that is not covered by Markdown's syntax, you simply -use HTML itself. There's no need to preface it or delimit it to -indicate that you're switching from Markdown to HTML; you just use -the tags. - -The only restrictions are that block-level HTML elements -- e.g. `
`, -``, `
`, `

`, etc. -- must be separated from surrounding -content by blank lines, and the start and end tags of the block should -not be indented with tabs or spaces. Markdown is smart enough not -to add extra (unwanted) `

` tags around HTML block-level tags. - -For example, to add an HTML table to a Markdown article: - - This is a regular paragraph. - -

- - - -
Foo
- - This is another regular paragraph. - -Note that Markdown formatting syntax is not processed within block-level -HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an -HTML block. - -Span-level HTML tags -- e.g. ``, ``, or `` -- can be -used anywhere in a Markdown paragraph, list item, or header. If you -want, you can even use HTML tags instead of Markdown formatting; e.g. if -you'd prefer to use HTML `` or `` tags instead of Markdown's -link or image syntax, go right ahead. - -Unlike block-level HTML tags, Markdown syntax *is* processed within -span-level tags. - - -

Automatic Escaping for Special Characters

- -In HTML, there are two characters that demand special treatment: `<` -and `&`. Left angle brackets are used to start tags; ampersands are -used to denote HTML entities. If you want to use them as literal -characters, you must escape them as entities, e.g. `<`, and -`&`. - -Ampersands in particular are bedeviling for web writers. If you want to -write about 'AT&T', you need to write '`AT&T`'. You even need to -escape ampersands within URLs. Thus, if you want to link to: - - http://images.google.com/images?num=30&q=larry+bird - -you need to encode the URL as: - - http://images.google.com/images?num=30&q=larry+bird - -in your anchor tag `href` attribute. Needless to say, this is easy to -forget, and is probably the single most common source of HTML validation -errors in otherwise well-marked-up web sites. - -Markdown allows you to use these characters naturally, taking care of -all the necessary escaping for you. If you use an ampersand as part of -an HTML entity, it remains unchanged; otherwise it will be translated -into `&`. - -So, if you want to include a copyright symbol in your article, you can write: - - © - -and Markdown will leave it alone. But if you write: - - AT&T - -Markdown will translate it to: - - AT&T - -Similarly, because Markdown supports [inline HTML](#html), if you use -angle brackets as delimiters for HTML tags, Markdown will treat them as -such. But if you write: - - 4 < 5 - -Markdown will translate it to: - - 4 < 5 - -However, inside Markdown code spans and blocks, angle brackets and -ampersands are *always* encoded automatically. This makes it easy to use -Markdown to write about HTML code. (As opposed to raw HTML, which is a -terrible format for writing about HTML syntax, because every single `<` -and `&` in your example code needs to be escaped.) - - -* * * - - -

Block Elements

- - -

Paragraphs and Line Breaks

- -A paragraph is simply one or more consecutive lines of text, separated -by one or more blank lines. (A blank line is any line that looks like a -blank line -- a line containing nothing but spaces or tabs is considered -blank.) Normal paragraphs should not be intended with spaces or tabs. - -The implication of the "one or more consecutive lines of text" rule is -that Markdown supports "hard-wrapped" text paragraphs. This differs -significantly from most other text-to-HTML formatters (including Movable -Type's "Convert Line Breaks" option) which translate every line break -character in a paragraph into a `
` tag. - -When you *do* want to insert a `
` break tag using Markdown, you -end a line with two or more spaces, then type return. - -Yes, this takes a tad more effort to create a `
`, but a simplistic -"every line break is a `
`" rule wouldn't work for Markdown. -Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l] -work best -- and look better -- when you format them with hard breaks. - - [bq]: #blockquote - [l]: #list - - - - - -Markdown supports two styles of headers, [Setext] [1] and [atx] [2]. - -Setext-style headers are "underlined" using equal signs (for first-level -headers) and dashes (for second-level headers). For example: - - This is an H1 - ============= - - This is an H2 - ------------- - -Any number of underlining `=`'s or `-`'s will work. - -Atx-style headers use 1-6 hash characters at the start of the line, -corresponding to header levels 1-6. For example: - - # This is an H1 - - ## This is an H2 - - ###### This is an H6 - -Optionally, you may "close" atx-style headers. This is purely -cosmetic -- you can use this if you think it looks better. The -closing hashes don't even need to match the number of hashes -used to open the header. (The number of opening hashes -determines the header level.) : - - # This is an H1 # - - ## This is an H2 ## - - ### This is an H3 ###### - - -

Blockquotes

- -Markdown uses email-style `>` characters for blockquoting. If you're -familiar with quoting passages of text in an email message, then you -know how to create a blockquote in Markdown. It looks best if you hard -wrap the text and put a `>` before every line: - - > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, - > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. - > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. - > - > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse - > id sem consectetuer libero luctus adipiscing. - -Markdown allows you to be lazy and only put the `>` before the first -line of a hard-wrapped paragraph: - - > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, - consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. - Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. - - > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse - id sem consectetuer libero luctus adipiscing. - -Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by -adding additional levels of `>`: - - > This is the first level of quoting. - > - > > This is nested blockquote. - > - > Back to the first level. - -Blockquotes can contain other Markdown elements, including headers, lists, -and code blocks: - - > ## This is a header. - > - > 1. This is the first list item. - > 2. This is the second list item. - > - > Here's some example code: - > - > return shell_exec("echo $input | $markdown_script"); - -Any decent text editor should make email-style quoting easy. For -example, with BBEdit, you can make a selection and choose Increase -Quote Level from the Text menu. - - -

Lists

- -Markdown supports ordered (numbered) and unordered (bulleted) lists. - -Unordered lists use asterisks, pluses, and hyphens -- interchangably --- as list markers: - - * Red - * Green - * Blue - -is equivalent to: - - + Red - + Green - + Blue - -and: - - - Red - - Green - - Blue - -Ordered lists use numbers followed by periods: - - 1. Bird - 2. McHale - 3. Parish - -It's important to note that the actual numbers you use to mark the -list have no effect on the HTML output Markdown produces. The HTML -Markdown produces from the above list is: - -
    -
  1. Bird
  2. -
  3. McHale
  4. -
  5. Parish
  6. -
- -If you instead wrote the list in Markdown like this: - - 1. Bird - 1. McHale - 1. Parish - -or even: - - 3. Bird - 1. McHale - 8. Parish - -you'd get the exact same HTML output. The point is, if you want to, -you can use ordinal numbers in your ordered Markdown lists, so that -the numbers in your source match the numbers in your published HTML. -But if you want to be lazy, you don't have to. - -If you do use lazy list numbering, however, you should still start the -list with the number 1. At some point in the future, Markdown may support -starting ordered lists at an arbitrary number. - -List markers typically start at the left margin, but may be indented by -up to three spaces. List markers must be followed by one or more spaces -or a tab. - -To make lists look nice, you can wrap items with hanging indents: - - * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. - Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, - viverra nec, fringilla in, laoreet vitae, risus. - * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. - Suspendisse id sem consectetuer libero luctus adipiscing. - -But if you want to be lazy, you don't have to: - - * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. - Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, - viverra nec, fringilla in, laoreet vitae, risus. - * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. - Suspendisse id sem consectetuer libero luctus adipiscing. - -If list items are separated by blank lines, Markdown will wrap the -items in `

` tags in the HTML output. For example, this input: - - * Bird - * Magic - -will turn into: - -

    -
  • Bird
  • -
  • Magic
  • -
- -But this: - - * Bird - - * Magic - -will turn into: - -
    -
  • Bird

  • -
  • Magic

  • -
- -List items may consist of multiple paragraphs. Each subsequent -paragraph in a list item must be intended by either 4 spaces -or one tab: - - 1. This is a list item with two paragraphs. Lorem ipsum dolor - sit amet, consectetuer adipiscing elit. Aliquam hendrerit - mi posuere lectus. - - Vestibulum enim wisi, viverra nec, fringilla in, laoreet - vitae, risus. Donec sit amet nisl. Aliquam semper ipsum - sit amet velit. - - 2. Suspendisse id sem consectetuer libero luctus adipiscing. - -It looks nice if you indent every line of the subsequent -paragraphs, but here again, Markdown will allow you to be -lazy: - - * This is a list item with two paragraphs. - - This is the second paragraph in the list item. You're - only required to indent the first line. Lorem ipsum dolor - sit amet, consectetuer adipiscing elit. - - * Another item in the same list. - -To put a blockquote within a list item, the blockquote's `>` -delimiters need to be indented: - - * A list item with a blockquote: - - > This is a blockquote - > inside a list item. - -To put a code block within a list item, the code block needs -to be indented *twice* -- 8 spaces or two tabs: - - * A list item with a code block: - - - - -It's worth noting that it's possible to trigger an ordered list by -accident, by writing something like this: - - 1986. What a great season. - -In other words, a *number-period-space* sequence at the beginning of a -line. To avoid this, you can backslash-escape the period: - - 1986\. What a great season. - - - -

Code Blocks

- -Pre-formatted code blocks are used for writing about programming or -markup source code. Rather than forming normal paragraphs, the lines -of a code block are interpreted literally. Markdown wraps a code block -in both `
` and `` tags.
-
-To produce a code block in Markdown, simply indent every line of the
-block by at least 4 spaces or 1 tab. For example, given this input:
-
-    This is a normal paragraph:
-
-        This is a code block.
-
-Markdown will generate:
-
-    

This is a normal paragraph:

- -
This is a code block.
-    
- -One level of indentation -- 4 spaces or 1 tab -- is removed from each -line of the code block. For example, this: - - Here is an example of AppleScript: - - tell application "Foo" - beep - end tell - -will turn into: - -

Here is an example of AppleScript:

- -
tell application "Foo"
-        beep
-    end tell
-    
- -A code block continues until it reaches a line that is not indented -(or the end of the article). - -Within a code block, ampersands (`&`) and angle brackets (`<` and `>`) -are automatically converted into HTML entities. This makes it very -easy to include example HTML source code using Markdown -- just paste -it and indent it, and Markdown will handle the hassle of encoding the -ampersands and angle brackets. For example, this: - - - -will turn into: - -
<div class="footer">
-        &copy; 2004 Foo Corporation
-    </div>
-    
- -Regular Markdown syntax is not processed within code blocks. E.g., -asterisks are just literal asterisks within a code block. This means -it's also easy to use Markdown to write about Markdown's own syntax. - - - -

Horizontal Rules

- -You can produce a horizontal rule tag (`
`) by placing three or -more hyphens, asterisks, or underscores on a line by themselves. If you -wish, you may use spaces between the hyphens or asterisks. Each of the -following lines will produce a horizontal rule: - - * * * - - *** - - ***** - - - - - - - --------------------------------------- - - _ _ _ - - -* * * - -

Span Elements

- - - -Markdown supports two style of links: *inline* and *reference*. - -In both styles, the link text is delimited by [square brackets]. - -To create an inline link, use a set of regular parentheses immediately -after the link text's closing square bracket. Inside the parentheses, -put the URL where you want the link to point, along with an *optional* -title for the link, surrounded in quotes. For example: - - This is [an example](http://example.com/ "Title") inline link. - - [This link](http://example.net/) has no title attribute. - -Will produce: - -

This is - an example inline link.

- -

This link has no - title attribute.

- -If you're referring to a local resource on the same server, you can -use relative paths: - - See my [About](/about/) page for details. - -Reference-style links use a second set of square brackets, inside -which you place a label of your choosing to identify the link: - - This is [an example][id] reference-style link. - -You can optionally use a space to separate the sets of brackets: - - This is [an example] [id] reference-style link. - -Then, anywhere in the document, you define your link label like this, -on a line by itself: - - [id]: http://example.com/ "Optional Title Here" - -That is: - -* Square brackets containing the link identifier (optionally - indented from the left margin using up to three spaces); -* followed by a colon; -* followed by one or more spaces (or tabs); -* followed by the URL for the link; -* optionally followed by a title attribute for the link, enclosed - in double or single quotes. - -The link URL may, optionally, be surrounded by angle brackets: - - [id]: "Optional Title Here" - -You can put the title attribute on the next line and use extra spaces -or tabs for padding, which tends to look better with longer URLs: - - [id]: http://example.com/longish/path/to/resource/here - "Optional Title Here" - -Link definitions are only used for creating links during Markdown -processing, and are stripped from your document in the HTML output. - -Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links: - - [link text][a] - [link text][A] - -are equivalent. - -The *implicit link name* shortcut allows you to omit the name of the -link, in which case the link text itself is used as the name. -Just use an empty set of square brackets -- e.g., to link the word -"Google" to the google.com web site, you could simply write: - - [Google][] - -And then define the link: - - [Google]: http://google.com/ - -Because link names may contain spaces, this shortcut even works for -multiple words in the link text: - - Visit [Daring Fireball][] for more information. - -And then define the link: - - [Daring Fireball]: http://daringfireball.net/ - -Link definitions can be placed anywhere in your Markdown document. I -tend to put them immediately after each paragraph in which they're -used, but if you want, you can put them all at the end of your -document, sort of like footnotes. - -Here's an example of reference links in action: - - I get 10 times more traffic from [Google] [1] than from - [Yahoo] [2] or [MSN] [3]. - - [1]: http://google.com/ "Google" - [2]: http://search.yahoo.com/ "Yahoo Search" - [3]: http://search.msn.com/ "MSN Search" - -Using the implicit link name shortcut, you could instead write: - - I get 10 times more traffic from [Google][] than from - [Yahoo][] or [MSN][]. - - [google]: http://google.com/ "Google" - [yahoo]: http://search.yahoo.com/ "Yahoo Search" - [msn]: http://search.msn.com/ "MSN Search" - -Both of the above examples will produce the following HTML output: - -

I get 10 times more traffic from Google than from - Yahoo - or MSN.

- -For comparison, here is the same paragraph written using -Markdown's inline link style: - - I get 10 times more traffic from [Google](http://google.com/ "Google") - than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or - [MSN](http://search.msn.com/ "MSN Search"). - -The point of reference-style links is not that they're easier to -write. The point is that with reference-style links, your document -source is vastly more readable. Compare the above examples: using -reference-style links, the paragraph itself is only 81 characters -long; with inline-style links, it's 176 characters; and as raw HTML, -it's 234 characters. In the raw HTML, there's more markup than there -is text. - -With Markdown's reference-style links, a source document much more -closely resembles the final output, as rendered in a browser. By -allowing you to move the markup-related metadata out of the paragraph, -you can add links without interrupting the narrative flow of your -prose. - - -

Emphasis

- -Markdown treats asterisks (`*`) and underscores (`_`) as indicators of -emphasis. Text wrapped with one `*` or `_` will be wrapped with an -HTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML -`` tag. E.g., this input: - - *single asterisks* - - _single underscores_ - - **double asterisks** - - __double underscores__ - -will produce: - - single asterisks - - single underscores - - double asterisks - - double underscores - -You can use whichever style you prefer; the lone restriction is that -the same character must be used to open and close an emphasis span. - -Emphasis can be used in the middle of a word: - - un*fucking*believable - -But if you surround an `*` or `_` with spaces, it'll be treated as a -literal asterisk or underscore. - -To produce a literal asterisk or underscore at a position where it -would otherwise be used as an emphasis delimiter, you can backslash -escape it: - - \*this text is surrounded by literal asterisks\* - - - -

Code

- -To indicate a span of code, wrap it with backtick quotes (`` ` ``). -Unlike a pre-formatted code block, a code span indicates code within a -normal paragraph. For example: - - Use the `printf()` function. - -will produce: - -

Use the printf() function.

- -To include a literal backtick character within a code span, you can use -multiple backticks as the opening and closing delimiters: - - ``There is a literal backtick (`) here.`` - -which will produce this: - -

There is a literal backtick (`) here.

- -The backtick delimiters surrounding a code span may include spaces -- -one after the opening, one before the closing. This allows you to place -literal backtick characters at the beginning or end of a code span: - - A single backtick in a code span: `` ` `` - - A backtick-delimited string in a code span: `` `foo` `` - -will produce: - -

A single backtick in a code span: `

- -

A backtick-delimited string in a code span: `foo`

- -With a code span, ampersands and angle brackets are encoded as HTML -entities automatically, which makes it easy to include example HTML -tags. Markdown will turn this: - - Please don't use any `` tags. - -into: - -

Please don't use any <blink> tags.

- -You can write this: - - `—` is the decimal-encoded equivalent of `—`. - -to produce: - -

&#8212; is the decimal-encoded - equivalent of &mdash;.

- - - -

Images

- -Admittedly, it's fairly difficult to devise a "natural" syntax for -placing images into a plain text document format. - -Markdown uses an image syntax that is intended to resemble the syntax -for links, allowing for two styles: *inline* and *reference*. - -Inline image syntax looks like this: - - ![Alt text](/path/to/img.jpg) - - ![Alt text](/path/to/img.jpg "Optional title") - -That is: - -* An exclamation mark: `!`; -* followed by a set of square brackets, containing the `alt` - attribute text for the image; -* followed by a set of parentheses, containing the URL or path to - the image, and an optional `title` attribute enclosed in double - or single quotes. - -Reference-style image syntax looks like this: - - ![Alt text][id] - -Where "id" is the name of a defined image reference. Image references -are defined using syntax identical to link references: - - [id]: url/to/image "Optional title attribute" - -As of this writing, Markdown has no syntax for specifying the -dimensions of an image; if this is important to you, you can simply -use regular HTML `` tags. - - -* * * - - -

Miscellaneous

- - - -Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this: - - - -Markdown will turn this into: - - http://example.com/ - -Automatic links for email addresses work similarly, except that -Markdown will also perform a bit of randomized decimal and hex -entity-encoding to help obscure your address from address-harvesting -spambots. For example, Markdown will turn this: - - - -into something like this: - - address@exa - mple.com - -which will render in a browser as a clickable link to "address@example.com". - -(This sort of entity-encoding trick will indeed fool many, if not -most, address-harvesting bots, but it definitely won't fool all of -them. It's better than nothing, but an address published in this way -will probably eventually start receiving spam.) - - - -

Backslash Escapes

- -Markdown allows you to use backslash escapes to generate literal -characters which would otherwise have special meaning in Markdown's -formatting syntax. For example, if you wanted to surround a word with -literal asterisks (instead of an HTML `` tag), you can backslashes -before the asterisks, like this: - - \*literal asterisks\* - -Markdown provides backslash escapes for the following characters: - - \ backslash - ` backtick - * asterisk - _ underscore - {} curly braces - [] square brackets - () parentheses - # hash mark - + plus sign - - minus sign (hyphen) - . dot - ! exclamation mark - diff --git a/tests/extensions-x-def_list/simple_def-lists.html b/tests/extensions-x-def_list/simple_def-lists.html deleted file mode 100644 index 278e1ec..0000000 --- a/tests/extensions-x-def_list/simple_def-lists.html +++ /dev/null @@ -1,37 +0,0 @@ -

Some text

-
-
term1
-
Def1
-
term2-1
-
term2-2
-
Def2-1
-
Def2-2
-
-

more text

-
-
term 3
-
-

def 3 -line 2 of def 3

-

paragraph 2 of def 3.

-
-
-

def 3-2

-
# A code block in a def
-
-
-

a blockquote

-
-
    -
  • -

    a list item

    -
  • -
  • -
    -

    blockquote in list

    -
    -
  • -
-
-
-

final text.

\ No newline at end of file diff --git a/tests/extensions-x-def_list/simple_def-lists.txt b/tests/extensions-x-def_list/simple_def-lists.txt deleted file mode 100644 index 20c028a..0000000 --- a/tests/extensions-x-def_list/simple_def-lists.txt +++ /dev/null @@ -1,29 +0,0 @@ -Some text - -term1 -: Def1 - -term2-1 -term2-2 -: Def2-1 -: Def2-2 - -more text - -term *3* -: def 3 - line __2__ of def 3 - - paragraph 2 of def 3. - -: def 3-2 - - # A code block in a def - - > a blockquote - - * a list item - - * > blockquote in list - -final text. diff --git a/tests/extensions-x-footnotes/footnote.html b/tests/extensions-x-footnotes/footnote.html deleted file mode 100644 index 6556dab..0000000 --- a/tests/extensions-x-footnotes/footnote.html +++ /dev/null @@ -1,29 +0,0 @@ -

This is the body with a footnote1 or two2 or more3 4.

-
-
-
    -
  1. -

    Footnote that ends with a list:

    -
      -
    • item 1
    • -
    • item 2
    • -
    -

    -
  2. -
  3. -
    -

    This footnote is a blockquote. -

    -
    -

    -
  4. -
  5. -

    A simple oneliner. - 

    -
  6. -
  7. -

    A footnote with multiple paragraphs.

    -

    Paragraph two. 

    -
  8. -
-
\ No newline at end of file diff --git a/tests/extensions-x-footnotes/footnote.txt b/tests/extensions-x-footnotes/footnote.txt deleted file mode 100644 index 07188d0..0000000 --- a/tests/extensions-x-footnotes/footnote.txt +++ /dev/null @@ -1,14 +0,0 @@ -This is the body with a footnote[^1] or two[^2] or more[^3] [^4]. - -[^1]: Footnote that ends with a list: - - * item 1 - * item 2 - -[^2]: > This footnote is a blockquote. - -[^3]: A simple oneliner. - -[^4]: A footnote with multiple paragraphs. - - Paragraph two. diff --git a/tests/extensions-x-footnotes/named_markers.html b/tests/extensions-x-footnotes/named_markers.html deleted file mode 100644 index 6996b5f..0000000 --- a/tests/extensions-x-footnotes/named_markers.html +++ /dev/null @@ -1,24 +0,0 @@ -

This is the body with footnotes1 -that have named2 markers and -oddly3 numbered4 markers.

-
-
-
    -
  1. -

    Footnote marked foo. - 

    -
  2. -
  3. -

    This one is marked bar. - 

    -
  4. -
  5. -

    A numbered footnote. - 

    -
  6. -
  7. -

    The last one. - 

    -
  8. -
-
\ No newline at end of file diff --git a/tests/extensions-x-footnotes/named_markers.txt b/tests/extensions-x-footnotes/named_markers.txt deleted file mode 100644 index d246524..0000000 --- a/tests/extensions-x-footnotes/named_markers.txt +++ /dev/null @@ -1,9 +0,0 @@ -This is the body with footnotes[^foo] -that have named[^bar] markers and -oddly[^56] numbered[^99] markers. - -[^foo]: Footnote marked ``foo``. -[^bar]: This one is marked *bar*. -[^56]: A __numbered__ footnote. -[^99]: The last one. - diff --git a/tests/extensions-x-tables/tables.html b/tests/extensions-x-tables/tables.html deleted file mode 100644 index c931e6a..0000000 --- a/tests/extensions-x-tables/tables.html +++ /dev/null @@ -1,119 +0,0 @@ -

Table Tests

- - - - - - - - - - - - - - - - - -
First HeaderSecond Header
Content CellContent Cell
Content CellContent Cell
- - - - - - - - - - - - - - - - - -
First HeaderSecond Header
Content CellContent Cell
Content CellContent Cell
- - - - - - - - - - - - - - - - - - - - - -
ItemValue
Computer$1600
Phone$12
Pipe$1
- - - - - - - - - - - - - - - - - -
Function nameDescription
help()Display the help window.
destroy()Destroy your computer!
- - - - - - - - - - - - - - - - - -
foobarbaz
-Q -
W -W
- - - - - - - - - - - - - - - - - -
foobarbaz
-Q -
W -W
\ No newline at end of file diff --git a/tests/extensions-x-tables/tables.txt b/tests/extensions-x-tables/tables.txt deleted file mode 100644 index 64917ab..0000000 --- a/tests/extensions-x-tables/tables.txt +++ /dev/null @@ -1,34 +0,0 @@ -Table Tests ------------ - -First Header | Second Header -------------- | ------------- -Content Cell | Content Cell -Content Cell | Content Cell - -| First Header | Second Header | -| ------------- | ------------- | -| Content Cell | Content Cell | -| Content Cell | Content Cell | - -| Item | Value | -| :-------- | -----:| -| Computer | $1600 | -| Phone | $12 | -| Pipe | $1 | - -| Function name | Description | -| ------------- | ------------------------------ | -| `help()` | Display the help window. | -| `destroy()` | **Destroy your computer!** | - -|foo|bar|baz| -|:--|:-:|--:| -| | Q | | -|W | | W| - -foo|bar|baz ----|---|--- - | Q | - W | | W - diff --git a/tests/extensions-x-toc/invalid.html b/tests/extensions-x-toc/invalid.html deleted file mode 100644 index 41a3b1f..0000000 --- a/tests/extensions-x-toc/invalid.html +++ /dev/null @@ -1,6 +0,0 @@ -

[TOC]

-

Header 1

-

The TOC marker cannot be inside a header. This test makes sure markdown doesn't -crash when it encounters this errant syntax. The unexpected output should -clue the author in that s/he needs to add a blank line between the TOC and -the <hr>.

\ No newline at end of file diff --git a/tests/extensions-x-toc/invalid.txt b/tests/extensions-x-toc/invalid.txt deleted file mode 100644 index f6c4ec4..0000000 --- a/tests/extensions-x-toc/invalid.txt +++ /dev/null @@ -1,9 +0,0 @@ -[TOC] ------ - -# Header 1 - -The TOC marker cannot be inside a header. This test makes sure markdown doesn't -crash when it encounters this errant syntax. The unexpected output should -clue the author in that s/he needs to add a blank line between the TOC and -the `
`. diff --git a/tests/extensions-x-toc/nested.html b/tests/extensions-x-toc/nested.html deleted file mode 100644 index a8a1583..0000000 --- a/tests/extensions-x-toc/nested.html +++ /dev/null @@ -1,16 +0,0 @@ -

Header A

-

Header 1

-

Header i

-

Header B

-
- -
\ No newline at end of file diff --git a/tests/extensions-x-toc/nested.txt b/tests/extensions-x-toc/nested.txt deleted file mode 100644 index 9b515f9..0000000 --- a/tests/extensions-x-toc/nested.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Header A - -## Header 1 - -### Header i - -# Header B - -[TOC] diff --git a/tests/extensions-x-toc/syntax-toc.html b/tests/extensions-x-toc/syntax-toc.html deleted file mode 100644 index eea5347..0000000 --- a/tests/extensions-x-toc/syntax-toc.html +++ /dev/null @@ -1,699 +0,0 @@ - -

Overview

-

Philosophy

-

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

-

Readability, however, is emphasized above all else. A Markdown-formatted -document should be publishable as-is, as plain text, without looking -like it's been marked up with tags or formatting instructions. While -Markdown's syntax has been influenced by several existing text-to-HTML -filters -- including Setext, atx, Textile, reStructuredText, -Grutatext, and EtText -- the single biggest source of -inspiration for Markdown's syntax is the format of plain text email.

-

To this end, Markdown's syntax is comprised entirely of punctuation -characters, which punctuation characters have been carefully chosen so -as to look like what they mean. E.g., asterisks around a word actually -look like *emphasis*. Markdown lists look like, well, lists. Even -blockquotes look like quoted passages of text, assuming you've ever -used email.

-

Inline HTML

-

Markdown's syntax is intended for one purpose: to be used as a -format for writing for the web.

-

Markdown is not a replacement for HTML, or even close to it. Its -syntax is very small, corresponding only to a very small subset of -HTML tags. The idea is not to create a syntax that makes it easier -to insert HTML tags. In my opinion, HTML tags are already easy to -insert. The idea for Markdown is to make it easy to read, write, and -edit prose. HTML is a publishing format; Markdown is a writing -format. Thus, Markdown's formatting syntax only addresses issues that -can be conveyed in plain text.

-

For any markup that is not covered by Markdown's syntax, you simply -use HTML itself. There's no need to preface it or delimit it to -indicate that you're switching from Markdown to HTML; you just use -the tags.

-

The only restrictions are that block-level HTML elements -- e.g. <div>, -<table>, <pre>, <p>, etc. -- must be separated from surrounding -content by blank lines, and the start and end tags of the block should -not be indented with tabs or spaces. Markdown is smart enough not -to add extra (unwanted) <p> tags around HTML block-level tags.

-

For example, to add an HTML table to a Markdown article:

-
This is a regular paragraph.
-
-<table>
-    <tr>
-        <td>Foo</td>
-    </tr>
-</table>
-
-This is another regular paragraph.
-
-

Note that Markdown formatting syntax is not processed within block-level -HTML tags. E.g., you can't use Markdown-style *emphasis* inside an -HTML block.

-

Span-level HTML tags -- e.g. <span>, <cite>, or <del> -- can be -used anywhere in a Markdown paragraph, list item, or header. If you -want, you can even use HTML tags instead of Markdown formatting; e.g. if -you'd prefer to use HTML <a> or <img> tags instead of Markdown's -link or image syntax, go right ahead.

-

Unlike block-level HTML tags, Markdown syntax is processed within -span-level tags.

-

Automatic Escaping for Special Characters

-

In HTML, there are two characters that demand special treatment: < -and &. Left angle brackets are used to start tags; ampersands are -used to denote HTML entities. If you want to use them as literal -characters, you must escape them as entities, e.g. &lt;, and -&amp;.

-

Ampersands in particular are bedeviling for web writers. If you want to -write about 'AT&T', you need to write 'AT&amp;T'. You even need to -escape ampersands within URLs. Thus, if you want to link to:

-
http://images.google.com/images?num=30&q=larry+bird
-
-

you need to encode the URL as:

-
http://images.google.com/images?num=30&amp;q=larry+bird
-
-

in your anchor tag href attribute. Needless to say, this is easy to -forget, and is probably the single most common source of HTML validation -errors in otherwise well-marked-up web sites.

-

Markdown allows you to use these characters naturally, taking care of -all the necessary escaping for you. If you use an ampersand as part of -an HTML entity, it remains unchanged; otherwise it will be translated -into &amp;.

-

So, if you want to include a copyright symbol in your article, you can write:

-
&copy;
-
-

and Markdown will leave it alone. But if you write:

-
AT&T
-
-

Markdown will translate it to:

-
AT&amp;T
-
-

Similarly, because Markdown supports inline HTML, if you use -angle brackets as delimiters for HTML tags, Markdown will treat them as -such. But if you write:

-
4 < 5
-
-

Markdown will translate it to:

-
4 &lt; 5
-
-

However, inside Markdown code spans and blocks, angle brackets and -ampersands are always encoded automatically. This makes it easy to use -Markdown to write about HTML code. (As opposed to raw HTML, which is a -terrible format for writing about HTML syntax, because every single < -and & in your example code needs to be escaped.)

-
-

Block Elements

-

Paragraphs and Line Breaks

-

A paragraph is simply one or more consecutive lines of text, separated -by one or more blank lines. (A blank line is any line that looks like a -blank line -- a line containing nothing but spaces or tabs is considered -blank.) Normal paragraphs should not be intended with spaces or tabs.

-

The implication of the "one or more consecutive lines of text" rule is -that Markdown supports "hard-wrapped" text paragraphs. This differs -significantly from most other text-to-HTML formatters (including Movable -Type's "Convert Line Breaks" option) which translate every line break -character in a paragraph into a <br /> tag.

-

When you do want to insert a <br /> break tag using Markdown, you -end a line with two or more spaces, then type return.

-

Yes, this takes a tad more effort to create a <br />, but a simplistic -"every line break is a <br />" rule wouldn't work for Markdown. -Markdown's email-style blockquoting and multi-paragraph list items -work best -- and look better -- when you format them with hard breaks.

-

Headers

-

Markdown supports two styles of headers, Setext and atx.

-

Setext-style headers are "underlined" using equal signs (for first-level -headers) and dashes (for second-level headers). For example:

-
This is an H1
-=============
-
-This is an H2
--------------
-
-

Any number of underlining ='s or -'s will work.

-

Atx-style headers use 1-6 hash characters at the start of the line, -corresponding to header levels 1-6. For example:

-
# This is an H1
-
-## This is an H2
-
-###### This is an H6
-
-

Optionally, you may "close" atx-style headers. This is purely -cosmetic -- you can use this if you think it looks better. The -closing hashes don't even need to match the number of hashes -used to open the header. (The number of opening hashes -determines the header level.) :

-
# This is an H1 #
-
-## This is an H2 ##
-
-### This is an H3 ######
-
-

Blockquotes

-

Markdown uses email-style > characters for blockquoting. If you're -familiar with quoting passages of text in an email message, then you -know how to create a blockquote in Markdown. It looks best if you hard -wrap the text and put a > before every line:

-
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
-> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
-> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
-> 
-> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
-> id sem consectetuer libero luctus adipiscing.
-
-

Markdown allows you to be lazy and only put the > before the first -line of a hard-wrapped paragraph:

-
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
-consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
-Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
-
-> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
-id sem consectetuer libero luctus adipiscing.
-
-

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by -adding additional levels of >:

-
> This is the first level of quoting.
->
-> > This is nested blockquote.
->
-> Back to the first level.
-
-

Blockquotes can contain other Markdown elements, including headers, lists, -and code blocks:

-
> ## This is a header.
-> 
-> 1.   This is the first list item.
-> 2.   This is the second list item.
-> 
-> Here's some example code:
-> 
->     return shell_exec("echo $input | $markdown_script");
-
-

Any decent text editor should make email-style quoting easy. For -example, with BBEdit, you can make a selection and choose Increase -Quote Level from the Text menu.

-

Lists

-

Markdown supports ordered (numbered) and unordered (bulleted) lists.

-

Unordered lists use asterisks, pluses, and hyphens -- interchangably --- as list markers:

-
*   Red
-*   Green
-*   Blue
-
-

is equivalent to:

-
+   Red
-+   Green
-+   Blue
-
-

and:

-
-   Red
--   Green
--   Blue
-
-

Ordered lists use numbers followed by periods:

-
1.  Bird
-2.  McHale
-3.  Parish
-
-

It's important to note that the actual numbers you use to mark the -list have no effect on the HTML output Markdown produces. The HTML -Markdown produces from the above list is:

-
<ol>
-<li>Bird</li>
-<li>McHale</li>
-<li>Parish</li>
-</ol>
-
-

If you instead wrote the list in Markdown like this:

-
1.  Bird
-1.  McHale
-1.  Parish
-
-

or even:

-
3. Bird
-1. McHale
-8. Parish
-
-

you'd get the exact same HTML output. The point is, if you want to, -you can use ordinal numbers in your ordered Markdown lists, so that -the numbers in your source match the numbers in your published HTML. -But if you want to be lazy, you don't have to.

-

If you do use lazy list numbering, however, you should still start the -list with the number 1. At some point in the future, Markdown may support -starting ordered lists at an arbitrary number.

-

List markers typically start at the left margin, but may be indented by -up to three spaces. List markers must be followed by one or more spaces -or a tab.

-

To make lists look nice, you can wrap items with hanging indents:

-
*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
-    Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
-    viverra nec, fringilla in, laoreet vitae, risus.
-*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
-    Suspendisse id sem consectetuer libero luctus adipiscing.
-
-

But if you want to be lazy, you don't have to:

-
*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
-Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
-viverra nec, fringilla in, laoreet vitae, risus.
-*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
-Suspendisse id sem consectetuer libero luctus adipiscing.
-
-

If list items are separated by blank lines, Markdown will wrap the -items in <p> tags in the HTML output. For example, this input:

-
*   Bird
-*   Magic
-
-

will turn into:

-
<ul>
-<li>Bird</li>
-<li>Magic</li>
-</ul>
-
-

But this:

-
*   Bird
-
-*   Magic
-
-

will turn into:

-
<ul>
-<li><p>Bird</p></li>
-<li><p>Magic</p></li>
-</ul>
-
-

List items may consist of multiple paragraphs. Each subsequent -paragraph in a list item must be intended by either 4 spaces -or one tab:

-
1.  This is a list item with two paragraphs. Lorem ipsum dolor
-    sit amet, consectetuer adipiscing elit. Aliquam hendrerit
-    mi posuere lectus.
-
-    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
-    vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
-    sit amet velit.
-
-2.  Suspendisse id sem consectetuer libero luctus adipiscing.
-
-

It looks nice if you indent every line of the subsequent -paragraphs, but here again, Markdown will allow you to be -lazy:

-
*   This is a list item with two paragraphs.
-
-    This is the second paragraph in the list item. You're
-only required to indent the first line. Lorem ipsum dolor
-sit amet, consectetuer adipiscing elit.
-
-*   Another item in the same list.
-
-

To put a blockquote within a list item, the blockquote's > -delimiters need to be indented:

-
*   A list item with a blockquote:
-
-    > This is a blockquote
-    > inside a list item.
-
-

To put a code block within a list item, the code block needs -to be indented twice -- 8 spaces or two tabs:

-
*   A list item with a code block:
-
-        <code goes here>
-
-

It's worth noting that it's possible to trigger an ordered list by -accident, by writing something like this:

-
1986. What a great season.
-
-

In other words, a number-period-space sequence at the beginning of a -line. To avoid this, you can backslash-escape the period:

-
1986\. What a great season.
-
-

Code Blocks

-

Pre-formatted code blocks are used for writing about programming or -markup source code. Rather than forming normal paragraphs, the lines -of a code block are interpreted literally. Markdown wraps a code block -in both <pre> and <code> tags.

-

To produce a code block in Markdown, simply indent every line of the -block by at least 4 spaces or 1 tab. For example, given this input:

-
This is a normal paragraph:
-
-    This is a code block.
-
-

Markdown will generate:

-
<p>This is a normal paragraph:</p>
-
-<pre><code>This is a code block.
-</code></pre>
-
-

One level of indentation -- 4 spaces or 1 tab -- is removed from each -line of the code block. For example, this:

-
Here is an example of AppleScript:
-
-    tell application "Foo"
-        beep
-    end tell
-
-

will turn into:

-
<p>Here is an example of AppleScript:</p>
-
-<pre><code>tell application "Foo"
-    beep
-end tell
-</code></pre>
-
-

A code block continues until it reaches a line that is not indented -(or the end of the article).

-

Within a code block, ampersands (&) and angle brackets (< and >) -are automatically converted into HTML entities. This makes it very -easy to include example HTML source code using Markdown -- just paste -it and indent it, and Markdown will handle the hassle of encoding the -ampersands and angle brackets. For example, this:

-
    <div class="footer">
-        &copy; 2004 Foo Corporation
-    </div>
-
-

will turn into:

-
<pre><code>&lt;div class="footer"&gt;
-    &amp;copy; 2004 Foo Corporation
-&lt;/div&gt;
-</code></pre>
-
-

Regular Markdown syntax is not processed within code blocks. E.g., -asterisks are just literal asterisks within a code block. This means -it's also easy to use Markdown to write about Markdown's own syntax.

-

Horizontal Rules

-

You can produce a horizontal rule tag (<hr />) by placing three or -more hyphens, asterisks, or underscores on a line by themselves. If you -wish, you may use spaces between the hyphens or asterisks. Each of the -following lines will produce a horizontal rule:

-
* * *
-
-***
-
-*****
-
-- - -
-
----------------------------------------
-
-_ _ _
-
-
-

Span Elements

- -

Markdown supports two style of links: inline and reference.

-

In both styles, the link text is delimited by [square brackets].

-

To create an inline link, use a set of regular parentheses immediately -after the link text's closing square bracket. Inside the parentheses, -put the URL where you want the link to point, along with an optional -title for the link, surrounded in quotes. For example:

-
This is [an example](http://example.com/ "Title") inline link.
-
-[This link](http://example.net/) has no title attribute.
-
-

Will produce:

-
<p>This is <a href="http://example.com/" title="Title">
-an example</a> inline link.</p>
-
-<p><a href="http://example.net/">This link</a> has no
-title attribute.</p>
-
-

If you're referring to a local resource on the same server, you can -use relative paths:

-
See my [About](/about/) page for details.
-
-

Reference-style links use a second set of square brackets, inside -which you place a label of your choosing to identify the link:

-
This is [an example][id] reference-style link.
-
-

You can optionally use a space to separate the sets of brackets:

-
This is [an example] [id] reference-style link.
-
-

Then, anywhere in the document, you define your link label like this, -on a line by itself:

-
[id]: http://example.com/  "Optional Title Here"
-
-

That is:

-
    -
  • Square brackets containing the link identifier (optionally -indented from the left margin using up to three spaces);
  • -
  • followed by a colon;
  • -
  • followed by one or more spaces (or tabs);
  • -
  • followed by the URL for the link;
  • -
  • optionally followed by a title attribute for the link, enclosed -in double or single quotes.
  • -
-

The link URL may, optionally, be surrounded by angle brackets:

-
[id]: <http://example.com/>  "Optional Title Here"
-
-

You can put the title attribute on the next line and use extra spaces -or tabs for padding, which tends to look better with longer URLs:

-
[id]: http://example.com/longish/path/to/resource/here
-    "Optional Title Here"
-
-

Link definitions are only used for creating links during Markdown -processing, and are stripped from your document in the HTML output.

-

Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are not case sensitive. E.g. these two links:

-
[link text][a]
-[link text][A]
-
-

are equivalent.

-

The implicit link name shortcut allows you to omit the name of the -link, in which case the link text itself is used as the name. -Just use an empty set of square brackets -- e.g., to link the word -"Google" to the google.com web site, you could simply write:

-
[Google][]
-
-

And then define the link:

-
[Google]: http://google.com/
-
-

Because link names may contain spaces, this shortcut even works for -multiple words in the link text:

-
Visit [Daring Fireball][] for more information.
-
-

And then define the link:

-
[Daring Fireball]: http://daringfireball.net/
-
-

Link definitions can be placed anywhere in your Markdown document. I -tend to put them immediately after each paragraph in which they're -used, but if you want, you can put them all at the end of your -document, sort of like footnotes.

-

Here's an example of reference links in action:

-
I get 10 times more traffic from [Google] [1] than from
-[Yahoo] [2] or [MSN] [3].
-
-  [1]: http://google.com/        "Google"
-  [2]: http://search.yahoo.com/  "Yahoo Search"
-  [3]: http://search.msn.com/    "MSN Search"
-
-

Using the implicit link name shortcut, you could instead write:

-
I get 10 times more traffic from [Google][] than from
-[Yahoo][] or [MSN][].
-
-  [google]: http://google.com/        "Google"
-  [yahoo]:  http://search.yahoo.com/  "Yahoo Search"
-  [msn]:    http://search.msn.com/    "MSN Search"
-
-

Both of the above examples will produce the following HTML output:

-
<p>I get 10 times more traffic from <a href="http://google.com/"
-title="Google">Google</a> than from
-<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
-or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
-
-

For comparison, here is the same paragraph written using -Markdown's inline link style:

-
I get 10 times more traffic from [Google](http://google.com/ "Google")
-than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
-[MSN](http://search.msn.com/ "MSN Search").
-
-

The point of reference-style links is not that they're easier to -write. The point is that with reference-style links, your document -source is vastly more readable. Compare the above examples: using -reference-style links, the paragraph itself is only 81 characters -long; with inline-style links, it's 176 characters; and as raw HTML, -it's 234 characters. In the raw HTML, there's more markup than there -is text.

-

With Markdown's reference-style links, a source document much more -closely resembles the final output, as rendered in a browser. By -allowing you to move the markup-related metadata out of the paragraph, -you can add links without interrupting the narrative flow of your -prose.

-

Emphasis

-

Markdown treats asterisks (*) and underscores (_) as indicators of -emphasis. Text wrapped with one * or _ will be wrapped with an -HTML <em> tag; double *'s or _'s will be wrapped with an HTML -<strong> tag. E.g., this input:

-
*single asterisks*
-
-_single underscores_
-
-**double asterisks**
-
-__double underscores__
-
-

will produce:

-
<em>single asterisks</em>
-
-<em>single underscores</em>
-
-<strong>double asterisks</strong>
-
-<strong>double underscores</strong>
-
-

You can use whichever style you prefer; the lone restriction is that -the same character must be used to open and close an emphasis span.

-

Emphasis can be used in the middle of a word:

-
un*fucking*believable
-
-

But if you surround an * or _ with spaces, it'll be treated as a -literal asterisk or underscore.

-

To produce a literal asterisk or underscore at a position where it -would otherwise be used as an emphasis delimiter, you can backslash -escape it:

-
\*this text is surrounded by literal asterisks\*
-
-

Code

-

To indicate a span of code, wrap it with backtick quotes (`). -Unlike a pre-formatted code block, a code span indicates code within a -normal paragraph. For example:

-
Use the `printf()` function.
-
-

will produce:

-
<p>Use the <code>printf()</code> function.</p>
-
-

To include a literal backtick character within a code span, you can use -multiple backticks as the opening and closing delimiters:

-
``There is a literal backtick (`) here.``
-
-

which will produce this:

-
<p><code>There is a literal backtick (`) here.</code></p>
-
-

The backtick delimiters surrounding a code span may include spaces -- -one after the opening, one before the closing. This allows you to place -literal backtick characters at the beginning or end of a code span:

-
A single backtick in a code span: `` ` ``
-
-A backtick-delimited string in a code span: `` `foo` ``
-
-

will produce:

-
<p>A single backtick in a code span: <code>`</code></p>
-
-<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
-
-

With a code span, ampersands and angle brackets are encoded as HTML -entities automatically, which makes it easy to include example HTML -tags. Markdown will turn this:

-
Please don't use any `<blink>` tags.
-
-

into:

-
<p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
-
-

You can write this:

-
`&#8212;` is the decimal-encoded equivalent of `&mdash;`.
-
-

to produce:

-
<p><code>&amp;#8212;</code> is the decimal-encoded
-equivalent of <code>&amp;mdash;</code>.</p>
-
-

Images

-

Admittedly, it's fairly difficult to devise a "natural" syntax for -placing images into a plain text document format.

-

Markdown uses an image syntax that is intended to resemble the syntax -for links, allowing for two styles: inline and reference.

-

Inline image syntax looks like this:

-
![Alt text](/path/to/img.jpg)
-
-![Alt text](/path/to/img.jpg "Optional title")
-
-

That is:

-
    -
  • An exclamation mark: !;
  • -
  • followed by a set of square brackets, containing the alt -attribute text for the image;
  • -
  • followed by a set of parentheses, containing the URL or path to -the image, and an optional title attribute enclosed in double -or single quotes.
  • -
-

Reference-style image syntax looks like this:

-
![Alt text][id]
-
-

Where "id" is the name of a defined image reference. Image references -are defined using syntax identical to link references:

-
[id]: url/to/image  "Optional title attribute"
-
-

As of this writing, Markdown has no syntax for specifying the -dimensions of an image; if this is important to you, you can simply -use regular HTML <img> tags.

-
-

Miscellaneous

- -

Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

-
<http://example.com/>
-
-

Markdown will turn this into:

-
<a href="http://example.com/">http://example.com/</a>
-
-

Automatic links for email addresses work similarly, except that -Markdown will also perform a bit of randomized decimal and hex -entity-encoding to help obscure your address from address-harvesting -spambots. For example, Markdown will turn this:

-
<address@example.com>
-
-

into something like this:

-
<a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
-&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
-&#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
-&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
-
-

which will render in a browser as a clickable link to "address@example.com".

-

(This sort of entity-encoding trick will indeed fool many, if not -most, address-harvesting bots, but it definitely won't fool all of -them. It's better than nothing, but an address published in this way -will probably eventually start receiving spam.)

-

Backslash Escapes

-

Markdown allows you to use backslash escapes to generate literal -characters which would otherwise have special meaning in Markdown's -formatting syntax. For example, if you wanted to surround a word with -literal asterisks (instead of an HTML <em> tag), you can backslashes -before the asterisks, like this:

-
\*literal asterisks\*
-
-

Markdown provides backslash escapes for the following characters:

-
\   backslash
-`   backtick
-*   asterisk
-_   underscore
-{}  curly braces
-[]  square brackets
-()  parentheses
-#   hash mark
-+   plus sign
--   minus sign (hyphen)
-.   dot
-!   exclamation mark
-
\ No newline at end of file diff --git a/tests/extensions-x-toc/syntax-toc.txt b/tests/extensions-x-toc/syntax-toc.txt deleted file mode 100644 index f297200..0000000 --- a/tests/extensions-x-toc/syntax-toc.txt +++ /dev/null @@ -1,851 +0,0 @@ - -[TOC] - -# Overview - -## Philosophy - -Markdown is intended to be as easy-to-read and easy-to-write as is feasible. - -Readability, however, is emphasized above all else. A Markdown-formatted -document should be publishable as-is, as plain text, without looking -like it's been marked up with tags or formatting instructions. While -Markdown's syntax has been influenced by several existing text-to-HTML -filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4], -[Grutatext] [5], and [EtText] [6] -- the single biggest source of -inspiration for Markdown's syntax is the format of plain text email. - - [1]: http://docutils.sourceforge.net/mirror/setext.html - [2]: http://www.aaronsw.com/2002/atx/ - [3]: http://textism.com/tools/textile/ - [4]: http://docutils.sourceforge.net/rst.html - [5]: http://www.triptico.com/software/grutatxt.html - [6]: http://ettext.taint.org/doc/ - -To this end, Markdown's syntax is comprised entirely of punctuation -characters, which punctuation characters have been carefully chosen so -as to look like what they mean. E.g., asterisks around a word actually -look like \*emphasis\*. Markdown lists look like, well, lists. Even -blockquotes look like quoted passages of text, assuming you've ever -used email. - - - -## Inline HTML - -Markdown's syntax is intended for one purpose: to be used as a -format for *writing* for the web. - -Markdown is not a replacement for HTML, or even close to it. Its -syntax is very small, corresponding only to a very small subset of -HTML tags. The idea is *not* to create a syntax that makes it easier -to insert HTML tags. In my opinion, HTML tags are already easy to -insert. The idea for Markdown is to make it easy to read, write, and -edit prose. HTML is a *publishing* format; Markdown is a *writing* -format. Thus, Markdown's formatting syntax only addresses issues that -can be conveyed in plain text. - -For any markup that is not covered by Markdown's syntax, you simply -use HTML itself. There's no need to preface it or delimit it to -indicate that you're switching from Markdown to HTML; you just use -the tags. - -The only restrictions are that block-level HTML elements -- e.g. `
`, -``, `
`, `

`, etc. -- must be separated from surrounding -content by blank lines, and the start and end tags of the block should -not be indented with tabs or spaces. Markdown is smart enough not -to add extra (unwanted) `

` tags around HTML block-level tags. - -For example, to add an HTML table to a Markdown article: - - This is a regular paragraph. - -

- - - -
Foo
- - This is another regular paragraph. - -Note that Markdown formatting syntax is not processed within block-level -HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an -HTML block. - -Span-level HTML tags -- e.g. ``, ``, or `` -- can be -used anywhere in a Markdown paragraph, list item, or header. If you -want, you can even use HTML tags instead of Markdown formatting; e.g. if -you'd prefer to use HTML `` or `` tags instead of Markdown's -link or image syntax, go right ahead. - -Unlike block-level HTML tags, Markdown syntax *is* processed within -span-level tags. - - -## Automatic Escaping for Special Characters - -In HTML, there are two characters that demand special treatment: `<` -and `&`. Left angle brackets are used to start tags; ampersands are -used to denote HTML entities. If you want to use them as literal -characters, you must escape them as entities, e.g. `<`, and -`&`. - -Ampersands in particular are bedeviling for web writers. If you want to -write about 'AT&T', you need to write '`AT&T`'. You even need to -escape ampersands within URLs. Thus, if you want to link to: - - http://images.google.com/images?num=30&q=larry+bird - -you need to encode the URL as: - - http://images.google.com/images?num=30&q=larry+bird - -in your anchor tag `href` attribute. Needless to say, this is easy to -forget, and is probably the single most common source of HTML validation -errors in otherwise well-marked-up web sites. - -Markdown allows you to use these characters naturally, taking care of -all the necessary escaping for you. If you use an ampersand as part of -an HTML entity, it remains unchanged; otherwise it will be translated -into `&`. - -So, if you want to include a copyright symbol in your article, you can write: - - © - -and Markdown will leave it alone. But if you write: - - AT&T - -Markdown will translate it to: - - AT&T - -Similarly, because Markdown supports [inline HTML](#html), if you use -angle brackets as delimiters for HTML tags, Markdown will treat them as -such. But if you write: - - 4 < 5 - -Markdown will translate it to: - - 4 < 5 - -However, inside Markdown code spans and blocks, angle brackets and -ampersands are *always* encoded automatically. This makes it easy to use -Markdown to write about HTML code. (As opposed to raw HTML, which is a -terrible format for writing about HTML syntax, because every single `<` -and `&` in your example code needs to be escaped.) - - -* * * - - -# Block Elements - - -## Paragraphs and Line Breaks - -A paragraph is simply one or more consecutive lines of text, separated -by one or more blank lines. (A blank line is any line that looks like a -blank line -- a line containing nothing but spaces or tabs is considered -blank.) Normal paragraphs should not be intended with spaces or tabs. - -The implication of the "one or more consecutive lines of text" rule is -that Markdown supports "hard-wrapped" text paragraphs. This differs -significantly from most other text-to-HTML formatters (including Movable -Type's "Convert Line Breaks" option) which translate every line break -character in a paragraph into a `
` tag. - -When you *do* want to insert a `
` break tag using Markdown, you -end a line with two or more spaces, then type return. - -Yes, this takes a tad more effort to create a `
`, but a simplistic -"every line break is a `
`" rule wouldn't work for Markdown. -Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l] -work best -- and look better -- when you format them with hard breaks. - - [bq]: #blockquote - [l]: #list - - - -## Headers - -Markdown supports two styles of headers, [Setext] [1] and [atx] [2]. - -Setext-style headers are "underlined" using equal signs (for first-level -headers) and dashes (for second-level headers). For example: - - This is an H1 - ============= - - This is an H2 - ------------- - -Any number of underlining `=`'s or `-`'s will work. - -Atx-style headers use 1-6 hash characters at the start of the line, -corresponding to header levels 1-6. For example: - - # This is an H1 - - ## This is an H2 - - ###### This is an H6 - -Optionally, you may "close" atx-style headers. This is purely -cosmetic -- you can use this if you think it looks better. The -closing hashes don't even need to match the number of hashes -used to open the header. (The number of opening hashes -determines the header level.) : - - # This is an H1 # - - ## This is an H2 ## - - ### This is an H3 ###### - - -## Blockquotes - -Markdown uses email-style `>` characters for blockquoting. If you're -familiar with quoting passages of text in an email message, then you -know how to create a blockquote in Markdown. It looks best if you hard -wrap the text and put a `>` before every line: - - > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, - > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. - > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. - > - > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse - > id sem consectetuer libero luctus adipiscing. - -Markdown allows you to be lazy and only put the `>` before the first -line of a hard-wrapped paragraph: - - > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, - consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. - Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. - - > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse - id sem consectetuer libero luctus adipiscing. - -Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by -adding additional levels of `>`: - - > This is the first level of quoting. - > - > > This is nested blockquote. - > - > Back to the first level. - -Blockquotes can contain other Markdown elements, including headers, lists, -and code blocks: - - > ## This is a header. - > - > 1. This is the first list item. - > 2. This is the second list item. - > - > Here's some example code: - > - > return shell_exec("echo $input | $markdown_script"); - -Any decent text editor should make email-style quoting easy. For -example, with BBEdit, you can make a selection and choose Increase -Quote Level from the Text menu. - - -## Lists - -Markdown supports ordered (numbered) and unordered (bulleted) lists. - -Unordered lists use asterisks, pluses, and hyphens -- interchangably --- as list markers: - - * Red - * Green - * Blue - -is equivalent to: - - + Red - + Green - + Blue - -and: - - - Red - - Green - - Blue - -Ordered lists use numbers followed by periods: - - 1. Bird - 2. McHale - 3. Parish - -It's important to note that the actual numbers you use to mark the -list have no effect on the HTML output Markdown produces. The HTML -Markdown produces from the above list is: - -
    -
  1. Bird
  2. -
  3. McHale
  4. -
  5. Parish
  6. -
- -If you instead wrote the list in Markdown like this: - - 1. Bird - 1. McHale - 1. Parish - -or even: - - 3. Bird - 1. McHale - 8. Parish - -you'd get the exact same HTML output. The point is, if you want to, -you can use ordinal numbers in your ordered Markdown lists, so that -the numbers in your source match the numbers in your published HTML. -But if you want to be lazy, you don't have to. - -If you do use lazy list numbering, however, you should still start the -list with the number 1. At some point in the future, Markdown may support -starting ordered lists at an arbitrary number. - -List markers typically start at the left margin, but may be indented by -up to three spaces. List markers must be followed by one or more spaces -or a tab. - -To make lists look nice, you can wrap items with hanging indents: - - * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. - Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, - viverra nec, fringilla in, laoreet vitae, risus. - * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. - Suspendisse id sem consectetuer libero luctus adipiscing. - -But if you want to be lazy, you don't have to: - - * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. - Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, - viverra nec, fringilla in, laoreet vitae, risus. - * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. - Suspendisse id sem consectetuer libero luctus adipiscing. - -If list items are separated by blank lines, Markdown will wrap the -items in `

` tags in the HTML output. For example, this input: - - * Bird - * Magic - -will turn into: - -

    -
  • Bird
  • -
  • Magic
  • -
- -But this: - - * Bird - - * Magic - -will turn into: - -
    -
  • Bird

  • -
  • Magic

  • -
- -List items may consist of multiple paragraphs. Each subsequent -paragraph in a list item must be intended by either 4 spaces -or one tab: - - 1. This is a list item with two paragraphs. Lorem ipsum dolor - sit amet, consectetuer adipiscing elit. Aliquam hendrerit - mi posuere lectus. - - Vestibulum enim wisi, viverra nec, fringilla in, laoreet - vitae, risus. Donec sit amet nisl. Aliquam semper ipsum - sit amet velit. - - 2. Suspendisse id sem consectetuer libero luctus adipiscing. - -It looks nice if you indent every line of the subsequent -paragraphs, but here again, Markdown will allow you to be -lazy: - - * This is a list item with two paragraphs. - - This is the second paragraph in the list item. You're - only required to indent the first line. Lorem ipsum dolor - sit amet, consectetuer adipiscing elit. - - * Another item in the same list. - -To put a blockquote within a list item, the blockquote's `>` -delimiters need to be indented: - - * A list item with a blockquote: - - > This is a blockquote - > inside a list item. - -To put a code block within a list item, the code block needs -to be indented *twice* -- 8 spaces or two tabs: - - * A list item with a code block: - - - - -It's worth noting that it's possible to trigger an ordered list by -accident, by writing something like this: - - 1986. What a great season. - -In other words, a *number-period-space* sequence at the beginning of a -line. To avoid this, you can backslash-escape the period: - - 1986\. What a great season. - - - -## Code Blocks - -Pre-formatted code blocks are used for writing about programming or -markup source code. Rather than forming normal paragraphs, the lines -of a code block are interpreted literally. Markdown wraps a code block -in both `
` and `` tags.
-
-To produce a code block in Markdown, simply indent every line of the
-block by at least 4 spaces or 1 tab. For example, given this input:
-
-    This is a normal paragraph:
-
-        This is a code block.
-
-Markdown will generate:
-
-    

This is a normal paragraph:

- -
This is a code block.
-    
- -One level of indentation -- 4 spaces or 1 tab -- is removed from each -line of the code block. For example, this: - - Here is an example of AppleScript: - - tell application "Foo" - beep - end tell - -will turn into: - -

Here is an example of AppleScript:

- -
tell application "Foo"
-        beep
-    end tell
-    
- -A code block continues until it reaches a line that is not indented -(or the end of the article). - -Within a code block, ampersands (`&`) and angle brackets (`<` and `>`) -are automatically converted into HTML entities. This makes it very -easy to include example HTML source code using Markdown -- just paste -it and indent it, and Markdown will handle the hassle of encoding the -ampersands and angle brackets. For example, this: - - - -will turn into: - -
<div class="footer">
-        &copy; 2004 Foo Corporation
-    </div>
-    
- -Regular Markdown syntax is not processed within code blocks. E.g., -asterisks are just literal asterisks within a code block. This means -it's also easy to use Markdown to write about Markdown's own syntax. - - - -## Horizontal Rules - -You can produce a horizontal rule tag (`
`) by placing three or -more hyphens, asterisks, or underscores on a line by themselves. If you -wish, you may use spaces between the hyphens or asterisks. Each of the -following lines will produce a horizontal rule: - - * * * - - *** - - ***** - - - - - - - --------------------------------------- - - _ _ _ - - -* * * - -# Span Elements - -## Links - -Markdown supports two style of links: *inline* and *reference*. - -In both styles, the link text is delimited by [square brackets]. - -To create an inline link, use a set of regular parentheses immediately -after the link text's closing square bracket. Inside the parentheses, -put the URL where you want the link to point, along with an *optional* -title for the link, surrounded in quotes. For example: - - This is [an example](http://example.com/ "Title") inline link. - - [This link](http://example.net/) has no title attribute. - -Will produce: - -

This is - an example inline link.

- -

This link has no - title attribute.

- -If you're referring to a local resource on the same server, you can -use relative paths: - - See my [About](/about/) page for details. - -Reference-style links use a second set of square brackets, inside -which you place a label of your choosing to identify the link: - - This is [an example][id] reference-style link. - -You can optionally use a space to separate the sets of brackets: - - This is [an example] [id] reference-style link. - -Then, anywhere in the document, you define your link label like this, -on a line by itself: - - [id]: http://example.com/ "Optional Title Here" - -That is: - -* Square brackets containing the link identifier (optionally - indented from the left margin using up to three spaces); -* followed by a colon; -* followed by one or more spaces (or tabs); -* followed by the URL for the link; -* optionally followed by a title attribute for the link, enclosed - in double or single quotes. - -The link URL may, optionally, be surrounded by angle brackets: - - [id]: "Optional Title Here" - -You can put the title attribute on the next line and use extra spaces -or tabs for padding, which tends to look better with longer URLs: - - [id]: http://example.com/longish/path/to/resource/here - "Optional Title Here" - -Link definitions are only used for creating links during Markdown -processing, and are stripped from your document in the HTML output. - -Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links: - - [link text][a] - [link text][A] - -are equivalent. - -The *implicit link name* shortcut allows you to omit the name of the -link, in which case the link text itself is used as the name. -Just use an empty set of square brackets -- e.g., to link the word -"Google" to the google.com web site, you could simply write: - - [Google][] - -And then define the link: - - [Google]: http://google.com/ - -Because link names may contain spaces, this shortcut even works for -multiple words in the link text: - - Visit [Daring Fireball][] for more information. - -And then define the link: - - [Daring Fireball]: http://daringfireball.net/ - -Link definitions can be placed anywhere in your Markdown document. I -tend to put them immediately after each paragraph in which they're -used, but if you want, you can put them all at the end of your -document, sort of like footnotes. - -Here's an example of reference links in action: - - I get 10 times more traffic from [Google] [1] than from - [Yahoo] [2] or [MSN] [3]. - - [1]: http://google.com/ "Google" - [2]: http://search.yahoo.com/ "Yahoo Search" - [3]: http://search.msn.com/ "MSN Search" - -Using the implicit link name shortcut, you could instead write: - - I get 10 times more traffic from [Google][] than from - [Yahoo][] or [MSN][]. - - [google]: http://google.com/ "Google" - [yahoo]: http://search.yahoo.com/ "Yahoo Search" - [msn]: http://search.msn.com/ "MSN Search" - -Both of the above examples will produce the following HTML output: - -

I get 10 times more traffic from Google than from - Yahoo - or MSN.

- -For comparison, here is the same paragraph written using -Markdown's inline link style: - - I get 10 times more traffic from [Google](http://google.com/ "Google") - than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or - [MSN](http://search.msn.com/ "MSN Search"). - -The point of reference-style links is not that they're easier to -write. The point is that with reference-style links, your document -source is vastly more readable. Compare the above examples: using -reference-style links, the paragraph itself is only 81 characters -long; with inline-style links, it's 176 characters; and as raw HTML, -it's 234 characters. In the raw HTML, there's more markup than there -is text. - -With Markdown's reference-style links, a source document much more -closely resembles the final output, as rendered in a browser. By -allowing you to move the markup-related metadata out of the paragraph, -you can add links without interrupting the narrative flow of your -prose. - - -## Emphasis - -Markdown treats asterisks (`*`) and underscores (`_`) as indicators of -emphasis. Text wrapped with one `*` or `_` will be wrapped with an -HTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML -`` tag. E.g., this input: - - *single asterisks* - - _single underscores_ - - **double asterisks** - - __double underscores__ - -will produce: - - single asterisks - - single underscores - - double asterisks - - double underscores - -You can use whichever style you prefer; the lone restriction is that -the same character must be used to open and close an emphasis span. - -Emphasis can be used in the middle of a word: - - un*fucking*believable - -But if you surround an `*` or `_` with spaces, it'll be treated as a -literal asterisk or underscore. - -To produce a literal asterisk or underscore at a position where it -would otherwise be used as an emphasis delimiter, you can backslash -escape it: - - \*this text is surrounded by literal asterisks\* - - - -## Code - -To indicate a span of code, wrap it with backtick quotes (`` ` ``). -Unlike a pre-formatted code block, a code span indicates code within a -normal paragraph. For example: - - Use the `printf()` function. - -will produce: - -

Use the printf() function.

- -To include a literal backtick character within a code span, you can use -multiple backticks as the opening and closing delimiters: - - ``There is a literal backtick (`) here.`` - -which will produce this: - -

There is a literal backtick (`) here.

- -The backtick delimiters surrounding a code span may include spaces -- -one after the opening, one before the closing. This allows you to place -literal backtick characters at the beginning or end of a code span: - - A single backtick in a code span: `` ` `` - - A backtick-delimited string in a code span: `` `foo` `` - -will produce: - -

A single backtick in a code span: `

- -

A backtick-delimited string in a code span: `foo`

- -With a code span, ampersands and angle brackets are encoded as HTML -entities automatically, which makes it easy to include example HTML -tags. Markdown will turn this: - - Please don't use any `` tags. - -into: - -

Please don't use any <blink> tags.

- -You can write this: - - `—` is the decimal-encoded equivalent of `—`. - -to produce: - -

&#8212; is the decimal-encoded - equivalent of &mdash;.

- - - -## Images - -Admittedly, it's fairly difficult to devise a "natural" syntax for -placing images into a plain text document format. - -Markdown uses an image syntax that is intended to resemble the syntax -for links, allowing for two styles: *inline* and *reference*. - -Inline image syntax looks like this: - - ![Alt text](/path/to/img.jpg) - - ![Alt text](/path/to/img.jpg "Optional title") - -That is: - -* An exclamation mark: `!`; -* followed by a set of square brackets, containing the `alt` - attribute text for the image; -* followed by a set of parentheses, containing the URL or path to - the image, and an optional `title` attribute enclosed in double - or single quotes. - -Reference-style image syntax looks like this: - - ![Alt text][id] - -Where "id" is the name of a defined image reference. Image references -are defined using syntax identical to link references: - - [id]: url/to/image "Optional title attribute" - -As of this writing, Markdown has no syntax for specifying the -dimensions of an image; if this is important to you, you can simply -use regular HTML `` tags. - - -* * * - - -# Miscellaneous - -## Automatic Links - -Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this: - - - -Markdown will turn this into: - - http://example.com/ - -Automatic links for email addresses work similarly, except that -Markdown will also perform a bit of randomized decimal and hex -entity-encoding to help obscure your address from address-harvesting -spambots. For example, Markdown will turn this: - - - -into something like this: - - address@exa - mple.com - -which will render in a browser as a clickable link to "address@example.com". - -(This sort of entity-encoding trick will indeed fool many, if not -most, address-harvesting bots, but it definitely won't fool all of -them. It's better than nothing, but an address published in this way -will probably eventually start receiving spam.) - - - -## Backslash Escapes - -Markdown allows you to use backslash escapes to generate literal -characters which would otherwise have special meaning in Markdown's -formatting syntax. For example, if you wanted to surround a word with -literal asterisks (instead of an HTML `` tag), you can backslashes -before the asterisks, like this: - - \*literal asterisks\* - -Markdown provides backslash escapes for the following characters: - - \ backslash - ` backtick - * asterisk - _ underscore - {} curly braces - [] square brackets - () parentheses - # hash mark - + plus sign - - minus sign (hyphen) - . dot - ! exclamation mark - diff --git a/tests/extensions-x-wikilinks/wikilinks.html b/tests/extensions-x-wikilinks/wikilinks.html deleted file mode 100644 index 1a38535..0000000 --- a/tests/extensions-x-wikilinks/wikilinks.html +++ /dev/null @@ -1,6 +0,0 @@ -

Some text with a WikiLink.

-

A link with white space and_underscores and a empty one.

-

And a RealLink.

-

http://example.com/And_A_AutoLink

-

And a MarkdownLink for -completeness.

\ No newline at end of file diff --git a/tests/extensions-x-wikilinks/wikilinks.txt b/tests/extensions-x-wikilinks/wikilinks.txt deleted file mode 100644 index 8e6911b..0000000 --- a/tests/extensions-x-wikilinks/wikilinks.txt +++ /dev/null @@ -1,14 +0,0 @@ -Some text with a [[WikiLink]]. - -A link with [[ white space and_underscores ]] and a empty [[ ]] one. - -Another with [[double spaces]] and [[double__underscores]] and -one that [[has _emphasis_ inside]] and one [[with_multiple_underscores]] -and one that is _[[emphasised]]_. - -And a RealLink. - - - -And a [MarkdownLink](/MarkdownLink/ "A MarkdownLink") for -completeness. diff --git a/tests/extensions/admonition.html b/tests/extensions/admonition.html new file mode 100644 index 0000000..8812dcb --- /dev/null +++ b/tests/extensions/admonition.html @@ -0,0 +1,48 @@ +

Some text

+
+

Note

+

A normal paragraph here

+
    +
  1. first
  2. +
  3. second
  4. +
+
+

Some important quote

+

another paragraph in the quote

+
+
int main() {
+    // insert some code
+}
+
+
+

More text and stuff.

+
+

Did you know?

+

You can customize the title of the admonition

+
+

Not part of an Admonition!

+
+

And now...

+

For something completely different.

+

You can also use a custom CSS class name.

+
+
+

And now...

+

For something completely different.

+

Several class names can be separated by space chars.

+
+
+

Note

+

The default title is the capitalized first class name.

+
+
+

An explicitly empty string prevents the title from being rendered.

+
+

No body:

+
+

Note

+
+

Extra whitespace after the title should not alter output:

+
+

Note

+
\ No newline at end of file diff --git a/tests/extensions/admonition.txt b/tests/extensions/admonition.txt new file mode 100644 index 0000000..03ff4e9 --- /dev/null +++ b/tests/extensions/admonition.txt @@ -0,0 +1,45 @@ +Some text + +!!! note + A normal paragraph here + + 1. first + 2. second + + > Some important quote + + > another paragraph in the quote + + int main() { + // insert some code + } + +More text and stuff. + +!!! Note "Did you know?" + You can customize the title of the admonition +Not part of an Admonition! + +!!! mycustomcssclass "And now..." + For something completely different. + + You can also use a custom CSS class name. + +!!! class1 class2 class3 "And now..." + For something completely different. + + Several class names can be separated by space chars. + +!!! note anotherclass + The default title is the capitalized first class name. + +!!! tip "" + An explicitly empty string prevents the title from being rendered. + +No body: + +!!! note + +Extra whitespace after the title should not alter output: + +!!! note diff --git a/tests/extensions/attr_list.html b/tests/extensions/attr_list.html new file mode 100644 index 0000000..e7bfe0b --- /dev/null +++ b/tests/extensions/attr_list.html @@ -0,0 +1,69 @@ +

This is a sextext header

+

A paragraph with some text. +Line two of the paragraph.

+

This is another

+

Test some inline text. +A link +And a nested link

+

This is a hash Header

+

And now some random attributes.

+

No closing hash header

+

Now test overrides

+
# A code block which contains attr_list syntax
+# This should be ignored.
+{: #someid .someclass }
+
+

No colon for compatibility with Headerid ext

+

Also a codespan: {: .someclass}.

+

Bad Syntax

+
    +
  • Item1
  • +
  • Item2
      +
    • Item2-1
    • +
    +
  • +
  • Item3
      +
    • Item3-1
    • +
    +
  • +
  • Item4
      +
    • Item4-1
    • +
    +
  • +
  • Item5
  • +
+

And ordered lists too

+
    +
  1. Item1
  2. +
  3. Item2
      +
    1. Item2-1
    2. +
    +
  4. +
  5. Item3
      +
    1. Item3-1
    2. +
    +
  6. +
  7. Item4
      +
    1. Item4-1
    2. +
    +
  8. +
  9. Item5
  10. +
+

Definition lists

+
+
DT1
+
DT2
+
Some dd
+
dd
+
DT3
+
Some dd
+
+

Bad attributes

+

Key without value

+

Value without key

+

No key or value

+

Weirdness

+

More weirdness

+

This should not cause a crash

+

Attr_lists do not contain newlines{ foo=bar +key=value }

\ No newline at end of file diff --git a/tests/extensions/attr_list.txt b/tests/extensions/attr_list.txt new file mode 100644 index 0000000..465ce4f --- /dev/null +++ b/tests/extensions/attr_list.txt @@ -0,0 +1,94 @@ +This is a sextext header {: #setext} +==================================== + +A paragraph with some text. +Line two of the paragraph. +{: #par1 .myclass } + +This is another {: #sextext2 .someclass} +---------------------------------------- + +Test some _inline_{: .inline} text. +A [link](http://example.com){: .linkkyclass title="A title."} +And a __nested [link][]{: .linky2}__{: .nest} + +[link]: http://example.com "Some title" + +### This is a hash Header ### {: #hash} + +And now some random attributes. +{:foo bar='b az' baz="blah blah" title="I wasn't kidding!" } + +### No closing hash header {: #hash2} + +Now test overrides +{: #overrideme .andme id=overridden class='foo bar' .addme } + + # A code block which contains attr_list syntax + # This should be ignored. + {: #someid .someclass } + +### No colon for compatibility with Headerid ext { #hash3 } + +Also a codespan: `{: .someclass}`{: .foo}. +{: #the_end} + +### Bad Syntax { {: #hash5 } + +* Item1 + {: .item } +* Item2 + {: .item } + * Item2-1 + {: .subitem } +* _Item3_{: .emph } + {: .item } + * _Item3-1_{: .emph } + {: .subitem } +* Item4 + * Item4-1 +* Item5 + +# And ordered lists *too*{.inline} + +1. Item1 + {: .item } +2. Item2 + {: .item } + 1. Item2-1 + {: .subitem } +3. _Item3_{: .emph } + {: .item } + 1. _Item3-1_{: .emph } + {: .subitem } +4. Item4 + 1. Item4-1 +5. Item5 + +# Definition *lists* {.block} + +DT1 {.term} +DT2 {.term} +: Some dd + {.def} +: *dd*{.inline} + +*DT3*{.inline} +: Some dd + +# Bad attributes + +Key without *value*{ foo= } + +Value without *key*{ =bar } + +No *key or value*{ = } + +*Weirdness*{ == } + +*More weirdness*{ === } + +This should not cause a *crash*{ foo=a=b } + +Attr_lists do not contain *newlines*{ foo=bar +key=value } diff --git a/tests/extensions/codehilite.html b/tests/extensions/codehilite.html new file mode 100644 index 0000000..6a8ee91 --- /dev/null +++ b/tests/extensions/codehilite.html @@ -0,0 +1,16 @@ +

Some text

+
1
+2
+3
+4
+5
+6
def __init__ (self, pattern) :
+    self.pattern = pattern
+    self.compiled_re = re.compile("^(.*)%s(.*)$" % pattern, re.DOTALL)
+
+def getCompiledRegExp (self) :
+    return self.compiled_re
+
+
+ +

More text

\ No newline at end of file diff --git a/tests/extensions/codehilite.txt b/tests/extensions/codehilite.txt new file mode 100644 index 0000000..6c62e6a --- /dev/null +++ b/tests/extensions/codehilite.txt @@ -0,0 +1,12 @@ + +Some text + + #!python + def __init__ (self, pattern) : + self.pattern = pattern + self.compiled_re = re.compile("^(.*)%s(.*)$" % pattern, re.DOTALL) + + def getCompiledRegExp (self) : + return self.compiled_re + +More text \ No newline at end of file diff --git a/tests/extensions/extra/def-in-list.html b/tests/extensions/extra/def-in-list.html new file mode 100644 index 0000000..21cddaa --- /dev/null +++ b/tests/extensions/extra/def-in-list.html @@ -0,0 +1,25 @@ +

: a paragraph that starts with a colon

+
    +
  • A List item
  • +
  • +
    +
    A def term
    +
    A def item
    +
    a second
    +
    +
  • +
  • +
    +
    Another def term
    +
    +

    a loose item

    +
    +
    +

    a second

    +
    +
    +
  • +
  • +

    : a list item that starts with a colon

    +
  • +
\ No newline at end of file diff --git a/tests/extensions/extra/def-in-list.txt b/tests/extensions/extra/def-in-list.txt new file mode 100644 index 0000000..7a292ab --- /dev/null +++ b/tests/extensions/extra/def-in-list.txt @@ -0,0 +1,15 @@ +: a paragraph that starts with a colon + +* A List item +* + A def term + : A def item + : a second + +* Another def term + + : a loose item + + : a second + +* : a list item that starts with a colon diff --git a/tests/extensions/extra/extra_config.html b/tests/extensions/extra/extra_config.html new file mode 100644 index 0000000..cbad740 --- /dev/null +++ b/tests/extensions/extra/extra_config.html @@ -0,0 +1,9 @@ +
+
+
    +
  1. +

    A Footnote. 

    +
  2. +
+
+

Some text with a footnote1.

\ No newline at end of file diff --git a/tests/extensions/extra/extra_config.txt b/tests/extensions/extra/extra_config.txt new file mode 100644 index 0000000..2d29819 --- /dev/null +++ b/tests/extensions/extra/extra_config.txt @@ -0,0 +1,5 @@ +~~~placemarker~~~ + +Some text with a footnote[^1]. + +[^1]: A Footnote. diff --git a/tests/extensions/extra/footnote.html b/tests/extensions/extra/footnote.html new file mode 100644 index 0000000..4d86421 --- /dev/null +++ b/tests/extensions/extra/footnote.html @@ -0,0 +1,71 @@ +

This is the body with a footnote1 or two2 or more3 4 5.

+

Also a reference that does not exist[^6].

+

Duplicate6 footnotes6 test6.

+

Duplicate7 footnotes7 test7.

+

Single after duplicates8.

+

Test emphasis at end of footnote9

+

Complex footnote content10

+
+
+
    +
  1. +

    Footnote that ends with a list:

    +
      +
    • item 1
    • +
    • item 2
    • +
    +

    +
  2. +
  3. +
    +

    This footnote is a blockquote.

    +
    +

    +
  4. +
  5. +

    A simple oneliner. 

    +
  6. +
  7. +

    A footnote with multiple paragraphs.

    +

    Paragraph two. 

    +
  8. +
  9. +

    First line of first paragraph. +Second line of first paragraph is not intended. +Nor is third... 

    +
  10. +
  11. +

    +
  12. +
  13. +

    +
  14. +
  15. +

    +
  16. +
  17. +

    emphasis works

    +

    emphasis still works 

    +
  18. +
  19. +
      +
    1. +

      The top couple half figure, contrary sides and hands across with bottom couple,

      +

      Half figure back on your own sides, and turn partner to places,

      +

      Swing partners with right hands into straight line long-ways, as in a reel, and

      +

      Set,

      +

      Hey and return to places,

      +

      The other three couples do the same.

      +
    2. +
    3. +

      Top and bottom couples meet and set,

      +

      Then each gentleman leas the opposite lady to the couple on his left, and set,

      +

      Aach four right and left,

      +

      Swing side couples to places, and turn partners all eight,

      +

      The other two couple o the same.

      +
    4. +
    +

    +
  20. +
+
\ No newline at end of file diff --git a/tests/extensions/extra/footnote.txt b/tests/extensions/extra/footnote.txt new file mode 100644 index 0000000..93b5869 --- /dev/null +++ b/tests/extensions/extra/footnote.txt @@ -0,0 +1,62 @@ +This is the body with a footnote[^1] or two[^2] or more[^3] [^4] [^5]. + +Also a reference that does not exist[^6]. + +Duplicate[^a] footnotes[^a] test[^a]. + +Duplicate[^b] footnotes[^b] test[^b]. + +Single after duplicates[^c]. + +Test emphasis at end of footnote[^d] + +Complex footnote content[^e] + +[^1]: Footnote that ends with a list: + + * item 1 + * item 2 + +[^2]: > This footnote is a blockquote. + +[^3]: A simple oneliner. + +[^4]: A footnote with multiple paragraphs. + + Paragraph two. + +[^5]: First line of first paragraph. +Second line of first paragraph is not intended. +Nor is third... + +[^a]: 1 +[^b]: 2 +[^c]: 3 + +[^d]: + _emphasis works_ + + _emphasis still works_ + +[^e]: + 1. The top couple half figure, contrary sides and hands across with bottom couple, + + Half figure back on your own sides, and turn partner to places, + + Swing partners with right hands into straight line long-ways, as in a reel, and + + Set, + + Hey and return to places, + + The other three couples do the same. + + 2. Top and bottom couples meet and set, + + Then each gentleman leas the opposite lady to the couple on his left, and set, + + Aach four right and left, + + Swing side couples to places, and turn partners all eight, + + The other two couple o the same. diff --git a/tests/extensions/extra/footnote_many_footnotes.html b/tests/extensions/extra/footnote_many_footnotes.html new file mode 100644 index 0000000..00de949 --- /dev/null +++ b/tests/extensions/extra/footnote_many_footnotes.html @@ -0,0 +1,4801 @@ +

Something1

+

Something2

+

Something3

+

Something4

+

Something5

+

Something6

+

Something7

+

Something8

+

Something9

+

Something10

+

Something11

+

Something12

+

Something13

+

Something14

+

Something15

+

Something16

+

Something17

+

Something18

+

Something19

+

Something20

+

Something21

+

Something22

+

Something23

+

Something24

+

Something25

+

Something26

+

Something27

+

Something28

+

Something29

+

Something30

+

Something31

+

Something32

+

Something33

+

Something34

+

Something35

+

Something36

+

Something37

+

Something38

+

Something39

+

Something40

+

Something41

+

Something42

+

Something43

+

Something44

+

Something45

+

Something46

+

Something47

+

Something48

+

Something49

+

Something50

+

Something51

+

Something52

+

Something53

+

Something54

+

Something55

+

Something56

+

Something57

+

Something58

+

Something59

+

Something60

+

Something61

+

Something62

+

Something63

+

Something64

+

Something65

+

Something66

+

Something67

+

Something68

+

Something69

+

Something70

+

Something71

+

Something72

+

Something73

+

Something74

+

Something75

+

Something76

+

Something77

+

Something78

+

Something79

+

Something80

+

Something81

+

Something82

+

Something83

+

Something84

+

Something85

+

Something86

+

Something87

+

Something88

+

Something89

+

Something90

+

Something91

+

Something92

+

Something93

+

Something94

+

Something95

+

Something96

+

Something97

+

Something98

+

Something99

+

Something100

+

Something101

+

Something102

+

Something103

+

Something104

+

Something105

+

Something106

+

Something107

+

Something108

+

Something109

+

Something110

+

Something111

+

Something112

+

Something113

+

Something114

+

Something115

+

Something116

+

Something117

+

Something118

+

Something119

+

Something120

+

Something121

+

Something122

+

Something123

+

Something124

+

Something125

+

Something126

+

Something127

+

Something128

+

Something129

+

Something130

+

Something131

+

Something132

+

Something133

+

Something134

+

Something135

+

Something136

+

Something137

+

Something138

+

Something139

+

Something140

+

Something141

+

Something142

+

Something143

+

Something144

+

Something145

+

Something146

+

Something147

+

Something148

+

Something149

+

Something150

+

Something151

+

Something152

+

Something153

+

Something154

+

Something155

+

Something156

+

Something157

+

Something158

+

Something159

+

Something160

+

Something161

+

Something162

+

Something163

+

Something164

+

Something165

+

Something166

+

Something167

+

Something168

+

Something169

+

Something170

+

Something171

+

Something172

+

Something173

+

Something174

+

Something175

+

Something176

+

Something177

+

Something178

+

Something179

+

Something180

+

Something181

+

Something182

+

Something183

+

Something184

+

Something185

+

Something186

+

Something187

+

Something188

+

Something189

+

Something190

+

Something191

+

Something192

+

Something193

+

Something194

+

Something195

+

Something196

+

Something197

+

Something198

+

Something199

+

Something200

+

Something201

+

Something202

+

Something203

+

Something204

+

Something205

+

Something206

+

Something207

+

Something208

+

Something209

+

Something210

+

Something211

+

Something212

+

Something213

+

Something214

+

Something215

+

Something216

+

Something217

+

Something218

+

Something219

+

Something220

+

Something221

+

Something222

+

Something223

+

Something224

+

Something225

+

Something226

+

Something227

+

Something228

+

Something229

+

Something230

+

Something231

+

Something232

+

Something233

+

Something234

+

Something235

+

Something236

+

Something237

+

Something238

+

Something239

+

Something240

+

Something241

+

Something242

+

Something243

+

Something244

+

Something245

+

Something246

+

Something247

+

Something248

+

Something249

+

Something250

+

Something251

+

Something252

+

Something253

+

Something254

+

Something255

+

Something256

+

Something257

+

Something258

+

Something259

+

Something260

+

Something261

+

Something262

+

Something263

+

Something264

+

Something265

+

Something266

+

Something267

+

Something268

+

Something269

+

Something270

+

Something271

+

Something272

+

Something273

+

Something274

+

Something275

+

Something276

+

Something277

+

Something278

+

Something279

+

Something280

+

Something281

+

Something282

+

Something283

+

Something284

+

Something285

+

Something286

+

Something287

+

Something288

+

Something289

+

Something290

+

Something291

+

Something292

+

Something293

+

Something294

+

Something295

+

Something296

+

Something297

+

Something298

+

Something299

+

Something300

+

Something301

+

Something302

+

Something303

+

Something304

+

Something305

+

Something306

+

Something307

+

Something308

+

Something309

+

Something310

+

Something311

+

Something312

+

Something313

+

Something314

+

Something315

+

Something316

+

Something317

+

Something318

+

Something319

+

Something320

+

Something321

+

Something322

+

Something323

+

Something324

+

Something325

+

Something326

+

Something327

+

Something328

+

Something329

+

Something330

+

Something331

+

Something332

+

Something333

+

Something334

+

Something335

+

Something336

+

Something337

+

Something338

+

Something339

+

Something340

+

Something341

+

Something342

+

Something343

+

Something344

+

Something345

+

Something346

+

Something347

+

Something348

+

Something349

+

Something350

+

Something351

+

Something352

+

Something353

+

Something354

+

Something355

+

Something356

+

Something357

+

Something358

+

Something359

+

Something360

+

Something361

+

Something362

+

Something363

+

Something364

+

Something365

+

Something366

+

Something367

+

Something368

+

Something369

+

Something370

+

Something371

+

Something372

+

Something373

+

Something374

+

Something375

+

Something376

+

Something377

+

Something378

+

Something379

+

Something380

+

Something381

+

Something382

+

Something383

+

Something384

+

Something385

+

Something386

+

Something387

+

Something388

+

Something389

+

Something390

+

Something391

+

Something392

+

Something393

+

Something394

+

Something395

+

Something396

+

Something397

+

Something398

+

Something399

+

Something400

+

Something401

+

Something402

+

Something403

+

Something404

+

Something405

+

Something406

+

Something407

+

Something408

+

Something409

+

Something410

+

Something411

+

Something412

+

Something413

+

Something414

+

Something415

+

Something416

+

Something417

+

Something418

+

Something419

+

Something420

+

Something421

+

Something422

+

Something423

+

Something424

+

Something425

+

Something426

+

Something427

+

Something428

+

Something429

+

Something430

+

Something431

+

Something432

+

Something433

+

Something434

+

Something435

+

Something436

+

Something437

+

Something438

+

Something439

+

Something440

+

Something441

+

Something442

+

Something443

+

Something444

+

Something445

+

Something446

+

Something447

+

Something448

+

Something449

+

Something450

+

Something451

+

Something452

+

Something453

+

Something454

+

Something455

+

Something456

+

Something457

+

Something458

+

Something459

+

Something460

+

Something461

+

Something462

+

Something463

+

Something464

+

Something465

+

Something466

+

Something467

+

Something468

+

Something469

+

Something470

+

Something471

+

Something472

+

Something473

+

Something474

+

Something475

+

Something476

+

Something477

+

Something478

+

Something479

+

Something480

+

Something481

+

Something482

+

Something483

+

Something484

+

Something485

+

Something486

+

Something487

+

Something488

+

Something489

+

Something490

+

Something491

+

Something492

+

Something493

+

Something494

+

Something495

+

Something496

+

Something497

+

Something498

+

Something499

+

Something500

+

Something501

+

Something502

+

Something503

+

Something504

+

Something505

+

Something506

+

Something507

+

Something508

+

Something509

+

Something510

+

Something511

+

Something512

+

Something513

+

Something514

+

Something515

+

Something516

+

Something517

+

Something518

+

Something519

+

Something520

+

Something521

+

Something522

+

Something523

+

Something524

+

Something525

+

Something526

+

Something527

+

Something528

+

Something529

+

Something530

+

Something531

+

Something532

+

Something533

+

Something534

+

Something535

+

Something536

+

Something537

+

Something538

+

Something539

+

Something540

+

Something541

+

Something542

+

Something543

+

Something544

+

Something545

+

Something546

+

Something547

+

Something548

+

Something549

+

Something550

+

Something551

+

Something552

+

Something553

+

Something554

+

Something555

+

Something556

+

Something557

+

Something558

+

Something559

+

Something560

+

Something561

+

Something562

+

Something563

+

Something564

+

Something565

+

Something566

+

Something567

+

Something568

+

Something569

+

Something570

+

Something571

+

Something572

+

Something573

+

Something574

+

Something575

+

Something576

+

Something577

+

Something578

+

Something579

+

Something580

+

Something581

+

Something582

+

Something583

+

Something584

+

Something585

+

Something586

+

Something587

+

Something588

+

Something589

+

Something590

+

Something591

+

Something592

+

Something593

+

Something594

+

Something595

+

Something596

+

Something597

+

Something598

+

Something599

+

Something600

+

Something601

+

Something602

+

Something603

+

Something604

+

Something605

+

Something606

+

Something607

+

Something608

+

Something609

+

Something610

+

Something611

+

Something612

+

Something613

+

Something614

+

Something615

+

Something616

+

Something617

+

Something618

+

Something619

+

Something620

+

Something621

+

Something622

+

Something623

+

Something624

+

Something625

+

Something626

+

Something627

+

Something628

+

Something629

+

Something630

+

Something631

+

Something632

+

Something633

+

Something634

+

Something635

+

Something636

+

Something637

+

Something638

+

Something639

+

Something640

+

Something641

+

Something642

+

Something643

+

Something644

+

Something645

+

Something646

+

Something647

+

Something648

+

Something649

+

Something650

+

Something651

+

Something652

+

Something653

+

Something654

+

Something655

+

Something656

+

Something657

+

Something658

+

Something659

+

Something660

+

Something661

+

Something662

+

Something663

+

Something664

+

Something665

+

Something666

+

Something667

+

Something668

+

Something669

+

Something670

+

Something671

+

Something672

+

Something673

+

Something674

+

Something675

+

Something676

+

Something677

+

Something678

+

Something679

+

Something680

+

Something681

+

Something682

+

Something683

+

Something684

+

Something685

+

Something686

+

Something687

+

Something688

+

Something689

+

Something690

+

Something691

+

Something692

+

Something693

+

Something694

+

Something695

+

Something696

+

Something697

+

Something698

+

Something699

+

Something700

+

Something701

+

Something702

+

Something703

+

Something704

+

Something705

+

Something706

+

Something707

+

Something708

+

Something709

+

Something710

+

Something711

+

Something712

+

Something713

+

Something714

+

Something715

+

Something716

+

Something717

+

Something718

+

Something719

+

Something720

+

Something721

+

Something722

+

Something723

+

Something724

+

Something725

+

Something726

+

Something727

+

Something728

+

Something729

+

Something730

+

Something731

+

Something732

+

Something733

+

Something734

+

Something735

+

Something736

+

Something737

+

Something738

+

Something739

+

Something740

+

Something741

+

Something742

+

Something743

+

Something744

+

Something745

+

Something746

+

Something747

+

Something748

+

Something749

+

Something750

+

Something751

+

Something752

+

Something753

+

Something754

+

Something755

+

Something756

+

Something757

+

Something758

+

Something759

+

Something760

+

Something761

+

Something762

+

Something763

+

Something764

+

Something765

+

Something766

+

Something767

+

Something768

+

Something769

+

Something770

+

Something771

+

Something772

+

Something773

+

Something774

+

Something775

+

Something776

+

Something777

+

Something778

+

Something779

+

Something780

+

Something781

+

Something782

+

Something783

+

Something784

+

Something785

+

Something786

+

Something787

+

Something788

+

Something789

+

Something790

+

Something791

+

Something792

+

Something793

+

Something794

+

Something795

+

Something796

+

Something797

+

Something798

+

Something799

+

Something800

+

Something801

+

Something802

+

Something803

+

Something804

+

Something805

+

Something806

+

Something807

+

Something808

+

Something809

+

Something810

+

Something811

+

Something812

+

Something813

+

Something814

+

Something815

+

Something816

+

Something817

+

Something818

+

Something819

+

Something820

+

Something821

+

Something822

+

Something823

+

Something824

+

Something825

+

Something826

+

Something827

+

Something828

+

Something829

+

Something830

+

Something831

+

Something832

+

Something833

+

Something834

+

Something835

+

Something836

+

Something837

+

Something838

+

Something839

+

Something840

+

Something841

+

Something842

+

Something843

+

Something844

+

Something845

+

Something846

+

Something847

+

Something848

+

Something849

+

Something850

+

Something851

+

Something852

+

Something853

+

Something854

+

Something855

+

Something856

+

Something857

+

Something858

+

Something859

+

Something860

+

Something861

+

Something862

+

Something863

+

Something864

+

Something865

+

Something866

+

Something867

+

Something868

+

Something869

+

Something870

+

Something871

+

Something872

+

Something873

+

Something874

+

Something875

+

Something876

+

Something877

+

Something878

+

Something879

+

Something880

+

Something881

+

Something882

+

Something883

+

Something884

+

Something885

+

Something886

+

Something887

+

Something888

+

Something889

+

Something890

+

Something891

+

Something892

+

Something893

+

Something894

+

Something895

+

Something896

+

Something897

+

Something898

+

Something899

+

Something900

+

Something901

+

Something902

+

Something903

+

Something904

+

Something905

+

Something906

+

Something907

+

Something908

+

Something909

+

Something910

+

Something911

+

Something912

+

Something913

+

Something914

+

Something915

+

Something916

+

Something917

+

Something918

+

Something919

+

Something920

+

Something921

+

Something922

+

Something923

+

Something924

+

Something925

+

Something926

+

Something927

+

Something928

+

Something929

+

Something930

+

Something931

+

Something932

+

Something933

+

Something934

+

Something935

+

Something936

+

Something937

+

Something938

+

Something939

+

Something940

+

Something941

+

Something942

+

Something943

+

Something944

+

Something945

+

Something946

+

Something947

+

Something948

+

Something949

+

Something950

+

Something951

+

Something952

+

Something953

+

Something954

+

Something955

+

Something956

+

Something957

+

Something958

+

Something959

+

Something960

+

Something961

+

Something962

+

Something963

+

Something964

+

Something965

+

Something966

+

Something967

+

Something968

+

Something969

+

Something970

+

Something971

+

Something972

+

Something973

+

Something974

+

Something975

+

Something976

+

Something977

+

Something978

+

Something979

+

Something980

+

Something981

+

Something982

+

Something983

+

Something984

+

Something985

+

Something986

+

Something987

+

Something988

+

Something989

+

Something990

+

Something991

+

Something992

+

Something993

+

Something994

+

Something995

+

Something996

+

Something997

+

Something998

+

Something999

+

Something1000

+

Something1001

+

Something1002

+

Something1003

+

Something1004

+

Something1005

+

Something1006

+

Something1007

+

Something1008

+

Something1009

+

Something1010

+

Something1011

+

Something1012

+

Something1013

+

Something1014

+

Something1015

+

Something1016

+

Something1017

+

Something1018

+

Something1019

+

Something1020

+

Something1021

+

Something1022

+

Something1023

+

Something1024

+

Something1025

+

Something1026

+

Something1027

+

Something1028

+

Something1029

+

Something1030

+

Something1031

+

Something1032

+

Something1033

+

Something1034

+

Something1035

+

Something1036

+

Something1037

+

Something1038

+

Something1039

+

Something1040

+

Something1041

+

Something1042

+

Something1043

+

Something1044

+

Something1045

+

Something1046

+

Something1047

+

Something1048

+

Something1049

+

Something1050

+

Something1051

+

Something1052

+

Something1053

+

Something1054

+

Something1055

+

Something1056

+

Something1057

+

Something1058

+

Something1059

+

Something1060

+

Something1061

+

Something1062

+

Something1063

+

Something1064

+

Something1065

+

Something1066

+

Something1067

+

Something1068

+

Something1069

+

Something1070

+

Something1071

+

Something1072

+

Something1073

+

Something1074

+

Something1075

+

Something1076

+

Something1077

+

Something1078

+

Something1079

+

Something1080

+

Something1081

+

Something1082

+

Something1083

+

Something1084

+

Something1085

+

Something1086

+

Something1087

+

Something1088

+

Something1089

+

Something1090

+

Something1091

+

Something1092

+

Something1093

+

Something1094

+

Something1095

+

Something1096

+

Something1097

+

Something1098

+

Something1099

+

Something1100

+

Something1101

+

Something1102

+

Something1103

+

Something1104

+

Something1105

+

Something1106

+

Something1107

+

Something1108

+

Something1109

+

Something1110

+

Something1111

+

Something1112

+

Something1113

+

Something1114

+

Something1115

+

Something1116

+

Something1117

+

Something1118

+

Something1119

+

Something1120

+

Something1121

+

Something1122

+

Something1123

+

Something1124

+

Something1125

+

Something1126

+

Something1127

+

Something1128

+

Something1129

+

Something1130

+

Something1131

+

Something1132

+

Something1133

+

Something1134

+

Something1135

+

Something1136

+

Something1137

+

Something1138

+

Something1139

+

Something1140

+

Something1141

+

Something1142

+

Something1143

+

Something1144

+

Something1145

+

Something1146

+

Something1147

+

Something1148

+

Something1149

+

Something1150

+

Something1151

+

Something1152

+

Something1153

+

Something1154

+

Something1155

+

Something1156

+

Something1157

+

Something1158

+

Something1159

+

Something1160

+

Something1161

+

Something1162

+

Something1163

+

Something1164

+

Something1165

+

Something1166

+

Something1167

+

Something1168

+

Something1169

+

Something1170

+

Something1171

+

Something1172

+

Something1173

+

Something1174

+

Something1175

+

Something1176

+

Something1177

+

Something1178

+

Something1179

+

Something1180

+

Something1181

+

Something1182

+

Something1183

+

Something1184

+

Something1185

+

Something1186

+

Something1187

+

Something1188

+

Something1189

+

Something1190

+

Something1191

+

Something1192

+

Something1193

+

Something1194

+

Something1195

+

Something1196

+

Something1197

+

Something1198

+

Something1199

+
+
+
    +
  1. +

    Another thing 

    +
  2. +
  3. +

    Another thing 

    +
  4. +
  5. +

    Another thing 

    +
  6. +
  7. +

    Another thing 

    +
  8. +
  9. +

    Another thing 

    +
  10. +
  11. +

    Another thing 

    +
  12. +
  13. +

    Another thing 

    +
  14. +
  15. +

    Another thing 

    +
  16. +
  17. +

    Another thing 

    +
  18. +
  19. +

    Another thing 

    +
  20. +
  21. +

    Another thing 

    +
  22. +
  23. +

    Another thing 

    +
  24. +
  25. +

    Another thing 

    +
  26. +
  27. +

    Another thing 

    +
  28. +
  29. +

    Another thing 

    +
  30. +
  31. +

    Another thing 

    +
  32. +
  33. +

    Another thing 

    +
  34. +
  35. +

    Another thing 

    +
  36. +
  37. +

    Another thing 

    +
  38. +
  39. +

    Another thing 

    +
  40. +
  41. +

    Another thing 

    +
  42. +
  43. +

    Another thing 

    +
  44. +
  45. +

    Another thing 

    +
  46. +
  47. +

    Another thing 

    +
  48. +
  49. +

    Another thing 

    +
  50. +
  51. +

    Another thing 

    +
  52. +
  53. +

    Another thing 

    +
  54. +
  55. +

    Another thing 

    +
  56. +
  57. +

    Another thing 

    +
  58. +
  59. +

    Another thing 

    +
  60. +
  61. +

    Another thing 

    +
  62. +
  63. +

    Another thing 

    +
  64. +
  65. +

    Another thing 

    +
  66. +
  67. +

    Another thing 

    +
  68. +
  69. +

    Another thing 

    +
  70. +
  71. +

    Another thing 

    +
  72. +
  73. +

    Another thing 

    +
  74. +
  75. +

    Another thing 

    +
  76. +
  77. +

    Another thing 

    +
  78. +
  79. +

    Another thing 

    +
  80. +
  81. +

    Another thing 

    +
  82. +
  83. +

    Another thing 

    +
  84. +
  85. +

    Another thing 

    +
  86. +
  87. +

    Another thing 

    +
  88. +
  89. +

    Another thing 

    +
  90. +
  91. +

    Another thing 

    +
  92. +
  93. +

    Another thing 

    +
  94. +
  95. +

    Another thing 

    +
  96. +
  97. +

    Another thing 

    +
  98. +
  99. +

    Another thing 

    +
  100. +
  101. +

    Another thing 

    +
  102. +
  103. +

    Another thing 

    +
  104. +
  105. +

    Another thing 

    +
  106. +
  107. +

    Another thing 

    +
  108. +
  109. +

    Another thing 

    +
  110. +
  111. +

    Another thing 

    +
  112. +
  113. +

    Another thing 

    +
  114. +
  115. +

    Another thing 

    +
  116. +
  117. +

    Another thing 

    +
  118. +
  119. +

    Another thing 

    +
  120. +
  121. +

    Another thing 

    +
  122. +
  123. +

    Another thing 

    +
  124. +
  125. +

    Another thing 

    +
  126. +
  127. +

    Another thing 

    +
  128. +
  129. +

    Another thing 

    +
  130. +
  131. +

    Another thing 

    +
  132. +
  133. +

    Another thing 

    +
  134. +
  135. +

    Another thing 

    +
  136. +
  137. +

    Another thing 

    +
  138. +
  139. +

    Another thing 

    +
  140. +
  141. +

    Another thing 

    +
  142. +
  143. +

    Another thing 

    +
  144. +
  145. +

    Another thing 

    +
  146. +
  147. +

    Another thing 

    +
  148. +
  149. +

    Another thing 

    +
  150. +
  151. +

    Another thing 

    +
  152. +
  153. +

    Another thing 

    +
  154. +
  155. +

    Another thing 

    +
  156. +
  157. +

    Another thing 

    +
  158. +
  159. +

    Another thing 

    +
  160. +
  161. +

    Another thing 

    +
  162. +
  163. +

    Another thing 

    +
  164. +
  165. +

    Another thing 

    +
  166. +
  167. +

    Another thing 

    +
  168. +
  169. +

    Another thing 

    +
  170. +
  171. +

    Another thing 

    +
  172. +
  173. +

    Another thing 

    +
  174. +
  175. +

    Another thing 

    +
  176. +
  177. +

    Another thing 

    +
  178. +
  179. +

    Another thing 

    +
  180. +
  181. +

    Another thing 

    +
  182. +
  183. +

    Another thing 

    +
  184. +
  185. +

    Another thing 

    +
  186. +
  187. +

    Another thing 

    +
  188. +
  189. +

    Another thing 

    +
  190. +
  191. +

    Another thing 

    +
  192. +
  193. +

    Another thing 

    +
  194. +
  195. +

    Another thing 

    +
  196. +
  197. +

    Another thing 

    +
  198. +
  199. +

    Another thing 

    +
  200. +
  201. +

    Another thing 

    +
  202. +
  203. +

    Another thing 

    +
  204. +
  205. +

    Another thing 

    +
  206. +
  207. +

    Another thing 

    +
  208. +
  209. +

    Another thing 

    +
  210. +
  211. +

    Another thing 

    +
  212. +
  213. +

    Another thing 

    +
  214. +
  215. +

    Another thing 

    +
  216. +
  217. +

    Another thing 

    +
  218. +
  219. +

    Another thing 

    +
  220. +
  221. +

    Another thing 

    +
  222. +
  223. +

    Another thing 

    +
  224. +
  225. +

    Another thing 

    +
  226. +
  227. +

    Another thing 

    +
  228. +
  229. +

    Another thing 

    +
  230. +
  231. +

    Another thing 

    +
  232. +
  233. +

    Another thing 

    +
  234. +
  235. +

    Another thing 

    +
  236. +
  237. +

    Another thing 

    +
  238. +
  239. +

    Another thing 

    +
  240. +
  241. +

    Another thing 

    +
  242. +
  243. +

    Another thing 

    +
  244. +
  245. +

    Another thing 

    +
  246. +
  247. +

    Another thing 

    +
  248. +
  249. +

    Another thing 

    +
  250. +
  251. +

    Another thing 

    +
  252. +
  253. +

    Another thing 

    +
  254. +
  255. +

    Another thing 

    +
  256. +
  257. +

    Another thing 

    +
  258. +
  259. +

    Another thing 

    +
  260. +
  261. +

    Another thing 

    +
  262. +
  263. +

    Another thing 

    +
  264. +
  265. +

    Another thing 

    +
  266. +
  267. +

    Another thing 

    +
  268. +
  269. +

    Another thing 

    +
  270. +
  271. +

    Another thing 

    +
  272. +
  273. +

    Another thing 

    +
  274. +
  275. +

    Another thing 

    +
  276. +
  277. +

    Another thing 

    +
  278. +
  279. +

    Another thing 

    +
  280. +
  281. +

    Another thing 

    +
  282. +
  283. +

    Another thing 

    +
  284. +
  285. +

    Another thing 

    +
  286. +
  287. +

    Another thing 

    +
  288. +
  289. +

    Another thing 

    +
  290. +
  291. +

    Another thing 

    +
  292. +
  293. +

    Another thing 

    +
  294. +
  295. +

    Another thing 

    +
  296. +
  297. +

    Another thing 

    +
  298. +
  299. +

    Another thing 

    +
  300. +
  301. +

    Another thing 

    +
  302. +
  303. +

    Another thing 

    +
  304. +
  305. +

    Another thing 

    +
  306. +
  307. +

    Another thing 

    +
  308. +
  309. +

    Another thing 

    +
  310. +
  311. +

    Another thing 

    +
  312. +
  313. +

    Another thing 

    +
  314. +
  315. +

    Another thing 

    +
  316. +
  317. +

    Another thing 

    +
  318. +
  319. +

    Another thing 

    +
  320. +
  321. +

    Another thing 

    +
  322. +
  323. +

    Another thing 

    +
  324. +
  325. +

    Another thing 

    +
  326. +
  327. +

    Another thing 

    +
  328. +
  329. +

    Another thing 

    +
  330. +
  331. +

    Another thing 

    +
  332. +
  333. +

    Another thing 

    +
  334. +
  335. +

    Another thing 

    +
  336. +
  337. +

    Another thing 

    +
  338. +
  339. +

    Another thing 

    +
  340. +
  341. +

    Another thing 

    +
  342. +
  343. +

    Another thing 

    +
  344. +
  345. +

    Another thing 

    +
  346. +
  347. +

    Another thing 

    +
  348. +
  349. +

    Another thing 

    +
  350. +
  351. +

    Another thing 

    +
  352. +
  353. +

    Another thing 

    +
  354. +
  355. +

    Another thing 

    +
  356. +
  357. +

    Another thing 

    +
  358. +
  359. +

    Another thing 

    +
  360. +
  361. +

    Another thing 

    +
  362. +
  363. +

    Another thing 

    +
  364. +
  365. +

    Another thing 

    +
  366. +
  367. +

    Another thing 

    +
  368. +
  369. +

    Another thing 

    +
  370. +
  371. +

    Another thing 

    +
  372. +
  373. +

    Another thing 

    +
  374. +
  375. +

    Another thing 

    +
  376. +
  377. +

    Another thing 

    +
  378. +
  379. +

    Another thing 

    +
  380. +
  381. +

    Another thing 

    +
  382. +
  383. +

    Another thing 

    +
  384. +
  385. +

    Another thing 

    +
  386. +
  387. +

    Another thing 

    +
  388. +
  389. +

    Another thing 

    +
  390. +
  391. +

    Another thing 

    +
  392. +
  393. +

    Another thing 

    +
  394. +
  395. +

    Another thing 

    +
  396. +
  397. +

    Another thing 

    +
  398. +
  399. +

    Another thing 

    +
  400. +
  401. +

    Another thing 

    +
  402. +
  403. +

    Another thing 

    +
  404. +
  405. +

    Another thing 

    +
  406. +
  407. +

    Another thing 

    +
  408. +
  409. +

    Another thing 

    +
  410. +
  411. +

    Another thing 

    +
  412. +
  413. +

    Another thing 

    +
  414. +
  415. +

    Another thing 

    +
  416. +
  417. +

    Another thing 

    +
  418. +
  419. +

    Another thing 

    +
  420. +
  421. +

    Another thing 

    +
  422. +
  423. +

    Another thing 

    +
  424. +
  425. +

    Another thing 

    +
  426. +
  427. +

    Another thing 

    +
  428. +
  429. +

    Another thing 

    +
  430. +
  431. +

    Another thing 

    +
  432. +
  433. +

    Another thing 

    +
  434. +
  435. +

    Another thing 

    +
  436. +
  437. +

    Another thing 

    +
  438. +
  439. +

    Another thing 

    +
  440. +
  441. +

    Another thing 

    +
  442. +
  443. +

    Another thing 

    +
  444. +
  445. +

    Another thing 

    +
  446. +
  447. +

    Another thing 

    +
  448. +
  449. +

    Another thing 

    +
  450. +
  451. +

    Another thing 

    +
  452. +
  453. +

    Another thing 

    +
  454. +
  455. +

    Another thing 

    +
  456. +
  457. +

    Another thing 

    +
  458. +
  459. +

    Another thing 

    +
  460. +
  461. +

    Another thing 

    +
  462. +
  463. +

    Another thing 

    +
  464. +
  465. +

    Another thing 

    +
  466. +
  467. +

    Another thing 

    +
  468. +
  469. +

    Another thing 

    +
  470. +
  471. +

    Another thing 

    +
  472. +
  473. +

    Another thing 

    +
  474. +
  475. +

    Another thing 

    +
  476. +
  477. +

    Another thing 

    +
  478. +
  479. +

    Another thing 

    +
  480. +
  481. +

    Another thing 

    +
  482. +
  483. +

    Another thing 

    +
  484. +
  485. +

    Another thing 

    +
  486. +
  487. +

    Another thing 

    +
  488. +
  489. +

    Another thing 

    +
  490. +
  491. +

    Another thing 

    +
  492. +
  493. +

    Another thing 

    +
  494. +
  495. +

    Another thing 

    +
  496. +
  497. +

    Another thing 

    +
  498. +
  499. +

    Another thing 

    +
  500. +
  501. +

    Another thing 

    +
  502. +
  503. +

    Another thing 

    +
  504. +
  505. +

    Another thing 

    +
  506. +
  507. +

    Another thing 

    +
  508. +
  509. +

    Another thing 

    +
  510. +
  511. +

    Another thing 

    +
  512. +
  513. +

    Another thing 

    +
  514. +
  515. +

    Another thing 

    +
  516. +
  517. +

    Another thing 

    +
  518. +
  519. +

    Another thing 

    +
  520. +
  521. +

    Another thing 

    +
  522. +
  523. +

    Another thing 

    +
  524. +
  525. +

    Another thing 

    +
  526. +
  527. +

    Another thing 

    +
  528. +
  529. +

    Another thing 

    +
  530. +
  531. +

    Another thing 

    +
  532. +
  533. +

    Another thing 

    +
  534. +
  535. +

    Another thing 

    +
  536. +
  537. +

    Another thing 

    +
  538. +
  539. +

    Another thing 

    +
  540. +
  541. +

    Another thing 

    +
  542. +
  543. +

    Another thing 

    +
  544. +
  545. +

    Another thing 

    +
  546. +
  547. +

    Another thing 

    +
  548. +
  549. +

    Another thing 

    +
  550. +
  551. +

    Another thing 

    +
  552. +
  553. +

    Another thing 

    +
  554. +
  555. +

    Another thing 

    +
  556. +
  557. +

    Another thing 

    +
  558. +
  559. +

    Another thing 

    +
  560. +
  561. +

    Another thing 

    +
  562. +
  563. +

    Another thing 

    +
  564. +
  565. +

    Another thing 

    +
  566. +
  567. +

    Another thing 

    +
  568. +
  569. +

    Another thing 

    +
  570. +
  571. +

    Another thing 

    +
  572. +
  573. +

    Another thing 

    +
  574. +
  575. +

    Another thing 

    +
  576. +
  577. +

    Another thing 

    +
  578. +
  579. +

    Another thing 

    +
  580. +
  581. +

    Another thing 

    +
  582. +
  583. +

    Another thing 

    +
  584. +
  585. +

    Another thing 

    +
  586. +
  587. +

    Another thing 

    +
  588. +
  589. +

    Another thing 

    +
  590. +
  591. +

    Another thing 

    +
  592. +
  593. +

    Another thing 

    +
  594. +
  595. +

    Another thing 

    +
  596. +
  597. +

    Another thing 

    +
  598. +
  599. +

    Another thing 

    +
  600. +
  601. +

    Another thing 

    +
  602. +
  603. +

    Another thing 

    +
  604. +
  605. +

    Another thing 

    +
  606. +
  607. +

    Another thing 

    +
  608. +
  609. +

    Another thing 

    +
  610. +
  611. +

    Another thing 

    +
  612. +
  613. +

    Another thing 

    +
  614. +
  615. +

    Another thing 

    +
  616. +
  617. +

    Another thing 

    +
  618. +
  619. +

    Another thing 

    +
  620. +
  621. +

    Another thing 

    +
  622. +
  623. +

    Another thing 

    +
  624. +
  625. +

    Another thing 

    +
  626. +
  627. +

    Another thing 

    +
  628. +
  629. +

    Another thing 

    +
  630. +
  631. +

    Another thing 

    +
  632. +
  633. +

    Another thing 

    +
  634. +
  635. +

    Another thing 

    +
  636. +
  637. +

    Another thing 

    +
  638. +
  639. +

    Another thing 

    +
  640. +
  641. +

    Another thing 

    +
  642. +
  643. +

    Another thing 

    +
  644. +
  645. +

    Another thing 

    +
  646. +
  647. +

    Another thing 

    +
  648. +
  649. +

    Another thing 

    +
  650. +
  651. +

    Another thing 

    +
  652. +
  653. +

    Another thing 

    +
  654. +
  655. +

    Another thing 

    +
  656. +
  657. +

    Another thing 

    +
  658. +
  659. +

    Another thing 

    +
  660. +
  661. +

    Another thing 

    +
  662. +
  663. +

    Another thing 

    +
  664. +
  665. +

    Another thing 

    +
  666. +
  667. +

    Another thing 

    +
  668. +
  669. +

    Another thing 

    +
  670. +
  671. +

    Another thing 

    +
  672. +
  673. +

    Another thing 

    +
  674. +
  675. +

    Another thing 

    +
  676. +
  677. +

    Another thing 

    +
  678. +
  679. +

    Another thing 

    +
  680. +
  681. +

    Another thing 

    +
  682. +
  683. +

    Another thing 

    +
  684. +
  685. +

    Another thing 

    +
  686. +
  687. +

    Another thing 

    +
  688. +
  689. +

    Another thing 

    +
  690. +
  691. +

    Another thing 

    +
  692. +
  693. +

    Another thing 

    +
  694. +
  695. +

    Another thing 

    +
  696. +
  697. +

    Another thing 

    +
  698. +
  699. +

    Another thing 

    +
  700. +
  701. +

    Another thing 

    +
  702. +
  703. +

    Another thing 

    +
  704. +
  705. +

    Another thing 

    +
  706. +
  707. +

    Another thing 

    +
  708. +
  709. +

    Another thing 

    +
  710. +
  711. +

    Another thing 

    +
  712. +
  713. +

    Another thing 

    +
  714. +
  715. +

    Another thing 

    +
  716. +
  717. +

    Another thing 

    +
  718. +
  719. +

    Another thing 

    +
  720. +
  721. +

    Another thing 

    +
  722. +
  723. +

    Another thing 

    +
  724. +
  725. +

    Another thing 

    +
  726. +
  727. +

    Another thing 

    +
  728. +
  729. +

    Another thing 

    +
  730. +
  731. +

    Another thing 

    +
  732. +
  733. +

    Another thing 

    +
  734. +
  735. +

    Another thing 

    +
  736. +
  737. +

    Another thing 

    +
  738. +
  739. +

    Another thing 

    +
  740. +
  741. +

    Another thing 

    +
  742. +
  743. +

    Another thing 

    +
  744. +
  745. +

    Another thing 

    +
  746. +
  747. +

    Another thing 

    +
  748. +
  749. +

    Another thing 

    +
  750. +
  751. +

    Another thing 

    +
  752. +
  753. +

    Another thing 

    +
  754. +
  755. +

    Another thing 

    +
  756. +
  757. +

    Another thing 

    +
  758. +
  759. +

    Another thing 

    +
  760. +
  761. +

    Another thing 

    +
  762. +
  763. +

    Another thing 

    +
  764. +
  765. +

    Another thing 

    +
  766. +
  767. +

    Another thing 

    +
  768. +
  769. +

    Another thing 

    +
  770. +
  771. +

    Another thing 

    +
  772. +
  773. +

    Another thing 

    +
  774. +
  775. +

    Another thing 

    +
  776. +
  777. +

    Another thing 

    +
  778. +
  779. +

    Another thing 

    +
  780. +
  781. +

    Another thing 

    +
  782. +
  783. +

    Another thing 

    +
  784. +
  785. +

    Another thing 

    +
  786. +
  787. +

    Another thing 

    +
  788. +
  789. +

    Another thing 

    +
  790. +
  791. +

    Another thing 

    +
  792. +
  793. +

    Another thing 

    +
  794. +
  795. +

    Another thing 

    +
  796. +
  797. +

    Another thing 

    +
  798. +
  799. +

    Another thing 

    +
  800. +
  801. +

    Another thing 

    +
  802. +
  803. +

    Another thing 

    +
  804. +
  805. +

    Another thing 

    +
  806. +
  807. +

    Another thing 

    +
  808. +
  809. +

    Another thing 

    +
  810. +
  811. +

    Another thing 

    +
  812. +
  813. +

    Another thing 

    +
  814. +
  815. +

    Another thing 

    +
  816. +
  817. +

    Another thing 

    +
  818. +
  819. +

    Another thing 

    +
  820. +
  821. +

    Another thing 

    +
  822. +
  823. +

    Another thing 

    +
  824. +
  825. +

    Another thing 

    +
  826. +
  827. +

    Another thing 

    +
  828. +
  829. +

    Another thing 

    +
  830. +
  831. +

    Another thing 

    +
  832. +
  833. +

    Another thing 

    +
  834. +
  835. +

    Another thing 

    +
  836. +
  837. +

    Another thing 

    +
  838. +
  839. +

    Another thing 

    +
  840. +
  841. +

    Another thing 

    +
  842. +
  843. +

    Another thing 

    +
  844. +
  845. +

    Another thing 

    +
  846. +
  847. +

    Another thing 

    +
  848. +
  849. +

    Another thing 

    +
  850. +
  851. +

    Another thing 

    +
  852. +
  853. +

    Another thing 

    +
  854. +
  855. +

    Another thing 

    +
  856. +
  857. +

    Another thing 

    +
  858. +
  859. +

    Another thing 

    +
  860. +
  861. +

    Another thing 

    +
  862. +
  863. +

    Another thing 

    +
  864. +
  865. +

    Another thing 

    +
  866. +
  867. +

    Another thing 

    +
  868. +
  869. +

    Another thing 

    +
  870. +
  871. +

    Another thing 

    +
  872. +
  873. +

    Another thing 

    +
  874. +
  875. +

    Another thing 

    +
  876. +
  877. +

    Another thing 

    +
  878. +
  879. +

    Another thing 

    +
  880. +
  881. +

    Another thing 

    +
  882. +
  883. +

    Another thing 

    +
  884. +
  885. +

    Another thing 

    +
  886. +
  887. +

    Another thing 

    +
  888. +
  889. +

    Another thing 

    +
  890. +
  891. +

    Another thing 

    +
  892. +
  893. +

    Another thing 

    +
  894. +
  895. +

    Another thing 

    +
  896. +
  897. +

    Another thing 

    +
  898. +
  899. +

    Another thing 

    +
  900. +
  901. +

    Another thing 

    +
  902. +
  903. +

    Another thing 

    +
  904. +
  905. +

    Another thing 

    +
  906. +
  907. +

    Another thing 

    +
  908. +
  909. +

    Another thing 

    +
  910. +
  911. +

    Another thing 

    +
  912. +
  913. +

    Another thing 

    +
  914. +
  915. +

    Another thing 

    +
  916. +
  917. +

    Another thing 

    +
  918. +
  919. +

    Another thing 

    +
  920. +
  921. +

    Another thing 

    +
  922. +
  923. +

    Another thing 

    +
  924. +
  925. +

    Another thing 

    +
  926. +
  927. +

    Another thing 

    +
  928. +
  929. +

    Another thing 

    +
  930. +
  931. +

    Another thing 

    +
  932. +
  933. +

    Another thing 

    +
  934. +
  935. +

    Another thing 

    +
  936. +
  937. +

    Another thing 

    +
  938. +
  939. +

    Another thing 

    +
  940. +
  941. +

    Another thing 

    +
  942. +
  943. +

    Another thing 

    +
  944. +
  945. +

    Another thing 

    +
  946. +
  947. +

    Another thing 

    +
  948. +
  949. +

    Another thing 

    +
  950. +
  951. +

    Another thing 

    +
  952. +
  953. +

    Another thing 

    +
  954. +
  955. +

    Another thing 

    +
  956. +
  957. +

    Another thing 

    +
  958. +
  959. +

    Another thing 

    +
  960. +
  961. +

    Another thing 

    +
  962. +
  963. +

    Another thing 

    +
  964. +
  965. +

    Another thing 

    +
  966. +
  967. +

    Another thing 

    +
  968. +
  969. +

    Another thing 

    +
  970. +
  971. +

    Another thing 

    +
  972. +
  973. +

    Another thing 

    +
  974. +
  975. +

    Another thing 

    +
  976. +
  977. +

    Another thing 

    +
  978. +
  979. +

    Another thing 

    +
  980. +
  981. +

    Another thing 

    +
  982. +
  983. +

    Another thing 

    +
  984. +
  985. +

    Another thing 

    +
  986. +
  987. +

    Another thing 

    +
  988. +
  989. +

    Another thing 

    +
  990. +
  991. +

    Another thing 

    +
  992. +
  993. +

    Another thing 

    +
  994. +
  995. +

    Another thing 

    +
  996. +
  997. +

    Another thing 

    +
  998. +
  999. +

    Another thing 

    +
  1000. +
  1001. +

    Another thing 

    +
  1002. +
  1003. +

    Another thing 

    +
  1004. +
  1005. +

    Another thing 

    +
  1006. +
  1007. +

    Another thing 

    +
  1008. +
  1009. +

    Another thing 

    +
  1010. +
  1011. +

    Another thing 

    +
  1012. +
  1013. +

    Another thing 

    +
  1014. +
  1015. +

    Another thing 

    +
  1016. +
  1017. +

    Another thing 

    +
  1018. +
  1019. +

    Another thing 

    +
  1020. +
  1021. +

    Another thing 

    +
  1022. +
  1023. +

    Another thing 

    +
  1024. +
  1025. +

    Another thing 

    +
  1026. +
  1027. +

    Another thing 

    +
  1028. +
  1029. +

    Another thing 

    +
  1030. +
  1031. +

    Another thing 

    +
  1032. +
  1033. +

    Another thing 

    +
  1034. +
  1035. +

    Another thing 

    +
  1036. +
  1037. +

    Another thing 

    +
  1038. +
  1039. +

    Another thing 

    +
  1040. +
  1041. +

    Another thing 

    +
  1042. +
  1043. +

    Another thing 

    +
  1044. +
  1045. +

    Another thing 

    +
  1046. +
  1047. +

    Another thing 

    +
  1048. +
  1049. +

    Another thing 

    +
  1050. +
  1051. +

    Another thing 

    +
  1052. +
  1053. +

    Another thing 

    +
  1054. +
  1055. +

    Another thing 

    +
  1056. +
  1057. +

    Another thing 

    +
  1058. +
  1059. +

    Another thing 

    +
  1060. +
  1061. +

    Another thing 

    +
  1062. +
  1063. +

    Another thing 

    +
  1064. +
  1065. +

    Another thing 

    +
  1066. +
  1067. +

    Another thing 

    +
  1068. +
  1069. +

    Another thing 

    +
  1070. +
  1071. +

    Another thing 

    +
  1072. +
  1073. +

    Another thing 

    +
  1074. +
  1075. +

    Another thing 

    +
  1076. +
  1077. +

    Another thing 

    +
  1078. +
  1079. +

    Another thing 

    +
  1080. +
  1081. +

    Another thing 

    +
  1082. +
  1083. +

    Another thing 

    +
  1084. +
  1085. +

    Another thing 

    +
  1086. +
  1087. +

    Another thing 

    +
  1088. +
  1089. +

    Another thing 

    +
  1090. +
  1091. +

    Another thing 

    +
  1092. +
  1093. +

    Another thing 

    +
  1094. +
  1095. +

    Another thing 

    +
  1096. +
  1097. +

    Another thing 

    +
  1098. +
  1099. +

    Another thing 

    +
  1100. +
  1101. +

    Another thing 

    +
  1102. +
  1103. +

    Another thing 

    +
  1104. +
  1105. +

    Another thing 

    +
  1106. +
  1107. +

    Another thing 

    +
  1108. +
  1109. +

    Another thing 

    +
  1110. +
  1111. +

    Another thing 

    +
  1112. +
  1113. +

    Another thing 

    +
  1114. +
  1115. +

    Another thing 

    +
  1116. +
  1117. +

    Another thing 

    +
  1118. +
  1119. +

    Another thing 

    +
  1120. +
  1121. +

    Another thing 

    +
  1122. +
  1123. +

    Another thing 

    +
  1124. +
  1125. +

    Another thing 

    +
  1126. +
  1127. +

    Another thing 

    +
  1128. +
  1129. +

    Another thing 

    +
  1130. +
  1131. +

    Another thing 

    +
  1132. +
  1133. +

    Another thing 

    +
  1134. +
  1135. +

    Another thing 

    +
  1136. +
  1137. +

    Another thing 

    +
  1138. +
  1139. +

    Another thing 

    +
  1140. +
  1141. +

    Another thing 

    +
  1142. +
  1143. +

    Another thing 

    +
  1144. +
  1145. +

    Another thing 

    +
  1146. +
  1147. +

    Another thing 

    +
  1148. +
  1149. +

    Another thing 

    +
  1150. +
  1151. +

    Another thing 

    +
  1152. +
  1153. +

    Another thing 

    +
  1154. +
  1155. +

    Another thing 

    +
  1156. +
  1157. +

    Another thing 

    +
  1158. +
  1159. +

    Another thing 

    +
  1160. +
  1161. +

    Another thing 

    +
  1162. +
  1163. +

    Another thing 

    +
  1164. +
  1165. +

    Another thing 

    +
  1166. +
  1167. +

    Another thing 

    +
  1168. +
  1169. +

    Another thing 

    +
  1170. +
  1171. +

    Another thing 

    +
  1172. +
  1173. +

    Another thing 

    +
  1174. +
  1175. +

    Another thing 

    +
  1176. +
  1177. +

    Another thing 

    +
  1178. +
  1179. +

    Another thing 

    +
  1180. +
  1181. +

    Another thing 

    +
  1182. +
  1183. +

    Another thing 

    +
  1184. +
  1185. +

    Another thing 

    +
  1186. +
  1187. +

    Another thing 

    +
  1188. +
  1189. +

    Another thing 

    +
  1190. +
  1191. +

    Another thing 

    +
  1192. +
  1193. +

    Another thing 

    +
  1194. +
  1195. +

    Another thing 

    +
  1196. +
  1197. +

    Another thing 

    +
  1198. +
  1199. +

    Another thing 

    +
  1200. +
  1201. +

    Another thing 

    +
  1202. +
  1203. +

    Another thing 

    +
  1204. +
  1205. +

    Another thing 

    +
  1206. +
  1207. +

    Another thing 

    +
  1208. +
  1209. +

    Another thing 

    +
  1210. +
  1211. +

    Another thing 

    +
  1212. +
  1213. +

    Another thing 

    +
  1214. +
  1215. +

    Another thing 

    +
  1216. +
  1217. +

    Another thing 

    +
  1218. +
  1219. +

    Another thing 

    +
  1220. +
  1221. +

    Another thing 

    +
  1222. +
  1223. +

    Another thing 

    +
  1224. +
  1225. +

    Another thing 

    +
  1226. +
  1227. +

    Another thing 

    +
  1228. +
  1229. +

    Another thing 

    +
  1230. +
  1231. +

    Another thing 

    +
  1232. +
  1233. +

    Another thing 

    +
  1234. +
  1235. +

    Another thing 

    +
  1236. +
  1237. +

    Another thing 

    +
  1238. +
  1239. +

    Another thing 

    +
  1240. +
  1241. +

    Another thing 

    +
  1242. +
  1243. +

    Another thing 

    +
  1244. +
  1245. +

    Another thing 

    +
  1246. +
  1247. +

    Another thing 

    +
  1248. +
  1249. +

    Another thing 

    +
  1250. +
  1251. +

    Another thing 

    +
  1252. +
  1253. +

    Another thing 

    +
  1254. +
  1255. +

    Another thing 

    +
  1256. +
  1257. +

    Another thing 

    +
  1258. +
  1259. +

    Another thing 

    +
  1260. +
  1261. +

    Another thing 

    +
  1262. +
  1263. +

    Another thing 

    +
  1264. +
  1265. +

    Another thing 

    +
  1266. +
  1267. +

    Another thing 

    +
  1268. +
  1269. +

    Another thing 

    +
  1270. +
  1271. +

    Another thing 

    +
  1272. +
  1273. +

    Another thing 

    +
  1274. +
  1275. +

    Another thing 

    +
  1276. +
  1277. +

    Another thing 

    +
  1278. +
  1279. +

    Another thing 

    +
  1280. +
  1281. +

    Another thing 

    +
  1282. +
  1283. +

    Another thing 

    +
  1284. +
  1285. +

    Another thing 

    +
  1286. +
  1287. +

    Another thing 

    +
  1288. +
  1289. +

    Another thing 

    +
  1290. +
  1291. +

    Another thing 

    +
  1292. +
  1293. +

    Another thing 

    +
  1294. +
  1295. +

    Another thing 

    +
  1296. +
  1297. +

    Another thing 

    +
  1298. +
  1299. +

    Another thing 

    +
  1300. +
  1301. +

    Another thing 

    +
  1302. +
  1303. +

    Another thing 

    +
  1304. +
  1305. +

    Another thing 

    +
  1306. +
  1307. +

    Another thing 

    +
  1308. +
  1309. +

    Another thing 

    +
  1310. +
  1311. +

    Another thing 

    +
  1312. +
  1313. +

    Another thing 

    +
  1314. +
  1315. +

    Another thing 

    +
  1316. +
  1317. +

    Another thing 

    +
  1318. +
  1319. +

    Another thing 

    +
  1320. +
  1321. +

    Another thing 

    +
  1322. +
  1323. +

    Another thing 

    +
  1324. +
  1325. +

    Another thing 

    +
  1326. +
  1327. +

    Another thing 

    +
  1328. +
  1329. +

    Another thing 

    +
  1330. +
  1331. +

    Another thing 

    +
  1332. +
  1333. +

    Another thing 

    +
  1334. +
  1335. +

    Another thing 

    +
  1336. +
  1337. +

    Another thing 

    +
  1338. +
  1339. +

    Another thing 

    +
  1340. +
  1341. +

    Another thing 

    +
  1342. +
  1343. +

    Another thing 

    +
  1344. +
  1345. +

    Another thing 

    +
  1346. +
  1347. +

    Another thing 

    +
  1348. +
  1349. +

    Another thing 

    +
  1350. +
  1351. +

    Another thing 

    +
  1352. +
  1353. +

    Another thing 

    +
  1354. +
  1355. +

    Another thing 

    +
  1356. +
  1357. +

    Another thing 

    +
  1358. +
  1359. +

    Another thing 

    +
  1360. +
  1361. +

    Another thing 

    +
  1362. +
  1363. +

    Another thing 

    +
  1364. +
  1365. +

    Another thing 

    +
  1366. +
  1367. +

    Another thing 

    +
  1368. +
  1369. +

    Another thing 

    +
  1370. +
  1371. +

    Another thing 

    +
  1372. +
  1373. +

    Another thing 

    +
  1374. +
  1375. +

    Another thing 

    +
  1376. +
  1377. +

    Another thing 

    +
  1378. +
  1379. +

    Another thing 

    +
  1380. +
  1381. +

    Another thing 

    +
  1382. +
  1383. +

    Another thing 

    +
  1384. +
  1385. +

    Another thing 

    +
  1386. +
  1387. +

    Another thing 

    +
  1388. +
  1389. +

    Another thing 

    +
  1390. +
  1391. +

    Another thing 

    +
  1392. +
  1393. +

    Another thing 

    +
  1394. +
  1395. +

    Another thing 

    +
  1396. +
  1397. +

    Another thing 

    +
  1398. +
  1399. +

    Another thing 

    +
  1400. +
  1401. +

    Another thing 

    +
  1402. +
  1403. +

    Another thing 

    +
  1404. +
  1405. +

    Another thing 

    +
  1406. +
  1407. +

    Another thing 

    +
  1408. +
  1409. +

    Another thing 

    +
  1410. +
  1411. +

    Another thing 

    +
  1412. +
  1413. +

    Another thing 

    +
  1414. +
  1415. +

    Another thing 

    +
  1416. +
  1417. +

    Another thing 

    +
  1418. +
  1419. +

    Another thing 

    +
  1420. +
  1421. +

    Another thing 

    +
  1422. +
  1423. +

    Another thing 

    +
  1424. +
  1425. +

    Another thing 

    +
  1426. +
  1427. +

    Another thing 

    +
  1428. +
  1429. +

    Another thing 

    +
  1430. +
  1431. +

    Another thing 

    +
  1432. +
  1433. +

    Another thing 

    +
  1434. +
  1435. +

    Another thing 

    +
  1436. +
  1437. +

    Another thing 

    +
  1438. +
  1439. +

    Another thing 

    +
  1440. +
  1441. +

    Another thing 

    +
  1442. +
  1443. +

    Another thing 

    +
  1444. +
  1445. +

    Another thing 

    +
  1446. +
  1447. +

    Another thing 

    +
  1448. +
  1449. +

    Another thing 

    +
  1450. +
  1451. +

    Another thing 

    +
  1452. +
  1453. +

    Another thing 

    +
  1454. +
  1455. +

    Another thing 

    +
  1456. +
  1457. +

    Another thing 

    +
  1458. +
  1459. +

    Another thing 

    +
  1460. +
  1461. +

    Another thing 

    +
  1462. +
  1463. +

    Another thing 

    +
  1464. +
  1465. +

    Another thing 

    +
  1466. +
  1467. +

    Another thing 

    +
  1468. +
  1469. +

    Another thing 

    +
  1470. +
  1471. +

    Another thing 

    +
  1472. +
  1473. +

    Another thing 

    +
  1474. +
  1475. +

    Another thing 

    +
  1476. +
  1477. +

    Another thing 

    +
  1478. +
  1479. +

    Another thing 

    +
  1480. +
  1481. +

    Another thing 

    +
  1482. +
  1483. +

    Another thing 

    +
  1484. +
  1485. +

    Another thing 

    +
  1486. +
  1487. +

    Another thing 

    +
  1488. +
  1489. +

    Another thing 

    +
  1490. +
  1491. +

    Another thing 

    +
  1492. +
  1493. +

    Another thing 

    +
  1494. +
  1495. +

    Another thing 

    +
  1496. +
  1497. +

    Another thing 

    +
  1498. +
  1499. +

    Another thing 

    +
  1500. +
  1501. +

    Another thing 

    +
  1502. +
  1503. +

    Another thing 

    +
  1504. +
  1505. +

    Another thing 

    +
  1506. +
  1507. +

    Another thing 

    +
  1508. +
  1509. +

    Another thing 

    +
  1510. +
  1511. +

    Another thing 

    +
  1512. +
  1513. +

    Another thing 

    +
  1514. +
  1515. +

    Another thing 

    +
  1516. +
  1517. +

    Another thing 

    +
  1518. +
  1519. +

    Another thing 

    +
  1520. +
  1521. +

    Another thing 

    +
  1522. +
  1523. +

    Another thing 

    +
  1524. +
  1525. +

    Another thing 

    +
  1526. +
  1527. +

    Another thing 

    +
  1528. +
  1529. +

    Another thing 

    +
  1530. +
  1531. +

    Another thing 

    +
  1532. +
  1533. +

    Another thing 

    +
  1534. +
  1535. +

    Another thing 

    +
  1536. +
  1537. +

    Another thing 

    +
  1538. +
  1539. +

    Another thing 

    +
  1540. +
  1541. +

    Another thing 

    +
  1542. +
  1543. +

    Another thing 

    +
  1544. +
  1545. +

    Another thing 

    +
  1546. +
  1547. +

    Another thing 

    +
  1548. +
  1549. +

    Another thing 

    +
  1550. +
  1551. +

    Another thing 

    +
  1552. +
  1553. +

    Another thing 

    +
  1554. +
  1555. +

    Another thing 

    +
  1556. +
  1557. +

    Another thing 

    +
  1558. +
  1559. +

    Another thing 

    +
  1560. +
  1561. +

    Another thing 

    +
  1562. +
  1563. +

    Another thing 

    +
  1564. +
  1565. +

    Another thing 

    +
  1566. +
  1567. +

    Another thing 

    +
  1568. +
  1569. +

    Another thing 

    +
  1570. +
  1571. +

    Another thing 

    +
  1572. +
  1573. +

    Another thing 

    +
  1574. +
  1575. +

    Another thing 

    +
  1576. +
  1577. +

    Another thing 

    +
  1578. +
  1579. +

    Another thing 

    +
  1580. +
  1581. +

    Another thing 

    +
  1582. +
  1583. +

    Another thing 

    +
  1584. +
  1585. +

    Another thing 

    +
  1586. +
  1587. +

    Another thing 

    +
  1588. +
  1589. +

    Another thing 

    +
  1590. +
  1591. +

    Another thing 

    +
  1592. +
  1593. +

    Another thing 

    +
  1594. +
  1595. +

    Another thing 

    +
  1596. +
  1597. +

    Another thing 

    +
  1598. +
  1599. +

    Another thing 

    +
  1600. +
  1601. +

    Another thing 

    +
  1602. +
  1603. +

    Another thing 

    +
  1604. +
  1605. +

    Another thing 

    +
  1606. +
  1607. +

    Another thing 

    +
  1608. +
  1609. +

    Another thing 

    +
  1610. +
  1611. +

    Another thing 

    +
  1612. +
  1613. +

    Another thing 

    +
  1614. +
  1615. +

    Another thing 

    +
  1616. +
  1617. +

    Another thing 

    +
  1618. +
  1619. +

    Another thing 

    +
  1620. +
  1621. +

    Another thing 

    +
  1622. +
  1623. +

    Another thing 

    +
  1624. +
  1625. +

    Another thing 

    +
  1626. +
  1627. +

    Another thing 

    +
  1628. +
  1629. +

    Another thing 

    +
  1630. +
  1631. +

    Another thing 

    +
  1632. +
  1633. +

    Another thing 

    +
  1634. +
  1635. +

    Another thing 

    +
  1636. +
  1637. +

    Another thing 

    +
  1638. +
  1639. +

    Another thing 

    +
  1640. +
  1641. +

    Another thing 

    +
  1642. +
  1643. +

    Another thing 

    +
  1644. +
  1645. +

    Another thing 

    +
  1646. +
  1647. +

    Another thing 

    +
  1648. +
  1649. +

    Another thing 

    +
  1650. +
  1651. +

    Another thing 

    +
  1652. +
  1653. +

    Another thing 

    +
  1654. +
  1655. +

    Another thing 

    +
  1656. +
  1657. +

    Another thing 

    +
  1658. +
  1659. +

    Another thing 

    +
  1660. +
  1661. +

    Another thing 

    +
  1662. +
  1663. +

    Another thing 

    +
  1664. +
  1665. +

    Another thing 

    +
  1666. +
  1667. +

    Another thing 

    +
  1668. +
  1669. +

    Another thing 

    +
  1670. +
  1671. +

    Another thing 

    +
  1672. +
  1673. +

    Another thing 

    +
  1674. +
  1675. +

    Another thing 

    +
  1676. +
  1677. +

    Another thing 

    +
  1678. +
  1679. +

    Another thing 

    +
  1680. +
  1681. +

    Another thing 

    +
  1682. +
  1683. +

    Another thing 

    +
  1684. +
  1685. +

    Another thing 

    +
  1686. +
  1687. +

    Another thing 

    +
  1688. +
  1689. +

    Another thing 

    +
  1690. +
  1691. +

    Another thing 

    +
  1692. +
  1693. +

    Another thing 

    +
  1694. +
  1695. +

    Another thing 

    +
  1696. +
  1697. +

    Another thing 

    +
  1698. +
  1699. +

    Another thing 

    +
  1700. +
  1701. +

    Another thing 

    +
  1702. +
  1703. +

    Another thing 

    +
  1704. +
  1705. +

    Another thing 

    +
  1706. +
  1707. +

    Another thing 

    +
  1708. +
  1709. +

    Another thing 

    +
  1710. +
  1711. +

    Another thing 

    +
  1712. +
  1713. +

    Another thing 

    +
  1714. +
  1715. +

    Another thing 

    +
  1716. +
  1717. +

    Another thing 

    +
  1718. +
  1719. +

    Another thing 

    +
  1720. +
  1721. +

    Another thing 

    +
  1722. +
  1723. +

    Another thing 

    +
  1724. +
  1725. +

    Another thing 

    +
  1726. +
  1727. +

    Another thing 

    +
  1728. +
  1729. +

    Another thing 

    +
  1730. +
  1731. +

    Another thing 

    +
  1732. +
  1733. +

    Another thing 

    +
  1734. +
  1735. +

    Another thing 

    +
  1736. +
  1737. +

    Another thing 

    +
  1738. +
  1739. +

    Another thing 

    +
  1740. +
  1741. +

    Another thing 

    +
  1742. +
  1743. +

    Another thing 

    +
  1744. +
  1745. +

    Another thing 

    +
  1746. +
  1747. +

    Another thing 

    +
  1748. +
  1749. +

    Another thing 

    +
  1750. +
  1751. +

    Another thing 

    +
  1752. +
  1753. +

    Another thing 

    +
  1754. +
  1755. +

    Another thing 

    +
  1756. +
  1757. +

    Another thing 

    +
  1758. +
  1759. +

    Another thing 

    +
  1760. +
  1761. +

    Another thing 

    +
  1762. +
  1763. +

    Another thing 

    +
  1764. +
  1765. +

    Another thing 

    +
  1766. +
  1767. +

    Another thing 

    +
  1768. +
  1769. +

    Another thing 

    +
  1770. +
  1771. +

    Another thing 

    +
  1772. +
  1773. +

    Another thing 

    +
  1774. +
  1775. +

    Another thing 

    +
  1776. +
  1777. +

    Another thing 

    +
  1778. +
  1779. +

    Another thing 

    +
  1780. +
  1781. +

    Another thing 

    +
  1782. +
  1783. +

    Another thing 

    +
  1784. +
  1785. +

    Another thing 

    +
  1786. +
  1787. +

    Another thing 

    +
  1788. +
  1789. +

    Another thing 

    +
  1790. +
  1791. +

    Another thing 

    +
  1792. +
  1793. +

    Another thing 

    +
  1794. +
  1795. +

    Another thing 

    +
  1796. +
  1797. +

    Another thing 

    +
  1798. +
  1799. +

    Another thing 

    +
  1800. +
  1801. +

    Another thing 

    +
  1802. +
  1803. +

    Another thing 

    +
  1804. +
  1805. +

    Another thing 

    +
  1806. +
  1807. +

    Another thing 

    +
  1808. +
  1809. +

    Another thing 

    +
  1810. +
  1811. +

    Another thing 

    +
  1812. +
  1813. +

    Another thing 

    +
  1814. +
  1815. +

    Another thing 

    +
  1816. +
  1817. +

    Another thing 

    +
  1818. +
  1819. +

    Another thing 

    +
  1820. +
  1821. +

    Another thing 

    +
  1822. +
  1823. +

    Another thing 

    +
  1824. +
  1825. +

    Another thing 

    +
  1826. +
  1827. +

    Another thing 

    +
  1828. +
  1829. +

    Another thing 

    +
  1830. +
  1831. +

    Another thing 

    +
  1832. +
  1833. +

    Another thing 

    +
  1834. +
  1835. +

    Another thing 

    +
  1836. +
  1837. +

    Another thing 

    +
  1838. +
  1839. +

    Another thing 

    +
  1840. +
  1841. +

    Another thing 

    +
  1842. +
  1843. +

    Another thing 

    +
  1844. +
  1845. +

    Another thing 

    +
  1846. +
  1847. +

    Another thing 

    +
  1848. +
  1849. +

    Another thing 

    +
  1850. +
  1851. +

    Another thing 

    +
  1852. +
  1853. +

    Another thing 

    +
  1854. +
  1855. +

    Another thing 

    +
  1856. +
  1857. +

    Another thing 

    +
  1858. +
  1859. +

    Another thing 

    +
  1860. +
  1861. +

    Another thing 

    +
  1862. +
  1863. +

    Another thing 

    +
  1864. +
  1865. +

    Another thing 

    +
  1866. +
  1867. +

    Another thing 

    +
  1868. +
  1869. +

    Another thing 

    +
  1870. +
  1871. +

    Another thing 

    +
  1872. +
  1873. +

    Another thing 

    +
  1874. +
  1875. +

    Another thing 

    +
  1876. +
  1877. +

    Another thing 

    +
  1878. +
  1879. +

    Another thing 

    +
  1880. +
  1881. +

    Another thing 

    +
  1882. +
  1883. +

    Another thing 

    +
  1884. +
  1885. +

    Another thing 

    +
  1886. +
  1887. +

    Another thing 

    +
  1888. +
  1889. +

    Another thing 

    +
  1890. +
  1891. +

    Another thing 

    +
  1892. +
  1893. +

    Another thing 

    +
  1894. +
  1895. +

    Another thing 

    +
  1896. +
  1897. +

    Another thing 

    +
  1898. +
  1899. +

    Another thing 

    +
  1900. +
  1901. +

    Another thing 

    +
  1902. +
  1903. +

    Another thing 

    +
  1904. +
  1905. +

    Another thing 

    +
  1906. +
  1907. +

    Another thing 

    +
  1908. +
  1909. +

    Another thing 

    +
  1910. +
  1911. +

    Another thing 

    +
  1912. +
  1913. +

    Another thing 

    +
  1914. +
  1915. +

    Another thing 

    +
  1916. +
  1917. +

    Another thing 

    +
  1918. +
  1919. +

    Another thing 

    +
  1920. +
  1921. +

    Another thing 

    +
  1922. +
  1923. +

    Another thing 

    +
  1924. +
  1925. +

    Another thing 

    +
  1926. +
  1927. +

    Another thing 

    +
  1928. +
  1929. +

    Another thing 

    +
  1930. +
  1931. +

    Another thing 

    +
  1932. +
  1933. +

    Another thing 

    +
  1934. +
  1935. +

    Another thing 

    +
  1936. +
  1937. +

    Another thing 

    +
  1938. +
  1939. +

    Another thing 

    +
  1940. +
  1941. +

    Another thing 

    +
  1942. +
  1943. +

    Another thing 

    +
  1944. +
  1945. +

    Another thing 

    +
  1946. +
  1947. +

    Another thing 

    +
  1948. +
  1949. +

    Another thing 

    +
  1950. +
  1951. +

    Another thing 

    +
  1952. +
  1953. +

    Another thing 

    +
  1954. +
  1955. +

    Another thing 

    +
  1956. +
  1957. +

    Another thing 

    +
  1958. +
  1959. +

    Another thing 

    +
  1960. +
  1961. +

    Another thing 

    +
  1962. +
  1963. +

    Another thing 

    +
  1964. +
  1965. +

    Another thing 

    +
  1966. +
  1967. +

    Another thing 

    +
  1968. +
  1969. +

    Another thing 

    +
  1970. +
  1971. +

    Another thing 

    +
  1972. +
  1973. +

    Another thing 

    +
  1974. +
  1975. +

    Another thing 

    +
  1976. +
  1977. +

    Another thing 

    +
  1978. +
  1979. +

    Another thing 

    +
  1980. +
  1981. +

    Another thing 

    +
  1982. +
  1983. +

    Another thing 

    +
  1984. +
  1985. +

    Another thing 

    +
  1986. +
  1987. +

    Another thing 

    +
  1988. +
  1989. +

    Another thing 

    +
  1990. +
  1991. +

    Another thing 

    +
  1992. +
  1993. +

    Another thing 

    +
  1994. +
  1995. +

    Another thing 

    +
  1996. +
  1997. +

    Another thing 

    +
  1998. +
  1999. +

    Another thing 

    +
  2000. +
  2001. +

    Another thing 

    +
  2002. +
  2003. +

    Another thing 

    +
  2004. +
  2005. +

    Another thing 

    +
  2006. +
  2007. +

    Another thing 

    +
  2008. +
  2009. +

    Another thing 

    +
  2010. +
  2011. +

    Another thing 

    +
  2012. +
  2013. +

    Another thing 

    +
  2014. +
  2015. +

    Another thing 

    +
  2016. +
  2017. +

    Another thing 

    +
  2018. +
  2019. +

    Another thing 

    +
  2020. +
  2021. +

    Another thing 

    +
  2022. +
  2023. +

    Another thing 

    +
  2024. +
  2025. +

    Another thing 

    +
  2026. +
  2027. +

    Another thing 

    +
  2028. +
  2029. +

    Another thing 

    +
  2030. +
  2031. +

    Another thing 

    +
  2032. +
  2033. +

    Another thing 

    +
  2034. +
  2035. +

    Another thing 

    +
  2036. +
  2037. +

    Another thing 

    +
  2038. +
  2039. +

    Another thing 

    +
  2040. +
  2041. +

    Another thing 

    +
  2042. +
  2043. +

    Another thing 

    +
  2044. +
  2045. +

    Another thing 

    +
  2046. +
  2047. +

    Another thing 

    +
  2048. +
  2049. +

    Another thing 

    +
  2050. +
  2051. +

    Another thing 

    +
  2052. +
  2053. +

    Another thing 

    +
  2054. +
  2055. +

    Another thing 

    +
  2056. +
  2057. +

    Another thing 

    +
  2058. +
  2059. +

    Another thing 

    +
  2060. +
  2061. +

    Another thing 

    +
  2062. +
  2063. +

    Another thing 

    +
  2064. +
  2065. +

    Another thing 

    +
  2066. +
  2067. +

    Another thing 

    +
  2068. +
  2069. +

    Another thing 

    +
  2070. +
  2071. +

    Another thing 

    +
  2072. +
  2073. +

    Another thing 

    +
  2074. +
  2075. +

    Another thing 

    +
  2076. +
  2077. +

    Another thing 

    +
  2078. +
  2079. +

    Another thing 

    +
  2080. +
  2081. +

    Another thing 

    +
  2082. +
  2083. +

    Another thing 

    +
  2084. +
  2085. +

    Another thing 

    +
  2086. +
  2087. +

    Another thing 

    +
  2088. +
  2089. +

    Another thing 

    +
  2090. +
  2091. +

    Another thing 

    +
  2092. +
  2093. +

    Another thing 

    +
  2094. +
  2095. +

    Another thing 

    +
  2096. +
  2097. +

    Another thing 

    +
  2098. +
  2099. +

    Another thing 

    +
  2100. +
  2101. +

    Another thing 

    +
  2102. +
  2103. +

    Another thing 

    +
  2104. +
  2105. +

    Another thing 

    +
  2106. +
  2107. +

    Another thing 

    +
  2108. +
  2109. +

    Another thing 

    +
  2110. +
  2111. +

    Another thing 

    +
  2112. +
  2113. +

    Another thing 

    +
  2114. +
  2115. +

    Another thing 

    +
  2116. +
  2117. +

    Another thing 

    +
  2118. +
  2119. +

    Another thing 

    +
  2120. +
  2121. +

    Another thing 

    +
  2122. +
  2123. +

    Another thing 

    +
  2124. +
  2125. +

    Another thing 

    +
  2126. +
  2127. +

    Another thing 

    +
  2128. +
  2129. +

    Another thing 

    +
  2130. +
  2131. +

    Another thing 

    +
  2132. +
  2133. +

    Another thing 

    +
  2134. +
  2135. +

    Another thing 

    +
  2136. +
  2137. +

    Another thing 

    +
  2138. +
  2139. +

    Another thing 

    +
  2140. +
  2141. +

    Another thing 

    +
  2142. +
  2143. +

    Another thing 

    +
  2144. +
  2145. +

    Another thing 

    +
  2146. +
  2147. +

    Another thing 

    +
  2148. +
  2149. +

    Another thing 

    +
  2150. +
  2151. +

    Another thing 

    +
  2152. +
  2153. +

    Another thing 

    +
  2154. +
  2155. +

    Another thing 

    +
  2156. +
  2157. +

    Another thing 

    +
  2158. +
  2159. +

    Another thing 

    +
  2160. +
  2161. +

    Another thing 

    +
  2162. +
  2163. +

    Another thing 

    +
  2164. +
  2165. +

    Another thing 

    +
  2166. +
  2167. +

    Another thing 

    +
  2168. +
  2169. +

    Another thing 

    +
  2170. +
  2171. +

    Another thing 

    +
  2172. +
  2173. +

    Another thing 

    +
  2174. +
  2175. +

    Another thing 

    +
  2176. +
  2177. +

    Another thing 

    +
  2178. +
  2179. +

    Another thing 

    +
  2180. +
  2181. +

    Another thing 

    +
  2182. +
  2183. +

    Another thing 

    +
  2184. +
  2185. +

    Another thing 

    +
  2186. +
  2187. +

    Another thing 

    +
  2188. +
  2189. +

    Another thing 

    +
  2190. +
  2191. +

    Another thing 

    +
  2192. +
  2193. +

    Another thing 

    +
  2194. +
  2195. +

    Another thing 

    +
  2196. +
  2197. +

    Another thing 

    +
  2198. +
  2199. +

    Another thing 

    +
  2200. +
  2201. +

    Another thing 

    +
  2202. +
  2203. +

    Another thing 

    +
  2204. +
  2205. +

    Another thing 

    +
  2206. +
  2207. +

    Another thing 

    +
  2208. +
  2209. +

    Another thing 

    +
  2210. +
  2211. +

    Another thing 

    +
  2212. +
  2213. +

    Another thing 

    +
  2214. +
  2215. +

    Another thing 

    +
  2216. +
  2217. +

    Another thing 

    +
  2218. +
  2219. +

    Another thing 

    +
  2220. +
  2221. +

    Another thing 

    +
  2222. +
  2223. +

    Another thing 

    +
  2224. +
  2225. +

    Another thing 

    +
  2226. +
  2227. +

    Another thing 

    +
  2228. +
  2229. +

    Another thing 

    +
  2230. +
  2231. +

    Another thing 

    +
  2232. +
  2233. +

    Another thing 

    +
  2234. +
  2235. +

    Another thing 

    +
  2236. +
  2237. +

    Another thing 

    +
  2238. +
  2239. +

    Another thing 

    +
  2240. +
  2241. +

    Another thing 

    +
  2242. +
  2243. +

    Another thing 

    +
  2244. +
  2245. +

    Another thing 

    +
  2246. +
  2247. +

    Another thing 

    +
  2248. +
  2249. +

    Another thing 

    +
  2250. +
  2251. +

    Another thing 

    +
  2252. +
  2253. +

    Another thing 

    +
  2254. +
  2255. +

    Another thing 

    +
  2256. +
  2257. +

    Another thing 

    +
  2258. +
  2259. +

    Another thing 

    +
  2260. +
  2261. +

    Another thing 

    +
  2262. +
  2263. +

    Another thing 

    +
  2264. +
  2265. +

    Another thing 

    +
  2266. +
  2267. +

    Another thing 

    +
  2268. +
  2269. +

    Another thing 

    +
  2270. +
  2271. +

    Another thing 

    +
  2272. +
  2273. +

    Another thing 

    +
  2274. +
  2275. +

    Another thing 

    +
  2276. +
  2277. +

    Another thing 

    +
  2278. +
  2279. +

    Another thing 

    +
  2280. +
  2281. +

    Another thing 

    +
  2282. +
  2283. +

    Another thing 

    +
  2284. +
  2285. +

    Another thing 

    +
  2286. +
  2287. +

    Another thing 

    +
  2288. +
  2289. +

    Another thing 

    +
  2290. +
  2291. +

    Another thing 

    +
  2292. +
  2293. +

    Another thing 

    +
  2294. +
  2295. +

    Another thing 

    +
  2296. +
  2297. +

    Another thing 

    +
  2298. +
  2299. +

    Another thing 

    +
  2300. +
  2301. +

    Another thing 

    +
  2302. +
  2303. +

    Another thing 

    +
  2304. +
  2305. +

    Another thing 

    +
  2306. +
  2307. +

    Another thing 

    +
  2308. +
  2309. +

    Another thing 

    +
  2310. +
  2311. +

    Another thing 

    +
  2312. +
  2313. +

    Another thing 

    +
  2314. +
  2315. +

    Another thing 

    +
  2316. +
  2317. +

    Another thing 

    +
  2318. +
  2319. +

    Another thing 

    +
  2320. +
  2321. +

    Another thing 

    +
  2322. +
  2323. +

    Another thing 

    +
  2324. +
  2325. +

    Another thing 

    +
  2326. +
  2327. +

    Another thing 

    +
  2328. +
  2329. +

    Another thing 

    +
  2330. +
  2331. +

    Another thing 

    +
  2332. +
  2333. +

    Another thing 

    +
  2334. +
  2335. +

    Another thing 

    +
  2336. +
  2337. +

    Another thing 

    +
  2338. +
  2339. +

    Another thing 

    +
  2340. +
  2341. +

    Another thing 

    +
  2342. +
  2343. +

    Another thing 

    +
  2344. +
  2345. +

    Another thing 

    +
  2346. +
  2347. +

    Another thing 

    +
  2348. +
  2349. +

    Another thing 

    +
  2350. +
  2351. +

    Another thing 

    +
  2352. +
  2353. +

    Another thing 

    +
  2354. +
  2355. +

    Another thing 

    +
  2356. +
  2357. +

    Another thing 

    +
  2358. +
  2359. +

    Another thing 

    +
  2360. +
  2361. +

    Another thing 

    +
  2362. +
  2363. +

    Another thing 

    +
  2364. +
  2365. +

    Another thing 

    +
  2366. +
  2367. +

    Another thing 

    +
  2368. +
  2369. +

    Another thing 

    +
  2370. +
  2371. +

    Another thing 

    +
  2372. +
  2373. +

    Another thing 

    +
  2374. +
  2375. +

    Another thing 

    +
  2376. +
  2377. +

    Another thing 

    +
  2378. +
  2379. +

    Another thing 

    +
  2380. +
  2381. +

    Another thing 

    +
  2382. +
  2383. +

    Another thing 

    +
  2384. +
  2385. +

    Another thing 

    +
  2386. +
  2387. +

    Another thing 

    +
  2388. +
  2389. +

    Another thing 

    +
  2390. +
  2391. +

    Another thing 

    +
  2392. +
  2393. +

    Another thing 

    +
  2394. +
  2395. +

    Another thing 

    +
  2396. +
  2397. +

    Another thing 

    +
  2398. +
+
\ No newline at end of file diff --git a/tests/extensions/extra/footnote_many_footnotes.txt b/tests/extensions/extra/footnote_many_footnotes.txt new file mode 100644 index 0000000..cd5ee8d --- /dev/null +++ b/tests/extensions/extra/footnote_many_footnotes.txt @@ -0,0 +1,4796 @@ +Something[^1] + +Something[^2] + +Something[^3] + +Something[^4] + +Something[^5] + +Something[^6] + +Something[^7] + +Something[^8] + +Something[^9] + +Something[^10] + +Something[^11] + +Something[^12] + +Something[^13] + +Something[^14] + +Something[^15] + +Something[^16] + +Something[^17] + +Something[^18] + +Something[^19] + +Something[^20] + +Something[^21] + +Something[^22] + +Something[^23] + +Something[^24] + +Something[^25] + +Something[^26] + +Something[^27] + +Something[^28] + +Something[^29] + +Something[^30] + +Something[^31] + +Something[^32] + +Something[^33] + +Something[^34] + +Something[^35] + +Something[^36] + +Something[^37] + +Something[^38] + +Something[^39] + +Something[^40] + +Something[^41] + +Something[^42] + +Something[^43] + +Something[^44] + +Something[^45] + +Something[^46] + +Something[^47] + +Something[^48] + +Something[^49] + +Something[^50] + +Something[^51] + +Something[^52] + +Something[^53] + +Something[^54] + +Something[^55] + +Something[^56] + +Something[^57] + +Something[^58] + +Something[^59] + +Something[^60] + +Something[^61] + +Something[^62] + +Something[^63] + +Something[^64] + +Something[^65] + +Something[^66] + +Something[^67] + +Something[^68] + +Something[^69] + +Something[^70] + +Something[^71] + +Something[^72] + +Something[^73] + +Something[^74] + +Something[^75] + +Something[^76] + +Something[^77] + +Something[^78] + +Something[^79] + +Something[^80] + +Something[^81] + +Something[^82] + +Something[^83] + +Something[^84] + +Something[^85] + +Something[^86] + +Something[^87] + +Something[^88] + +Something[^89] + +Something[^90] + +Something[^91] + +Something[^92] + +Something[^93] + +Something[^94] + +Something[^95] + +Something[^96] + +Something[^97] + +Something[^98] + +Something[^99] + +Something[^100] + +Something[^101] + +Something[^102] + +Something[^103] + +Something[^104] + +Something[^105] + +Something[^106] + +Something[^107] + +Something[^108] + +Something[^109] + +Something[^110] + +Something[^111] + +Something[^112] + +Something[^113] + +Something[^114] + +Something[^115] + +Something[^116] + +Something[^117] + +Something[^118] + +Something[^119] + +Something[^120] + +Something[^121] + +Something[^122] + +Something[^123] + +Something[^124] + +Something[^125] + +Something[^126] + +Something[^127] + +Something[^128] + +Something[^129] + +Something[^130] + +Something[^131] + +Something[^132] + +Something[^133] + +Something[^134] + +Something[^135] + +Something[^136] + +Something[^137] + +Something[^138] + +Something[^139] + +Something[^140] + +Something[^141] + +Something[^142] + +Something[^143] + +Something[^144] + +Something[^145] + +Something[^146] + +Something[^147] + +Something[^148] + +Something[^149] + +Something[^150] + +Something[^151] + +Something[^152] + +Something[^153] + +Something[^154] + +Something[^155] + +Something[^156] + +Something[^157] + +Something[^158] + +Something[^159] + +Something[^160] + +Something[^161] + +Something[^162] + +Something[^163] + +Something[^164] + +Something[^165] + +Something[^166] + +Something[^167] + +Something[^168] + +Something[^169] + +Something[^170] + +Something[^171] + +Something[^172] + +Something[^173] + +Something[^174] + +Something[^175] + +Something[^176] + +Something[^177] + +Something[^178] + +Something[^179] + +Something[^180] + +Something[^181] + +Something[^182] + +Something[^183] + +Something[^184] + +Something[^185] + +Something[^186] + +Something[^187] + +Something[^188] + +Something[^189] + +Something[^190] + +Something[^191] + +Something[^192] + +Something[^193] + +Something[^194] + +Something[^195] + +Something[^196] + +Something[^197] + +Something[^198] + +Something[^199] + +Something[^200] + +Something[^201] + +Something[^202] + +Something[^203] + +Something[^204] + +Something[^205] + +Something[^206] + +Something[^207] + +Something[^208] + +Something[^209] + +Something[^210] + +Something[^211] + +Something[^212] + +Something[^213] + +Something[^214] + +Something[^215] + +Something[^216] + +Something[^217] + +Something[^218] + +Something[^219] + +Something[^220] + +Something[^221] + +Something[^222] + +Something[^223] + +Something[^224] + +Something[^225] + +Something[^226] + +Something[^227] + +Something[^228] + +Something[^229] + +Something[^230] + +Something[^231] + +Something[^232] + +Something[^233] + +Something[^234] + +Something[^235] + +Something[^236] + +Something[^237] + +Something[^238] + +Something[^239] + +Something[^240] + +Something[^241] + +Something[^242] + +Something[^243] + +Something[^244] + +Something[^245] + +Something[^246] + +Something[^247] + +Something[^248] + +Something[^249] + +Something[^250] + +Something[^251] + +Something[^252] + +Something[^253] + +Something[^254] + +Something[^255] + +Something[^256] + +Something[^257] + +Something[^258] + +Something[^259] + +Something[^260] + +Something[^261] + +Something[^262] + +Something[^263] + +Something[^264] + +Something[^265] + +Something[^266] + +Something[^267] + +Something[^268] + +Something[^269] + +Something[^270] + +Something[^271] + +Something[^272] + +Something[^273] + +Something[^274] + +Something[^275] + +Something[^276] + +Something[^277] + +Something[^278] + +Something[^279] + +Something[^280] + +Something[^281] + +Something[^282] + +Something[^283] + +Something[^284] + +Something[^285] + +Something[^286] + +Something[^287] + +Something[^288] + +Something[^289] + +Something[^290] + +Something[^291] + +Something[^292] + +Something[^293] + +Something[^294] + +Something[^295] + +Something[^296] + +Something[^297] + +Something[^298] + +Something[^299] + +Something[^300] + +Something[^301] + +Something[^302] + +Something[^303] + +Something[^304] + +Something[^305] + +Something[^306] + +Something[^307] + +Something[^308] + +Something[^309] + +Something[^310] + +Something[^311] + +Something[^312] + +Something[^313] + +Something[^314] + +Something[^315] + +Something[^316] + +Something[^317] + +Something[^318] + +Something[^319] + +Something[^320] + +Something[^321] + +Something[^322] + +Something[^323] + +Something[^324] + +Something[^325] + +Something[^326] + +Something[^327] + +Something[^328] + +Something[^329] + +Something[^330] + +Something[^331] + +Something[^332] + +Something[^333] + +Something[^334] + +Something[^335] + +Something[^336] + +Something[^337] + +Something[^338] + +Something[^339] + +Something[^340] + +Something[^341] + +Something[^342] + +Something[^343] + +Something[^344] + +Something[^345] + +Something[^346] + +Something[^347] + +Something[^348] + +Something[^349] + +Something[^350] + +Something[^351] + +Something[^352] + +Something[^353] + +Something[^354] + +Something[^355] + +Something[^356] + +Something[^357] + +Something[^358] + +Something[^359] + +Something[^360] + +Something[^361] + +Something[^362] + +Something[^363] + +Something[^364] + +Something[^365] + +Something[^366] + +Something[^367] + +Something[^368] + +Something[^369] + +Something[^370] + +Something[^371] + +Something[^372] + +Something[^373] + +Something[^374] + +Something[^375] + +Something[^376] + +Something[^377] + +Something[^378] + +Something[^379] + +Something[^380] + +Something[^381] + +Something[^382] + +Something[^383] + +Something[^384] + +Something[^385] + +Something[^386] + +Something[^387] + +Something[^388] + +Something[^389] + +Something[^390] + +Something[^391] + +Something[^392] + +Something[^393] + +Something[^394] + +Something[^395] + +Something[^396] + +Something[^397] + +Something[^398] + +Something[^399] + +Something[^400] + +Something[^401] + +Something[^402] + +Something[^403] + +Something[^404] + +Something[^405] + +Something[^406] + +Something[^407] + +Something[^408] + +Something[^409] + +Something[^410] + +Something[^411] + +Something[^412] + +Something[^413] + +Something[^414] + +Something[^415] + +Something[^416] + +Something[^417] + +Something[^418] + +Something[^419] + +Something[^420] + +Something[^421] + +Something[^422] + +Something[^423] + +Something[^424] + +Something[^425] + +Something[^426] + +Something[^427] + +Something[^428] + +Something[^429] + +Something[^430] + +Something[^431] + +Something[^432] + +Something[^433] + +Something[^434] + +Something[^435] + +Something[^436] + +Something[^437] + +Something[^438] + +Something[^439] + +Something[^440] + +Something[^441] + +Something[^442] + +Something[^443] + +Something[^444] + +Something[^445] + +Something[^446] + +Something[^447] + +Something[^448] + +Something[^449] + +Something[^450] + +Something[^451] + +Something[^452] + +Something[^453] + +Something[^454] + +Something[^455] + +Something[^456] + +Something[^457] + +Something[^458] + +Something[^459] + +Something[^460] + +Something[^461] + +Something[^462] + +Something[^463] + +Something[^464] + +Something[^465] + +Something[^466] + +Something[^467] + +Something[^468] + +Something[^469] + +Something[^470] + +Something[^471] + +Something[^472] + +Something[^473] + +Something[^474] + +Something[^475] + +Something[^476] + +Something[^477] + +Something[^478] + +Something[^479] + +Something[^480] + +Something[^481] + +Something[^482] + +Something[^483] + +Something[^484] + +Something[^485] + +Something[^486] + +Something[^487] + +Something[^488] + +Something[^489] + +Something[^490] + +Something[^491] + +Something[^492] + +Something[^493] + +Something[^494] + +Something[^495] + +Something[^496] + +Something[^497] + +Something[^498] + +Something[^499] + +Something[^500] + +Something[^501] + +Something[^502] + +Something[^503] + +Something[^504] + +Something[^505] + +Something[^506] + +Something[^507] + +Something[^508] + +Something[^509] + +Something[^510] + +Something[^511] + +Something[^512] + +Something[^513] + +Something[^514] + +Something[^515] + +Something[^516] + +Something[^517] + +Something[^518] + +Something[^519] + +Something[^520] + +Something[^521] + +Something[^522] + +Something[^523] + +Something[^524] + +Something[^525] + +Something[^526] + +Something[^527] + +Something[^528] + +Something[^529] + +Something[^530] + +Something[^531] + +Something[^532] + +Something[^533] + +Something[^534] + +Something[^535] + +Something[^536] + +Something[^537] + +Something[^538] + +Something[^539] + +Something[^540] + +Something[^541] + +Something[^542] + +Something[^543] + +Something[^544] + +Something[^545] + +Something[^546] + +Something[^547] + +Something[^548] + +Something[^549] + +Something[^550] + +Something[^551] + +Something[^552] + +Something[^553] + +Something[^554] + +Something[^555] + +Something[^556] + +Something[^557] + +Something[^558] + +Something[^559] + +Something[^560] + +Something[^561] + +Something[^562] + +Something[^563] + +Something[^564] + +Something[^565] + +Something[^566] + +Something[^567] + +Something[^568] + +Something[^569] + +Something[^570] + +Something[^571] + +Something[^572] + +Something[^573] + +Something[^574] + +Something[^575] + +Something[^576] + +Something[^577] + +Something[^578] + +Something[^579] + +Something[^580] + +Something[^581] + +Something[^582] + +Something[^583] + +Something[^584] + +Something[^585] + +Something[^586] + +Something[^587] + +Something[^588] + +Something[^589] + +Something[^590] + +Something[^591] + +Something[^592] + +Something[^593] + +Something[^594] + +Something[^595] + +Something[^596] + +Something[^597] + +Something[^598] + +Something[^599] + +Something[^600] + +Something[^601] + +Something[^602] + +Something[^603] + +Something[^604] + +Something[^605] + +Something[^606] + +Something[^607] + +Something[^608] + +Something[^609] + +Something[^610] + +Something[^611] + +Something[^612] + +Something[^613] + +Something[^614] + +Something[^615] + +Something[^616] + +Something[^617] + +Something[^618] + +Something[^619] + +Something[^620] + +Something[^621] + +Something[^622] + +Something[^623] + +Something[^624] + +Something[^625] + +Something[^626] + +Something[^627] + +Something[^628] + +Something[^629] + +Something[^630] + +Something[^631] + +Something[^632] + +Something[^633] + +Something[^634] + +Something[^635] + +Something[^636] + +Something[^637] + +Something[^638] + +Something[^639] + +Something[^640] + +Something[^641] + +Something[^642] + +Something[^643] + +Something[^644] + +Something[^645] + +Something[^646] + +Something[^647] + +Something[^648] + +Something[^649] + +Something[^650] + +Something[^651] + +Something[^652] + +Something[^653] + +Something[^654] + +Something[^655] + +Something[^656] + +Something[^657] + +Something[^658] + +Something[^659] + +Something[^660] + +Something[^661] + +Something[^662] + +Something[^663] + +Something[^664] + +Something[^665] + +Something[^666] + +Something[^667] + +Something[^668] + +Something[^669] + +Something[^670] + +Something[^671] + +Something[^672] + +Something[^673] + +Something[^674] + +Something[^675] + +Something[^676] + +Something[^677] + +Something[^678] + +Something[^679] + +Something[^680] + +Something[^681] + +Something[^682] + +Something[^683] + +Something[^684] + +Something[^685] + +Something[^686] + +Something[^687] + +Something[^688] + +Something[^689] + +Something[^690] + +Something[^691] + +Something[^692] + +Something[^693] + +Something[^694] + +Something[^695] + +Something[^696] + +Something[^697] + +Something[^698] + +Something[^699] + +Something[^700] + +Something[^701] + +Something[^702] + +Something[^703] + +Something[^704] + +Something[^705] + +Something[^706] + +Something[^707] + +Something[^708] + +Something[^709] + +Something[^710] + +Something[^711] + +Something[^712] + +Something[^713] + +Something[^714] + +Something[^715] + +Something[^716] + +Something[^717] + +Something[^718] + +Something[^719] + +Something[^720] + +Something[^721] + +Something[^722] + +Something[^723] + +Something[^724] + +Something[^725] + +Something[^726] + +Something[^727] + +Something[^728] + +Something[^729] + +Something[^730] + +Something[^731] + +Something[^732] + +Something[^733] + +Something[^734] + +Something[^735] + +Something[^736] + +Something[^737] + +Something[^738] + +Something[^739] + +Something[^740] + +Something[^741] + +Something[^742] + +Something[^743] + +Something[^744] + +Something[^745] + +Something[^746] + +Something[^747] + +Something[^748] + +Something[^749] + +Something[^750] + +Something[^751] + +Something[^752] + +Something[^753] + +Something[^754] + +Something[^755] + +Something[^756] + +Something[^757] + +Something[^758] + +Something[^759] + +Something[^760] + +Something[^761] + +Something[^762] + +Something[^763] + +Something[^764] + +Something[^765] + +Something[^766] + +Something[^767] + +Something[^768] + +Something[^769] + +Something[^770] + +Something[^771] + +Something[^772] + +Something[^773] + +Something[^774] + +Something[^775] + +Something[^776] + +Something[^777] + +Something[^778] + +Something[^779] + +Something[^780] + +Something[^781] + +Something[^782] + +Something[^783] + +Something[^784] + +Something[^785] + +Something[^786] + +Something[^787] + +Something[^788] + +Something[^789] + +Something[^790] + +Something[^791] + +Something[^792] + +Something[^793] + +Something[^794] + +Something[^795] + +Something[^796] + +Something[^797] + +Something[^798] + +Something[^799] + +Something[^800] + +Something[^801] + +Something[^802] + +Something[^803] + +Something[^804] + +Something[^805] + +Something[^806] + +Something[^807] + +Something[^808] + +Something[^809] + +Something[^810] + +Something[^811] + +Something[^812] + +Something[^813] + +Something[^814] + +Something[^815] + +Something[^816] + +Something[^817] + +Something[^818] + +Something[^819] + +Something[^820] + +Something[^821] + +Something[^822] + +Something[^823] + +Something[^824] + +Something[^825] + +Something[^826] + +Something[^827] + +Something[^828] + +Something[^829] + +Something[^830] + +Something[^831] + +Something[^832] + +Something[^833] + +Something[^834] + +Something[^835] + +Something[^836] + +Something[^837] + +Something[^838] + +Something[^839] + +Something[^840] + +Something[^841] + +Something[^842] + +Something[^843] + +Something[^844] + +Something[^845] + +Something[^846] + +Something[^847] + +Something[^848] + +Something[^849] + +Something[^850] + +Something[^851] + +Something[^852] + +Something[^853] + +Something[^854] + +Something[^855] + +Something[^856] + +Something[^857] + +Something[^858] + +Something[^859] + +Something[^860] + +Something[^861] + +Something[^862] + +Something[^863] + +Something[^864] + +Something[^865] + +Something[^866] + +Something[^867] + +Something[^868] + +Something[^869] + +Something[^870] + +Something[^871] + +Something[^872] + +Something[^873] + +Something[^874] + +Something[^875] + +Something[^876] + +Something[^877] + +Something[^878] + +Something[^879] + +Something[^880] + +Something[^881] + +Something[^882] + +Something[^883] + +Something[^884] + +Something[^885] + +Something[^886] + +Something[^887] + +Something[^888] + +Something[^889] + +Something[^890] + +Something[^891] + +Something[^892] + +Something[^893] + +Something[^894] + +Something[^895] + +Something[^896] + +Something[^897] + +Something[^898] + +Something[^899] + +Something[^900] + +Something[^901] + +Something[^902] + +Something[^903] + +Something[^904] + +Something[^905] + +Something[^906] + +Something[^907] + +Something[^908] + +Something[^909] + +Something[^910] + +Something[^911] + +Something[^912] + +Something[^913] + +Something[^914] + +Something[^915] + +Something[^916] + +Something[^917] + +Something[^918] + +Something[^919] + +Something[^920] + +Something[^921] + +Something[^922] + +Something[^923] + +Something[^924] + +Something[^925] + +Something[^926] + +Something[^927] + +Something[^928] + +Something[^929] + +Something[^930] + +Something[^931] + +Something[^932] + +Something[^933] + +Something[^934] + +Something[^935] + +Something[^936] + +Something[^937] + +Something[^938] + +Something[^939] + +Something[^940] + +Something[^941] + +Something[^942] + +Something[^943] + +Something[^944] + +Something[^945] + +Something[^946] + +Something[^947] + +Something[^948] + +Something[^949] + +Something[^950] + +Something[^951] + +Something[^952] + +Something[^953] + +Something[^954] + +Something[^955] + +Something[^956] + +Something[^957] + +Something[^958] + +Something[^959] + +Something[^960] + +Something[^961] + +Something[^962] + +Something[^963] + +Something[^964] + +Something[^965] + +Something[^966] + +Something[^967] + +Something[^968] + +Something[^969] + +Something[^970] + +Something[^971] + +Something[^972] + +Something[^973] + +Something[^974] + +Something[^975] + +Something[^976] + +Something[^977] + +Something[^978] + +Something[^979] + +Something[^980] + +Something[^981] + +Something[^982] + +Something[^983] + +Something[^984] + +Something[^985] + +Something[^986] + +Something[^987] + +Something[^988] + +Something[^989] + +Something[^990] + +Something[^991] + +Something[^992] + +Something[^993] + +Something[^994] + +Something[^995] + +Something[^996] + +Something[^997] + +Something[^998] + +Something[^999] + +Something[^1000] + +Something[^1001] + +Something[^1002] + +Something[^1003] + +Something[^1004] + +Something[^1005] + +Something[^1006] + +Something[^1007] + +Something[^1008] + +Something[^1009] + +Something[^1010] + +Something[^1011] + +Something[^1012] + +Something[^1013] + +Something[^1014] + +Something[^1015] + +Something[^1016] + +Something[^1017] + +Something[^1018] + +Something[^1019] + +Something[^1020] + +Something[^1021] + +Something[^1022] + +Something[^1023] + +Something[^1024] + +Something[^1025] + +Something[^1026] + +Something[^1027] + +Something[^1028] + +Something[^1029] + +Something[^1030] + +Something[^1031] + +Something[^1032] + +Something[^1033] + +Something[^1034] + +Something[^1035] + +Something[^1036] + +Something[^1037] + +Something[^1038] + +Something[^1039] + +Something[^1040] + +Something[^1041] + +Something[^1042] + +Something[^1043] + +Something[^1044] + +Something[^1045] + +Something[^1046] + +Something[^1047] + +Something[^1048] + +Something[^1049] + +Something[^1050] + +Something[^1051] + +Something[^1052] + +Something[^1053] + +Something[^1054] + +Something[^1055] + +Something[^1056] + +Something[^1057] + +Something[^1058] + +Something[^1059] + +Something[^1060] + +Something[^1061] + +Something[^1062] + +Something[^1063] + +Something[^1064] + +Something[^1065] + +Something[^1066] + +Something[^1067] + +Something[^1068] + +Something[^1069] + +Something[^1070] + +Something[^1071] + +Something[^1072] + +Something[^1073] + +Something[^1074] + +Something[^1075] + +Something[^1076] + +Something[^1077] + +Something[^1078] + +Something[^1079] + +Something[^1080] + +Something[^1081] + +Something[^1082] + +Something[^1083] + +Something[^1084] + +Something[^1085] + +Something[^1086] + +Something[^1087] + +Something[^1088] + +Something[^1089] + +Something[^1090] + +Something[^1091] + +Something[^1092] + +Something[^1093] + +Something[^1094] + +Something[^1095] + +Something[^1096] + +Something[^1097] + +Something[^1098] + +Something[^1099] + +Something[^1100] + +Something[^1101] + +Something[^1102] + +Something[^1103] + +Something[^1104] + +Something[^1105] + +Something[^1106] + +Something[^1107] + +Something[^1108] + +Something[^1109] + +Something[^1110] + +Something[^1111] + +Something[^1112] + +Something[^1113] + +Something[^1114] + +Something[^1115] + +Something[^1116] + +Something[^1117] + +Something[^1118] + +Something[^1119] + +Something[^1120] + +Something[^1121] + +Something[^1122] + +Something[^1123] + +Something[^1124] + +Something[^1125] + +Something[^1126] + +Something[^1127] + +Something[^1128] + +Something[^1129] + +Something[^1130] + +Something[^1131] + +Something[^1132] + +Something[^1133] + +Something[^1134] + +Something[^1135] + +Something[^1136] + +Something[^1137] + +Something[^1138] + +Something[^1139] + +Something[^1140] + +Something[^1141] + +Something[^1142] + +Something[^1143] + +Something[^1144] + +Something[^1145] + +Something[^1146] + +Something[^1147] + +Something[^1148] + +Something[^1149] + +Something[^1150] + +Something[^1151] + +Something[^1152] + +Something[^1153] + +Something[^1154] + +Something[^1155] + +Something[^1156] + +Something[^1157] + +Something[^1158] + +Something[^1159] + +Something[^1160] + +Something[^1161] + +Something[^1162] + +Something[^1163] + +Something[^1164] + +Something[^1165] + +Something[^1166] + +Something[^1167] + +Something[^1168] + +Something[^1169] + +Something[^1170] + +Something[^1171] + +Something[^1172] + +Something[^1173] + +Something[^1174] + +Something[^1175] + +Something[^1176] + +Something[^1177] + +Something[^1178] + +Something[^1179] + +Something[^1180] + +Something[^1181] + +Something[^1182] + +Something[^1183] + +Something[^1184] + +Something[^1185] + +Something[^1186] + +Something[^1187] + +Something[^1188] + +Something[^1189] + +Something[^1190] + +Something[^1191] + +Something[^1192] + +Something[^1193] + +Something[^1194] + +Something[^1195] + +Something[^1196] + +Something[^1197] + +Something[^1198] + +Something[^1199] + +[^1]: Another thing + +[^2]: Another thing + +[^3]: Another thing + +[^4]: Another thing + +[^5]: Another thing + +[^6]: Another thing + +[^7]: Another thing + +[^8]: Another thing + +[^9]: Another thing + +[^10]: Another thing + +[^11]: Another thing + +[^12]: Another thing + +[^13]: Another thing + +[^14]: Another thing + +[^15]: Another thing + +[^16]: Another thing + +[^17]: Another thing + +[^18]: Another thing + +[^19]: Another thing + +[^20]: Another thing + +[^21]: Another thing + +[^22]: Another thing + +[^23]: Another thing + +[^24]: Another thing + +[^25]: Another thing + +[^26]: Another thing + +[^27]: Another thing + +[^28]: Another thing + +[^29]: Another thing + +[^30]: Another thing + +[^31]: Another thing + +[^32]: Another thing + +[^33]: Another thing + +[^34]: Another thing + +[^35]: Another thing + +[^36]: Another thing + +[^37]: Another thing + +[^38]: Another thing + +[^39]: Another thing + +[^40]: Another thing + +[^41]: Another thing + +[^42]: Another thing + +[^43]: Another thing + +[^44]: Another thing + +[^45]: Another thing + +[^46]: Another thing + +[^47]: Another thing + +[^48]: Another thing + +[^49]: Another thing + +[^50]: Another thing + +[^51]: Another thing + +[^52]: Another thing + +[^53]: Another thing + +[^54]: Another thing + +[^55]: Another thing + +[^56]: Another thing + +[^57]: Another thing + +[^58]: Another thing + +[^59]: Another thing + +[^60]: Another thing + +[^61]: Another thing + +[^62]: Another thing + +[^63]: Another thing + +[^64]: Another thing + +[^65]: Another thing + +[^66]: Another thing + +[^67]: Another thing + +[^68]: Another thing + +[^69]: Another thing + +[^70]: Another thing + +[^71]: Another thing + +[^72]: Another thing + +[^73]: Another thing + +[^74]: Another thing + +[^75]: Another thing + +[^76]: Another thing + +[^77]: Another thing + +[^78]: Another thing + +[^79]: Another thing + +[^80]: Another thing + +[^81]: Another thing + +[^82]: Another thing + +[^83]: Another thing + +[^84]: Another thing + +[^85]: Another thing + +[^86]: Another thing + +[^87]: Another thing + +[^88]: Another thing + +[^89]: Another thing + +[^90]: Another thing + +[^91]: Another thing + +[^92]: Another thing + +[^93]: Another thing + +[^94]: Another thing + +[^95]: Another thing + +[^96]: Another thing + +[^97]: Another thing + +[^98]: Another thing + +[^99]: Another thing + +[^100]: Another thing + +[^101]: Another thing + +[^102]: Another thing + +[^103]: Another thing + +[^104]: Another thing + +[^105]: Another thing + +[^106]: Another thing + +[^107]: Another thing + +[^108]: Another thing + +[^109]: Another thing + +[^110]: Another thing + +[^111]: Another thing + +[^112]: Another thing + +[^113]: Another thing + +[^114]: Another thing + +[^115]: Another thing + +[^116]: Another thing + +[^117]: Another thing + +[^118]: Another thing + +[^119]: Another thing + +[^120]: Another thing + +[^121]: Another thing + +[^122]: Another thing + +[^123]: Another thing + +[^124]: Another thing + +[^125]: Another thing + +[^126]: Another thing + +[^127]: Another thing + +[^128]: Another thing + +[^129]: Another thing + +[^130]: Another thing + +[^131]: Another thing + +[^132]: Another thing + +[^133]: Another thing + +[^134]: Another thing + +[^135]: Another thing + +[^136]: Another thing + +[^137]: Another thing + +[^138]: Another thing + +[^139]: Another thing + +[^140]: Another thing + +[^141]: Another thing + +[^142]: Another thing + +[^143]: Another thing + +[^144]: Another thing + +[^145]: Another thing + +[^146]: Another thing + +[^147]: Another thing + +[^148]: Another thing + +[^149]: Another thing + +[^150]: Another thing + +[^151]: Another thing + +[^152]: Another thing + +[^153]: Another thing + +[^154]: Another thing + +[^155]: Another thing + +[^156]: Another thing + +[^157]: Another thing + +[^158]: Another thing + +[^159]: Another thing + +[^160]: Another thing + +[^161]: Another thing + +[^162]: Another thing + +[^163]: Another thing + +[^164]: Another thing + +[^165]: Another thing + +[^166]: Another thing + +[^167]: Another thing + +[^168]: Another thing + +[^169]: Another thing + +[^170]: Another thing + +[^171]: Another thing + +[^172]: Another thing + +[^173]: Another thing + +[^174]: Another thing + +[^175]: Another thing + +[^176]: Another thing + +[^177]: Another thing + +[^178]: Another thing + +[^179]: Another thing + +[^180]: Another thing + +[^181]: Another thing + +[^182]: Another thing + +[^183]: Another thing + +[^184]: Another thing + +[^185]: Another thing + +[^186]: Another thing + +[^187]: Another thing + +[^188]: Another thing + +[^189]: Another thing + +[^190]: Another thing + +[^191]: Another thing + +[^192]: Another thing + +[^193]: Another thing + +[^194]: Another thing + +[^195]: Another thing + +[^196]: Another thing + +[^197]: Another thing + +[^198]: Another thing + +[^199]: Another thing + +[^200]: Another thing + +[^201]: Another thing + +[^202]: Another thing + +[^203]: Another thing + +[^204]: Another thing + +[^205]: Another thing + +[^206]: Another thing + +[^207]: Another thing + +[^208]: Another thing + +[^209]: Another thing + +[^210]: Another thing + +[^211]: Another thing + +[^212]: Another thing + +[^213]: Another thing + +[^214]: Another thing + +[^215]: Another thing + +[^216]: Another thing + +[^217]: Another thing + +[^218]: Another thing + +[^219]: Another thing + +[^220]: Another thing + +[^221]: Another thing + +[^222]: Another thing + +[^223]: Another thing + +[^224]: Another thing + +[^225]: Another thing + +[^226]: Another thing + +[^227]: Another thing + +[^228]: Another thing + +[^229]: Another thing + +[^230]: Another thing + +[^231]: Another thing + +[^232]: Another thing + +[^233]: Another thing + +[^234]: Another thing + +[^235]: Another thing + +[^236]: Another thing + +[^237]: Another thing + +[^238]: Another thing + +[^239]: Another thing + +[^240]: Another thing + +[^241]: Another thing + +[^242]: Another thing + +[^243]: Another thing + +[^244]: Another thing + +[^245]: Another thing + +[^246]: Another thing + +[^247]: Another thing + +[^248]: Another thing + +[^249]: Another thing + +[^250]: Another thing + +[^251]: Another thing + +[^252]: Another thing + +[^253]: Another thing + +[^254]: Another thing + +[^255]: Another thing + +[^256]: Another thing + +[^257]: Another thing + +[^258]: Another thing + +[^259]: Another thing + +[^260]: Another thing + +[^261]: Another thing + +[^262]: Another thing + +[^263]: Another thing + +[^264]: Another thing + +[^265]: Another thing + +[^266]: Another thing + +[^267]: Another thing + +[^268]: Another thing + +[^269]: Another thing + +[^270]: Another thing + +[^271]: Another thing + +[^272]: Another thing + +[^273]: Another thing + +[^274]: Another thing + +[^275]: Another thing + +[^276]: Another thing + +[^277]: Another thing + +[^278]: Another thing + +[^279]: Another thing + +[^280]: Another thing + +[^281]: Another thing + +[^282]: Another thing + +[^283]: Another thing + +[^284]: Another thing + +[^285]: Another thing + +[^286]: Another thing + +[^287]: Another thing + +[^288]: Another thing + +[^289]: Another thing + +[^290]: Another thing + +[^291]: Another thing + +[^292]: Another thing + +[^293]: Another thing + +[^294]: Another thing + +[^295]: Another thing + +[^296]: Another thing + +[^297]: Another thing + +[^298]: Another thing + +[^299]: Another thing + +[^300]: Another thing + +[^301]: Another thing + +[^302]: Another thing + +[^303]: Another thing + +[^304]: Another thing + +[^305]: Another thing + +[^306]: Another thing + +[^307]: Another thing + +[^308]: Another thing + +[^309]: Another thing + +[^310]: Another thing + +[^311]: Another thing + +[^312]: Another thing + +[^313]: Another thing + +[^314]: Another thing + +[^315]: Another thing + +[^316]: Another thing + +[^317]: Another thing + +[^318]: Another thing + +[^319]: Another thing + +[^320]: Another thing + +[^321]: Another thing + +[^322]: Another thing + +[^323]: Another thing + +[^324]: Another thing + +[^325]: Another thing + +[^326]: Another thing + +[^327]: Another thing + +[^328]: Another thing + +[^329]: Another thing + +[^330]: Another thing + +[^331]: Another thing + +[^332]: Another thing + +[^333]: Another thing + +[^334]: Another thing + +[^335]: Another thing + +[^336]: Another thing + +[^337]: Another thing + +[^338]: Another thing + +[^339]: Another thing + +[^340]: Another thing + +[^341]: Another thing + +[^342]: Another thing + +[^343]: Another thing + +[^344]: Another thing + +[^345]: Another thing + +[^346]: Another thing + +[^347]: Another thing + +[^348]: Another thing + +[^349]: Another thing + +[^350]: Another thing + +[^351]: Another thing + +[^352]: Another thing + +[^353]: Another thing + +[^354]: Another thing + +[^355]: Another thing + +[^356]: Another thing + +[^357]: Another thing + +[^358]: Another thing + +[^359]: Another thing + +[^360]: Another thing + +[^361]: Another thing + +[^362]: Another thing + +[^363]: Another thing + +[^364]: Another thing + +[^365]: Another thing + +[^366]: Another thing + +[^367]: Another thing + +[^368]: Another thing + +[^369]: Another thing + +[^370]: Another thing + +[^371]: Another thing + +[^372]: Another thing + +[^373]: Another thing + +[^374]: Another thing + +[^375]: Another thing + +[^376]: Another thing + +[^377]: Another thing + +[^378]: Another thing + +[^379]: Another thing + +[^380]: Another thing + +[^381]: Another thing + +[^382]: Another thing + +[^383]: Another thing + +[^384]: Another thing + +[^385]: Another thing + +[^386]: Another thing + +[^387]: Another thing + +[^388]: Another thing + +[^389]: Another thing + +[^390]: Another thing + +[^391]: Another thing + +[^392]: Another thing + +[^393]: Another thing + +[^394]: Another thing + +[^395]: Another thing + +[^396]: Another thing + +[^397]: Another thing + +[^398]: Another thing + +[^399]: Another thing + +[^400]: Another thing + +[^401]: Another thing + +[^402]: Another thing + +[^403]: Another thing + +[^404]: Another thing + +[^405]: Another thing + +[^406]: Another thing + +[^407]: Another thing + +[^408]: Another thing + +[^409]: Another thing + +[^410]: Another thing + +[^411]: Another thing + +[^412]: Another thing + +[^413]: Another thing + +[^414]: Another thing + +[^415]: Another thing + +[^416]: Another thing + +[^417]: Another thing + +[^418]: Another thing + +[^419]: Another thing + +[^420]: Another thing + +[^421]: Another thing + +[^422]: Another thing + +[^423]: Another thing + +[^424]: Another thing + +[^425]: Another thing + +[^426]: Another thing + +[^427]: Another thing + +[^428]: Another thing + +[^429]: Another thing + +[^430]: Another thing + +[^431]: Another thing + +[^432]: Another thing + +[^433]: Another thing + +[^434]: Another thing + +[^435]: Another thing + +[^436]: Another thing + +[^437]: Another thing + +[^438]: Another thing + +[^439]: Another thing + +[^440]: Another thing + +[^441]: Another thing + +[^442]: Another thing + +[^443]: Another thing + +[^444]: Another thing + +[^445]: Another thing + +[^446]: Another thing + +[^447]: Another thing + +[^448]: Another thing + +[^449]: Another thing + +[^450]: Another thing + +[^451]: Another thing + +[^452]: Another thing + +[^453]: Another thing + +[^454]: Another thing + +[^455]: Another thing + +[^456]: Another thing + +[^457]: Another thing + +[^458]: Another thing + +[^459]: Another thing + +[^460]: Another thing + +[^461]: Another thing + +[^462]: Another thing + +[^463]: Another thing + +[^464]: Another thing + +[^465]: Another thing + +[^466]: Another thing + +[^467]: Another thing + +[^468]: Another thing + +[^469]: Another thing + +[^470]: Another thing + +[^471]: Another thing + +[^472]: Another thing + +[^473]: Another thing + +[^474]: Another thing + +[^475]: Another thing + +[^476]: Another thing + +[^477]: Another thing + +[^478]: Another thing + +[^479]: Another thing + +[^480]: Another thing + +[^481]: Another thing + +[^482]: Another thing + +[^483]: Another thing + +[^484]: Another thing + +[^485]: Another thing + +[^486]: Another thing + +[^487]: Another thing + +[^488]: Another thing + +[^489]: Another thing + +[^490]: Another thing + +[^491]: Another thing + +[^492]: Another thing + +[^493]: Another thing + +[^494]: Another thing + +[^495]: Another thing + +[^496]: Another thing + +[^497]: Another thing + +[^498]: Another thing + +[^499]: Another thing + +[^500]: Another thing + +[^501]: Another thing + +[^502]: Another thing + +[^503]: Another thing + +[^504]: Another thing + +[^505]: Another thing + +[^506]: Another thing + +[^507]: Another thing + +[^508]: Another thing + +[^509]: Another thing + +[^510]: Another thing + +[^511]: Another thing + +[^512]: Another thing + +[^513]: Another thing + +[^514]: Another thing + +[^515]: Another thing + +[^516]: Another thing + +[^517]: Another thing + +[^518]: Another thing + +[^519]: Another thing + +[^520]: Another thing + +[^521]: Another thing + +[^522]: Another thing + +[^523]: Another thing + +[^524]: Another thing + +[^525]: Another thing + +[^526]: Another thing + +[^527]: Another thing + +[^528]: Another thing + +[^529]: Another thing + +[^530]: Another thing + +[^531]: Another thing + +[^532]: Another thing + +[^533]: Another thing + +[^534]: Another thing + +[^535]: Another thing + +[^536]: Another thing + +[^537]: Another thing + +[^538]: Another thing + +[^539]: Another thing + +[^540]: Another thing + +[^541]: Another thing + +[^542]: Another thing + +[^543]: Another thing + +[^544]: Another thing + +[^545]: Another thing + +[^546]: Another thing + +[^547]: Another thing + +[^548]: Another thing + +[^549]: Another thing + +[^550]: Another thing + +[^551]: Another thing + +[^552]: Another thing + +[^553]: Another thing + +[^554]: Another thing + +[^555]: Another thing + +[^556]: Another thing + +[^557]: Another thing + +[^558]: Another thing + +[^559]: Another thing + +[^560]: Another thing + +[^561]: Another thing + +[^562]: Another thing + +[^563]: Another thing + +[^564]: Another thing + +[^565]: Another thing + +[^566]: Another thing + +[^567]: Another thing + +[^568]: Another thing + +[^569]: Another thing + +[^570]: Another thing + +[^571]: Another thing + +[^572]: Another thing + +[^573]: Another thing + +[^574]: Another thing + +[^575]: Another thing + +[^576]: Another thing + +[^577]: Another thing + +[^578]: Another thing + +[^579]: Another thing + +[^580]: Another thing + +[^581]: Another thing + +[^582]: Another thing + +[^583]: Another thing + +[^584]: Another thing + +[^585]: Another thing + +[^586]: Another thing + +[^587]: Another thing + +[^588]: Another thing + +[^589]: Another thing + +[^590]: Another thing + +[^591]: Another thing + +[^592]: Another thing + +[^593]: Another thing + +[^594]: Another thing + +[^595]: Another thing + +[^596]: Another thing + +[^597]: Another thing + +[^598]: Another thing + +[^599]: Another thing + +[^600]: Another thing + +[^601]: Another thing + +[^602]: Another thing + +[^603]: Another thing + +[^604]: Another thing + +[^605]: Another thing + +[^606]: Another thing + +[^607]: Another thing + +[^608]: Another thing + +[^609]: Another thing + +[^610]: Another thing + +[^611]: Another thing + +[^612]: Another thing + +[^613]: Another thing + +[^614]: Another thing + +[^615]: Another thing + +[^616]: Another thing + +[^617]: Another thing + +[^618]: Another thing + +[^619]: Another thing + +[^620]: Another thing + +[^621]: Another thing + +[^622]: Another thing + +[^623]: Another thing + +[^624]: Another thing + +[^625]: Another thing + +[^626]: Another thing + +[^627]: Another thing + +[^628]: Another thing + +[^629]: Another thing + +[^630]: Another thing + +[^631]: Another thing + +[^632]: Another thing + +[^633]: Another thing + +[^634]: Another thing + +[^635]: Another thing + +[^636]: Another thing + +[^637]: Another thing + +[^638]: Another thing + +[^639]: Another thing + +[^640]: Another thing + +[^641]: Another thing + +[^642]: Another thing + +[^643]: Another thing + +[^644]: Another thing + +[^645]: Another thing + +[^646]: Another thing + +[^647]: Another thing + +[^648]: Another thing + +[^649]: Another thing + +[^650]: Another thing + +[^651]: Another thing + +[^652]: Another thing + +[^653]: Another thing + +[^654]: Another thing + +[^655]: Another thing + +[^656]: Another thing + +[^657]: Another thing + +[^658]: Another thing + +[^659]: Another thing + +[^660]: Another thing + +[^661]: Another thing + +[^662]: Another thing + +[^663]: Another thing + +[^664]: Another thing + +[^665]: Another thing + +[^666]: Another thing + +[^667]: Another thing + +[^668]: Another thing + +[^669]: Another thing + +[^670]: Another thing + +[^671]: Another thing + +[^672]: Another thing + +[^673]: Another thing + +[^674]: Another thing + +[^675]: Another thing + +[^676]: Another thing + +[^677]: Another thing + +[^678]: Another thing + +[^679]: Another thing + +[^680]: Another thing + +[^681]: Another thing + +[^682]: Another thing + +[^683]: Another thing + +[^684]: Another thing + +[^685]: Another thing + +[^686]: Another thing + +[^687]: Another thing + +[^688]: Another thing + +[^689]: Another thing + +[^690]: Another thing + +[^691]: Another thing + +[^692]: Another thing + +[^693]: Another thing + +[^694]: Another thing + +[^695]: Another thing + +[^696]: Another thing + +[^697]: Another thing + +[^698]: Another thing + +[^699]: Another thing + +[^700]: Another thing + +[^701]: Another thing + +[^702]: Another thing + +[^703]: Another thing + +[^704]: Another thing + +[^705]: Another thing + +[^706]: Another thing + +[^707]: Another thing + +[^708]: Another thing + +[^709]: Another thing + +[^710]: Another thing + +[^711]: Another thing + +[^712]: Another thing + +[^713]: Another thing + +[^714]: Another thing + +[^715]: Another thing + +[^716]: Another thing + +[^717]: Another thing + +[^718]: Another thing + +[^719]: Another thing + +[^720]: Another thing + +[^721]: Another thing + +[^722]: Another thing + +[^723]: Another thing + +[^724]: Another thing + +[^725]: Another thing + +[^726]: Another thing + +[^727]: Another thing + +[^728]: Another thing + +[^729]: Another thing + +[^730]: Another thing + +[^731]: Another thing + +[^732]: Another thing + +[^733]: Another thing + +[^734]: Another thing + +[^735]: Another thing + +[^736]: Another thing + +[^737]: Another thing + +[^738]: Another thing + +[^739]: Another thing + +[^740]: Another thing + +[^741]: Another thing + +[^742]: Another thing + +[^743]: Another thing + +[^744]: Another thing + +[^745]: Another thing + +[^746]: Another thing + +[^747]: Another thing + +[^748]: Another thing + +[^749]: Another thing + +[^750]: Another thing + +[^751]: Another thing + +[^752]: Another thing + +[^753]: Another thing + +[^754]: Another thing + +[^755]: Another thing + +[^756]: Another thing + +[^757]: Another thing + +[^758]: Another thing + +[^759]: Another thing + +[^760]: Another thing + +[^761]: Another thing + +[^762]: Another thing + +[^763]: Another thing + +[^764]: Another thing + +[^765]: Another thing + +[^766]: Another thing + +[^767]: Another thing + +[^768]: Another thing + +[^769]: Another thing + +[^770]: Another thing + +[^771]: Another thing + +[^772]: Another thing + +[^773]: Another thing + +[^774]: Another thing + +[^775]: Another thing + +[^776]: Another thing + +[^777]: Another thing + +[^778]: Another thing + +[^779]: Another thing + +[^780]: Another thing + +[^781]: Another thing + +[^782]: Another thing + +[^783]: Another thing + +[^784]: Another thing + +[^785]: Another thing + +[^786]: Another thing + +[^787]: Another thing + +[^788]: Another thing + +[^789]: Another thing + +[^790]: Another thing + +[^791]: Another thing + +[^792]: Another thing + +[^793]: Another thing + +[^794]: Another thing + +[^795]: Another thing + +[^796]: Another thing + +[^797]: Another thing + +[^798]: Another thing + +[^799]: Another thing + +[^800]: Another thing + +[^801]: Another thing + +[^802]: Another thing + +[^803]: Another thing + +[^804]: Another thing + +[^805]: Another thing + +[^806]: Another thing + +[^807]: Another thing + +[^808]: Another thing + +[^809]: Another thing + +[^810]: Another thing + +[^811]: Another thing + +[^812]: Another thing + +[^813]: Another thing + +[^814]: Another thing + +[^815]: Another thing + +[^816]: Another thing + +[^817]: Another thing + +[^818]: Another thing + +[^819]: Another thing + +[^820]: Another thing + +[^821]: Another thing + +[^822]: Another thing + +[^823]: Another thing + +[^824]: Another thing + +[^825]: Another thing + +[^826]: Another thing + +[^827]: Another thing + +[^828]: Another thing + +[^829]: Another thing + +[^830]: Another thing + +[^831]: Another thing + +[^832]: Another thing + +[^833]: Another thing + +[^834]: Another thing + +[^835]: Another thing + +[^836]: Another thing + +[^837]: Another thing + +[^838]: Another thing + +[^839]: Another thing + +[^840]: Another thing + +[^841]: Another thing + +[^842]: Another thing + +[^843]: Another thing + +[^844]: Another thing + +[^845]: Another thing + +[^846]: Another thing + +[^847]: Another thing + +[^848]: Another thing + +[^849]: Another thing + +[^850]: Another thing + +[^851]: Another thing + +[^852]: Another thing + +[^853]: Another thing + +[^854]: Another thing + +[^855]: Another thing + +[^856]: Another thing + +[^857]: Another thing + +[^858]: Another thing + +[^859]: Another thing + +[^860]: Another thing + +[^861]: Another thing + +[^862]: Another thing + +[^863]: Another thing + +[^864]: Another thing + +[^865]: Another thing + +[^866]: Another thing + +[^867]: Another thing + +[^868]: Another thing + +[^869]: Another thing + +[^870]: Another thing + +[^871]: Another thing + +[^872]: Another thing + +[^873]: Another thing + +[^874]: Another thing + +[^875]: Another thing + +[^876]: Another thing + +[^877]: Another thing + +[^878]: Another thing + +[^879]: Another thing + +[^880]: Another thing + +[^881]: Another thing + +[^882]: Another thing + +[^883]: Another thing + +[^884]: Another thing + +[^885]: Another thing + +[^886]: Another thing + +[^887]: Another thing + +[^888]: Another thing + +[^889]: Another thing + +[^890]: Another thing + +[^891]: Another thing + +[^892]: Another thing + +[^893]: Another thing + +[^894]: Another thing + +[^895]: Another thing + +[^896]: Another thing + +[^897]: Another thing + +[^898]: Another thing + +[^899]: Another thing + +[^900]: Another thing + +[^901]: Another thing + +[^902]: Another thing + +[^903]: Another thing + +[^904]: Another thing + +[^905]: Another thing + +[^906]: Another thing + +[^907]: Another thing + +[^908]: Another thing + +[^909]: Another thing + +[^910]: Another thing + +[^911]: Another thing + +[^912]: Another thing + +[^913]: Another thing + +[^914]: Another thing + +[^915]: Another thing + +[^916]: Another thing + +[^917]: Another thing + +[^918]: Another thing + +[^919]: Another thing + +[^920]: Another thing + +[^921]: Another thing + +[^922]: Another thing + +[^923]: Another thing + +[^924]: Another thing + +[^925]: Another thing + +[^926]: Another thing + +[^927]: Another thing + +[^928]: Another thing + +[^929]: Another thing + +[^930]: Another thing + +[^931]: Another thing + +[^932]: Another thing + +[^933]: Another thing + +[^934]: Another thing + +[^935]: Another thing + +[^936]: Another thing + +[^937]: Another thing + +[^938]: Another thing + +[^939]: Another thing + +[^940]: Another thing + +[^941]: Another thing + +[^942]: Another thing + +[^943]: Another thing + +[^944]: Another thing + +[^945]: Another thing + +[^946]: Another thing + +[^947]: Another thing + +[^948]: Another thing + +[^949]: Another thing + +[^950]: Another thing + +[^951]: Another thing + +[^952]: Another thing + +[^953]: Another thing + +[^954]: Another thing + +[^955]: Another thing + +[^956]: Another thing + +[^957]: Another thing + +[^958]: Another thing + +[^959]: Another thing + +[^960]: Another thing + +[^961]: Another thing + +[^962]: Another thing + +[^963]: Another thing + +[^964]: Another thing + +[^965]: Another thing + +[^966]: Another thing + +[^967]: Another thing + +[^968]: Another thing + +[^969]: Another thing + +[^970]: Another thing + +[^971]: Another thing + +[^972]: Another thing + +[^973]: Another thing + +[^974]: Another thing + +[^975]: Another thing + +[^976]: Another thing + +[^977]: Another thing + +[^978]: Another thing + +[^979]: Another thing + +[^980]: Another thing + +[^981]: Another thing + +[^982]: Another thing + +[^983]: Another thing + +[^984]: Another thing + +[^985]: Another thing + +[^986]: Another thing + +[^987]: Another thing + +[^988]: Another thing + +[^989]: Another thing + +[^990]: Another thing + +[^991]: Another thing + +[^992]: Another thing + +[^993]: Another thing + +[^994]: Another thing + +[^995]: Another thing + +[^996]: Another thing + +[^997]: Another thing + +[^998]: Another thing + +[^999]: Another thing + +[^1000]: Another thing + +[^1001]: Another thing + +[^1002]: Another thing + +[^1003]: Another thing + +[^1004]: Another thing + +[^1005]: Another thing + +[^1006]: Another thing + +[^1007]: Another thing + +[^1008]: Another thing + +[^1009]: Another thing + +[^1010]: Another thing + +[^1011]: Another thing + +[^1012]: Another thing + +[^1013]: Another thing + +[^1014]: Another thing + +[^1015]: Another thing + +[^1016]: Another thing + +[^1017]: Another thing + +[^1018]: Another thing + +[^1019]: Another thing + +[^1020]: Another thing + +[^1021]: Another thing + +[^1022]: Another thing + +[^1023]: Another thing + +[^1024]: Another thing + +[^1025]: Another thing + +[^1026]: Another thing + +[^1027]: Another thing + +[^1028]: Another thing + +[^1029]: Another thing + +[^1030]: Another thing + +[^1031]: Another thing + +[^1032]: Another thing + +[^1033]: Another thing + +[^1034]: Another thing + +[^1035]: Another thing + +[^1036]: Another thing + +[^1037]: Another thing + +[^1038]: Another thing + +[^1039]: Another thing + +[^1040]: Another thing + +[^1041]: Another thing + +[^1042]: Another thing + +[^1043]: Another thing + +[^1044]: Another thing + +[^1045]: Another thing + +[^1046]: Another thing + +[^1047]: Another thing + +[^1048]: Another thing + +[^1049]: Another thing + +[^1050]: Another thing + +[^1051]: Another thing + +[^1052]: Another thing + +[^1053]: Another thing + +[^1054]: Another thing + +[^1055]: Another thing + +[^1056]: Another thing + +[^1057]: Another thing + +[^1058]: Another thing + +[^1059]: Another thing + +[^1060]: Another thing + +[^1061]: Another thing + +[^1062]: Another thing + +[^1063]: Another thing + +[^1064]: Another thing + +[^1065]: Another thing + +[^1066]: Another thing + +[^1067]: Another thing + +[^1068]: Another thing + +[^1069]: Another thing + +[^1070]: Another thing + +[^1071]: Another thing + +[^1072]: Another thing + +[^1073]: Another thing + +[^1074]: Another thing + +[^1075]: Another thing + +[^1076]: Another thing + +[^1077]: Another thing + +[^1078]: Another thing + +[^1079]: Another thing + +[^1080]: Another thing + +[^1081]: Another thing + +[^1082]: Another thing + +[^1083]: Another thing + +[^1084]: Another thing + +[^1085]: Another thing + +[^1086]: Another thing + +[^1087]: Another thing + +[^1088]: Another thing + +[^1089]: Another thing + +[^1090]: Another thing + +[^1091]: Another thing + +[^1092]: Another thing + +[^1093]: Another thing + +[^1094]: Another thing + +[^1095]: Another thing + +[^1096]: Another thing + +[^1097]: Another thing + +[^1098]: Another thing + +[^1099]: Another thing + +[^1100]: Another thing + +[^1101]: Another thing + +[^1102]: Another thing + +[^1103]: Another thing + +[^1104]: Another thing + +[^1105]: Another thing + +[^1106]: Another thing + +[^1107]: Another thing + +[^1108]: Another thing + +[^1109]: Another thing + +[^1110]: Another thing + +[^1111]: Another thing + +[^1112]: Another thing + +[^1113]: Another thing + +[^1114]: Another thing + +[^1115]: Another thing + +[^1116]: Another thing + +[^1117]: Another thing + +[^1118]: Another thing + +[^1119]: Another thing + +[^1120]: Another thing + +[^1121]: Another thing + +[^1122]: Another thing + +[^1123]: Another thing + +[^1124]: Another thing + +[^1125]: Another thing + +[^1126]: Another thing + +[^1127]: Another thing + +[^1128]: Another thing + +[^1129]: Another thing + +[^1130]: Another thing + +[^1131]: Another thing + +[^1132]: Another thing + +[^1133]: Another thing + +[^1134]: Another thing + +[^1135]: Another thing + +[^1136]: Another thing + +[^1137]: Another thing + +[^1138]: Another thing + +[^1139]: Another thing + +[^1140]: Another thing + +[^1141]: Another thing + +[^1142]: Another thing + +[^1143]: Another thing + +[^1144]: Another thing + +[^1145]: Another thing + +[^1146]: Another thing + +[^1147]: Another thing + +[^1148]: Another thing + +[^1149]: Another thing + +[^1150]: Another thing + +[^1151]: Another thing + +[^1152]: Another thing + +[^1153]: Another thing + +[^1154]: Another thing + +[^1155]: Another thing + +[^1156]: Another thing + +[^1157]: Another thing + +[^1158]: Another thing + +[^1159]: Another thing + +[^1160]: Another thing + +[^1161]: Another thing + +[^1162]: Another thing + +[^1163]: Another thing + +[^1164]: Another thing + +[^1165]: Another thing + +[^1166]: Another thing + +[^1167]: Another thing + +[^1168]: Another thing + +[^1169]: Another thing + +[^1170]: Another thing + +[^1171]: Another thing + +[^1172]: Another thing + +[^1173]: Another thing + +[^1174]: Another thing + +[^1175]: Another thing + +[^1176]: Another thing + +[^1177]: Another thing + +[^1178]: Another thing + +[^1179]: Another thing + +[^1180]: Another thing + +[^1181]: Another thing + +[^1182]: Another thing + +[^1183]: Another thing + +[^1184]: Another thing + +[^1185]: Another thing + +[^1186]: Another thing + +[^1187]: Another thing + +[^1188]: Another thing + +[^1189]: Another thing + +[^1190]: Another thing + +[^1191]: Another thing + +[^1192]: Another thing + +[^1193]: Another thing + +[^1194]: Another thing + +[^1195]: Another thing + +[^1196]: Another thing + +[^1197]: Another thing + +[^1198]: Another thing + +[^1199]: Another thing + diff --git a/tests/extensions/extra/footnote_placeholder.html b/tests/extensions/extra/footnote_placeholder.html new file mode 100644 index 0000000..cbad740 --- /dev/null +++ b/tests/extensions/extra/footnote_placeholder.html @@ -0,0 +1,9 @@ +
+
+
    +
  1. +

    A Footnote. 

    +
  2. +
+
+

Some text with a footnote1.

\ No newline at end of file diff --git a/tests/extensions/extra/footnote_placeholder.txt b/tests/extensions/extra/footnote_placeholder.txt new file mode 100644 index 0000000..0b0af42 --- /dev/null +++ b/tests/extensions/extra/footnote_placeholder.txt @@ -0,0 +1,5 @@ +///Footnotes Go Here/// + +Some text with a footnote[^1]. + +[^1]: A Footnote. diff --git a/tests/extensions/extra/footnote_placeholder_depth.html b/tests/extensions/extra/footnote_placeholder_depth.html new file mode 100644 index 0000000..60c2bbb --- /dev/null +++ b/tests/extensions/extra/footnote_placeholder_depth.html @@ -0,0 +1,13 @@ +
+
+
+
+
    +
  1. +

    A Footnote. 

    +
  2. +
+
+

Some text with a footnote1.

+
+
\ No newline at end of file diff --git a/tests/extensions/extra/footnote_placeholder_depth.txt b/tests/extensions/extra/footnote_placeholder_depth.txt new file mode 100644 index 0000000..cfe87c0 --- /dev/null +++ b/tests/extensions/extra/footnote_placeholder_depth.txt @@ -0,0 +1,5 @@ +>> ///Footnotes Go Here/// +>> +>> Some text with a footnote[^1]. + +[^1]: A Footnote. diff --git a/tests/extensions/extra/loose_def_list.html b/tests/extensions/extra/loose_def_list.html new file mode 100644 index 0000000..0de6eb6 --- /dev/null +++ b/tests/extensions/extra/loose_def_list.html @@ -0,0 +1,31 @@ +

some text

+
+
term 1
+
+

def 1-1

+
+
+

def 2-2

+
+
term 2
+
term 3
+
+

def 2-1 +line 2 of def 2-1

+
+
+

def 2-2

+

par 2 of def2-2

+
+
+

more text

+
+
term 4
+
not loose
+
term 5
+
+

loose

+
+
term 6
+
also not loose
+
\ No newline at end of file diff --git a/tests/extensions/extra/loose_def_list.txt b/tests/extensions/extra/loose_def_list.txt new file mode 100644 index 0000000..909d12b --- /dev/null +++ b/tests/extensions/extra/loose_def_list.txt @@ -0,0 +1,31 @@ +some text + +term 1 + +: def 1-1 + +: def 2-2 + +term 2 +term 3 + +: def 2-1 + line 2 of def 2-1 + +: def 2-2 + + par 2 of def2-2 + +more text + +term 4 +: not loose + + +term 5 + +: loose + +term 6 +: also not loose + diff --git a/tests/extensions/extra/markdown-syntax.html b/tests/extensions/extra/markdown-syntax.html new file mode 100644 index 0000000..cd7ba17 --- /dev/null +++ b/tests/extensions/extra/markdown-syntax.html @@ -0,0 +1,728 @@ +

Markdown: Syntax

+ + + +

Note: This document is itself written using Markdown; you +can see the source for it by adding '.text' to the URL.

+
+

Overview

+ +

Philosophy

+ +

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

+

Readability, however, is emphasized above all else. A Markdown-formatted +document should be publishable as-is, as plain text, without looking +like it's been marked up with tags or formatting instructions. While +Markdown's syntax has been influenced by several existing text-to-HTML +filters -- including Setext, atx, Textile, reStructuredText, +Grutatext, and EtText -- the single biggest source of +inspiration for Markdown's syntax is the format of plain text email.

+

To this end, Markdown's syntax is comprised entirely of punctuation +characters, which punctuation characters have been carefully chosen so +as to look like what they mean. E.g., asterisks around a word actually +look like *emphasis*. Markdown lists look like, well, lists. Even +blockquotes look like quoted passages of text, assuming you've ever +used email.

+

Inline HTML

+ +

Markdown's syntax is intended for one purpose: to be used as a +format for writing for the web.

+

Markdown is not a replacement for HTML, or even close to it. Its +syntax is very small, corresponding only to a very small subset of +HTML tags. The idea is not to create a syntax that makes it easier +to insert HTML tags. In my opinion, HTML tags are already easy to +insert. The idea for Markdown is to make it easy to read, write, and +edit prose. HTML is a publishing format; Markdown is a writing +format. Thus, Markdown's formatting syntax only addresses issues that +can be conveyed in plain text.

+

For any markup that is not covered by Markdown's syntax, you simply +use HTML itself. There's no need to preface it or delimit it to +indicate that you're switching from Markdown to HTML; you just use +the tags.

+

The only restrictions are that block-level HTML elements -- e.g. <div>, +<table>, <pre>, <p>, etc. -- must be separated from surrounding +content by blank lines, and the start and end tags of the block should +not be indented with tabs or spaces. Markdown is smart enough not +to add extra (unwanted) <p> tags around HTML block-level tags.

+

For example, to add an HTML table to a Markdown article:

+
This is a regular paragraph.
+
+<table>
+    <tr>
+        <td>Foo</td>
+    </tr>
+</table>
+
+This is another regular paragraph.
+
+

Note that Markdown formatting syntax is not processed within block-level +HTML tags. E.g., you can't use Markdown-style *emphasis* inside an +HTML block.

+

Span-level HTML tags -- e.g. <span>, <cite>, or <del> -- can be +used anywhere in a Markdown paragraph, list item, or header. If you +want, you can even use HTML tags instead of Markdown formatting; e.g. if +you'd prefer to use HTML <a> or <img> tags instead of Markdown's +link or image syntax, go right ahead.

+

Unlike block-level HTML tags, Markdown syntax is processed within +span-level tags.

+

Automatic Escaping for Special Characters

+ +

In HTML, there are two characters that demand special treatment: < +and &. Left angle brackets are used to start tags; ampersands are +used to denote HTML entities. If you want to use them as literal +characters, you must escape them as entities, e.g. &lt;, and +&amp;.

+

Ampersands in particular are bedeviling for web writers. If you want to +write about 'AT&T', you need to write 'AT&amp;T'. You even need to +escape ampersands within URLs. Thus, if you want to link to:

+
http://images.google.com/images?num=30&q=larry+bird
+
+

you need to encode the URL as:

+
http://images.google.com/images?num=30&amp;q=larry+bird
+
+

in your anchor tag href attribute. Needless to say, this is easy to +forget, and is probably the single most common source of HTML validation +errors in otherwise well-marked-up web sites.

+

Markdown allows you to use these characters naturally, taking care of +all the necessary escaping for you. If you use an ampersand as part of +an HTML entity, it remains unchanged; otherwise it will be translated +into &amp;.

+

So, if you want to include a copyright symbol in your article, you can write:

+
&copy;
+
+

and Markdown will leave it alone. But if you write:

+
AT&T
+
+

Markdown will translate it to:

+
AT&amp;T
+
+

Similarly, because Markdown supports inline HTML, if you use +angle brackets as delimiters for HTML tags, Markdown will treat them as +such. But if you write:

+
4 < 5
+
+

Markdown will translate it to:

+
4 &lt; 5
+
+

However, inside Markdown code spans and blocks, angle brackets and +ampersands are always encoded automatically. This makes it easy to use +Markdown to write about HTML code. (As opposed to raw HTML, which is a +terrible format for writing about HTML syntax, because every single < +and & in your example code needs to be escaped.)

+
+

Block Elements

+ +

Paragraphs and Line Breaks

+ +

A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing but spaces or tabs is considered +blank.) Normal paragraphs should not be indented with spaces or tabs.

+

The implication of the "one or more consecutive lines of text" rule is +that Markdown supports "hard-wrapped" text paragraphs. This differs +significantly from most other text-to-HTML formatters (including Movable +Type's "Convert Line Breaks" option) which translate every line break +character in a paragraph into a <br /> tag.

+

When you do want to insert a <br /> break tag using Markdown, you +end a line with two or more spaces, then type return.

+

Yes, this takes a tad more effort to create a <br />, but a simplistic +"every line break is a <br />" rule wouldn't work for Markdown. +Markdown's email-style blockquoting and multi-paragraph list items +work best -- and look better -- when you format them with hard breaks.

+ + +

Markdown supports two styles of headers, Setext and atx.

+

Setext-style headers are "underlined" using equal signs (for first-level +headers) and dashes (for second-level headers). For example:

+
This is an H1
+=============
+
+This is an H2
+-------------
+
+

Any number of underlining ='s or -'s will work.

+

Atx-style headers use 1-6 hash characters at the start of the line, +corresponding to header levels 1-6. For example:

+
# This is an H1
+
+## This is an H2
+
+###### This is an H6
+
+

Optionally, you may "close" atx-style headers. This is purely +cosmetic -- you can use this if you think it looks better. The +closing hashes don't even need to match the number of hashes +used to open the header. (The number of opening hashes +determines the header level.) :

+
# This is an H1 #
+
+## This is an H2 ##
+
+### This is an H3 ######
+
+

Blockquotes

+ +

Markdown uses email-style > characters for blockquoting. If you're +familiar with quoting passages of text in an email message, then you +know how to create a blockquote in Markdown. It looks best if you hard +wrap the text and put a > before every line:

+
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
+> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
+> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
+> 
+> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
+> id sem consectetuer libero luctus adipiscing.
+
+

Markdown allows you to be lazy and only put the > before the first +line of a hard-wrapped paragraph:

+
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
+consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
+Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
+
+> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
+id sem consectetuer libero luctus adipiscing.
+
+

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by +adding additional levels of >:

+
> This is the first level of quoting.
+>
+> > This is nested blockquote.
+>
+> Back to the first level.
+
+

Blockquotes can contain other Markdown elements, including headers, lists, +and code blocks:

+
> ## This is a header.
+> 
+> 1.   This is the first list item.
+> 2.   This is the second list item.
+> 
+> Here's some example code:
+> 
+>     return shell_exec("echo $input | $markdown_script");
+
+

Any decent text editor should make email-style quoting easy. For +example, with BBEdit, you can make a selection and choose Increase +Quote Level from the Text menu.

+

Lists

+ +

Markdown supports ordered (numbered) and unordered (bulleted) lists.

+

Unordered lists use asterisks, pluses, and hyphens -- interchangeably +-- as list markers:

+
*   Red
+*   Green
+*   Blue
+
+

is equivalent to:

+
+   Red
++   Green
++   Blue
+
+

and:

+
-   Red
+-   Green
+-   Blue
+
+

Ordered lists use numbers followed by periods:

+
1.  Bird
+2.  McHale
+3.  Parish
+
+

It's important to note that the actual numbers you use to mark the +list have no effect on the HTML output Markdown produces. The HTML +Markdown produces from the above list is:

+
<ol>
+<li>Bird</li>
+<li>McHale</li>
+<li>Parish</li>
+</ol>
+
+

If you instead wrote the list in Markdown like this:

+
1.  Bird
+1.  McHale
+1.  Parish
+
+

or even:

+
3. Bird
+1. McHale
+8. Parish
+
+

you'd get the exact same HTML output. The point is, if you want to, +you can use ordinal numbers in your ordered Markdown lists, so that +the numbers in your source match the numbers in your published HTML. +But if you want to be lazy, you don't have to.

+

If you do use lazy list numbering, however, you should still start the +list with the number 1. At some point in the future, Markdown may support +starting ordered lists at an arbitrary number.

+

List markers typically start at the left margin, but may be indented by +up to three spaces. List markers must be followed by one or more spaces +or a tab.

+

To make lists look nice, you can wrap items with hanging indents:

+
*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+    Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
+    viverra nec, fringilla in, laoreet vitae, risus.
+*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
+    Suspendisse id sem consectetuer libero luctus adipiscing.
+
+

But if you want to be lazy, you don't have to:

+
*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
+viverra nec, fringilla in, laoreet vitae, risus.
+*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
+Suspendisse id sem consectetuer libero luctus adipiscing.
+
+

If list items are separated by blank lines, Markdown will wrap the +items in <p> tags in the HTML output. For example, this input:

+
*   Bird
+*   Magic
+
+

will turn into:

+
<ul>
+<li>Bird</li>
+<li>Magic</li>
+</ul>
+
+

But this:

+
*   Bird
+
+*   Magic
+
+

will turn into:

+
<ul>
+<li><p>Bird</p></li>
+<li><p>Magic</p></li>
+</ul>
+
+

List items may consist of multiple paragraphs. Each subsequent +paragraph in a list item must be indented by either 4 spaces +or one tab:

+
1.  This is a list item with two paragraphs. Lorem ipsum dolor
+    sit amet, consectetuer adipiscing elit. Aliquam hendrerit
+    mi posuere lectus.
+
+    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
+    vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
+    sit amet velit.
+
+2.  Suspendisse id sem consectetuer libero luctus adipiscing.
+
+

It looks nice if you indent every line of the subsequent +paragraphs, but here again, Markdown will allow you to be +lazy:

+
*   This is a list item with two paragraphs.
+
+    This is the second paragraph in the list item. You're
+only required to indent the first line. Lorem ipsum dolor
+sit amet, consectetuer adipiscing elit.
+
+*   Another item in the same list.
+
+

To put a blockquote within a list item, the blockquote's > +delimiters need to be indented:

+
*   A list item with a blockquote:
+
+    > This is a blockquote
+    > inside a list item.
+
+

To put a code block within a list item, the code block needs +to be indented twice -- 8 spaces or two tabs:

+
*   A list item with a code block:
+
+        <code goes here>
+
+

It's worth noting that it's possible to trigger an ordered list by +accident, by writing something like this:

+
1986. What a great season.
+
+

In other words, a number-period-space sequence at the beginning of a +line. To avoid this, you can backslash-escape the period:

+
1986\. What a great season.
+
+

Code Blocks

+ +

Pre-formatted code blocks are used for writing about programming or +markup source code. Rather than forming normal paragraphs, the lines +of a code block are interpreted literally. Markdown wraps a code block +in both <pre> and <code> tags.

+

To produce a code block in Markdown, simply indent every line of the +block by at least 4 spaces or 1 tab. For example, given this input:

+
This is a normal paragraph:
+
+    This is a code block.
+
+

Markdown will generate:

+
<p>This is a normal paragraph:</p>
+
+<pre><code>This is a code block.
+</code></pre>
+
+

One level of indentation -- 4 spaces or 1 tab -- is removed from each +line of the code block. For example, this:

+
Here is an example of AppleScript:
+
+    tell application "Foo"
+        beep
+    end tell
+
+

will turn into:

+
<p>Here is an example of AppleScript:</p>
+
+<pre><code>tell application "Foo"
+    beep
+end tell
+</code></pre>
+
+

A code block continues until it reaches a line that is not indented +(or the end of the article).

+

Within a code block, ampersands (&) and angle brackets (< and >) +are automatically converted into HTML entities. This makes it very +easy to include example HTML source code using Markdown -- just paste +it and indent it, and Markdown will handle the hassle of encoding the +ampersands and angle brackets. For example, this:

+
    <div class="footer">
+        &copy; 2004 Foo Corporation
+    </div>
+
+

will turn into:

+
<pre><code>&lt;div class="footer"&gt;
+    &amp;copy; 2004 Foo Corporation
+&lt;/div&gt;
+</code></pre>
+
+

Regular Markdown syntax is not processed within code blocks. E.g., +asterisks are just literal asterisks within a code block. This means +it's also easy to use Markdown to write about Markdown's own syntax.

+

Horizontal Rules

+ +

You can produce a horizontal rule tag (<hr />) by placing three or +more hyphens, asterisks, or underscores on a line by themselves. If you +wish, you may use spaces between the hyphens or asterisks. Each of the +following lines will produce a horizontal rule:

+
* * *
+
+***
+
+*****
+
+- - -
+
+---------------------------------------
+
+_ _ _
+
+
+

Span Elements

+ + + +

Markdown supports two style of links: inline and reference.

+

In both styles, the link text is delimited by [square brackets].

+

To create an inline link, use a set of regular parentheses immediately +after the link text's closing square bracket. Inside the parentheses, +put the URL where you want the link to point, along with an optional +title for the link, surrounded in quotes. For example:

+
This is [an example](http://example.com/ "Title") inline link.
+
+[This link](http://example.net/) has no title attribute.
+
+

Will produce:

+
<p>This is <a href="http://example.com/" title="Title">
+an example</a> inline link.</p>
+
+<p><a href="http://example.net/">This link</a> has no
+title attribute.</p>
+
+

If you're referring to a local resource on the same server, you can +use relative paths:

+
See my [About](/about/) page for details.
+
+

Reference-style links use a second set of square brackets, inside +which you place a label of your choosing to identify the link:

+
This is [an example][id] reference-style link.
+
+

You can optionally use a space to separate the sets of brackets:

+
This is [an example] [id] reference-style link.
+
+

Then, anywhere in the document, you define your link label like this, +on a line by itself:

+
[id]: http://example.com/  "Optional Title Here"
+
+

That is:

+
    +
  • Square brackets containing the link identifier (optionally + indented from the left margin using up to three spaces);
  • +
  • followed by a colon;
  • +
  • followed by one or more spaces (or tabs);
  • +
  • followed by the URL for the link;
  • +
  • optionally followed by a title attribute for the link, enclosed + in double or single quotes.
  • +
+

The link URL may, optionally, be surrounded by angle brackets:

+
[id]: <http://example.com/>  "Optional Title Here"
+
+

You can put the title attribute on the next line and use extra spaces +or tabs for padding, which tends to look better with longer URLs:

+
[id]: http://example.com/longish/path/to/resource/here
+    "Optional Title Here"
+
+

Link definitions are only used for creating links during Markdown +processing, and are stripped from your document in the HTML output.

+

Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are not case sensitive. E.g. these two links:

+
[link text][a]
+[link text][A]
+
+

are equivalent.

+

The implicit link name shortcut allows you to omit the name of the +link, in which case the link text itself is used as the name. +Just use an empty set of square brackets -- e.g., to link the word +"Google" to the google.com web site, you could simply write:

+
[Google][]
+
+

And then define the link:

+
[Google]: http://google.com/
+
+

Because link names may contain spaces, this shortcut even works for +multiple words in the link text:

+
Visit [Daring Fireball][] for more information.
+
+

And then define the link:

+
[Daring Fireball]: http://daringfireball.net/
+
+

Link definitions can be placed anywhere in your Markdown document. I +tend to put them immediately after each paragraph in which they're +used, but if you want, you can put them all at the end of your +document, sort of like footnotes.

+

Here's an example of reference links in action:

+
I get 10 times more traffic from [Google] [1] than from
+[Yahoo] [2] or [MSN] [3].
+
+  [1]: http://google.com/        "Google"
+  [2]: http://search.yahoo.com/  "Yahoo Search"
+  [3]: http://search.msn.com/    "MSN Search"
+
+

Using the implicit link name shortcut, you could instead write:

+
I get 10 times more traffic from [Google][] than from
+[Yahoo][] or [MSN][].
+
+  [google]: http://google.com/        "Google"
+  [yahoo]:  http://search.yahoo.com/  "Yahoo Search"
+  [msn]:    http://search.msn.com/    "MSN Search"
+
+

Both of the above examples will produce the following HTML output:

+
<p>I get 10 times more traffic from <a href="http://google.com/"
+title="Google">Google</a> than from
+<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
+or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
+
+

For comparison, here is the same paragraph written using +Markdown's inline link style:

+
I get 10 times more traffic from [Google](http://google.com/ "Google")
+than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
+[MSN](http://search.msn.com/ "MSN Search").
+
+

The point of reference-style links is not that they're easier to +write. The point is that with reference-style links, your document +source is vastly more readable. Compare the above examples: using +reference-style links, the paragraph itself is only 81 characters +long; with inline-style links, it's 176 characters; and as raw HTML, +it's 234 characters. In the raw HTML, there's more markup than there +is text.

+

With Markdown's reference-style links, a source document much more +closely resembles the final output, as rendered in a browser. By +allowing you to move the markup-related metadata out of the paragraph, +you can add links without interrupting the narrative flow of your +prose.

+

Emphasis

+ +

Markdown treats asterisks (*) and underscores (_) as indicators of +emphasis. Text wrapped with one * or _ will be wrapped with an +HTML <em> tag; double *'s or _'s will be wrapped with an HTML +<strong> tag. E.g., this input:

+
*single asterisks*
+
+_single underscores_
+
+**double asterisks**
+
+__double underscores__
+
+

will produce:

+
<em>single asterisks</em>
+
+<em>single underscores</em>
+
+<strong>double asterisks</strong>
+
+<strong>double underscores</strong>
+
+

You can use whichever style you prefer; the lone restriction is that +the same character must be used to open and close an emphasis span.

+

Emphasis can be used in the middle of a word:

+
un*fucking*believable
+
+

But if you surround an * or _ with spaces, it'll be treated as a +literal asterisk or underscore.

+

To produce a literal asterisk or underscore at a position where it +would otherwise be used as an emphasis delimiter, you can backslash +escape it:

+
\*this text is surrounded by literal asterisks\*
+
+

Code

+ +

To indicate a span of code, wrap it with backtick quotes (`). +Unlike a pre-formatted code block, a code span indicates code within a +normal paragraph. For example:

+
Use the `printf()` function.
+
+

will produce:

+
<p>Use the <code>printf()</code> function.</p>
+
+

To include a literal backtick character within a code span, you can use +multiple backticks as the opening and closing delimiters:

+
``There is a literal backtick (`) here.``
+
+

which will produce this:

+
<p><code>There is a literal backtick (`) here.</code></p>
+
+

The backtick delimiters surrounding a code span may include spaces -- +one after the opening, one before the closing. This allows you to place +literal backtick characters at the beginning or end of a code span:

+
A single backtick in a code span: `` ` ``
+
+A backtick-delimited string in a code span: `` `foo` ``
+
+

will produce:

+
<p>A single backtick in a code span: <code>`</code></p>
+
+<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
+
+

With a code span, ampersands and angle brackets are encoded as HTML +entities automatically, which makes it easy to include example HTML +tags. Markdown will turn this:

+
Please don't use any `<blink>` tags.
+
+

into:

+
<p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
+
+

You can write this:

+
`&#8212;` is the decimal-encoded equivalent of `&mdash;`.
+
+

to produce:

+
<p><code>&amp;#8212;</code> is the decimal-encoded
+equivalent of <code>&amp;mdash;</code>.</p>
+
+

Images

+ +

Admittedly, it's fairly difficult to devise a "natural" syntax for +placing images into a plain text document format.

+

Markdown uses an image syntax that is intended to resemble the syntax +for links, allowing for two styles: inline and reference.

+

Inline image syntax looks like this:

+
![Alt text](/path/to/img.jpg)
+
+![Alt text](/path/to/img.jpg "Optional title")
+
+

That is:

+
    +
  • An exclamation mark: !;
  • +
  • followed by a set of square brackets, containing the alt + attribute text for the image;
  • +
  • followed by a set of parentheses, containing the URL or path to + the image, and an optional title attribute enclosed in double + or single quotes.
  • +
+

Reference-style image syntax looks like this:

+
![Alt text][id]
+
+

Where "id" is the name of a defined image reference. Image references +are defined using syntax identical to link references:

+
[id]: url/to/image  "Optional title attribute"
+
+

As of this writing, Markdown has no syntax for specifying the +dimensions of an image; if this is important to you, you can simply +use regular HTML <img> tags.

+
+

Miscellaneous

+ + + +

Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

+
<http://example.com/>
+
+

Markdown will turn this into:

+
<a href="http://example.com/">http://example.com/</a>
+
+

Automatic links for email addresses work similarly, except that +Markdown will also perform a bit of randomized decimal and hex +entity-encoding to help obscure your address from address-harvesting +spambots. For example, Markdown will turn this:

+
<address@example.com>
+
+

into something like this:

+
<a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
+&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
+&#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
+&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
+
+

which will render in a browser as a clickable link to "address@example.com".

+

(This sort of entity-encoding trick will indeed fool many, if not +most, address-harvesting bots, but it definitely won't fool all of +them. It's better than nothing, but an address published in this way +will probably eventually start receiving spam.)

+

Backslash Escapes

+ +

Markdown allows you to use backslash escapes to generate literal +characters which would otherwise have special meaning in Markdown's +formatting syntax. For example, if you wanted to surround a word with +literal asterisks (instead of an HTML <em> tag), you can backslashes +before the asterisks, like this:

+
\*literal asterisks\*
+
+

Markdown provides backslash escapes for the following characters:

+
\   backslash
+`   backtick
+*   asterisk
+_   underscore
+{}  curly braces
+[]  square brackets
+()  parentheses
+#   hash mark
++   plus sign
+-   minus sign (hyphen)
+.   dot
+!   exclamation mark
+
\ No newline at end of file diff --git a/tests/extensions/extra/markdown-syntax.txt b/tests/extensions/extra/markdown-syntax.txt new file mode 100644 index 0000000..38f6e78 --- /dev/null +++ b/tests/extensions/extra/markdown-syntax.txt @@ -0,0 +1,888 @@ +Markdown: Syntax +================ + + + + +* [Overview](#overview) + * [Philosophy](#philosophy) + * [Inline HTML](#html) + * [Automatic Escaping for Special Characters](#autoescape) +* [Block Elements](#block) + * [Paragraphs and Line Breaks](#p) + * [Headers](#header) + * [Blockquotes](#blockquote) + * [Lists](#list) + * [Code Blocks](#precode) + * [Horizontal Rules](#hr) +* [Span Elements](#span) + * [Links](#link) + * [Emphasis](#em) + * [Code](#code) + * [Images](#img) +* [Miscellaneous](#misc) + * [Backslash Escapes](#backslash) + * [Automatic Links](#autolink) + + +**Note:** This document is itself written using Markdown; you +can [see the source for it by adding '.text' to the URL][src]. + + [src]: /projects/markdown/syntax.text + +* * * + +

Overview

+ +

Philosophy

+ +Markdown is intended to be as easy-to-read and easy-to-write as is feasible. + +Readability, however, is emphasized above all else. A Markdown-formatted +document should be publishable as-is, as plain text, without looking +like it's been marked up with tags or formatting instructions. While +Markdown's syntax has been influenced by several existing text-to-HTML +filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4], +[Grutatext] [5], and [EtText] [6] -- the single biggest source of +inspiration for Markdown's syntax is the format of plain text email. + + [1]: http://docutils.sourceforge.net/mirror/setext.html + [2]: http://www.aaronsw.com/2002/atx/ + [3]: http://textism.com/tools/textile/ + [4]: http://docutils.sourceforge.net/rst.html + [5]: http://www.triptico.com/software/grutatxt.html + [6]: http://ettext.taint.org/doc/ + +To this end, Markdown's syntax is comprised entirely of punctuation +characters, which punctuation characters have been carefully chosen so +as to look like what they mean. E.g., asterisks around a word actually +look like \*emphasis\*. Markdown lists look like, well, lists. Even +blockquotes look like quoted passages of text, assuming you've ever +used email. + + + +

Inline HTML

+ +Markdown's syntax is intended for one purpose: to be used as a +format for *writing* for the web. + +Markdown is not a replacement for HTML, or even close to it. Its +syntax is very small, corresponding only to a very small subset of +HTML tags. The idea is *not* to create a syntax that makes it easier +to insert HTML tags. In my opinion, HTML tags are already easy to +insert. The idea for Markdown is to make it easy to read, write, and +edit prose. HTML is a *publishing* format; Markdown is a *writing* +format. Thus, Markdown's formatting syntax only addresses issues that +can be conveyed in plain text. + +For any markup that is not covered by Markdown's syntax, you simply +use HTML itself. There's no need to preface it or delimit it to +indicate that you're switching from Markdown to HTML; you just use +the tags. + +The only restrictions are that block-level HTML elements -- e.g. `
`, +``, `
`, `

`, etc. -- must be separated from surrounding +content by blank lines, and the start and end tags of the block should +not be indented with tabs or spaces. Markdown is smart enough not +to add extra (unwanted) `

` tags around HTML block-level tags. + +For example, to add an HTML table to a Markdown article: + + This is a regular paragraph. + +

+ + + +
Foo
+ + This is another regular paragraph. + +Note that Markdown formatting syntax is not processed within block-level +HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an +HTML block. + +Span-level HTML tags -- e.g. ``, ``, or `` -- can be +used anywhere in a Markdown paragraph, list item, or header. If you +want, you can even use HTML tags instead of Markdown formatting; e.g. if +you'd prefer to use HTML `` or `` tags instead of Markdown's +link or image syntax, go right ahead. + +Unlike block-level HTML tags, Markdown syntax *is* processed within +span-level tags. + + +

Automatic Escaping for Special Characters

+ +In HTML, there are two characters that demand special treatment: `<` +and `&`. Left angle brackets are used to start tags; ampersands are +used to denote HTML entities. If you want to use them as literal +characters, you must escape them as entities, e.g. `<`, and +`&`. + +Ampersands in particular are bedeviling for web writers. If you want to +write about 'AT&T', you need to write '`AT&T`'. You even need to +escape ampersands within URLs. Thus, if you want to link to: + + http://images.google.com/images?num=30&q=larry+bird + +you need to encode the URL as: + + http://images.google.com/images?num=30&q=larry+bird + +in your anchor tag `href` attribute. Needless to say, this is easy to +forget, and is probably the single most common source of HTML validation +errors in otherwise well-marked-up web sites. + +Markdown allows you to use these characters naturally, taking care of +all the necessary escaping for you. If you use an ampersand as part of +an HTML entity, it remains unchanged; otherwise it will be translated +into `&`. + +So, if you want to include a copyright symbol in your article, you can write: + + © + +and Markdown will leave it alone. But if you write: + + AT&T + +Markdown will translate it to: + + AT&T + +Similarly, because Markdown supports [inline HTML](#html), if you use +angle brackets as delimiters for HTML tags, Markdown will treat them as +such. But if you write: + + 4 < 5 + +Markdown will translate it to: + + 4 < 5 + +However, inside Markdown code spans and blocks, angle brackets and +ampersands are *always* encoded automatically. This makes it easy to use +Markdown to write about HTML code. (As opposed to raw HTML, which is a +terrible format for writing about HTML syntax, because every single `<` +and `&` in your example code needs to be escaped.) + + +* * * + + +

Block Elements

+ + +

Paragraphs and Line Breaks

+ +A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing but spaces or tabs is considered +blank.) Normal paragraphs should not be indented with spaces or tabs. + +The implication of the "one or more consecutive lines of text" rule is +that Markdown supports "hard-wrapped" text paragraphs. This differs +significantly from most other text-to-HTML formatters (including Movable +Type's "Convert Line Breaks" option) which translate every line break +character in a paragraph into a `
` tag. + +When you *do* want to insert a `
` break tag using Markdown, you +end a line with two or more spaces, then type return. + +Yes, this takes a tad more effort to create a `
`, but a simplistic +"every line break is a `
`" rule wouldn't work for Markdown. +Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l] +work best -- and look better -- when you format them with hard breaks. + + [bq]: #blockquote + [l]: #list + + + + + +Markdown supports two styles of headers, [Setext] [1] and [atx] [2]. + +Setext-style headers are "underlined" using equal signs (for first-level +headers) and dashes (for second-level headers). For example: + + This is an H1 + ============= + + This is an H2 + ------------- + +Any number of underlining `=`'s or `-`'s will work. + +Atx-style headers use 1-6 hash characters at the start of the line, +corresponding to header levels 1-6. For example: + + # This is an H1 + + ## This is an H2 + + ###### This is an H6 + +Optionally, you may "close" atx-style headers. This is purely +cosmetic -- you can use this if you think it looks better. The +closing hashes don't even need to match the number of hashes +used to open the header. (The number of opening hashes +determines the header level.) : + + # This is an H1 # + + ## This is an H2 ## + + ### This is an H3 ###### + + +

Blockquotes

+ +Markdown uses email-style `>` characters for blockquoting. If you're +familiar with quoting passages of text in an email message, then you +know how to create a blockquote in Markdown. It looks best if you hard +wrap the text and put a `>` before every line: + + > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, + > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. + > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + > + > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse + > id sem consectetuer libero luctus adipiscing. + +Markdown allows you to be lazy and only put the `>` before the first +line of a hard-wrapped paragraph: + + > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, + consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. + Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + + > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse + id sem consectetuer libero luctus adipiscing. + +Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by +adding additional levels of `>`: + + > This is the first level of quoting. + > + > > This is nested blockquote. + > + > Back to the first level. + +Blockquotes can contain other Markdown elements, including headers, lists, +and code blocks: + + > ## This is a header. + > + > 1. This is the first list item. + > 2. This is the second list item. + > + > Here's some example code: + > + > return shell_exec("echo $input | $markdown_script"); + +Any decent text editor should make email-style quoting easy. For +example, with BBEdit, you can make a selection and choose Increase +Quote Level from the Text menu. + + +

Lists

+ +Markdown supports ordered (numbered) and unordered (bulleted) lists. + +Unordered lists use asterisks, pluses, and hyphens -- interchangeably +-- as list markers: + + * Red + * Green + * Blue + +is equivalent to: + + + Red + + Green + + Blue + +and: + + - Red + - Green + - Blue + +Ordered lists use numbers followed by periods: + + 1. Bird + 2. McHale + 3. Parish + +It's important to note that the actual numbers you use to mark the +list have no effect on the HTML output Markdown produces. The HTML +Markdown produces from the above list is: + +
    +
  1. Bird
  2. +
  3. McHale
  4. +
  5. Parish
  6. +
+ +If you instead wrote the list in Markdown like this: + + 1. Bird + 1. McHale + 1. Parish + +or even: + + 3. Bird + 1. McHale + 8. Parish + +you'd get the exact same HTML output. The point is, if you want to, +you can use ordinal numbers in your ordered Markdown lists, so that +the numbers in your source match the numbers in your published HTML. +But if you want to be lazy, you don't have to. + +If you do use lazy list numbering, however, you should still start the +list with the number 1. At some point in the future, Markdown may support +starting ordered lists at an arbitrary number. + +List markers typically start at the left margin, but may be indented by +up to three spaces. List markers must be followed by one or more spaces +or a tab. + +To make lists look nice, you can wrap items with hanging indents: + + * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. + * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +But if you want to be lazy, you don't have to: + + * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. + * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +If list items are separated by blank lines, Markdown will wrap the +items in `

` tags in the HTML output. For example, this input: + + * Bird + * Magic + +will turn into: + +

    +
  • Bird
  • +
  • Magic
  • +
+ +But this: + + * Bird + + * Magic + +will turn into: + +
    +
  • Bird

  • +
  • Magic

  • +
+ +List items may consist of multiple paragraphs. Each subsequent +paragraph in a list item must be indented by either 4 spaces +or one tab: + + 1. This is a list item with two paragraphs. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. Aliquam hendrerit + mi posuere lectus. + + Vestibulum enim wisi, viverra nec, fringilla in, laoreet + vitae, risus. Donec sit amet nisl. Aliquam semper ipsum + sit amet velit. + + 2. Suspendisse id sem consectetuer libero luctus adipiscing. + +It looks nice if you indent every line of the subsequent +paragraphs, but here again, Markdown will allow you to be +lazy: + + * This is a list item with two paragraphs. + + This is the second paragraph in the list item. You're + only required to indent the first line. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. + + * Another item in the same list. + +To put a blockquote within a list item, the blockquote's `>` +delimiters need to be indented: + + * A list item with a blockquote: + + > This is a blockquote + > inside a list item. + +To put a code block within a list item, the code block needs +to be indented *twice* -- 8 spaces or two tabs: + + * A list item with a code block: + + + + +It's worth noting that it's possible to trigger an ordered list by +accident, by writing something like this: + + 1986. What a great season. + +In other words, a *number-period-space* sequence at the beginning of a +line. To avoid this, you can backslash-escape the period: + + 1986\. What a great season. + + + +

Code Blocks

+ +Pre-formatted code blocks are used for writing about programming or +markup source code. Rather than forming normal paragraphs, the lines +of a code block are interpreted literally. Markdown wraps a code block +in both `
` and `` tags.
+
+To produce a code block in Markdown, simply indent every line of the
+block by at least 4 spaces or 1 tab. For example, given this input:
+
+    This is a normal paragraph:
+
+        This is a code block.
+
+Markdown will generate:
+
+    

This is a normal paragraph:

+ +
This is a code block.
+    
+ +One level of indentation -- 4 spaces or 1 tab -- is removed from each +line of the code block. For example, this: + + Here is an example of AppleScript: + + tell application "Foo" + beep + end tell + +will turn into: + +

Here is an example of AppleScript:

+ +
tell application "Foo"
+        beep
+    end tell
+    
+ +A code block continues until it reaches a line that is not indented +(or the end of the article). + +Within a code block, ampersands (`&`) and angle brackets (`<` and `>`) +are automatically converted into HTML entities. This makes it very +easy to include example HTML source code using Markdown -- just paste +it and indent it, and Markdown will handle the hassle of encoding the +ampersands and angle brackets. For example, this: + + + +will turn into: + +
<div class="footer">
+        &copy; 2004 Foo Corporation
+    </div>
+    
+ +Regular Markdown syntax is not processed within code blocks. E.g., +asterisks are just literal asterisks within a code block. This means +it's also easy to use Markdown to write about Markdown's own syntax. + + + +

Horizontal Rules

+ +You can produce a horizontal rule tag (`
`) by placing three or +more hyphens, asterisks, or underscores on a line by themselves. If you +wish, you may use spaces between the hyphens or asterisks. Each of the +following lines will produce a horizontal rule: + + * * * + + *** + + ***** + + - - - + + --------------------------------------- + + _ _ _ + + +* * * + +

Span Elements

+ + + +Markdown supports two style of links: *inline* and *reference*. + +In both styles, the link text is delimited by [square brackets]. + +To create an inline link, use a set of regular parentheses immediately +after the link text's closing square bracket. Inside the parentheses, +put the URL where you want the link to point, along with an *optional* +title for the link, surrounded in quotes. For example: + + This is [an example](http://example.com/ "Title") inline link. + + [This link](http://example.net/) has no title attribute. + +Will produce: + +

This is + an example inline link.

+ +

This link has no + title attribute.

+ +If you're referring to a local resource on the same server, you can +use relative paths: + + See my [About](/about/) page for details. + +Reference-style links use a second set of square brackets, inside +which you place a label of your choosing to identify the link: + + This is [an example][id] reference-style link. + +You can optionally use a space to separate the sets of brackets: + + This is [an example] [id] reference-style link. + +Then, anywhere in the document, you define your link label like this, +on a line by itself: + + [id]: http://example.com/ "Optional Title Here" + +That is: + +* Square brackets containing the link identifier (optionally + indented from the left margin using up to three spaces); +* followed by a colon; +* followed by one or more spaces (or tabs); +* followed by the URL for the link; +* optionally followed by a title attribute for the link, enclosed + in double or single quotes. + +The link URL may, optionally, be surrounded by angle brackets: + + [id]: "Optional Title Here" + +You can put the title attribute on the next line and use extra spaces +or tabs for padding, which tends to look better with longer URLs: + + [id]: http://example.com/longish/path/to/resource/here + "Optional Title Here" + +Link definitions are only used for creating links during Markdown +processing, and are stripped from your document in the HTML output. + +Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links: + + [link text][a] + [link text][A] + +are equivalent. + +The *implicit link name* shortcut allows you to omit the name of the +link, in which case the link text itself is used as the name. +Just use an empty set of square brackets -- e.g., to link the word +"Google" to the google.com web site, you could simply write: + + [Google][] + +And then define the link: + + [Google]: http://google.com/ + +Because link names may contain spaces, this shortcut even works for +multiple words in the link text: + + Visit [Daring Fireball][] for more information. + +And then define the link: + + [Daring Fireball]: http://daringfireball.net/ + +Link definitions can be placed anywhere in your Markdown document. I +tend to put them immediately after each paragraph in which they're +used, but if you want, you can put them all at the end of your +document, sort of like footnotes. + +Here's an example of reference links in action: + + I get 10 times more traffic from [Google] [1] than from + [Yahoo] [2] or [MSN] [3]. + + [1]: http://google.com/ "Google" + [2]: http://search.yahoo.com/ "Yahoo Search" + [3]: http://search.msn.com/ "MSN Search" + +Using the implicit link name shortcut, you could instead write: + + I get 10 times more traffic from [Google][] than from + [Yahoo][] or [MSN][]. + + [google]: http://google.com/ "Google" + [yahoo]: http://search.yahoo.com/ "Yahoo Search" + [msn]: http://search.msn.com/ "MSN Search" + +Both of the above examples will produce the following HTML output: + +

I get 10 times more traffic from Google than from + Yahoo + or MSN.

+ +For comparison, here is the same paragraph written using +Markdown's inline link style: + + I get 10 times more traffic from [Google](http://google.com/ "Google") + than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or + [MSN](http://search.msn.com/ "MSN Search"). + +The point of reference-style links is not that they're easier to +write. The point is that with reference-style links, your document +source is vastly more readable. Compare the above examples: using +reference-style links, the paragraph itself is only 81 characters +long; with inline-style links, it's 176 characters; and as raw HTML, +it's 234 characters. In the raw HTML, there's more markup than there +is text. + +With Markdown's reference-style links, a source document much more +closely resembles the final output, as rendered in a browser. By +allowing you to move the markup-related metadata out of the paragraph, +you can add links without interrupting the narrative flow of your +prose. + + +

Emphasis

+ +Markdown treats asterisks (`*`) and underscores (`_`) as indicators of +emphasis. Text wrapped with one `*` or `_` will be wrapped with an +HTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML +`` tag. E.g., this input: + + *single asterisks* + + _single underscores_ + + **double asterisks** + + __double underscores__ + +will produce: + + single asterisks + + single underscores + + double asterisks + + double underscores + +You can use whichever style you prefer; the lone restriction is that +the same character must be used to open and close an emphasis span. + +Emphasis can be used in the middle of a word: + + un*fucking*believable + +But if you surround an `*` or `_` with spaces, it'll be treated as a +literal asterisk or underscore. + +To produce a literal asterisk or underscore at a position where it +would otherwise be used as an emphasis delimiter, you can backslash +escape it: + + \*this text is surrounded by literal asterisks\* + + + +

Code

+ +To indicate a span of code, wrap it with backtick quotes (`` ` ``). +Unlike a pre-formatted code block, a code span indicates code within a +normal paragraph. For example: + + Use the `printf()` function. + +will produce: + +

Use the printf() function.

+ +To include a literal backtick character within a code span, you can use +multiple backticks as the opening and closing delimiters: + + ``There is a literal backtick (`) here.`` + +which will produce this: + +

There is a literal backtick (`) here.

+ +The backtick delimiters surrounding a code span may include spaces -- +one after the opening, one before the closing. This allows you to place +literal backtick characters at the beginning or end of a code span: + + A single backtick in a code span: `` ` `` + + A backtick-delimited string in a code span: `` `foo` `` + +will produce: + +

A single backtick in a code span: `

+ +

A backtick-delimited string in a code span: `foo`

+ +With a code span, ampersands and angle brackets are encoded as HTML +entities automatically, which makes it easy to include example HTML +tags. Markdown will turn this: + + Please don't use any `` tags. + +into: + +

Please don't use any <blink> tags.

+ +You can write this: + + `—` is the decimal-encoded equivalent of `—`. + +to produce: + +

&#8212; is the decimal-encoded + equivalent of &mdash;.

+ + + +

Images

+ +Admittedly, it's fairly difficult to devise a "natural" syntax for +placing images into a plain text document format. + +Markdown uses an image syntax that is intended to resemble the syntax +for links, allowing for two styles: *inline* and *reference*. + +Inline image syntax looks like this: + + ![Alt text](/path/to/img.jpg) + + ![Alt text](/path/to/img.jpg "Optional title") + +That is: + +* An exclamation mark: `!`; +* followed by a set of square brackets, containing the `alt` + attribute text for the image; +* followed by a set of parentheses, containing the URL or path to + the image, and an optional `title` attribute enclosed in double + or single quotes. + +Reference-style image syntax looks like this: + + ![Alt text][id] + +Where "id" is the name of a defined image reference. Image references +are defined using syntax identical to link references: + + [id]: url/to/image "Optional title attribute" + +As of this writing, Markdown has no syntax for specifying the +dimensions of an image; if this is important to you, you can simply +use regular HTML `` tags. + + +* * * + + +

Miscellaneous

+ + + +Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this: + + + +Markdown will turn this into: + + http://example.com/ + +Automatic links for email addresses work similarly, except that +Markdown will also perform a bit of randomized decimal and hex +entity-encoding to help obscure your address from address-harvesting +spambots. For example, Markdown will turn this: + + + +into something like this: + + address@exa + mple.com + +which will render in a browser as a clickable link to "address@example.com". + +(This sort of entity-encoding trick will indeed fool many, if not +most, address-harvesting bots, but it definitely won't fool all of +them. It's better than nothing, but an address published in this way +will probably eventually start receiving spam.) + + + +

Backslash Escapes

+ +Markdown allows you to use backslash escapes to generate literal +characters which would otherwise have special meaning in Markdown's +formatting syntax. For example, if you wanted to surround a word with +literal asterisks (instead of an HTML `` tag), you can backslashes +before the asterisks, like this: + + \*literal asterisks\* + +Markdown provides backslash escapes for the following characters: + + \ backslash + ` backtick + * asterisk + _ underscore + {} curly braces + [] square brackets + () parentheses + # hash mark + + plus sign + - minus sign (hyphen) + . dot + ! exclamation mark + diff --git a/tests/extensions/extra/named_markers.html b/tests/extensions/extra/named_markers.html new file mode 100644 index 0000000..fd40245 --- /dev/null +++ b/tests/extensions/extra/named_markers.html @@ -0,0 +1,20 @@ +

This is the body with footnotes1 +that have named2 markers and +oddly3 numbered4 markers.

+
+
+
    +
  1. +

    Footnote marked foo

    +
  2. +
  3. +

    This one is marked bar

    +
  4. +
  5. +

    A numbered footnote. 

    +
  6. +
  7. +

    The last one. 

    +
  8. +
+
\ No newline at end of file diff --git a/tests/extensions/extra/named_markers.txt b/tests/extensions/extra/named_markers.txt new file mode 100644 index 0000000..d246524 --- /dev/null +++ b/tests/extensions/extra/named_markers.txt @@ -0,0 +1,9 @@ +This is the body with footnotes[^foo] +that have named[^bar] markers and +oddly[^56] numbered[^99] markers. + +[^foo]: Footnote marked ``foo``. +[^bar]: This one is marked *bar*. +[^56]: A __numbered__ footnote. +[^99]: The last one. + diff --git a/tests/extensions/extra/raw-html.html b/tests/extensions/extra/raw-html.html new file mode 100644 index 0000000..ef94cb3 --- /dev/null +++ b/tests/extensions/extra/raw-html.html @@ -0,0 +1,123 @@ +
+

foo

+
+
+

bar

+
+
+

blah

+
+
+

The text of the Example element.

+
+

This text gets wrapped in p tags.

+
+

The tail of the DefaultBlockMode subelement.

+

+This text is not wrapped in additional p tags. +

+

The tail of the DefaultSpanMode subelement.

+
+This div block is not wrapped in paragraph tags. +Note: Subelements are not required to have tail text. +
+

+

This p block is foolishly wrapped in further paragraph tags.

+

+

The tail of the BlockModeOverride subelement.

+
+Raw html blocks may also be nested. +
+
+

This text is after the markdown in html.

+
+

1 +2

+
+
+

Markdown is active here.

+
+Raw html blocks may also be nested. +
+

Markdown is still active here.

+
+

Markdown is active again here.

+
+

foo bar

+

bar

+
+
+
+

link

+
+
+
+
+

abbr

+
+
+
+
+

footnote1

+
+
+
+
+

link

+
+
+
+
+

abbr

+
+
+
+
+

footnote2

+
+
+
+
+
    +
  1. +
      +
    1. +

      The top couple half figure, contrary sides and hands across with bottom couple,

      +

      Half figure back on your own sides, and turn partner to places,

      +

      Swing partners with right hands into straight line long-ways, as in a reel, and

      +

      Set,

      +

      Hey and return to places,

      +

      The other three couples do the same.

      +
    2. +
    3. +

      Top and bottom couples meet and set,

      +

      Then each gentleman leas the opposite lady to the couple on his left, and set,

      +

      Aach four right and left,

      +

      Swing side couples to places, and turn partners all eight,

      +

      The other two couple o the same.

      +
    4. +
    +

    +
  2. +
  3. +
      +
    1. +

      The top couple half figure, contrary sides and hands across with bottom couple,

      +

      Half figure back on your own sides, and turn partner to places,

      +

      Swing partners with right hands into straight line long-ways, as in a reel, and

      +

      Set,

      +

      Hey and return to places,

      +

      The other three couples do the same.

      +
    2. +
    3. +

      Top and bottom couples meet and set,

      +

      Then each gentleman leas the opposite lady to the couple on his left, and set,

      +

      Aach four right and left,

      +

      Swing side couples to places, and turn partners all eight,

      +

      The other two couple o the same.

      +
    4. +
    +

    +
  4. +
+
\ No newline at end of file diff --git a/tests/extensions/extra/raw-html.txt b/tests/extensions/extra/raw-html.txt new file mode 100644 index 0000000..c82ddbb --- /dev/null +++ b/tests/extensions/extra/raw-html.txt @@ -0,0 +1,184 @@ +
_foo_
+ +
+_bar_ +
+ +
+ +_blah_ + +
+ +
+ +The text of the `Example` element. + +
+This text gets wrapped in `p` tags. +
+ +The tail of the `DefaultBlockMode` subelement. + +

+This text *is not* wrapped in additional `p` tags. +

+ +The tail of the `DefaultSpanMode` subelement. + +
+This `div` block is not wrapped in paragraph tags. +Note: Subelements are not required to have tail text. +
+ +

+This `p` block *is* foolishly wrapped in further paragraph tags. +

+ +The tail of the `BlockModeOverride` subelement. + +
+Raw html blocks may also be nested. +
+ +
+ +This text is after the markdown in html. + +
+ +1 +2 + +
+ +
+ +Markdown is *active* here. + +
+Raw html blocks may also be nested. +
+ +Markdown is *still* active here. + +
+ +Markdown is *active again* here. + +
+foo bar + +bar +
+ +
+ +[link]: http://example.com + +
+[link][link] +
+ +
+ +
+ +*[abbr]: Abbreviation + +
+abbr +
+ +
+ +
+ +[^1]: + 1. The top couple half figure, contrary sides and hands across with bottom couple, + + Half figure back on your own sides, and turn partner to places, + + Swing partners with right hands into straight line long-ways, as in a reel, and + + Set, + + Hey and return to places, + + The other three couples do the same. + + 2. Top and bottom couples meet and set, + + Then each gentleman leas the opposite lady to the couple on his left, and set, + + Aach four right and left, + + Swing side couples to places, and turn partners all eight, + + The other two couple o the same. + +
+footnote[^1] +
+ +
+ +
+ +[link]: http://example.com + + + + +
+[link][link] +
+ +
+ +
+ +*[abbr]: Abbreviation + + + + +
+abbr +
+ +
+ +
+ +[^2]: + 1. The top couple half figure, contrary sides and hands across with bottom couple, + + Half figure back on your own sides, and turn partner to places, + + Swing partners with right hands into straight line long-ways, as in a reel, and + + Set, + + Hey and return to places, + + The other three couples do the same. + + 2. Top and bottom couples meet and set, + + Then each gentleman leas the opposite lady to the couple on his left, and set, + + Aach four right and left, + + Swing side couples to places, and turn partners all eight, + + The other two couple o the same. + + + + +
+footnote[^2] +
+ +
diff --git a/tests/extensions/extra/simple_def-lists.html b/tests/extensions/extra/simple_def-lists.html new file mode 100644 index 0000000..9448773 --- /dev/null +++ b/tests/extensions/extra/simple_def-lists.html @@ -0,0 +1,43 @@ +

Some text

+
+
term1
+
Def1
+
term2-1
+
term2-2
+
Def2-1
+
Def2-2
+
+

more text

+
+
term 3
+
+

def 3 +line 2 of def 3

+

paragraph 2 of def 3.

+
+
+

def 3-2

+
# A code block in a def
+
+
+

a blockquote

+
+
    +
  • +

    a list item

    +
  • +
  • +
    +

    blockquote in list

    +
    +
  • +
+
+
+

and more text.

+
+
term 4
+
def4 + line 2 of def 4
+
+

final text.

\ No newline at end of file diff --git a/tests/extensions/extra/simple_def-lists.txt b/tests/extensions/extra/simple_def-lists.txt new file mode 100644 index 0000000..20e9afa --- /dev/null +++ b/tests/extensions/extra/simple_def-lists.txt @@ -0,0 +1,35 @@ +Some text + +term1 +: Def1 + +term2-1 +term2-2 +: Def2-1 +: Def2-2 + +more text + +term *3* +: def 3 + line __2__ of def 3 + + paragraph 2 of def 3. + +: def 3-2 + + # A code block in a def + + > a blockquote + + * a list item + + * > blockquote in list + +and more text. + +term 4 +: def4 + line 2 of def 4 + +final text. diff --git a/tests/extensions/github_flavored.html b/tests/extensions/github_flavored.html new file mode 100644 index 0000000..98dc82a --- /dev/null +++ b/tests/extensions/github_flavored.html @@ -0,0 +1,40 @@ +

index 0000000..6e956a9

+
--- /dev/null
++++ b/test/data/stripped_text/mike-30-lili
+@@ -0,0 +1,27 @@
++Summary:
++ drift_mod.py |    1 +
++ 1 files changed, 1 insertions(+), 0 deletions(-)
++
++commit da4bfb04debdd994683740878d09988b2641513d
++Author: Mike Dirolf <mike@dirolf.com>
++Date:   Tue Jan 17 13:42:28 2012 -0500
++
++```
++minor: just wanted to push something.
++```
++
++diff --git a/drift_mod.py b/drift_mod.py
++index 34dfba6..8a88a69 100644
++
++```
++--- a/drift_mod.py
+++++ b/drift_mod.py
++@@ -281,6 +281,7 @@ CONTEXT_DIFF_LINE_PATTERN = re.compile(r'^('
++                                        '|\+ .*'
++                                        '|- .*'
++                                        ')$')
+++
++ def wrap_context_diffs(message_text):
++     return _wrap_diff(CONTEXT_DIFF_HEADER_PATTERN,
++                       CONTEXT_DIFF_LINE_PATTERN,
++```
+
+

Test support for foo+bar lexer names.

+
<title>{% block title %}{% endblock %}</title>
+<ul>
+{% for user in users %}
+  <li><a href="{{ user.url }}">{{ user.username }}</a></li>
+{% endfor %}
+</ul>
+
\ No newline at end of file diff --git a/tests/extensions/github_flavored.txt b/tests/extensions/github_flavored.txt new file mode 100644 index 0000000..4f362b7 --- /dev/null +++ b/tests/extensions/github_flavored.txt @@ -0,0 +1,45 @@ +index 0000000..6e956a9 + +```diff +--- /dev/null ++++ b/test/data/stripped_text/mike-30-lili +@@ -0,0 +1,27 @@ ++Summary: ++ drift_mod.py | 1 + ++ 1 files changed, 1 insertions(+), 0 deletions(-) ++ ++commit da4bfb04debdd994683740878d09988b2641513d ++Author: Mike Dirolf ++Date: Tue Jan 17 13:42:28 2012 -0500 ++ ++``` ++minor: just wanted to push something. ++``` ++ ++diff --git a/drift_mod.py b/drift_mod.py ++index 34dfba6..8a88a69 100644 ++ ++``` ++--- a/drift_mod.py +++++ b/drift_mod.py ++@@ -281,6 +281,7 @@ CONTEXT_DIFF_LINE_PATTERN = re.compile(r'^(' ++ '|\+ .*' ++ '|- .*' ++ ')$') +++ ++ def wrap_context_diffs(message_text): ++ return _wrap_diff(CONTEXT_DIFF_HEADER_PATTERN, ++ CONTEXT_DIFF_LINE_PATTERN, ++``` +``` + +Test support for foo+bar lexer names. + +```html+jinja +{% block title %}{% endblock %} + +``` diff --git a/tests/extensions/nl2br_w_attr_list.html b/tests/extensions/nl2br_w_attr_list.html new file mode 100644 index 0000000..e5e7eb2 --- /dev/null +++ b/tests/extensions/nl2br_w_attr_list.html @@ -0,0 +1 @@ +

Foo

\ No newline at end of file diff --git a/tests/extensions/nl2br_w_attr_list.txt b/tests/extensions/nl2br_w_attr_list.txt new file mode 100644 index 0000000..4b520b5 --- /dev/null +++ b/tests/extensions/nl2br_w_attr_list.txt @@ -0,0 +1,2 @@ +Foo +{: #bar} \ No newline at end of file diff --git a/tests/extensions/sane_lists.html b/tests/extensions/sane_lists.html new file mode 100644 index 0000000..ed51b4d --- /dev/null +++ b/tests/extensions/sane_lists.html @@ -0,0 +1,32 @@ +
    +
  1. Ordered
  2. +
  3. List
  4. +
+
    +
  • Unordered
  • +
  • List
  • +
+
    +
  1. Ordered again
  2. +
+

Paragraph +* not a list item

+
    +
  1. More ordered +* not a list item
  2. +
+
    +
  • Unordered again +1. not a list item
  • +
+
    +
  1. Bird
  2. +
  3. McHale
  4. +
  5. Parish
  6. +
+

Not a list

+
    +
  1. Bird
  2. +
  3. McHale
  4. +
  5. Parish
  6. +
\ No newline at end of file diff --git a/tests/extensions/sane_lists.txt b/tests/extensions/sane_lists.txt new file mode 100644 index 0000000..464149f --- /dev/null +++ b/tests/extensions/sane_lists.txt @@ -0,0 +1,26 @@ +1. Ordered +2. List + +* Unordered +* List + +1. Ordered again + +Paragraph +* not a list item + +1. More ordered +* not a list item + +* Unordered again +1. not a list item + +3. Bird +1. McHale +8. Parish + +Not a list + +3. Bird +1. McHale +8. Parish \ No newline at end of file diff --git a/tests/extensions/smarty.html b/tests/extensions/smarty.html new file mode 100644 index 0000000..e37e377 --- /dev/null +++ b/tests/extensions/smarty.html @@ -0,0 +1,32 @@ +

’.
+1440–80’s
+1440–’80s
+1440—’80s
+1960s
+1960’s
+one two ’60s
+’60s

+

It’s fun. What’s fun?
+“Isn’t this fun”? — she said…
+“‘Quoted’ words in a larger quote.”
+‘Quoted “words” in a larger quote.’
+“quoted” text and bold “quoted” text
+‘quoted’ text and bold ‘quoted’ text
+em-dashes (—) and ellipes (…)
+“Link” — she said.

+

“Ellipsis within quotes…”

+

Кавычки-«ёлочки»
+«hello»
+Anführungszeichen-»Chevrons«

+
+

Escaped -- ndash
+'Escaped' "quotes"
+Escaped ellipsis...

+

‘Escaped "quotes" in real ones’
+'“Real” quotes in escaped ones'

+

Skip <<all>> "code" -- --- 'spans' ....

+
Also skip "code" 'blocks'
+foo -- bar --- baz ...
+
+

A line that ‘wraps’ with +emphasis at the beginning of the next line.

\ No newline at end of file diff --git a/tests/extensions/smarty.txt b/tests/extensions/smarty.txt new file mode 100644 index 0000000..12e5c95 --- /dev/null +++ b/tests/extensions/smarty.txt @@ -0,0 +1,40 @@ +'. +1440--80's +1440--'80s +1440---'80s +1960s +1960's +one two '60s +'60s + +It's fun. What's fun? +"Isn't this fun"? --- she said... +"'Quoted' words in a larger quote." +'Quoted "words" in a larger quote.' +"quoted" text and **bold "quoted" text** +'quoted' text and **bold 'quoted' text** +em-dashes (---) and ellipes (...) +"[Link](http://example.com)" --- she said. + +"Ellipsis within quotes..." + +Кавычки-<<ёлочки>> +<> +Anführungszeichen->>Chevrons<< + +--- -- --- + +Escaped \-- ndash +\'Escaped\' \"quotes\" +Escaped ellipsis\... + +'Escaped \"quotes\" in real ones' +\'"Real" quotes in escaped ones\' + +Skip `<> "code" -- --- 'spans' ...`. + + Also skip "code" 'blocks' + foo -- bar --- baz ... + +A line that 'wraps' with +*emphasis* at the beginning of the next line. diff --git a/tests/extensions/toc.html b/tests/extensions/toc.html new file mode 100644 index 0000000..1f06b68 --- /dev/null +++ b/tests/extensions/toc.html @@ -0,0 +1,699 @@ + +

Overview

+

Philosophy

+

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

+

Readability, however, is emphasized above all else. A Markdown-formatted +document should be publishable as-is, as plain text, without looking +like it's been marked up with tags or formatting instructions. While +Markdown's syntax has been influenced by several existing text-to-HTML +filters -- including Setext, atx, Textile, reStructuredText, +Grutatext, and EtText -- the single biggest source of +inspiration for Markdown's syntax is the format of plain text email.

+

To this end, Markdown's syntax is comprised entirely of punctuation +characters, which punctuation characters have been carefully chosen so +as to look like what they mean. E.g., asterisks around a word actually +look like *emphasis*. Markdown lists look like, well, lists. Even +blockquotes look like quoted passages of text, assuming you've ever +used email.

+

Inline HTML

+

Markdown's syntax is intended for one purpose: to be used as a +format for writing for the web.

+

Markdown is not a replacement for HTML, or even close to it. Its +syntax is very small, corresponding only to a very small subset of +HTML tags. The idea is not to create a syntax that makes it easier +to insert HTML tags. In my opinion, HTML tags are already easy to +insert. The idea for Markdown is to make it easy to read, write, and +edit prose. HTML is a publishing format; Markdown is a writing +format. Thus, Markdown's formatting syntax only addresses issues that +can be conveyed in plain text.

+

For any markup that is not covered by Markdown's syntax, you simply +use HTML itself. There's no need to preface it or delimit it to +indicate that you're switching from Markdown to HTML; you just use +the tags.

+

The only restrictions are that block-level HTML elements -- e.g. <div>, +<table>, <pre>, <p>, etc. -- must be separated from surrounding +content by blank lines, and the start and end tags of the block should +not be indented with tabs or spaces. Markdown is smart enough not +to add extra (unwanted) <p> tags around HTML block-level tags.

+

For example, to add an HTML table to a Markdown article:

+
This is a regular paragraph.
+
+<table>
+    <tr>
+        <td>Foo</td>
+    </tr>
+</table>
+
+This is another regular paragraph.
+
+

Note that Markdown formatting syntax is not processed within block-level +HTML tags. E.g., you can't use Markdown-style *emphasis* inside an +HTML block.

+

Span-level HTML tags -- e.g. <span>, <cite>, or <del> -- can be +used anywhere in a Markdown paragraph, list item, or header. If you +want, you can even use HTML tags instead of Markdown formatting; e.g. if +you'd prefer to use HTML <a> or <img> tags instead of Markdown's +link or image syntax, go right ahead.

+

Unlike block-level HTML tags, Markdown syntax is processed within +span-level tags.

+

Automatic Escaping for Special Characters

+

In HTML, there are two characters that demand special treatment: < +and &. Left angle brackets are used to start tags; ampersands are +used to denote HTML entities. If you want to use them as literal +characters, you must escape them as entities, e.g. &lt;, and +&amp;.

+

Ampersands in particular are bedeviling for web writers. If you want to +write about 'AT&T', you need to write 'AT&amp;T'. You even need to +escape ampersands within URLs. Thus, if you want to link to:

+
http://images.google.com/images?num=30&q=larry+bird
+
+

you need to encode the URL as:

+
http://images.google.com/images?num=30&amp;q=larry+bird
+
+

in your anchor tag href attribute. Needless to say, this is easy to +forget, and is probably the single most common source of HTML validation +errors in otherwise well-marked-up web sites.

+

Markdown allows you to use these characters naturally, taking care of +all the necessary escaping for you. If you use an ampersand as part of +an HTML entity, it remains unchanged; otherwise it will be translated +into &amp;.

+

So, if you want to include a copyright symbol in your article, you can write:

+
&copy;
+
+

and Markdown will leave it alone. But if you write:

+
AT&T
+
+

Markdown will translate it to:

+
AT&amp;T
+
+

Similarly, because Markdown supports inline HTML, if you use +angle brackets as delimiters for HTML tags, Markdown will treat them as +such. But if you write:

+
4 < 5
+
+

Markdown will translate it to:

+
4 &lt; 5
+
+

However, inside Markdown code spans and blocks, angle brackets and +ampersands are always encoded automatically. This makes it easy to use +Markdown to write about HTML code. (As opposed to raw HTML, which is a +terrible format for writing about HTML syntax, because every single < +and & in your example code needs to be escaped.)

+
+

Block Elements

+

Paragraphs and Line Breaks

+

A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing but spaces or tabs is considered +blank.) Normal paragraphs should not be indented with spaces or tabs.

+

The implication of the "one or more consecutive lines of text" rule is +that Markdown supports "hard-wrapped" text paragraphs. This differs +significantly from most other text-to-HTML formatters (including Movable +Type's "Convert Line Breaks" option) which translate every line break +character in a paragraph into a <br /> tag.

+

When you do want to insert a <br /> break tag using Markdown, you +end a line with two or more spaces, then type return.

+

Yes, this takes a tad more effort to create a <br />, but a simplistic +"every line break is a <br />" rule wouldn't work for Markdown. +Markdown's email-style blockquoting and multi-paragraph list items +work best -- and look better -- when you format them with hard breaks.

+

Headers

+

Markdown supports two styles of headers, Setext and atx.

+

Setext-style headers are "underlined" using equal signs (for first-level +headers) and dashes (for second-level headers). For example:

+
This is an H1
+=============
+
+This is an H2
+-------------
+
+

Any number of underlining ='s or -'s will work.

+

Atx-style headers use 1-6 hash characters at the start of the line, +corresponding to header levels 1-6. For example:

+
# This is an H1
+
+## This is an H2
+
+###### This is an H6
+
+

Optionally, you may "close" atx-style headers. This is purely +cosmetic -- you can use this if you think it looks better. The +closing hashes don't even need to match the number of hashes +used to open the header. (The number of opening hashes +determines the header level.) :

+
# This is an H1 #
+
+## This is an H2 ##
+
+### This is an H3 ######
+
+

Blockquotes

+

Markdown uses email-style > characters for blockquoting. If you're +familiar with quoting passages of text in an email message, then you +know how to create a blockquote in Markdown. It looks best if you hard +wrap the text and put a > before every line:

+
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
+> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
+> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
+> 
+> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
+> id sem consectetuer libero luctus adipiscing.
+
+

Markdown allows you to be lazy and only put the > before the first +line of a hard-wrapped paragraph:

+
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
+consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
+Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
+
+> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
+id sem consectetuer libero luctus adipiscing.
+
+

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by +adding additional levels of >:

+
> This is the first level of quoting.
+>
+> > This is nested blockquote.
+>
+> Back to the first level.
+
+

Blockquotes can contain other Markdown elements, including headers, lists, +and code blocks:

+
> ## This is a header.
+> 
+> 1.   This is the first list item.
+> 2.   This is the second list item.
+> 
+> Here's some example code:
+> 
+>     return shell_exec("echo $input | $markdown_script");
+
+

Any decent text editor should make email-style quoting easy. For +example, with BBEdit, you can make a selection and choose Increase +Quote Level from the Text menu.

+

Lists

+

Markdown supports ordered (numbered) and unordered (bulleted) lists.

+

Unordered lists use asterisks, pluses, and hyphens -- interchangeably +-- as list markers:

+
*   Red
+*   Green
+*   Blue
+
+

is equivalent to:

+
+   Red
++   Green
++   Blue
+
+

and:

+
-   Red
+-   Green
+-   Blue
+
+

Ordered lists use numbers followed by periods:

+
1.  Bird
+2.  McHale
+3.  Parish
+
+

It's important to note that the actual numbers you use to mark the +list have no effect on the HTML output Markdown produces. The HTML +Markdown produces from the above list is:

+
<ol>
+<li>Bird</li>
+<li>McHale</li>
+<li>Parish</li>
+</ol>
+
+

If you instead wrote the list in Markdown like this:

+
1.  Bird
+1.  McHale
+1.  Parish
+
+

or even:

+
3. Bird
+1. McHale
+8. Parish
+
+

you'd get the exact same HTML output. The point is, if you want to, +you can use ordinal numbers in your ordered Markdown lists, so that +the numbers in your source match the numbers in your published HTML. +But if you want to be lazy, you don't have to.

+

If you do use lazy list numbering, however, you should still start the +list with the number 1. At some point in the future, Markdown may support +starting ordered lists at an arbitrary number.

+

List markers typically start at the left margin, but may be indented by +up to three spaces. List markers must be followed by one or more spaces +or a tab.

+

To make lists look nice, you can wrap items with hanging indents:

+
*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+    Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
+    viverra nec, fringilla in, laoreet vitae, risus.
+*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
+    Suspendisse id sem consectetuer libero luctus adipiscing.
+
+

But if you want to be lazy, you don't have to:

+
*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
+viverra nec, fringilla in, laoreet vitae, risus.
+*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
+Suspendisse id sem consectetuer libero luctus adipiscing.
+
+

If list items are separated by blank lines, Markdown will wrap the +items in <p> tags in the HTML output. For example, this input:

+
*   Bird
+*   Magic
+
+

will turn into:

+
<ul>
+<li>Bird</li>
+<li>Magic</li>
+</ul>
+
+

But this:

+
*   Bird
+
+*   Magic
+
+

will turn into:

+
<ul>
+<li><p>Bird</p></li>
+<li><p>Magic</p></li>
+</ul>
+
+

List items may consist of multiple paragraphs. Each subsequent +paragraph in a list item must be indented by either 4 spaces +or one tab:

+
1.  This is a list item with two paragraphs. Lorem ipsum dolor
+    sit amet, consectetuer adipiscing elit. Aliquam hendrerit
+    mi posuere lectus.
+
+    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
+    vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
+    sit amet velit.
+
+2.  Suspendisse id sem consectetuer libero luctus adipiscing.
+
+

It looks nice if you indent every line of the subsequent +paragraphs, but here again, Markdown will allow you to be +lazy:

+
*   This is a list item with two paragraphs.
+
+    This is the second paragraph in the list item. You're
+only required to indent the first line. Lorem ipsum dolor
+sit amet, consectetuer adipiscing elit.
+
+*   Another item in the same list.
+
+

To put a blockquote within a list item, the blockquote's > +delimiters need to be indented:

+
*   A list item with a blockquote:
+
+    > This is a blockquote
+    > inside a list item.
+
+

To put a code block within a list item, the code block needs +to be indented twice -- 8 spaces or two tabs:

+
*   A list item with a code block:
+
+        <code goes here>
+
+

It's worth noting that it's possible to trigger an ordered list by +accident, by writing something like this:

+
1986. What a great season.
+
+

In other words, a number-period-space sequence at the beginning of a +line. To avoid this, you can backslash-escape the period:

+
1986\. What a great season.
+
+

Code Blocks

+

Pre-formatted code blocks are used for writing about programming or +markup source code. Rather than forming normal paragraphs, the lines +of a code block are interpreted literally. Markdown wraps a code block +in both <pre> and <code> tags.

+

To produce a code block in Markdown, simply indent every line of the +block by at least 4 spaces or 1 tab. For example, given this input:

+
This is a normal paragraph:
+
+    This is a code block.
+
+

Markdown will generate:

+
<p>This is a normal paragraph:</p>
+
+<pre><code>This is a code block.
+</code></pre>
+
+

One level of indentation -- 4 spaces or 1 tab -- is removed from each +line of the code block. For example, this:

+
Here is an example of AppleScript:
+
+    tell application "Foo"
+        beep
+    end tell
+
+

will turn into:

+
<p>Here is an example of AppleScript:</p>
+
+<pre><code>tell application "Foo"
+    beep
+end tell
+</code></pre>
+
+

A code block continues until it reaches a line that is not indented +(or the end of the article).

+

Within a code block, ampersands (&) and angle brackets (< and >) +are automatically converted into HTML entities. This makes it very +easy to include example HTML source code using Markdown -- just paste +it and indent it, and Markdown will handle the hassle of encoding the +ampersands and angle brackets. For example, this:

+
    <div class="footer">
+        &copy; 2004 Foo Corporation
+    </div>
+
+

will turn into:

+
<pre><code>&lt;div class="footer"&gt;
+    &amp;copy; 2004 Foo Corporation
+&lt;/div&gt;
+</code></pre>
+
+

Regular Markdown syntax is not processed within code blocks. E.g., +asterisks are just literal asterisks within a code block. This means +it's also easy to use Markdown to write about Markdown's own syntax.

+

Horizontal Rules

+

You can produce a horizontal rule tag (<hr />) by placing three or +more hyphens, asterisks, or underscores on a line by themselves. If you +wish, you may use spaces between the hyphens or asterisks. Each of the +following lines will produce a horizontal rule:

+
* * *
+
+***
+
+*****
+
+- - -
+
+---------------------------------------
+
+_ _ _
+
+
+

Span Elements

+ +

Markdown supports two style of links: inline and reference.

+

In both styles, the link text is delimited by [square brackets].

+

To create an inline link, use a set of regular parentheses immediately +after the link text's closing square bracket. Inside the parentheses, +put the URL where you want the link to point, along with an optional +title for the link, surrounded in quotes. For example:

+
This is [an example](http://example.com/ "Title") inline link.
+
+[This link](http://example.net/) has no title attribute.
+
+

Will produce:

+
<p>This is <a href="http://example.com/" title="Title">
+an example</a> inline link.</p>
+
+<p><a href="http://example.net/">This link</a> has no
+title attribute.</p>
+
+

If you're referring to a local resource on the same server, you can +use relative paths:

+
See my [About](/about/) page for details.
+
+

Reference-style links use a second set of square brackets, inside +which you place a label of your choosing to identify the link:

+
This is [an example][id] reference-style link.
+
+

You can optionally use a space to separate the sets of brackets:

+
This is [an example] [id] reference-style link.
+
+

Then, anywhere in the document, you define your link label like this, +on a line by itself:

+
[id]: http://example.com/  "Optional Title Here"
+
+

That is:

+
    +
  • Square brackets containing the link identifier (optionally + indented from the left margin using up to three spaces);
  • +
  • followed by a colon;
  • +
  • followed by one or more spaces (or tabs);
  • +
  • followed by the URL for the link;
  • +
  • optionally followed by a title attribute for the link, enclosed + in double or single quotes.
  • +
+

The link URL may, optionally, be surrounded by angle brackets:

+
[id]: <http://example.com/>  "Optional Title Here"
+
+

You can put the title attribute on the next line and use extra spaces +or tabs for padding, which tends to look better with longer URLs:

+
[id]: http://example.com/longish/path/to/resource/here
+    "Optional Title Here"
+
+

Link definitions are only used for creating links during Markdown +processing, and are stripped from your document in the HTML output.

+

Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are not case sensitive. E.g. these two links:

+
[link text][a]
+[link text][A]
+
+

are equivalent.

+

The implicit link name shortcut allows you to omit the name of the +link, in which case the link text itself is used as the name. +Just use an empty set of square brackets -- e.g., to link the word +"Google" to the google.com web site, you could simply write:

+
[Google][]
+
+

And then define the link:

+
[Google]: http://google.com/
+
+

Because link names may contain spaces, this shortcut even works for +multiple words in the link text:

+
Visit [Daring Fireball][] for more information.
+
+

And then define the link:

+
[Daring Fireball]: http://daringfireball.net/
+
+

Link definitions can be placed anywhere in your Markdown document. I +tend to put them immediately after each paragraph in which they're +used, but if you want, you can put them all at the end of your +document, sort of like footnotes.

+

Here's an example of reference links in action:

+
I get 10 times more traffic from [Google] [1] than from
+[Yahoo] [2] or [MSN] [3].
+
+  [1]: http://google.com/        "Google"
+  [2]: http://search.yahoo.com/  "Yahoo Search"
+  [3]: http://search.msn.com/    "MSN Search"
+
+

Using the implicit link name shortcut, you could instead write:

+
I get 10 times more traffic from [Google][] than from
+[Yahoo][] or [MSN][].
+
+  [google]: http://google.com/        "Google"
+  [yahoo]:  http://search.yahoo.com/  "Yahoo Search"
+  [msn]:    http://search.msn.com/    "MSN Search"
+
+

Both of the above examples will produce the following HTML output:

+
<p>I get 10 times more traffic from <a href="http://google.com/"
+title="Google">Google</a> than from
+<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
+or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
+
+

For comparison, here is the same paragraph written using +Markdown's inline link style:

+
I get 10 times more traffic from [Google](http://google.com/ "Google")
+than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
+[MSN](http://search.msn.com/ "MSN Search").
+
+

The point of reference-style links is not that they're easier to +write. The point is that with reference-style links, your document +source is vastly more readable. Compare the above examples: using +reference-style links, the paragraph itself is only 81 characters +long; with inline-style links, it's 176 characters; and as raw HTML, +it's 234 characters. In the raw HTML, there's more markup than there +is text.

+

With Markdown's reference-style links, a source document much more +closely resembles the final output, as rendered in a browser. By +allowing you to move the markup-related metadata out of the paragraph, +you can add links without interrupting the narrative flow of your +prose.

+

Emphasis

+

Markdown treats asterisks (*) and underscores (_) as indicators of +emphasis. Text wrapped with one * or _ will be wrapped with an +HTML <em> tag; double *'s or _'s will be wrapped with an HTML +<strong> tag. E.g., this input:

+
*single asterisks*
+
+_single underscores_
+
+**double asterisks**
+
+__double underscores__
+
+

will produce:

+
<em>single asterisks</em>
+
+<em>single underscores</em>
+
+<strong>double asterisks</strong>
+
+<strong>double underscores</strong>
+
+

You can use whichever style you prefer; the lone restriction is that +the same character must be used to open and close an emphasis span.

+

Emphasis can be used in the middle of a word:

+
un*fucking*believable
+
+

But if you surround an * or _ with spaces, it'll be treated as a +literal asterisk or underscore.

+

To produce a literal asterisk or underscore at a position where it +would otherwise be used as an emphasis delimiter, you can backslash +escape it:

+
\*this text is surrounded by literal asterisks\*
+
+

Code

+

To indicate a span of code, wrap it with backtick quotes (`). +Unlike a pre-formatted code block, a code span indicates code within a +normal paragraph. For example:

+
Use the `printf()` function.
+
+

will produce:

+
<p>Use the <code>printf()</code> function.</p>
+
+

To include a literal backtick character within a code span, you can use +multiple backticks as the opening and closing delimiters:

+
``There is a literal backtick (`) here.``
+
+

which will produce this:

+
<p><code>There is a literal backtick (`) here.</code></p>
+
+

The backtick delimiters surrounding a code span may include spaces -- +one after the opening, one before the closing. This allows you to place +literal backtick characters at the beginning or end of a code span:

+
A single backtick in a code span: `` ` ``
+
+A backtick-delimited string in a code span: `` `foo` ``
+
+

will produce:

+
<p>A single backtick in a code span: <code>`</code></p>
+
+<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
+
+

With a code span, ampersands and angle brackets are encoded as HTML +entities automatically, which makes it easy to include example HTML +tags. Markdown will turn this:

+
Please don't use any `<blink>` tags.
+
+

into:

+
<p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
+
+

You can write this:

+
`&#8212;` is the decimal-encoded equivalent of `&mdash;`.
+
+

to produce:

+
<p><code>&amp;#8212;</code> is the decimal-encoded
+equivalent of <code>&amp;mdash;</code>.</p>
+
+

Images

+

Admittedly, it's fairly difficult to devise a "natural" syntax for +placing images into a plain text document format.

+

Markdown uses an image syntax that is intended to resemble the syntax +for links, allowing for two styles: inline and reference.

+

Inline image syntax looks like this:

+
![Alt text](/path/to/img.jpg)
+
+![Alt text](/path/to/img.jpg "Optional title")
+
+

That is:

+
    +
  • An exclamation mark: !;
  • +
  • followed by a set of square brackets, containing the alt + attribute text for the image;
  • +
  • followed by a set of parentheses, containing the URL or path to + the image, and an optional title attribute enclosed in double + or single quotes.
  • +
+

Reference-style image syntax looks like this:

+
![Alt text][id]
+
+

Where "id" is the name of a defined image reference. Image references +are defined using syntax identical to link references:

+
[id]: url/to/image  "Optional title attribute"
+
+

As of this writing, Markdown has no syntax for specifying the +dimensions of an image; if this is important to you, you can simply +use regular HTML <img> tags.

+
+

Miscellaneous

+ +

Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

+
<http://example.com/>
+
+

Markdown will turn this into:

+
<a href="http://example.com/">http://example.com/</a>
+
+

Automatic links for email addresses work similarly, except that +Markdown will also perform a bit of randomized decimal and hex +entity-encoding to help obscure your address from address-harvesting +spambots. For example, Markdown will turn this:

+
<address@example.com>
+
+

into something like this:

+
<a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
+&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
+&#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
+&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
+
+

which will render in a browser as a clickable link to "address@example.com".

+

(This sort of entity-encoding trick will indeed fool many, if not +most, address-harvesting bots, but it definitely won't fool all of +them. It's better than nothing, but an address published in this way +will probably eventually start receiving spam.)

+

Backslash Escapes

+

Markdown allows you to use backslash escapes to generate literal +characters which would otherwise have special meaning in Markdown's +formatting syntax. For example, if you wanted to surround a word with +literal asterisks (instead of an HTML <em> tag), you can backslashes +before the asterisks, like this:

+
\*literal asterisks\*
+
+

Markdown provides backslash escapes for the following characters:

+
\   backslash
+`   backtick
+*   asterisk
+_   underscore
+{}  curly braces
+[]  square brackets
+()  parentheses
+#   hash mark
++   plus sign
+-   minus sign (hyphen)
+.   dot
+!   exclamation mark
+
\ No newline at end of file diff --git a/tests/extensions/toc.txt b/tests/extensions/toc.txt new file mode 100644 index 0000000..1a1de34 --- /dev/null +++ b/tests/extensions/toc.txt @@ -0,0 +1,851 @@ + +[TOC] + +# Overview + +## Philosophy + +Markdown is intended to be as easy-to-read and easy-to-write as is feasible. + +Readability, however, is emphasized above all else. A Markdown-formatted +document should be publishable as-is, as plain text, without looking +like it's been marked up with tags or formatting instructions. While +Markdown's syntax has been influenced by several existing text-to-HTML +filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4], +[Grutatext] [5], and [EtText] [6] -- the single biggest source of +inspiration for Markdown's syntax is the format of plain text email. + + [1]: http://docutils.sourceforge.net/mirror/setext.html + [2]: http://www.aaronsw.com/2002/atx/ + [3]: http://textism.com/tools/textile/ + [4]: http://docutils.sourceforge.net/rst.html + [5]: http://www.triptico.com/software/grutatxt.html + [6]: http://ettext.taint.org/doc/ + +To this end, Markdown's syntax is comprised entirely of punctuation +characters, which punctuation characters have been carefully chosen so +as to look like what they mean. E.g., asterisks around a word actually +look like \*emphasis\*. Markdown lists look like, well, lists. Even +blockquotes look like quoted passages of text, assuming you've ever +used email. + + + +## Inline HTML + +Markdown's syntax is intended for one purpose: to be used as a +format for *writing* for the web. + +Markdown is not a replacement for HTML, or even close to it. Its +syntax is very small, corresponding only to a very small subset of +HTML tags. The idea is *not* to create a syntax that makes it easier +to insert HTML tags. In my opinion, HTML tags are already easy to +insert. The idea for Markdown is to make it easy to read, write, and +edit prose. HTML is a *publishing* format; Markdown is a *writing* +format. Thus, Markdown's formatting syntax only addresses issues that +can be conveyed in plain text. + +For any markup that is not covered by Markdown's syntax, you simply +use HTML itself. There's no need to preface it or delimit it to +indicate that you're switching from Markdown to HTML; you just use +the tags. + +The only restrictions are that block-level HTML elements -- e.g. `
`, +``, `
`, `

`, etc. -- must be separated from surrounding +content by blank lines, and the start and end tags of the block should +not be indented with tabs or spaces. Markdown is smart enough not +to add extra (unwanted) `

` tags around HTML block-level tags. + +For example, to add an HTML table to a Markdown article: + + This is a regular paragraph. + +

+ + + +
Foo
+ + This is another regular paragraph. + +Note that Markdown formatting syntax is not processed within block-level +HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an +HTML block. + +Span-level HTML tags -- e.g. ``, ``, or `` -- can be +used anywhere in a Markdown paragraph, list item, or header. If you +want, you can even use HTML tags instead of Markdown formatting; e.g. if +you'd prefer to use HTML `` or `` tags instead of Markdown's +link or image syntax, go right ahead. + +Unlike block-level HTML tags, Markdown syntax *is* processed within +span-level tags. + + +## Automatic Escaping for Special Characters + +In HTML, there are two characters that demand special treatment: `<` +and `&`. Left angle brackets are used to start tags; ampersands are +used to denote HTML entities. If you want to use them as literal +characters, you must escape them as entities, e.g. `<`, and +`&`. + +Ampersands in particular are bedeviling for web writers. If you want to +write about 'AT&T', you need to write '`AT&T`'. You even need to +escape ampersands within URLs. Thus, if you want to link to: + + http://images.google.com/images?num=30&q=larry+bird + +you need to encode the URL as: + + http://images.google.com/images?num=30&q=larry+bird + +in your anchor tag `href` attribute. Needless to say, this is easy to +forget, and is probably the single most common source of HTML validation +errors in otherwise well-marked-up web sites. + +Markdown allows you to use these characters naturally, taking care of +all the necessary escaping for you. If you use an ampersand as part of +an HTML entity, it remains unchanged; otherwise it will be translated +into `&`. + +So, if you want to include a copyright symbol in your article, you can write: + + © + +and Markdown will leave it alone. But if you write: + + AT&T + +Markdown will translate it to: + + AT&T + +Similarly, because Markdown supports [inline HTML](#html), if you use +angle brackets as delimiters for HTML tags, Markdown will treat them as +such. But if you write: + + 4 < 5 + +Markdown will translate it to: + + 4 < 5 + +However, inside Markdown code spans and blocks, angle brackets and +ampersands are *always* encoded automatically. This makes it easy to use +Markdown to write about HTML code. (As opposed to raw HTML, which is a +terrible format for writing about HTML syntax, because every single `<` +and `&` in your example code needs to be escaped.) + + +* * * + + +# Block Elements + + +## Paragraphs and Line Breaks + +A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing but spaces or tabs is considered +blank.) Normal paragraphs should not be indented with spaces or tabs. + +The implication of the "one or more consecutive lines of text" rule is +that Markdown supports "hard-wrapped" text paragraphs. This differs +significantly from most other text-to-HTML formatters (including Movable +Type's "Convert Line Breaks" option) which translate every line break +character in a paragraph into a `
` tag. + +When you *do* want to insert a `
` break tag using Markdown, you +end a line with two or more spaces, then type return. + +Yes, this takes a tad more effort to create a `
`, but a simplistic +"every line break is a `
`" rule wouldn't work for Markdown. +Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l] +work best -- and look better -- when you format them with hard breaks. + + [bq]: #blockquote + [l]: #list + + + +## Headers + +Markdown supports two styles of headers, [Setext] [1] and [atx] [2]. + +Setext-style headers are "underlined" using equal signs (for first-level +headers) and dashes (for second-level headers). For example: + + This is an H1 + ============= + + This is an H2 + ------------- + +Any number of underlining `=`'s or `-`'s will work. + +Atx-style headers use 1-6 hash characters at the start of the line, +corresponding to header levels 1-6. For example: + + # This is an H1 + + ## This is an H2 + + ###### This is an H6 + +Optionally, you may "close" atx-style headers. This is purely +cosmetic -- you can use this if you think it looks better. The +closing hashes don't even need to match the number of hashes +used to open the header. (The number of opening hashes +determines the header level.) : + + # This is an H1 # + + ## This is an H2 ## + + ### This is an H3 ###### + + +## Blockquotes + +Markdown uses email-style `>` characters for blockquoting. If you're +familiar with quoting passages of text in an email message, then you +know how to create a blockquote in Markdown. It looks best if you hard +wrap the text and put a `>` before every line: + + > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, + > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. + > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + > + > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse + > id sem consectetuer libero luctus adipiscing. + +Markdown allows you to be lazy and only put the `>` before the first +line of a hard-wrapped paragraph: + + > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, + consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. + Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + + > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse + id sem consectetuer libero luctus adipiscing. + +Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by +adding additional levels of `>`: + + > This is the first level of quoting. + > + > > This is nested blockquote. + > + > Back to the first level. + +Blockquotes can contain other Markdown elements, including headers, lists, +and code blocks: + + > ## This is a header. + > + > 1. This is the first list item. + > 2. This is the second list item. + > + > Here's some example code: + > + > return shell_exec("echo $input | $markdown_script"); + +Any decent text editor should make email-style quoting easy. For +example, with BBEdit, you can make a selection and choose Increase +Quote Level from the Text menu. + + +## Lists + +Markdown supports ordered (numbered) and unordered (bulleted) lists. + +Unordered lists use asterisks, pluses, and hyphens -- interchangeably +-- as list markers: + + * Red + * Green + * Blue + +is equivalent to: + + + Red + + Green + + Blue + +and: + + - Red + - Green + - Blue + +Ordered lists use numbers followed by periods: + + 1. Bird + 2. McHale + 3. Parish + +It's important to note that the actual numbers you use to mark the +list have no effect on the HTML output Markdown produces. The HTML +Markdown produces from the above list is: + +
    +
  1. Bird
  2. +
  3. McHale
  4. +
  5. Parish
  6. +
+ +If you instead wrote the list in Markdown like this: + + 1. Bird + 1. McHale + 1. Parish + +or even: + + 3. Bird + 1. McHale + 8. Parish + +you'd get the exact same HTML output. The point is, if you want to, +you can use ordinal numbers in your ordered Markdown lists, so that +the numbers in your source match the numbers in your published HTML. +But if you want to be lazy, you don't have to. + +If you do use lazy list numbering, however, you should still start the +list with the number 1. At some point in the future, Markdown may support +starting ordered lists at an arbitrary number. + +List markers typically start at the left margin, but may be indented by +up to three spaces. List markers must be followed by one or more spaces +or a tab. + +To make lists look nice, you can wrap items with hanging indents: + + * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. + * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +But if you want to be lazy, you don't have to: + + * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. + * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +If list items are separated by blank lines, Markdown will wrap the +items in `

` tags in the HTML output. For example, this input: + + * Bird + * Magic + +will turn into: + +

    +
  • Bird
  • +
  • Magic
  • +
+ +But this: + + * Bird + + * Magic + +will turn into: + +
    +
  • Bird

  • +
  • Magic

  • +
+ +List items may consist of multiple paragraphs. Each subsequent +paragraph in a list item must be indented by either 4 spaces +or one tab: + + 1. This is a list item with two paragraphs. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. Aliquam hendrerit + mi posuere lectus. + + Vestibulum enim wisi, viverra nec, fringilla in, laoreet + vitae, risus. Donec sit amet nisl. Aliquam semper ipsum + sit amet velit. + + 2. Suspendisse id sem consectetuer libero luctus adipiscing. + +It looks nice if you indent every line of the subsequent +paragraphs, but here again, Markdown will allow you to be +lazy: + + * This is a list item with two paragraphs. + + This is the second paragraph in the list item. You're + only required to indent the first line. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. + + * Another item in the same list. + +To put a blockquote within a list item, the blockquote's `>` +delimiters need to be indented: + + * A list item with a blockquote: + + > This is a blockquote + > inside a list item. + +To put a code block within a list item, the code block needs +to be indented *twice* -- 8 spaces or two tabs: + + * A list item with a code block: + + + + +It's worth noting that it's possible to trigger an ordered list by +accident, by writing something like this: + + 1986. What a great season. + +In other words, a *number-period-space* sequence at the beginning of a +line. To avoid this, you can backslash-escape the period: + + 1986\. What a great season. + + + +## Code Blocks + +Pre-formatted code blocks are used for writing about programming or +markup source code. Rather than forming normal paragraphs, the lines +of a code block are interpreted literally. Markdown wraps a code block +in both `
` and `` tags.
+
+To produce a code block in Markdown, simply indent every line of the
+block by at least 4 spaces or 1 tab. For example, given this input:
+
+    This is a normal paragraph:
+
+        This is a code block.
+
+Markdown will generate:
+
+    

This is a normal paragraph:

+ +
This is a code block.
+    
+ +One level of indentation -- 4 spaces or 1 tab -- is removed from each +line of the code block. For example, this: + + Here is an example of AppleScript: + + tell application "Foo" + beep + end tell + +will turn into: + +

Here is an example of AppleScript:

+ +
tell application "Foo"
+        beep
+    end tell
+    
+ +A code block continues until it reaches a line that is not indented +(or the end of the article). + +Within a code block, ampersands (`&`) and angle brackets (`<` and `>`) +are automatically converted into HTML entities. This makes it very +easy to include example HTML source code using Markdown -- just paste +it and indent it, and Markdown will handle the hassle of encoding the +ampersands and angle brackets. For example, this: + + + +will turn into: + +
<div class="footer">
+        &copy; 2004 Foo Corporation
+    </div>
+    
+ +Regular Markdown syntax is not processed within code blocks. E.g., +asterisks are just literal asterisks within a code block. This means +it's also easy to use Markdown to write about Markdown's own syntax. + + + +## Horizontal Rules + +You can produce a horizontal rule tag (`
`) by placing three or +more hyphens, asterisks, or underscores on a line by themselves. If you +wish, you may use spaces between the hyphens or asterisks. Each of the +following lines will produce a horizontal rule: + + * * * + + *** + + ***** + + - - - + + --------------------------------------- + + _ _ _ + + +* * * + +# Span Elements + +## Links + +Markdown supports two style of links: *inline* and *reference*. + +In both styles, the link text is delimited by [square brackets]. + +To create an inline link, use a set of regular parentheses immediately +after the link text's closing square bracket. Inside the parentheses, +put the URL where you want the link to point, along with an *optional* +title for the link, surrounded in quotes. For example: + + This is [an example](http://example.com/ "Title") inline link. + + [This link](http://example.net/) has no title attribute. + +Will produce: + +

This is + an example inline link.

+ +

This link has no + title attribute.

+ +If you're referring to a local resource on the same server, you can +use relative paths: + + See my [About](/about/) page for details. + +Reference-style links use a second set of square brackets, inside +which you place a label of your choosing to identify the link: + + This is [an example][id] reference-style link. + +You can optionally use a space to separate the sets of brackets: + + This is [an example] [id] reference-style link. + +Then, anywhere in the document, you define your link label like this, +on a line by itself: + + [id]: http://example.com/ "Optional Title Here" + +That is: + +* Square brackets containing the link identifier (optionally + indented from the left margin using up to three spaces); +* followed by a colon; +* followed by one or more spaces (or tabs); +* followed by the URL for the link; +* optionally followed by a title attribute for the link, enclosed + in double or single quotes. + +The link URL may, optionally, be surrounded by angle brackets: + + [id]: "Optional Title Here" + +You can put the title attribute on the next line and use extra spaces +or tabs for padding, which tends to look better with longer URLs: + + [id]: http://example.com/longish/path/to/resource/here + "Optional Title Here" + +Link definitions are only used for creating links during Markdown +processing, and are stripped from your document in the HTML output. + +Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links: + + [link text][a] + [link text][A] + +are equivalent. + +The *implicit link name* shortcut allows you to omit the name of the +link, in which case the link text itself is used as the name. +Just use an empty set of square brackets -- e.g., to link the word +"Google" to the google.com web site, you could simply write: + + [Google][] + +And then define the link: + + [Google]: http://google.com/ + +Because link names may contain spaces, this shortcut even works for +multiple words in the link text: + + Visit [Daring Fireball][] for more information. + +And then define the link: + + [Daring Fireball]: http://daringfireball.net/ + +Link definitions can be placed anywhere in your Markdown document. I +tend to put them immediately after each paragraph in which they're +used, but if you want, you can put them all at the end of your +document, sort of like footnotes. + +Here's an example of reference links in action: + + I get 10 times more traffic from [Google] [1] than from + [Yahoo] [2] or [MSN] [3]. + + [1]: http://google.com/ "Google" + [2]: http://search.yahoo.com/ "Yahoo Search" + [3]: http://search.msn.com/ "MSN Search" + +Using the implicit link name shortcut, you could instead write: + + I get 10 times more traffic from [Google][] than from + [Yahoo][] or [MSN][]. + + [google]: http://google.com/ "Google" + [yahoo]: http://search.yahoo.com/ "Yahoo Search" + [msn]: http://search.msn.com/ "MSN Search" + +Both of the above examples will produce the following HTML output: + +

I get 10 times more traffic from Google than from + Yahoo + or MSN.

+ +For comparison, here is the same paragraph written using +Markdown's inline link style: + + I get 10 times more traffic from [Google](http://google.com/ "Google") + than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or + [MSN](http://search.msn.com/ "MSN Search"). + +The point of reference-style links is not that they're easier to +write. The point is that with reference-style links, your document +source is vastly more readable. Compare the above examples: using +reference-style links, the paragraph itself is only 81 characters +long; with inline-style links, it's 176 characters; and as raw HTML, +it's 234 characters. In the raw HTML, there's more markup than there +is text. + +With Markdown's reference-style links, a source document much more +closely resembles the final output, as rendered in a browser. By +allowing you to move the markup-related metadata out of the paragraph, +you can add links without interrupting the narrative flow of your +prose. + + +## Emphasis + +Markdown treats asterisks (`*`) and underscores (`_`) as indicators of +emphasis. Text wrapped with one `*` or `_` will be wrapped with an +HTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML +`` tag. E.g., this input: + + *single asterisks* + + _single underscores_ + + **double asterisks** + + __double underscores__ + +will produce: + + single asterisks + + single underscores + + double asterisks + + double underscores + +You can use whichever style you prefer; the lone restriction is that +the same character must be used to open and close an emphasis span. + +Emphasis can be used in the middle of a word: + + un*fucking*believable + +But if you surround an `*` or `_` with spaces, it'll be treated as a +literal asterisk or underscore. + +To produce a literal asterisk or underscore at a position where it +would otherwise be used as an emphasis delimiter, you can backslash +escape it: + + \*this text is surrounded by literal asterisks\* + + + +## Code + +To indicate a span of code, wrap it with backtick quotes (`` ` ``). +Unlike a pre-formatted code block, a code span indicates code within a +normal paragraph. For example: + + Use the `printf()` function. + +will produce: + +

Use the printf() function.

+ +To include a literal backtick character within a code span, you can use +multiple backticks as the opening and closing delimiters: + + ``There is a literal backtick (`) here.`` + +which will produce this: + +

There is a literal backtick (`) here.

+ +The backtick delimiters surrounding a code span may include spaces -- +one after the opening, one before the closing. This allows you to place +literal backtick characters at the beginning or end of a code span: + + A single backtick in a code span: `` ` `` + + A backtick-delimited string in a code span: `` `foo` `` + +will produce: + +

A single backtick in a code span: `

+ +

A backtick-delimited string in a code span: `foo`

+ +With a code span, ampersands and angle brackets are encoded as HTML +entities automatically, which makes it easy to include example HTML +tags. Markdown will turn this: + + Please don't use any `` tags. + +into: + +

Please don't use any <blink> tags.

+ +You can write this: + + `—` is the decimal-encoded equivalent of `—`. + +to produce: + +

&#8212; is the decimal-encoded + equivalent of &mdash;.

+ + + +## Images + +Admittedly, it's fairly difficult to devise a "natural" syntax for +placing images into a plain text document format. + +Markdown uses an image syntax that is intended to resemble the syntax +for links, allowing for two styles: *inline* and *reference*. + +Inline image syntax looks like this: + + ![Alt text](/path/to/img.jpg) + + ![Alt text](/path/to/img.jpg "Optional title") + +That is: + +* An exclamation mark: `!`; +* followed by a set of square brackets, containing the `alt` + attribute text for the image; +* followed by a set of parentheses, containing the URL or path to + the image, and an optional `title` attribute enclosed in double + or single quotes. + +Reference-style image syntax looks like this: + + ![Alt text][id] + +Where "id" is the name of a defined image reference. Image references +are defined using syntax identical to link references: + + [id]: url/to/image "Optional title attribute" + +As of this writing, Markdown has no syntax for specifying the +dimensions of an image; if this is important to you, you can simply +use regular HTML `` tags. + + +* * * + + +# Miscellaneous + +## Automatic Links + +Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this: + + + +Markdown will turn this into: + + http://example.com/ + +Automatic links for email addresses work similarly, except that +Markdown will also perform a bit of randomized decimal and hex +entity-encoding to help obscure your address from address-harvesting +spambots. For example, Markdown will turn this: + + + +into something like this: + + address@exa + mple.com + +which will render in a browser as a clickable link to "address@example.com". + +(This sort of entity-encoding trick will indeed fool many, if not +most, address-harvesting bots, but it definitely won't fool all of +them. It's better than nothing, but an address published in this way +will probably eventually start receiving spam.) + + + +## Backslash Escapes + +Markdown allows you to use backslash escapes to generate literal +characters which would otherwise have special meaning in Markdown's +formatting syntax. For example, if you wanted to surround a word with +literal asterisks (instead of an HTML `` tag), you can backslashes +before the asterisks, like this: + + \*literal asterisks\* + +Markdown provides backslash escapes for the following characters: + + \ backslash + ` backtick + * asterisk + _ underscore + {} curly braces + [] square brackets + () parentheses + # hash mark + + plus sign + - minus sign (hyphen) + . dot + ! exclamation mark + diff --git a/tests/extensions/toc_invalid.html b/tests/extensions/toc_invalid.html new file mode 100644 index 0000000..41a3b1f --- /dev/null +++ b/tests/extensions/toc_invalid.html @@ -0,0 +1,6 @@ +

[TOC]

+

Header 1

+

The TOC marker cannot be inside a header. This test makes sure markdown doesn't +crash when it encounters this errant syntax. The unexpected output should +clue the author in that s/he needs to add a blank line between the TOC and +the <hr>.

\ No newline at end of file diff --git a/tests/extensions/toc_invalid.txt b/tests/extensions/toc_invalid.txt new file mode 100644 index 0000000..f6c4ec4 --- /dev/null +++ b/tests/extensions/toc_invalid.txt @@ -0,0 +1,9 @@ +[TOC] +----- + +# Header 1 + +The TOC marker cannot be inside a header. This test makes sure markdown doesn't +crash when it encounters this errant syntax. The unexpected output should +clue the author in that s/he needs to add a blank line between the TOC and +the `
`. diff --git a/tests/extensions/toc_nested.html b/tests/extensions/toc_nested.html new file mode 100644 index 0000000..27af9df --- /dev/null +++ b/tests/extensions/toc_nested.html @@ -0,0 +1,16 @@ +

Header A

+

Header 1

+

Header i

+

Header B

+
+ +
\ No newline at end of file diff --git a/tests/extensions/toc_nested.txt b/tests/extensions/toc_nested.txt new file mode 100644 index 0000000..0f897b2 --- /dev/null +++ b/tests/extensions/toc_nested.txt @@ -0,0 +1,9 @@ +# Header A + +## Header 1 + +### Header i + +# Header *B* + +[TOC] diff --git a/tests/extensions/toc_nested2.html b/tests/extensions/toc_nested2.html new file mode 100644 index 0000000..2d8fa2d --- /dev/null +++ b/tests/extensions/toc_nested2.html @@ -0,0 +1,14 @@ + +

Start with header other than one.[link]

+

Header 3[link]

+

Header 4[link]

+

Header 3[link]

\ No newline at end of file diff --git a/tests/extensions/toc_nested2.txt b/tests/extensions/toc_nested2.txt new file mode 100644 index 0000000..9db4d8c --- /dev/null +++ b/tests/extensions/toc_nested2.txt @@ -0,0 +1,10 @@ +[TOC] + +### Start with header other than one. + +### Header 3 + +#### Header 4 + +### Header 3 + diff --git a/tests/extensions/toc_nested_list.html b/tests/extensions/toc_nested_list.html new file mode 100644 index 0000000..6912411 --- /dev/null +++ b/tests/extensions/toc_nested_list.html @@ -0,0 +1,30 @@ +

Title

+ +

Section 1

+
    +
  1. +

    List Item 1

    +

    Subsection 1

    +

    Explanation 1

    +
  2. +
  3. +

    List Item 2

    +

    Subsection 2

    +

    Explanation 2

    +
  4. +
+

Section 2

+

Section 3

\ No newline at end of file diff --git a/tests/extensions/toc_nested_list.txt b/tests/extensions/toc_nested_list.txt new file mode 100644 index 0000000..d83e96f --- /dev/null +++ b/tests/extensions/toc_nested_list.txt @@ -0,0 +1,19 @@ +# Title + +[TOC] + +## Section 1 + +1. List Item 1 + + ### Subsection 1 + Explanation 1 + +2. List Item 2 + + ### Subsection 2 + Explanation 2 + +## Section 2 + +## Section 3 \ No newline at end of file diff --git a/tests/extensions/toc_out_of_order.html b/tests/extensions/toc_out_of_order.html new file mode 100644 index 0000000..93d8b04 --- /dev/null +++ b/tests/extensions/toc_out_of_order.html @@ -0,0 +1,8 @@ + +

Header 2

+

Header 1

\ No newline at end of file diff --git a/tests/extensions/toc_out_of_order.txt b/tests/extensions/toc_out_of_order.txt new file mode 100644 index 0000000..f08bdbc --- /dev/null +++ b/tests/extensions/toc_out_of_order.txt @@ -0,0 +1,5 @@ +[TOC] + +## Header 2 + +# Header 1 diff --git a/tests/extensions/wikilinks.html b/tests/extensions/wikilinks.html new file mode 100644 index 0000000..a76a693 --- /dev/null +++ b/tests/extensions/wikilinks.html @@ -0,0 +1,9 @@ +

Some text with a WikiLink.

+

A link with white space and_underscores and a empty one.

+

Another with double spaces and double__underscores and +one that has emphasis inside and one with_multiple_underscores +and one that is emphasised.

+

And a RealLink.

+

http://example.com/And_A_AutoLink

+

And a MarkdownLink for +completeness.

\ No newline at end of file diff --git a/tests/extensions/wikilinks.txt b/tests/extensions/wikilinks.txt new file mode 100644 index 0000000..8e6911b --- /dev/null +++ b/tests/extensions/wikilinks.txt @@ -0,0 +1,14 @@ +Some text with a [[WikiLink]]. + +A link with [[ white space and_underscores ]] and a empty [[ ]] one. + +Another with [[double spaces]] and [[double__underscores]] and +one that [[has _emphasis_ inside]] and one [[with_multiple_underscores]] +and one that is _[[emphasised]]_. + +And a RealLink. + + + +And a [MarkdownLink](/MarkdownLink/ "A MarkdownLink") for +completeness. diff --git a/tests/html4/html4.html b/tests/html4/html4.html deleted file mode 100644 index 7c88ad7..0000000 --- a/tests/html4/html4.html +++ /dev/null @@ -1,2 +0,0 @@ -

A test of the most
-basic of html/xhtml differences.

\ No newline at end of file diff --git a/tests/html4/html4.txt b/tests/html4/html4.txt deleted file mode 100644 index fddaf8e..0000000 --- a/tests/html4/html4.txt +++ /dev/null @@ -1,2 +0,0 @@ -A test of the most -basic of html/xhtml differences. \ No newline at end of file diff --git a/tests/markdown-test/amps-and-angle-encoding.html b/tests/markdown-test/amps-and-angle-encoding.html deleted file mode 100644 index 2c466c1..0000000 --- a/tests/markdown-test/amps-and-angle-encoding.html +++ /dev/null @@ -1,9 +0,0 @@ -

AT&T has an ampersand in their name.

-

AT&T is another way to write it.

-

This & that.

-

4 < 5.

-

6 > 5.

-

Here's a link with an ampersand in the URL.

-

Here's a link with an amersand in the link text: AT&T.

-

Here's an inline link.

-

Here's an inline link.

\ No newline at end of file diff --git a/tests/markdown-test/amps-and-angle-encoding.txt b/tests/markdown-test/amps-and-angle-encoding.txt deleted file mode 100644 index 0e9527f..0000000 --- a/tests/markdown-test/amps-and-angle-encoding.txt +++ /dev/null @@ -1,21 +0,0 @@ -AT&T has an ampersand in their name. - -AT&T is another way to write it. - -This & that. - -4 < 5. - -6 > 5. - -Here's a [link] [1] with an ampersand in the URL. - -Here's a link with an amersand in the link text: [AT&T] [2]. - -Here's an inline [link](/script?foo=1&bar=2). - -Here's an inline [link](). - - -[1]: http://example.com/?foo=1&bar=2 -[2]: http://att.com/ "AT&T" \ No newline at end of file diff --git a/tests/markdown-test/angle-links-and-img.html b/tests/markdown-test/angle-links-and-img.html deleted file mode 100644 index 1ca3b0b..0000000 --- a/tests/markdown-test/angle-links-and-img.html +++ /dev/null @@ -1,4 +0,0 @@ -

link -image -link -image

\ No newline at end of file diff --git a/tests/markdown-test/angle-links-and-img.txt b/tests/markdown-test/angle-links-and-img.txt deleted file mode 100644 index 1dbf404..0000000 --- a/tests/markdown-test/angle-links-and-img.txt +++ /dev/null @@ -1,4 +0,0 @@ -[link]( "title") -![image]() -[link]() -![image]() diff --git a/tests/markdown-test/auto-links.html b/tests/markdown-test/auto-links.html deleted file mode 100644 index 7481fe2..0000000 --- a/tests/markdown-test/auto-links.html +++ /dev/null @@ -1,15 +0,0 @@ -

Link: http://example.com/.

-

Https link: https://example.com

-

Ftp link: ftp://example.com

-

With an ampersand: http://example.com/?foo=1&bar=2

- -
-

Blockquoted: http://example.com/

-
-

Auto-links should not occur here: <http://example.com/>

-
or here: <http://example.com/>
-
\ No newline at end of file diff --git a/tests/markdown-test/auto-links.txt b/tests/markdown-test/auto-links.txt deleted file mode 100644 index a188b40..0000000 --- a/tests/markdown-test/auto-links.txt +++ /dev/null @@ -1,17 +0,0 @@ -Link: . - -Https link: - -Ftp link: - -With an ampersand: - -* In a list? -* -* It should. - -> Blockquoted: - -Auto-links should not occur here: `` - - or here: diff --git a/tests/markdown-test/backlash-escapes.html b/tests/markdown-test/backlash-escapes.html deleted file mode 100644 index 876775f..0000000 --- a/tests/markdown-test/backlash-escapes.html +++ /dev/null @@ -1,67 +0,0 @@ -

These should all get escaped:

-

Backslash: \

-

Backtick: `

-

Asterisk: *

-

Underscore: _

-

Left brace: {

-

Right brace: }

-

Left bracket: [

-

Right bracket: ]

-

Left paren: (

-

Right paren: )

-

Greater-than: >

-

Hash: #

-

Period: .

-

Bang: !

-

Plus: +

-

Minus: -

-

These should not, because they occur within a code block:

-
Backslash: \\
-
-Backtick: \`
-
-Asterisk: \*
-
-Underscore: \_
-
-Left brace: \{
-
-Right brace: \}
-
-Left bracket: \[
-
-Right bracket: \]
-
-Left paren: \(
-
-Right paren: \)
-
-Greater-than: \>
-
-Hash: \#
-
-Period: \.
-
-Bang: \!
-
-Plus: \+
-
-Minus: \-
-
-

Nor should these, which occur in code spans:

-

Backslash: \\

-

Backtick: \`

-

Asterisk: \*

-

Underscore: \_

-

Left brace: \{

-

Right brace: \}

-

Left bracket: \[

-

Right bracket: \]

-

Left paren: \(

-

Right paren: \)

-

Greater-than: \>

-

Hash: \#

-

Period: \.

-

Bang: \!

-

Plus: \+

-

Minus: \-

\ No newline at end of file diff --git a/tests/markdown-test/backlash-escapes.txt b/tests/markdown-test/backlash-escapes.txt deleted file mode 100644 index 16447a0..0000000 --- a/tests/markdown-test/backlash-escapes.txt +++ /dev/null @@ -1,104 +0,0 @@ -These should all get escaped: - -Backslash: \\ - -Backtick: \` - -Asterisk: \* - -Underscore: \_ - -Left brace: \{ - -Right brace: \} - -Left bracket: \[ - -Right bracket: \] - -Left paren: \( - -Right paren: \) - -Greater-than: \> - -Hash: \# - -Period: \. - -Bang: \! - -Plus: \+ - -Minus: \- - - - -These should not, because they occur within a code block: - - Backslash: \\ - - Backtick: \` - - Asterisk: \* - - Underscore: \_ - - Left brace: \{ - - Right brace: \} - - Left bracket: \[ - - Right bracket: \] - - Left paren: \( - - Right paren: \) - - Greater-than: \> - - Hash: \# - - Period: \. - - Bang: \! - - Plus: \+ - - Minus: \- - - -Nor should these, which occur in code spans: - -Backslash: `\\` - -Backtick: `` \` `` - -Asterisk: `\*` - -Underscore: `\_` - -Left brace: `\{` - -Right brace: `\}` - -Left bracket: `\[` - -Right bracket: `\]` - -Left paren: `\(` - -Right paren: `\)` - -Greater-than: `\>` - -Hash: `\#` - -Period: `\.` - -Bang: `\!` - -Plus: `\+` - -Minus: `\-` diff --git a/tests/markdown-test/benchmark.dat b/tests/markdown-test/benchmark.dat deleted file mode 100644 index 3d549dd..0000000 --- a/tests/markdown-test/benchmark.dat +++ /dev/null @@ -1,20 +0,0 @@ -construction:0.000000:0.000000 -amps-and-angle-encoding:0.070000:131072.000000 -auto-links:0.080000:397312.000000 -backlash-escapes:0.270000:884736.000000 -blockquotes-with-dode-blocks:0.020000:0.000000 -hard-wrapped:0.020000:0.000000 -horizontal-rules:0.180000:135168.000000 -inline-html-advanced:0.070000:0.000000 -inline-html-comments:0.080000:0.000000 -inline-html-simple:0.210000:0.000000 -links-inline:0.140000:0.000000 -links-reference:0.170000:0.000000 -literal-quotes:0.090000:0.000000 -markdown-documentation-basics:0.690000:1806336.000000 -markdown-syntax:3.310000:6696960.000000 -nested-blockquotes:0.200000:0.000000 -ordered-and-unordered-list:0.530000:0.000000 -strong-and-em-together:0.200000:0.000000 -tabs:0.200000:0.000000 -tidyness:0.200000:0.000000 diff --git a/tests/markdown-test/blockquotes-with-code-blocks.html b/tests/markdown-test/blockquotes-with-code-blocks.html deleted file mode 100644 index 5fc98b1..0000000 --- a/tests/markdown-test/blockquotes-with-code-blocks.html +++ /dev/null @@ -1,12 +0,0 @@ -
-

Example:

-
sub status {
-    print "working";
-}
-
-

Or:

-
sub status {
-    return "working";
-}
-
-
\ No newline at end of file diff --git a/tests/markdown-test/blockquotes-with-code-blocks.txt b/tests/markdown-test/blockquotes-with-code-blocks.txt deleted file mode 100644 index c31d171..0000000 --- a/tests/markdown-test/blockquotes-with-code-blocks.txt +++ /dev/null @@ -1,11 +0,0 @@ -> Example: -> -> sub status { -> print "working"; -> } -> -> Or: -> -> sub status { -> return "working"; -> } diff --git a/tests/markdown-test/codeblock-in-list.html b/tests/markdown-test/codeblock-in-list.html deleted file mode 100644 index 49edd56..0000000 --- a/tests/markdown-test/codeblock-in-list.html +++ /dev/null @@ -1,14 +0,0 @@ -
    -
  • -

    A list item with a code block

    -
    Some *code*
    -
    -
  • -
  • -

    Another list item

    -
    More code
    -
    -And more code
    -
    -
  • -
\ No newline at end of file diff --git a/tests/markdown-test/codeblock-in-list.txt b/tests/markdown-test/codeblock-in-list.txt deleted file mode 100644 index 87d4e3b..0000000 --- a/tests/markdown-test/codeblock-in-list.txt +++ /dev/null @@ -1,10 +0,0 @@ -* A list item with a code block - - Some *code* - -* Another list item - - More code - - And more code - diff --git a/tests/markdown-test/hard-wrapped.html b/tests/markdown-test/hard-wrapped.html deleted file mode 100644 index e28e900..0000000 --- a/tests/markdown-test/hard-wrapped.html +++ /dev/null @@ -1,7 +0,0 @@ -

In Markdown 1.0.0 and earlier. Version -8. This line turns into a list item. -Because a hard-wrapped line in the -middle of a paragraph looked like a -list item.

-

Here's one with a bullet. -* criminey.

\ No newline at end of file diff --git a/tests/markdown-test/hard-wrapped.txt b/tests/markdown-test/hard-wrapped.txt deleted file mode 100644 index f8a5b27..0000000 --- a/tests/markdown-test/hard-wrapped.txt +++ /dev/null @@ -1,8 +0,0 @@ -In Markdown 1.0.0 and earlier. Version -8. This line turns into a list item. -Because a hard-wrapped line in the -middle of a paragraph looked like a -list item. - -Here's one with a bullet. -* criminey. diff --git a/tests/markdown-test/horizontal-rules.html b/tests/markdown-test/horizontal-rules.html deleted file mode 100644 index 478e8c5..0000000 --- a/tests/markdown-test/horizontal-rules.html +++ /dev/null @@ -1,39 +0,0 @@ -

Dashes:

-
-
-
-
-
---
-
-
-
-
-
-
- - -
-
-

Asterisks:

-
-
-
-
-
***
-
-
-
-
-
-
* * *
-
-

Underscores:

-
-
-
-
-
___
-
-
-
-
-
-
_ _ _
-
\ No newline at end of file diff --git a/tests/markdown-test/horizontal-rules.txt b/tests/markdown-test/horizontal-rules.txt deleted file mode 100644 index 1594bda..0000000 --- a/tests/markdown-test/horizontal-rules.txt +++ /dev/null @@ -1,67 +0,0 @@ -Dashes: - ---- - - --- - - --- - - --- - - --- - -- - - - - - - - - - - - - - - - - - - - - - - - - -Asterisks: - -*** - - *** - - *** - - *** - - *** - -* * * - - * * * - - * * * - - * * * - - * * * - - -Underscores: - -___ - - ___ - - ___ - - ___ - - ___ - -_ _ _ - - _ _ _ - - _ _ _ - - _ _ _ - - _ _ _ diff --git a/tests/markdown-test/inline-html-advanced.html b/tests/markdown-test/inline-html-advanced.html deleted file mode 100644 index af1dec1..0000000 --- a/tests/markdown-test/inline-html-advanced.html +++ /dev/null @@ -1,12 +0,0 @@ -

Simple block on one line:

-
foo
- -

And nested without indentation:

-
-
-
-foo -
-
-
bar
-
\ No newline at end of file diff --git a/tests/markdown-test/inline-html-advanced.txt b/tests/markdown-test/inline-html-advanced.txt deleted file mode 100644 index 9d71ddc..0000000 --- a/tests/markdown-test/inline-html-advanced.txt +++ /dev/null @@ -1,14 +0,0 @@ -Simple block on one line: - -
foo
- -And nested without indentation: - -
-
-
-foo -
-
-
bar
-
diff --git a/tests/markdown-test/inline-html-comments.html b/tests/markdown-test/inline-html-comments.html deleted file mode 100644 index 0d4cad9..0000000 --- a/tests/markdown-test/inline-html-comments.html +++ /dev/null @@ -1,11 +0,0 @@ -

Paragraph one.

- - - - -

Paragraph two.

- - -

The end.

\ No newline at end of file diff --git a/tests/markdown-test/inline-html-comments.txt b/tests/markdown-test/inline-html-comments.txt deleted file mode 100644 index 41d830d..0000000 --- a/tests/markdown-test/inline-html-comments.txt +++ /dev/null @@ -1,13 +0,0 @@ -Paragraph one. - - - - - -Paragraph two. - - - -The end. diff --git a/tests/markdown-test/inline-html-simple.html b/tests/markdown-test/inline-html-simple.html deleted file mode 100644 index cb10451..0000000 --- a/tests/markdown-test/inline-html-simple.html +++ /dev/null @@ -1,58 +0,0 @@ -

Here's a simple block:

-
- foo -
- -

This should be a code block, though:

-
<div>
-    foo
-</div>
-
-

As should this:

-
<div>foo</div>
-
-

Now, nested:

-
-
-
- foo -
-
-
- -

This should just be an HTML comment:

- - -

Multiline:

- - -

Code block:

-
<!-- Comment -->
-
-

Just plain comment, with trailing spaces on the line:

- - -

Code:

-
<hr />
-
-

Hr's:

-
- -
- -
- -
- -
- -
- -
- -
- -
\ No newline at end of file diff --git a/tests/markdown-test/inline-html-simple.txt b/tests/markdown-test/inline-html-simple.txt deleted file mode 100644 index 14aa2dc..0000000 --- a/tests/markdown-test/inline-html-simple.txt +++ /dev/null @@ -1,69 +0,0 @@ -Here's a simple block: - -
- foo -
- -This should be a code block, though: - -
- foo -
- -As should this: - -
foo
- -Now, nested: - -
-
-
- foo -
-
-
- -This should just be an HTML comment: - - - -Multiline: - - - -Code block: - - - -Just plain comment, with trailing spaces on the line: - - - -Code: - -
- -Hr's: - -
- -
- -
- -
- -
- -
- -
- -
- -
- diff --git a/tests/markdown-test/links-inline.html b/tests/markdown-test/links-inline.html deleted file mode 100644 index 707937a..0000000 --- a/tests/markdown-test/links-inline.html +++ /dev/null @@ -1,5 +0,0 @@ -

Just a URL.

-

URL and title.

-

URL and title.

-

URL and title.

-

Empty.

\ No newline at end of file diff --git a/tests/markdown-test/links-inline.txt b/tests/markdown-test/links-inline.txt deleted file mode 100644 index 4d0c1c2..0000000 --- a/tests/markdown-test/links-inline.txt +++ /dev/null @@ -1,9 +0,0 @@ -Just a [URL](/url/). - -[URL and title](/url/ "title"). - -[URL and title](/url/ "title preceded by two spaces"). - -[URL and title](/url/ "title preceded by a tab"). - -[Empty](). diff --git a/tests/markdown-test/links-reference.html b/tests/markdown-test/links-reference.html deleted file mode 100644 index 165c71a..0000000 --- a/tests/markdown-test/links-reference.html +++ /dev/null @@ -1,10 +0,0 @@ -

Foo bar.

-

Foo bar.

-

Foo bar.

-

With embedded [brackets].

-

Indented once.

-

Indented twice.

-

Indented thrice.

-

Indented [four][] times.

-
[four]: /url
-
\ No newline at end of file diff --git a/tests/markdown-test/links-reference.txt b/tests/markdown-test/links-reference.txt deleted file mode 100644 index b2fa734..0000000 --- a/tests/markdown-test/links-reference.txt +++ /dev/null @@ -1,31 +0,0 @@ -Foo [bar] [1]. - -Foo [bar][1]. - -Foo [bar] -[1]. - -[1]: /url/ "Title" - - -With [embedded [brackets]] [b]. - - -Indented [once][]. - -Indented [twice][]. - -Indented [thrice][]. - -Indented [four][] times. - - [once]: /url - - [twice]: /url - - [thrice]: /url - - [four]: /url - - -[b]: /url/ diff --git a/tests/markdown-test/literal-quotes.html b/tests/markdown-test/literal-quotes.html deleted file mode 100644 index 0342589..0000000 --- a/tests/markdown-test/literal-quotes.html +++ /dev/null @@ -1,2 +0,0 @@ -

Foo bar.

-

Foo bar.

\ No newline at end of file diff --git a/tests/markdown-test/literal-quotes.txt b/tests/markdown-test/literal-quotes.txt deleted file mode 100644 index 29d0e42..0000000 --- a/tests/markdown-test/literal-quotes.txt +++ /dev/null @@ -1,7 +0,0 @@ -Foo [bar][]. - -Foo [bar](/url/ "Title with "quotes" inside"). - - - [bar]: /url/ "Title with "quotes" inside" - diff --git a/tests/markdown-test/markdown-documentation-basics.html b/tests/markdown-test/markdown-documentation-basics.html deleted file mode 100644 index 3bcaea9..0000000 --- a/tests/markdown-test/markdown-documentation-basics.html +++ /dev/null @@ -1,243 +0,0 @@ -

Markdown: Basics

- - -

Getting the Gist of Markdown's Formatting Syntax

-

This page offers a brief overview of what it's like to use Markdown. -The syntax page provides complete, detailed documentation for -every feature, but Markdown should be very easy to pick up simply by -looking at a few examples of it in action. The examples on this page -are written in a before/after style, showing example syntax and the -HTML output produced by Markdown.

-

It's also helpful to simply try Markdown out; the Dingus is a -web application that allows you type your own Markdown-formatted text -and translate it to XHTML.

-

Note: This document is itself written using Markdown; you -can see the source for it by adding '.text' to the URL.

-

Paragraphs, Headers, Blockquotes

-

A paragraph is simply one or more consecutive lines of text, separated -by one or more blank lines. (A blank line is any line that looks like a -blank line -- a line containing nothing spaces or tabs is considered -blank.) Normal paragraphs should not be intended with spaces or tabs.

-

Markdown offers two styles of headers: Setext and atx. -Setext-style headers for <h1> and <h2> are created by -"underlining" with equal signs (=) and hyphens (-), respectively. -To create an atx-style header, you put 1-6 hash marks (#) at the -beginning of the line -- the number of hashes equals the resulting -HTML header level.

-

Blockquotes are indicated using email-style '>' angle brackets.

-

Markdown:

-
A First Level Header
-====================
-
-A Second Level Header
----------------------
-
-Now is the time for all good men to come to
-the aid of their country. This is just a
-regular paragraph.
-
-The quick brown fox jumped over the lazy
-dog's back.
-
-### Header 3
-
-> This is a blockquote.
-> 
-> This is the second paragraph in the blockquote.
->
-> ## This is an H2 in a blockquote
-
-

Output:

-
<h1>A First Level Header</h1>
-
-<h2>A Second Level Header</h2>
-
-<p>Now is the time for all good men to come to
-the aid of their country. This is just a
-regular paragraph.</p>
-
-<p>The quick brown fox jumped over the lazy
-dog's back.</p>
-
-<h3>Header 3</h3>
-
-<blockquote>
-    <p>This is a blockquote.</p>
-
-    <p>This is the second paragraph in the blockquote.</p>
-
-    <h2>This is an H2 in a blockquote</h2>
-</blockquote>
-
-

Phrase Emphasis

-

Markdown uses asterisks and underscores to indicate spans of emphasis.

-

Markdown:

-
Some of these words *are emphasized*.
-Some of these words _are emphasized also_.
-
-Use two asterisks for **strong emphasis**.
-Or, if you prefer, __use two underscores instead__.
-
-

Output:

-
<p>Some of these words <em>are emphasized</em>.
-Some of these words <em>are emphasized also</em>.</p>
-
-<p>Use two asterisks for <strong>strong emphasis</strong>.
-Or, if you prefer, <strong>use two underscores instead</strong>.</p>
-
-

Lists

-

Unordered (bulleted) lists use asterisks, pluses, and hyphens (*, -+, and -) as list markers. These three markers are -interchangable; this:

-
*   Candy.
-*   Gum.
-*   Booze.
-
-

this:

-
+   Candy.
-+   Gum.
-+   Booze.
-
-

and this:

-
-   Candy.
--   Gum.
--   Booze.
-
-

all produce the same output:

-
<ul>
-<li>Candy.</li>
-<li>Gum.</li>
-<li>Booze.</li>
-</ul>
-
-

Ordered (numbered) lists use regular numbers, followed by periods, as -list markers:

-
1.  Red
-2.  Green
-3.  Blue
-
-

Output:

-
<ol>
-<li>Red</li>
-<li>Green</li>
-<li>Blue</li>
-</ol>
-
-

If you put blank lines between items, you'll get <p> tags for the -list item text. You can create multi-paragraph list items by indenting -the paragraphs by 4 spaces or 1 tab:

-
*   A list item.
-
-    With multiple paragraphs.
-
-*   Another item in the list.
-
-

Output:

-
<ul>
-<li><p>A list item.</p>
-<p>With multiple paragraphs.</p></li>
-<li><p>Another item in the list.</p></li>
-</ul>
-
-

Links

-

Markdown supports two styles for creating links: inline and -reference. With both styles, you use square brackets to delimit the -text you want to turn into a link.

-

Inline-style links use parentheses immediately after the link text. -For example:

-
This is an [example link](http://example.com/).
-
-

Output:

-
<p>This is an <a href="http://example.com/">
-example link</a>.</p>
-
-

Optionally, you may include a title attribute in the parentheses:

-
This is an [example link](http://example.com/ "With a Title").
-
-

Output:

-
<p>This is an <a href="http://example.com/" title="With a Title">
-example link</a>.</p>
-
-

Reference-style links allow you to refer to your links by names, which -you define elsewhere in your document:

-
I get 10 times more traffic from [Google][1] than from
-[Yahoo][2] or [MSN][3].
-
-[1]: http://google.com/        "Google"
-[2]: http://search.yahoo.com/  "Yahoo Search"
-[3]: http://search.msn.com/    "MSN Search"
-
-

Output:

-
<p>I get 10 times more traffic from <a href="http://google.com/"
-title="Google">Google</a> than from <a href="http://search.yahoo.com/"
-title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
-title="MSN Search">MSN</a>.</p>
-
-

The title attribute is optional. Link names may contain letters, -numbers and spaces, but are not case sensitive:

-
I start my morning with a cup of coffee and
-[The New York Times][NY Times].
-
-[ny times]: http://www.nytimes.com/
-
-

Output:

-
<p>I start my morning with a cup of coffee and
-<a href="http://www.nytimes.com/">The New York Times</a>.</p>
-
-

Images

-

Image syntax is very much like link syntax.

-

Inline (titles are optional):

-
![alt text](/path/to/img.jpg "Title")
-
-

Reference-style:

-
![alt text][id]
-
-[id]: /path/to/img.jpg "Title"
-
-

Both of the above examples produce the same output:

-
<img src="/path/to/img.jpg" alt="alt text" title="Title" />
-
-

Code

-

In a regular paragraph, you can create code span by wrapping text in -backtick quotes. Any ampersands (&) and angle brackets (< or ->) will automatically be translated into HTML entities. This makes -it easy to use Markdown to write about HTML example code:

-
I strongly recommend against using any `<blink>` tags.
-
-I wish SmartyPants used named entities like `&mdash;`
-instead of decimal-encoded entites like `&#8212;`.
-
-

Output:

-
<p>I strongly recommend against using any
-<code>&lt;blink&gt;</code> tags.</p>
-
-<p>I wish SmartyPants used named entities like
-<code>&amp;mdash;</code> instead of decimal-encoded
-entites like <code>&amp;#8212;</code>.</p>
-
-

To specify an entire block of pre-formatted code, indent every line of -the block by 4 spaces or 1 tab. Just like with code spans, &, <, -and > characters will be escaped automatically.

-

Markdown:

-
If you want your page to validate under XHTML 1.0 Strict,
-you've got to put paragraph tags in your blockquotes:
-
-    <blockquote>
-        <p>For example.</p>
-    </blockquote>
-
-

Output:

-
<p>If you want your page to validate under XHTML 1.0 Strict,
-you've got to put paragraph tags in your blockquotes:</p>
-
-<pre><code>&lt;blockquote&gt;
-    &lt;p&gt;For example.&lt;/p&gt;
-&lt;/blockquote&gt;
-</code></pre>
-
\ No newline at end of file diff --git a/tests/markdown-test/markdown-documentation-basics.txt b/tests/markdown-test/markdown-documentation-basics.txt deleted file mode 100644 index 486055c..0000000 --- a/tests/markdown-test/markdown-documentation-basics.txt +++ /dev/null @@ -1,306 +0,0 @@ -Markdown: Basics -================ - - - - -Getting the Gist of Markdown's Formatting Syntax ------------------------------------------------- - -This page offers a brief overview of what it's like to use Markdown. -The [syntax page] [s] provides complete, detailed documentation for -every feature, but Markdown should be very easy to pick up simply by -looking at a few examples of it in action. The examples on this page -are written in a before/after style, showing example syntax and the -HTML output produced by Markdown. - -It's also helpful to simply try Markdown out; the [Dingus] [d] is a -web application that allows you type your own Markdown-formatted text -and translate it to XHTML. - -**Note:** This document is itself written using Markdown; you -can [see the source for it by adding '.text' to the URL] [src]. - - [s]: /projects/markdown/syntax "Markdown Syntax" - [d]: /projects/markdown/dingus "Markdown Dingus" - [src]: /projects/markdown/basics.text - - -## Paragraphs, Headers, Blockquotes ## - -A paragraph is simply one or more consecutive lines of text, separated -by one or more blank lines. (A blank line is any line that looks like a -blank line -- a line containing nothing spaces or tabs is considered -blank.) Normal paragraphs should not be intended with spaces or tabs. - -Markdown offers two styles of headers: *Setext* and *atx*. -Setext-style headers for `

` and `

` are created by -"underlining" with equal signs (`=`) and hyphens (`-`), respectively. -To create an atx-style header, you put 1-6 hash marks (`#`) at the -beginning of the line -- the number of hashes equals the resulting -HTML header level. - -Blockquotes are indicated using email-style '`>`' angle brackets. - -Markdown: - - A First Level Header - ==================== - - A Second Level Header - --------------------- - - Now is the time for all good men to come to - the aid of their country. This is just a - regular paragraph. - - The quick brown fox jumped over the lazy - dog's back. - - ### Header 3 - - > This is a blockquote. - > - > This is the second paragraph in the blockquote. - > - > ## This is an H2 in a blockquote - - -Output: - -

A First Level Header

- -

A Second Level Header

- -

Now is the time for all good men to come to - the aid of their country. This is just a - regular paragraph.

- -

The quick brown fox jumped over the lazy - dog's back.

- -

Header 3

- -
-

This is a blockquote.

- -

This is the second paragraph in the blockquote.

- -

This is an H2 in a blockquote

-
- - - -### Phrase Emphasis ### - -Markdown uses asterisks and underscores to indicate spans of emphasis. - -Markdown: - - Some of these words *are emphasized*. - Some of these words _are emphasized also_. - - Use two asterisks for **strong emphasis**. - Or, if you prefer, __use two underscores instead__. - -Output: - -

Some of these words are emphasized. - Some of these words are emphasized also.

- -

Use two asterisks for strong emphasis. - Or, if you prefer, use two underscores instead.

- - - -## Lists ## - -Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`, -`+`, and `-`) as list markers. These three markers are -interchangable; this: - - * Candy. - * Gum. - * Booze. - -this: - - + Candy. - + Gum. - + Booze. - -and this: - - - Candy. - - Gum. - - Booze. - -all produce the same output: - -
    -
  • Candy.
  • -
  • Gum.
  • -
  • Booze.
  • -
- -Ordered (numbered) lists use regular numbers, followed by periods, as -list markers: - - 1. Red - 2. Green - 3. Blue - -Output: - -
    -
  1. Red
  2. -
  3. Green
  4. -
  5. Blue
  6. -
- -If you put blank lines between items, you'll get `

` tags for the -list item text. You can create multi-paragraph list items by indenting -the paragraphs by 4 spaces or 1 tab: - - * A list item. - - With multiple paragraphs. - - * Another item in the list. - -Output: - -

    -
  • A list item.

    -

    With multiple paragraphs.

  • -
  • Another item in the list.

  • -
- - - -### Links ### - -Markdown supports two styles for creating links: *inline* and -*reference*. With both styles, you use square brackets to delimit the -text you want to turn into a link. - -Inline-style links use parentheses immediately after the link text. -For example: - - This is an [example link](http://example.com/). - -Output: - -

This is an - example link.

- -Optionally, you may include a title attribute in the parentheses: - - This is an [example link](http://example.com/ "With a Title"). - -Output: - -

This is an - example link.

- -Reference-style links allow you to refer to your links by names, which -you define elsewhere in your document: - - I get 10 times more traffic from [Google][1] than from - [Yahoo][2] or [MSN][3]. - - [1]: http://google.com/ "Google" - [2]: http://search.yahoo.com/ "Yahoo Search" - [3]: http://search.msn.com/ "MSN Search" - -Output: - -

I get 10 times more traffic from Google than from Yahoo or MSN.

- -The title attribute is optional. Link names may contain letters, -numbers and spaces, but are *not* case sensitive: - - I start my morning with a cup of coffee and - [The New York Times][NY Times]. - - [ny times]: http://www.nytimes.com/ - -Output: - -

I start my morning with a cup of coffee and - The New York Times.

- - -### Images ### - -Image syntax is very much like link syntax. - -Inline (titles are optional): - - ![alt text](/path/to/img.jpg "Title") - -Reference-style: - - ![alt text][id] - - [id]: /path/to/img.jpg "Title" - -Both of the above examples produce the same output: - - alt text - - - -### Code ### - -In a regular paragraph, you can create code span by wrapping text in -backtick quotes. Any ampersands (`&`) and angle brackets (`<` or -`>`) will automatically be translated into HTML entities. This makes -it easy to use Markdown to write about HTML example code: - - I strongly recommend against using any `` tags. - - I wish SmartyPants used named entities like `—` - instead of decimal-encoded entites like `—`. - -Output: - -

I strongly recommend against using any - <blink> tags.

- -

I wish SmartyPants used named entities like - &mdash; instead of decimal-encoded - entites like &#8212;.

- - -To specify an entire block of pre-formatted code, indent every line of -the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`, -and `>` characters will be escaped automatically. - -Markdown: - - If you want your page to validate under XHTML 1.0 Strict, - you've got to put paragraph tags in your blockquotes: - -
-

For example.

-
- -Output: - -

If you want your page to validate under XHTML 1.0 Strict, - you've got to put paragraph tags in your blockquotes:

- -
<blockquote>
-        <p>For example.</p>
-    </blockquote>
-    
diff --git a/tests/markdown-test/markdown-syntax.html b/tests/markdown-test/markdown-syntax.html deleted file mode 100644 index 2f63b4b..0000000 --- a/tests/markdown-test/markdown-syntax.html +++ /dev/null @@ -1,728 +0,0 @@ -

Markdown: Syntax

- - - -

Note: This document is itself written using Markdown; you -can see the source for it by adding '.text' to the URL.

-
-

Overview

- -

Philosophy

- -

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

-

Readability, however, is emphasized above all else. A Markdown-formatted -document should be publishable as-is, as plain text, without looking -like it's been marked up with tags or formatting instructions. While -Markdown's syntax has been influenced by several existing text-to-HTML -filters -- including Setext, atx, Textile, reStructuredText, -Grutatext, and EtText -- the single biggest source of -inspiration for Markdown's syntax is the format of plain text email.

-

To this end, Markdown's syntax is comprised entirely of punctuation -characters, which punctuation characters have been carefully chosen so -as to look like what they mean. E.g., asterisks around a word actually -look like *emphasis*. Markdown lists look like, well, lists. Even -blockquotes look like quoted passages of text, assuming you've ever -used email.

-

Inline HTML

- -

Markdown's syntax is intended for one purpose: to be used as a -format for writing for the web.

-

Markdown is not a replacement for HTML, or even close to it. Its -syntax is very small, corresponding only to a very small subset of -HTML tags. The idea is not to create a syntax that makes it easier -to insert HTML tags. In my opinion, HTML tags are already easy to -insert. The idea for Markdown is to make it easy to read, write, and -edit prose. HTML is a publishing format; Markdown is a writing -format. Thus, Markdown's formatting syntax only addresses issues that -can be conveyed in plain text.

-

For any markup that is not covered by Markdown's syntax, you simply -use HTML itself. There's no need to preface it or delimit it to -indicate that you're switching from Markdown to HTML; you just use -the tags.

-

The only restrictions are that block-level HTML elements -- e.g. <div>, -<table>, <pre>, <p>, etc. -- must be separated from surrounding -content by blank lines, and the start and end tags of the block should -not be indented with tabs or spaces. Markdown is smart enough not -to add extra (unwanted) <p> tags around HTML block-level tags.

-

For example, to add an HTML table to a Markdown article:

-
This is a regular paragraph.
-
-<table>
-    <tr>
-        <td>Foo</td>
-    </tr>
-</table>
-
-This is another regular paragraph.
-
-

Note that Markdown formatting syntax is not processed within block-level -HTML tags. E.g., you can't use Markdown-style *emphasis* inside an -HTML block.

-

Span-level HTML tags -- e.g. <span>, <cite>, or <del> -- can be -used anywhere in a Markdown paragraph, list item, or header. If you -want, you can even use HTML tags instead of Markdown formatting; e.g. if -you'd prefer to use HTML <a> or <img> tags instead of Markdown's -link or image syntax, go right ahead.

-

Unlike block-level HTML tags, Markdown syntax is processed within -span-level tags.

-

Automatic Escaping for Special Characters

- -

In HTML, there are two characters that demand special treatment: < -and &. Left angle brackets are used to start tags; ampersands are -used to denote HTML entities. If you want to use them as literal -characters, you must escape them as entities, e.g. &lt;, and -&amp;.

-

Ampersands in particular are bedeviling for web writers. If you want to -write about 'AT&T', you need to write 'AT&amp;T'. You even need to -escape ampersands within URLs. Thus, if you want to link to:

-
http://images.google.com/images?num=30&q=larry+bird
-
-

you need to encode the URL as:

-
http://images.google.com/images?num=30&amp;q=larry+bird
-
-

in your anchor tag href attribute. Needless to say, this is easy to -forget, and is probably the single most common source of HTML validation -errors in otherwise well-marked-up web sites.

-

Markdown allows you to use these characters naturally, taking care of -all the necessary escaping for you. If you use an ampersand as part of -an HTML entity, it remains unchanged; otherwise it will be translated -into &amp;.

-

So, if you want to include a copyright symbol in your article, you can write:

-
&copy;
-
-

and Markdown will leave it alone. But if you write:

-
AT&T
-
-

Markdown will translate it to:

-
AT&amp;T
-
-

Similarly, because Markdown supports inline HTML, if you use -angle brackets as delimiters for HTML tags, Markdown will treat them as -such. But if you write:

-
4 < 5
-
-

Markdown will translate it to:

-
4 &lt; 5
-
-

However, inside Markdown code spans and blocks, angle brackets and -ampersands are always encoded automatically. This makes it easy to use -Markdown to write about HTML code. (As opposed to raw HTML, which is a -terrible format for writing about HTML syntax, because every single < -and & in your example code needs to be escaped.)

-
-

Block Elements

- -

Paragraphs and Line Breaks

- -

A paragraph is simply one or more consecutive lines of text, separated -by one or more blank lines. (A blank line is any line that looks like a -blank line -- a line containing nothing but spaces or tabs is considered -blank.) Normal paragraphs should not be intended with spaces or tabs.

-

The implication of the "one or more consecutive lines of text" rule is -that Markdown supports "hard-wrapped" text paragraphs. This differs -significantly from most other text-to-HTML formatters (including Movable -Type's "Convert Line Breaks" option) which translate every line break -character in a paragraph into a <br /> tag.

-

When you do want to insert a <br /> break tag using Markdown, you -end a line with two or more spaces, then type return.

-

Yes, this takes a tad more effort to create a <br />, but a simplistic -"every line break is a <br />" rule wouldn't work for Markdown. -Markdown's email-style blockquoting and multi-paragraph list items -work best -- and look better -- when you format them with hard breaks.

- - -

Markdown supports two styles of headers, Setext and atx.

-

Setext-style headers are "underlined" using equal signs (for first-level -headers) and dashes (for second-level headers). For example:

-
This is an H1
-=============
-
-This is an H2
--------------
-
-

Any number of underlining ='s or -'s will work.

-

Atx-style headers use 1-6 hash characters at the start of the line, -corresponding to header levels 1-6. For example:

-
# This is an H1
-
-## This is an H2
-
-###### This is an H6
-
-

Optionally, you may "close" atx-style headers. This is purely -cosmetic -- you can use this if you think it looks better. The -closing hashes don't even need to match the number of hashes -used to open the header. (The number of opening hashes -determines the header level.) :

-
# This is an H1 #
-
-## This is an H2 ##
-
-### This is an H3 ######
-
-

Blockquotes

- -

Markdown uses email-style > characters for blockquoting. If you're -familiar with quoting passages of text in an email message, then you -know how to create a blockquote in Markdown. It looks best if you hard -wrap the text and put a > before every line:

-
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
-> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
-> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
-> 
-> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
-> id sem consectetuer libero luctus adipiscing.
-
-

Markdown allows you to be lazy and only put the > before the first -line of a hard-wrapped paragraph:

-
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
-consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
-Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
-
-> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
-id sem consectetuer libero luctus adipiscing.
-
-

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by -adding additional levels of >:

-
> This is the first level of quoting.
->
-> > This is nested blockquote.
->
-> Back to the first level.
-
-

Blockquotes can contain other Markdown elements, including headers, lists, -and code blocks:

-
> ## This is a header.
-> 
-> 1.   This is the first list item.
-> 2.   This is the second list item.
-> 
-> Here's some example code:
-> 
->     return shell_exec("echo $input | $markdown_script");
-
-

Any decent text editor should make email-style quoting easy. For -example, with BBEdit, you can make a selection and choose Increase -Quote Level from the Text menu.

-

Lists

- -

Markdown supports ordered (numbered) and unordered (bulleted) lists.

-

Unordered lists use asterisks, pluses, and hyphens -- interchangably --- as list markers:

-
*   Red
-*   Green
-*   Blue
-
-

is equivalent to:

-
+   Red
-+   Green
-+   Blue
-
-

and:

-
-   Red
--   Green
--   Blue
-
-

Ordered lists use numbers followed by periods:

-
1.  Bird
-2.  McHale
-3.  Parish
-
-

It's important to note that the actual numbers you use to mark the -list have no effect on the HTML output Markdown produces. The HTML -Markdown produces from the above list is:

-
<ol>
-<li>Bird</li>
-<li>McHale</li>
-<li>Parish</li>
-</ol>
-
-

If you instead wrote the list in Markdown like this:

-
1.  Bird
-1.  McHale
-1.  Parish
-
-

or even:

-
3. Bird
-1. McHale
-8. Parish
-
-

you'd get the exact same HTML output. The point is, if you want to, -you can use ordinal numbers in your ordered Markdown lists, so that -the numbers in your source match the numbers in your published HTML. -But if you want to be lazy, you don't have to.

-

If you do use lazy list numbering, however, you should still start the -list with the number 1. At some point in the future, Markdown may support -starting ordered lists at an arbitrary number.

-

List markers typically start at the left margin, but may be indented by -up to three spaces. List markers must be followed by one or more spaces -or a tab.

-

To make lists look nice, you can wrap items with hanging indents:

-
*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
-    Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
-    viverra nec, fringilla in, laoreet vitae, risus.
-*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
-    Suspendisse id sem consectetuer libero luctus adipiscing.
-
-

But if you want to be lazy, you don't have to:

-
*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
-Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
-viverra nec, fringilla in, laoreet vitae, risus.
-*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
-Suspendisse id sem consectetuer libero luctus adipiscing.
-
-

If list items are separated by blank lines, Markdown will wrap the -items in <p> tags in the HTML output. For example, this input:

-
*   Bird
-*   Magic
-
-

will turn into:

-
<ul>
-<li>Bird</li>
-<li>Magic</li>
-</ul>
-
-

But this:

-
*   Bird
-
-*   Magic
-
-

will turn into:

-
<ul>
-<li><p>Bird</p></li>
-<li><p>Magic</p></li>
-</ul>
-
-

List items may consist of multiple paragraphs. Each subsequent -paragraph in a list item must be intended by either 4 spaces -or one tab:

-
1.  This is a list item with two paragraphs. Lorem ipsum dolor
-    sit amet, consectetuer adipiscing elit. Aliquam hendrerit
-    mi posuere lectus.
-
-    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
-    vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
-    sit amet velit.
-
-2.  Suspendisse id sem consectetuer libero luctus adipiscing.
-
-

It looks nice if you indent every line of the subsequent -paragraphs, but here again, Markdown will allow you to be -lazy:

-
*   This is a list item with two paragraphs.
-
-    This is the second paragraph in the list item. You're
-only required to indent the first line. Lorem ipsum dolor
-sit amet, consectetuer adipiscing elit.
-
-*   Another item in the same list.
-
-

To put a blockquote within a list item, the blockquote's > -delimiters need to be indented:

-
*   A list item with a blockquote:
-
-    > This is a blockquote
-    > inside a list item.
-
-

To put a code block within a list item, the code block needs -to be indented twice -- 8 spaces or two tabs:

-
*   A list item with a code block:
-
-        <code goes here>
-
-

It's worth noting that it's possible to trigger an ordered list by -accident, by writing something like this:

-
1986. What a great season.
-
-

In other words, a number-period-space sequence at the beginning of a -line. To avoid this, you can backslash-escape the period:

-
1986\. What a great season.
-
-

Code Blocks

- -

Pre-formatted code blocks are used for writing about programming or -markup source code. Rather than forming normal paragraphs, the lines -of a code block are interpreted literally. Markdown wraps a code block -in both <pre> and <code> tags.

-

To produce a code block in Markdown, simply indent every line of the -block by at least 4 spaces or 1 tab. For example, given this input:

-
This is a normal paragraph:
-
-    This is a code block.
-
-

Markdown will generate:

-
<p>This is a normal paragraph:</p>
-
-<pre><code>This is a code block.
-</code></pre>
-
-

One level of indentation -- 4 spaces or 1 tab -- is removed from each -line of the code block. For example, this:

-
Here is an example of AppleScript:
-
-    tell application "Foo"
-        beep
-    end tell
-
-

will turn into:

-
<p>Here is an example of AppleScript:</p>
-
-<pre><code>tell application "Foo"
-    beep
-end tell
-</code></pre>
-
-

A code block continues until it reaches a line that is not indented -(or the end of the article).

-

Within a code block, ampersands (&) and angle brackets (< and >) -are automatically converted into HTML entities. This makes it very -easy to include example HTML source code using Markdown -- just paste -it and indent it, and Markdown will handle the hassle of encoding the -ampersands and angle brackets. For example, this:

-
    <div class="footer">
-        &copy; 2004 Foo Corporation
-    </div>
-
-

will turn into:

-
<pre><code>&lt;div class="footer"&gt;
-    &amp;copy; 2004 Foo Corporation
-&lt;/div&gt;
-</code></pre>
-
-

Regular Markdown syntax is not processed within code blocks. E.g., -asterisks are just literal asterisks within a code block. This means -it's also easy to use Markdown to write about Markdown's own syntax.

-

Horizontal Rules

- -

You can produce a horizontal rule tag (<hr />) by placing three or -more hyphens, asterisks, or underscores on a line by themselves. If you -wish, you may use spaces between the hyphens or asterisks. Each of the -following lines will produce a horizontal rule:

-
* * *
-
-***
-
-*****
-
-- - -
-
----------------------------------------
-
-_ _ _
-
-
-

Span Elements

- - - -

Markdown supports two style of links: inline and reference.

-

In both styles, the link text is delimited by [square brackets].

-

To create an inline link, use a set of regular parentheses immediately -after the link text's closing square bracket. Inside the parentheses, -put the URL where you want the link to point, along with an optional -title for the link, surrounded in quotes. For example:

-
This is [an example](http://example.com/ "Title") inline link.
-
-[This link](http://example.net/) has no title attribute.
-
-

Will produce:

-
<p>This is <a href="http://example.com/" title="Title">
-an example</a> inline link.</p>
-
-<p><a href="http://example.net/">This link</a> has no
-title attribute.</p>
-
-

If you're referring to a local resource on the same server, you can -use relative paths:

-
See my [About](/about/) page for details.
-
-

Reference-style links use a second set of square brackets, inside -which you place a label of your choosing to identify the link:

-
This is [an example][id] reference-style link.
-
-

You can optionally use a space to separate the sets of brackets:

-
This is [an example] [id] reference-style link.
-
-

Then, anywhere in the document, you define your link label like this, -on a line by itself:

-
[id]: http://example.com/  "Optional Title Here"
-
-

That is:

-
    -
  • Square brackets containing the link identifier (optionally -indented from the left margin using up to three spaces);
  • -
  • followed by a colon;
  • -
  • followed by one or more spaces (or tabs);
  • -
  • followed by the URL for the link;
  • -
  • optionally followed by a title attribute for the link, enclosed -in double or single quotes.
  • -
-

The link URL may, optionally, be surrounded by angle brackets:

-
[id]: <http://example.com/>  "Optional Title Here"
-
-

You can put the title attribute on the next line and use extra spaces -or tabs for padding, which tends to look better with longer URLs:

-
[id]: http://example.com/longish/path/to/resource/here
-    "Optional Title Here"
-
-

Link definitions are only used for creating links during Markdown -processing, and are stripped from your document in the HTML output.

-

Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are not case sensitive. E.g. these two links:

-
[link text][a]
-[link text][A]
-
-

are equivalent.

-

The implicit link name shortcut allows you to omit the name of the -link, in which case the link text itself is used as the name. -Just use an empty set of square brackets -- e.g., to link the word -"Google" to the google.com web site, you could simply write:

-
[Google][]
-
-

And then define the link:

-
[Google]: http://google.com/
-
-

Because link names may contain spaces, this shortcut even works for -multiple words in the link text:

-
Visit [Daring Fireball][] for more information.
-
-

And then define the link:

-
[Daring Fireball]: http://daringfireball.net/
-
-

Link definitions can be placed anywhere in your Markdown document. I -tend to put them immediately after each paragraph in which they're -used, but if you want, you can put them all at the end of your -document, sort of like footnotes.

-

Here's an example of reference links in action:

-
I get 10 times more traffic from [Google] [1] than from
-[Yahoo] [2] or [MSN] [3].
-
-  [1]: http://google.com/        "Google"
-  [2]: http://search.yahoo.com/  "Yahoo Search"
-  [3]: http://search.msn.com/    "MSN Search"
-
-

Using the implicit link name shortcut, you could instead write:

-
I get 10 times more traffic from [Google][] than from
-[Yahoo][] or [MSN][].
-
-  [google]: http://google.com/        "Google"
-  [yahoo]:  http://search.yahoo.com/  "Yahoo Search"
-  [msn]:    http://search.msn.com/    "MSN Search"
-
-

Both of the above examples will produce the following HTML output:

-
<p>I get 10 times more traffic from <a href="http://google.com/"
-title="Google">Google</a> than from
-<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
-or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
-
-

For comparison, here is the same paragraph written using -Markdown's inline link style:

-
I get 10 times more traffic from [Google](http://google.com/ "Google")
-than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
-[MSN](http://search.msn.com/ "MSN Search").
-
-

The point of reference-style links is not that they're easier to -write. The point is that with reference-style links, your document -source is vastly more readable. Compare the above examples: using -reference-style links, the paragraph itself is only 81 characters -long; with inline-style links, it's 176 characters; and as raw HTML, -it's 234 characters. In the raw HTML, there's more markup than there -is text.

-

With Markdown's reference-style links, a source document much more -closely resembles the final output, as rendered in a browser. By -allowing you to move the markup-related metadata out of the paragraph, -you can add links without interrupting the narrative flow of your -prose.

-

Emphasis

- -

Markdown treats asterisks (*) and underscores (_) as indicators of -emphasis. Text wrapped with one * or _ will be wrapped with an -HTML <em> tag; double *'s or _'s will be wrapped with an HTML -<strong> tag. E.g., this input:

-
*single asterisks*
-
-_single underscores_
-
-**double asterisks**
-
-__double underscores__
-
-

will produce:

-
<em>single asterisks</em>
-
-<em>single underscores</em>
-
-<strong>double asterisks</strong>
-
-<strong>double underscores</strong>
-
-

You can use whichever style you prefer; the lone restriction is that -the same character must be used to open and close an emphasis span.

-

Emphasis can be used in the middle of a word:

-
un*fucking*believable
-
-

But if you surround an * or _ with spaces, it'll be treated as a -literal asterisk or underscore.

-

To produce a literal asterisk or underscore at a position where it -would otherwise be used as an emphasis delimiter, you can backslash -escape it:

-
\*this text is surrounded by literal asterisks\*
-
-

Code

- -

To indicate a span of code, wrap it with backtick quotes (`). -Unlike a pre-formatted code block, a code span indicates code within a -normal paragraph. For example:

-
Use the `printf()` function.
-
-

will produce:

-
<p>Use the <code>printf()</code> function.</p>
-
-

To include a literal backtick character within a code span, you can use -multiple backticks as the opening and closing delimiters:

-
``There is a literal backtick (`) here.``
-
-

which will produce this:

-
<p><code>There is a literal backtick (`) here.</code></p>
-
-

The backtick delimiters surrounding a code span may include spaces -- -one after the opening, one before the closing. This allows you to place -literal backtick characters at the beginning or end of a code span:

-
A single backtick in a code span: `` ` ``
-
-A backtick-delimited string in a code span: `` `foo` ``
-
-

will produce:

-
<p>A single backtick in a code span: <code>`</code></p>
-
-<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
-
-

With a code span, ampersands and angle brackets are encoded as HTML -entities automatically, which makes it easy to include example HTML -tags. Markdown will turn this:

-
Please don't use any `<blink>` tags.
-
-

into:

-
<p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
-
-

You can write this:

-
`&#8212;` is the decimal-encoded equivalent of `&mdash;`.
-
-

to produce:

-
<p><code>&amp;#8212;</code> is the decimal-encoded
-equivalent of <code>&amp;mdash;</code>.</p>
-
-

Images

- -

Admittedly, it's fairly difficult to devise a "natural" syntax for -placing images into a plain text document format.

-

Markdown uses an image syntax that is intended to resemble the syntax -for links, allowing for two styles: inline and reference.

-

Inline image syntax looks like this:

-
![Alt text](/path/to/img.jpg)
-
-![Alt text](/path/to/img.jpg "Optional title")
-
-

That is:

-
    -
  • An exclamation mark: !;
  • -
  • followed by a set of square brackets, containing the alt -attribute text for the image;
  • -
  • followed by a set of parentheses, containing the URL or path to -the image, and an optional title attribute enclosed in double -or single quotes.
  • -
-

Reference-style image syntax looks like this:

-
![Alt text][id]
-
-

Where "id" is the name of a defined image reference. Image references -are defined using syntax identical to link references:

-
[id]: url/to/image  "Optional title attribute"
-
-

As of this writing, Markdown has no syntax for specifying the -dimensions of an image; if this is important to you, you can simply -use regular HTML <img> tags.

-
-

Miscellaneous

- - - -

Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

-
<http://example.com/>
-
-

Markdown will turn this into:

-
<a href="http://example.com/">http://example.com/</a>
-
-

Automatic links for email addresses work similarly, except that -Markdown will also perform a bit of randomized decimal and hex -entity-encoding to help obscure your address from address-harvesting -spambots. For example, Markdown will turn this:

-
<address@example.com>
-
-

into something like this:

-
<a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
-&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
-&#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
-&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
-
-

which will render in a browser as a clickable link to "address@example.com".

-

(This sort of entity-encoding trick will indeed fool many, if not -most, address-harvesting bots, but it definitely won't fool all of -them. It's better than nothing, but an address published in this way -will probably eventually start receiving spam.)

-

Backslash Escapes

- -

Markdown allows you to use backslash escapes to generate literal -characters which would otherwise have special meaning in Markdown's -formatting syntax. For example, if you wanted to surround a word with -literal asterisks (instead of an HTML <em> tag), you can backslashes -before the asterisks, like this:

-
\*literal asterisks\*
-
-

Markdown provides backslash escapes for the following characters:

-
\   backslash
-`   backtick
-*   asterisk
-_   underscore
-{}  curly braces
-[]  square brackets
-()  parentheses
-#   hash mark
-+   plus sign
--   minus sign (hyphen)
-.   dot
-!   exclamation mark
-
\ No newline at end of file diff --git a/tests/markdown-test/markdown-syntax.txt b/tests/markdown-test/markdown-syntax.txt deleted file mode 100644 index dabd75c..0000000 --- a/tests/markdown-test/markdown-syntax.txt +++ /dev/null @@ -1,888 +0,0 @@ -Markdown: Syntax -================ - - - - -* [Overview](#overview) - * [Philosophy](#philosophy) - * [Inline HTML](#html) - * [Automatic Escaping for Special Characters](#autoescape) -* [Block Elements](#block) - * [Paragraphs and Line Breaks](#p) - * [Headers](#header) - * [Blockquotes](#blockquote) - * [Lists](#list) - * [Code Blocks](#precode) - * [Horizontal Rules](#hr) -* [Span Elements](#span) - * [Links](#link) - * [Emphasis](#em) - * [Code](#code) - * [Images](#img) -* [Miscellaneous](#misc) - * [Backslash Escapes](#backslash) - * [Automatic Links](#autolink) - - -**Note:** This document is itself written using Markdown; you -can [see the source for it by adding '.text' to the URL][src]. - - [src]: /projects/markdown/syntax.text - -* * * - -

Overview

- -

Philosophy

- -Markdown is intended to be as easy-to-read and easy-to-write as is feasible. - -Readability, however, is emphasized above all else. A Markdown-formatted -document should be publishable as-is, as plain text, without looking -like it's been marked up with tags or formatting instructions. While -Markdown's syntax has been influenced by several existing text-to-HTML -filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4], -[Grutatext] [5], and [EtText] [6] -- the single biggest source of -inspiration for Markdown's syntax is the format of plain text email. - - [1]: http://docutils.sourceforge.net/mirror/setext.html - [2]: http://www.aaronsw.com/2002/atx/ - [3]: http://textism.com/tools/textile/ - [4]: http://docutils.sourceforge.net/rst.html - [5]: http://www.triptico.com/software/grutatxt.html - [6]: http://ettext.taint.org/doc/ - -To this end, Markdown's syntax is comprised entirely of punctuation -characters, which punctuation characters have been carefully chosen so -as to look like what they mean. E.g., asterisks around a word actually -look like \*emphasis\*. Markdown lists look like, well, lists. Even -blockquotes look like quoted passages of text, assuming you've ever -used email. - - - -

Inline HTML

- -Markdown's syntax is intended for one purpose: to be used as a -format for *writing* for the web. - -Markdown is not a replacement for HTML, or even close to it. Its -syntax is very small, corresponding only to a very small subset of -HTML tags. The idea is *not* to create a syntax that makes it easier -to insert HTML tags. In my opinion, HTML tags are already easy to -insert. The idea for Markdown is to make it easy to read, write, and -edit prose. HTML is a *publishing* format; Markdown is a *writing* -format. Thus, Markdown's formatting syntax only addresses issues that -can be conveyed in plain text. - -For any markup that is not covered by Markdown's syntax, you simply -use HTML itself. There's no need to preface it or delimit it to -indicate that you're switching from Markdown to HTML; you just use -the tags. - -The only restrictions are that block-level HTML elements -- e.g. `
`, -``, `
`, `

`, etc. -- must be separated from surrounding -content by blank lines, and the start and end tags of the block should -not be indented with tabs or spaces. Markdown is smart enough not -to add extra (unwanted) `

` tags around HTML block-level tags. - -For example, to add an HTML table to a Markdown article: - - This is a regular paragraph. - -

- - - -
Foo
- - This is another regular paragraph. - -Note that Markdown formatting syntax is not processed within block-level -HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an -HTML block. - -Span-level HTML tags -- e.g. ``, ``, or `` -- can be -used anywhere in a Markdown paragraph, list item, or header. If you -want, you can even use HTML tags instead of Markdown formatting; e.g. if -you'd prefer to use HTML `` or `` tags instead of Markdown's -link or image syntax, go right ahead. - -Unlike block-level HTML tags, Markdown syntax *is* processed within -span-level tags. - - -

Automatic Escaping for Special Characters

- -In HTML, there are two characters that demand special treatment: `<` -and `&`. Left angle brackets are used to start tags; ampersands are -used to denote HTML entities. If you want to use them as literal -characters, you must escape them as entities, e.g. `<`, and -`&`. - -Ampersands in particular are bedeviling for web writers. If you want to -write about 'AT&T', you need to write '`AT&T`'. You even need to -escape ampersands within URLs. Thus, if you want to link to: - - http://images.google.com/images?num=30&q=larry+bird - -you need to encode the URL as: - - http://images.google.com/images?num=30&q=larry+bird - -in your anchor tag `href` attribute. Needless to say, this is easy to -forget, and is probably the single most common source of HTML validation -errors in otherwise well-marked-up web sites. - -Markdown allows you to use these characters naturally, taking care of -all the necessary escaping for you. If you use an ampersand as part of -an HTML entity, it remains unchanged; otherwise it will be translated -into `&`. - -So, if you want to include a copyright symbol in your article, you can write: - - © - -and Markdown will leave it alone. But if you write: - - AT&T - -Markdown will translate it to: - - AT&T - -Similarly, because Markdown supports [inline HTML](#html), if you use -angle brackets as delimiters for HTML tags, Markdown will treat them as -such. But if you write: - - 4 < 5 - -Markdown will translate it to: - - 4 < 5 - -However, inside Markdown code spans and blocks, angle brackets and -ampersands are *always* encoded automatically. This makes it easy to use -Markdown to write about HTML code. (As opposed to raw HTML, which is a -terrible format for writing about HTML syntax, because every single `<` -and `&` in your example code needs to be escaped.) - - -* * * - - -

Block Elements

- - -

Paragraphs and Line Breaks

- -A paragraph is simply one or more consecutive lines of text, separated -by one or more blank lines. (A blank line is any line that looks like a -blank line -- a line containing nothing but spaces or tabs is considered -blank.) Normal paragraphs should not be intended with spaces or tabs. - -The implication of the "one or more consecutive lines of text" rule is -that Markdown supports "hard-wrapped" text paragraphs. This differs -significantly from most other text-to-HTML formatters (including Movable -Type's "Convert Line Breaks" option) which translate every line break -character in a paragraph into a `
` tag. - -When you *do* want to insert a `
` break tag using Markdown, you -end a line with two or more spaces, then type return. - -Yes, this takes a tad more effort to create a `
`, but a simplistic -"every line break is a `
`" rule wouldn't work for Markdown. -Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l] -work best -- and look better -- when you format them with hard breaks. - - [bq]: #blockquote - [l]: #list - - - - - -Markdown supports two styles of headers, [Setext] [1] and [atx] [2]. - -Setext-style headers are "underlined" using equal signs (for first-level -headers) and dashes (for second-level headers). For example: - - This is an H1 - ============= - - This is an H2 - ------------- - -Any number of underlining `=`'s or `-`'s will work. - -Atx-style headers use 1-6 hash characters at the start of the line, -corresponding to header levels 1-6. For example: - - # This is an H1 - - ## This is an H2 - - ###### This is an H6 - -Optionally, you may "close" atx-style headers. This is purely -cosmetic -- you can use this if you think it looks better. The -closing hashes don't even need to match the number of hashes -used to open the header. (The number of opening hashes -determines the header level.) : - - # This is an H1 # - - ## This is an H2 ## - - ### This is an H3 ###### - - -

Blockquotes

- -Markdown uses email-style `>` characters for blockquoting. If you're -familiar with quoting passages of text in an email message, then you -know how to create a blockquote in Markdown. It looks best if you hard -wrap the text and put a `>` before every line: - - > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, - > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. - > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. - > - > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse - > id sem consectetuer libero luctus adipiscing. - -Markdown allows you to be lazy and only put the `>` before the first -line of a hard-wrapped paragraph: - - > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, - consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. - Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. - - > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse - id sem consectetuer libero luctus adipiscing. - -Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by -adding additional levels of `>`: - - > This is the first level of quoting. - > - > > This is nested blockquote. - > - > Back to the first level. - -Blockquotes can contain other Markdown elements, including headers, lists, -and code blocks: - - > ## This is a header. - > - > 1. This is the first list item. - > 2. This is the second list item. - > - > Here's some example code: - > - > return shell_exec("echo $input | $markdown_script"); - -Any decent text editor should make email-style quoting easy. For -example, with BBEdit, you can make a selection and choose Increase -Quote Level from the Text menu. - - -

Lists

- -Markdown supports ordered (numbered) and unordered (bulleted) lists. - -Unordered lists use asterisks, pluses, and hyphens -- interchangably --- as list markers: - - * Red - * Green - * Blue - -is equivalent to: - - + Red - + Green - + Blue - -and: - - - Red - - Green - - Blue - -Ordered lists use numbers followed by periods: - - 1. Bird - 2. McHale - 3. Parish - -It's important to note that the actual numbers you use to mark the -list have no effect on the HTML output Markdown produces. The HTML -Markdown produces from the above list is: - -
    -
  1. Bird
  2. -
  3. McHale
  4. -
  5. Parish
  6. -
- -If you instead wrote the list in Markdown like this: - - 1. Bird - 1. McHale - 1. Parish - -or even: - - 3. Bird - 1. McHale - 8. Parish - -you'd get the exact same HTML output. The point is, if you want to, -you can use ordinal numbers in your ordered Markdown lists, so that -the numbers in your source match the numbers in your published HTML. -But if you want to be lazy, you don't have to. - -If you do use lazy list numbering, however, you should still start the -list with the number 1. At some point in the future, Markdown may support -starting ordered lists at an arbitrary number. - -List markers typically start at the left margin, but may be indented by -up to three spaces. List markers must be followed by one or more spaces -or a tab. - -To make lists look nice, you can wrap items with hanging indents: - - * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. - Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, - viverra nec, fringilla in, laoreet vitae, risus. - * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. - Suspendisse id sem consectetuer libero luctus adipiscing. - -But if you want to be lazy, you don't have to: - - * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. - Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, - viverra nec, fringilla in, laoreet vitae, risus. - * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. - Suspendisse id sem consectetuer libero luctus adipiscing. - -If list items are separated by blank lines, Markdown will wrap the -items in `

` tags in the HTML output. For example, this input: - - * Bird - * Magic - -will turn into: - -

    -
  • Bird
  • -
  • Magic
  • -
- -But this: - - * Bird - - * Magic - -will turn into: - -
    -
  • Bird

  • -
  • Magic

  • -
- -List items may consist of multiple paragraphs. Each subsequent -paragraph in a list item must be intended by either 4 spaces -or one tab: - - 1. This is a list item with two paragraphs. Lorem ipsum dolor - sit amet, consectetuer adipiscing elit. Aliquam hendrerit - mi posuere lectus. - - Vestibulum enim wisi, viverra nec, fringilla in, laoreet - vitae, risus. Donec sit amet nisl. Aliquam semper ipsum - sit amet velit. - - 2. Suspendisse id sem consectetuer libero luctus adipiscing. - -It looks nice if you indent every line of the subsequent -paragraphs, but here again, Markdown will allow you to be -lazy: - - * This is a list item with two paragraphs. - - This is the second paragraph in the list item. You're - only required to indent the first line. Lorem ipsum dolor - sit amet, consectetuer adipiscing elit. - - * Another item in the same list. - -To put a blockquote within a list item, the blockquote's `>` -delimiters need to be indented: - - * A list item with a blockquote: - - > This is a blockquote - > inside a list item. - -To put a code block within a list item, the code block needs -to be indented *twice* -- 8 spaces or two tabs: - - * A list item with a code block: - - - - -It's worth noting that it's possible to trigger an ordered list by -accident, by writing something like this: - - 1986. What a great season. - -In other words, a *number-period-space* sequence at the beginning of a -line. To avoid this, you can backslash-escape the period: - - 1986\. What a great season. - - - -

Code Blocks

- -Pre-formatted code blocks are used for writing about programming or -markup source code. Rather than forming normal paragraphs, the lines -of a code block are interpreted literally. Markdown wraps a code block -in both `
` and `` tags.
-
-To produce a code block in Markdown, simply indent every line of the
-block by at least 4 spaces or 1 tab. For example, given this input:
-
-    This is a normal paragraph:
-
-        This is a code block.
-
-Markdown will generate:
-
-    

This is a normal paragraph:

- -
This is a code block.
-    
- -One level of indentation -- 4 spaces or 1 tab -- is removed from each -line of the code block. For example, this: - - Here is an example of AppleScript: - - tell application "Foo" - beep - end tell - -will turn into: - -

Here is an example of AppleScript:

- -
tell application "Foo"
-        beep
-    end tell
-    
- -A code block continues until it reaches a line that is not indented -(or the end of the article). - -Within a code block, ampersands (`&`) and angle brackets (`<` and `>`) -are automatically converted into HTML entities. This makes it very -easy to include example HTML source code using Markdown -- just paste -it and indent it, and Markdown will handle the hassle of encoding the -ampersands and angle brackets. For example, this: - - - -will turn into: - -
<div class="footer">
-        &copy; 2004 Foo Corporation
-    </div>
-    
- -Regular Markdown syntax is not processed within code blocks. E.g., -asterisks are just literal asterisks within a code block. This means -it's also easy to use Markdown to write about Markdown's own syntax. - - - -

Horizontal Rules

- -You can produce a horizontal rule tag (`
`) by placing three or -more hyphens, asterisks, or underscores on a line by themselves. If you -wish, you may use spaces between the hyphens or asterisks. Each of the -following lines will produce a horizontal rule: - - * * * - - *** - - ***** - - - - - - - --------------------------------------- - - _ _ _ - - -* * * - -

Span Elements

- - - -Markdown supports two style of links: *inline* and *reference*. - -In both styles, the link text is delimited by [square brackets]. - -To create an inline link, use a set of regular parentheses immediately -after the link text's closing square bracket. Inside the parentheses, -put the URL where you want the link to point, along with an *optional* -title for the link, surrounded in quotes. For example: - - This is [an example](http://example.com/ "Title") inline link. - - [This link](http://example.net/) has no title attribute. - -Will produce: - -

This is - an example inline link.

- -

This link has no - title attribute.

- -If you're referring to a local resource on the same server, you can -use relative paths: - - See my [About](/about/) page for details. - -Reference-style links use a second set of square brackets, inside -which you place a label of your choosing to identify the link: - - This is [an example][id] reference-style link. - -You can optionally use a space to separate the sets of brackets: - - This is [an example] [id] reference-style link. - -Then, anywhere in the document, you define your link label like this, -on a line by itself: - - [id]: http://example.com/ "Optional Title Here" - -That is: - -* Square brackets containing the link identifier (optionally - indented from the left margin using up to three spaces); -* followed by a colon; -* followed by one or more spaces (or tabs); -* followed by the URL for the link; -* optionally followed by a title attribute for the link, enclosed - in double or single quotes. - -The link URL may, optionally, be surrounded by angle brackets: - - [id]: "Optional Title Here" - -You can put the title attribute on the next line and use extra spaces -or tabs for padding, which tends to look better with longer URLs: - - [id]: http://example.com/longish/path/to/resource/here - "Optional Title Here" - -Link definitions are only used for creating links during Markdown -processing, and are stripped from your document in the HTML output. - -Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links: - - [link text][a] - [link text][A] - -are equivalent. - -The *implicit link name* shortcut allows you to omit the name of the -link, in which case the link text itself is used as the name. -Just use an empty set of square brackets -- e.g., to link the word -"Google" to the google.com web site, you could simply write: - - [Google][] - -And then define the link: - - [Google]: http://google.com/ - -Because link names may contain spaces, this shortcut even works for -multiple words in the link text: - - Visit [Daring Fireball][] for more information. - -And then define the link: - - [Daring Fireball]: http://daringfireball.net/ - -Link definitions can be placed anywhere in your Markdown document. I -tend to put them immediately after each paragraph in which they're -used, but if you want, you can put them all at the end of your -document, sort of like footnotes. - -Here's an example of reference links in action: - - I get 10 times more traffic from [Google] [1] than from - [Yahoo] [2] or [MSN] [3]. - - [1]: http://google.com/ "Google" - [2]: http://search.yahoo.com/ "Yahoo Search" - [3]: http://search.msn.com/ "MSN Search" - -Using the implicit link name shortcut, you could instead write: - - I get 10 times more traffic from [Google][] than from - [Yahoo][] or [MSN][]. - - [google]: http://google.com/ "Google" - [yahoo]: http://search.yahoo.com/ "Yahoo Search" - [msn]: http://search.msn.com/ "MSN Search" - -Both of the above examples will produce the following HTML output: - -

I get 10 times more traffic from Google than from - Yahoo - or MSN.

- -For comparison, here is the same paragraph written using -Markdown's inline link style: - - I get 10 times more traffic from [Google](http://google.com/ "Google") - than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or - [MSN](http://search.msn.com/ "MSN Search"). - -The point of reference-style links is not that they're easier to -write. The point is that with reference-style links, your document -source is vastly more readable. Compare the above examples: using -reference-style links, the paragraph itself is only 81 characters -long; with inline-style links, it's 176 characters; and as raw HTML, -it's 234 characters. In the raw HTML, there's more markup than there -is text. - -With Markdown's reference-style links, a source document much more -closely resembles the final output, as rendered in a browser. By -allowing you to move the markup-related metadata out of the paragraph, -you can add links without interrupting the narrative flow of your -prose. - - -

Emphasis

- -Markdown treats asterisks (`*`) and underscores (`_`) as indicators of -emphasis. Text wrapped with one `*` or `_` will be wrapped with an -HTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML -`` tag. E.g., this input: - - *single asterisks* - - _single underscores_ - - **double asterisks** - - __double underscores__ - -will produce: - - single asterisks - - single underscores - - double asterisks - - double underscores - -You can use whichever style you prefer; the lone restriction is that -the same character must be used to open and close an emphasis span. - -Emphasis can be used in the middle of a word: - - un*fucking*believable - -But if you surround an `*` or `_` with spaces, it'll be treated as a -literal asterisk or underscore. - -To produce a literal asterisk or underscore at a position where it -would otherwise be used as an emphasis delimiter, you can backslash -escape it: - - \*this text is surrounded by literal asterisks\* - - - -

Code

- -To indicate a span of code, wrap it with backtick quotes (`` ` ``). -Unlike a pre-formatted code block, a code span indicates code within a -normal paragraph. For example: - - Use the `printf()` function. - -will produce: - -

Use the printf() function.

- -To include a literal backtick character within a code span, you can use -multiple backticks as the opening and closing delimiters: - - ``There is a literal backtick (`) here.`` - -which will produce this: - -

There is a literal backtick (`) here.

- -The backtick delimiters surrounding a code span may include spaces -- -one after the opening, one before the closing. This allows you to place -literal backtick characters at the beginning or end of a code span: - - A single backtick in a code span: `` ` `` - - A backtick-delimited string in a code span: `` `foo` `` - -will produce: - -

A single backtick in a code span: `

- -

A backtick-delimited string in a code span: `foo`

- -With a code span, ampersands and angle brackets are encoded as HTML -entities automatically, which makes it easy to include example HTML -tags. Markdown will turn this: - - Please don't use any `` tags. - -into: - -

Please don't use any <blink> tags.

- -You can write this: - - `—` is the decimal-encoded equivalent of `—`. - -to produce: - -

&#8212; is the decimal-encoded - equivalent of &mdash;.

- - - -

Images

- -Admittedly, it's fairly difficult to devise a "natural" syntax for -placing images into a plain text document format. - -Markdown uses an image syntax that is intended to resemble the syntax -for links, allowing for two styles: *inline* and *reference*. - -Inline image syntax looks like this: - - ![Alt text](/path/to/img.jpg) - - ![Alt text](/path/to/img.jpg "Optional title") - -That is: - -* An exclamation mark: `!`; -* followed by a set of square brackets, containing the `alt` - attribute text for the image; -* followed by a set of parentheses, containing the URL or path to - the image, and an optional `title` attribute enclosed in double - or single quotes. - -Reference-style image syntax looks like this: - - ![Alt text][id] - -Where "id" is the name of a defined image reference. Image references -are defined using syntax identical to link references: - - [id]: url/to/image "Optional title attribute" - -As of this writing, Markdown has no syntax for specifying the -dimensions of an image; if this is important to you, you can simply -use regular HTML `` tags. - - -* * * - - -

Miscellaneous

- - - -Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this: - - - -Markdown will turn this into: - - http://example.com/ - -Automatic links for email addresses work similarly, except that -Markdown will also perform a bit of randomized decimal and hex -entity-encoding to help obscure your address from address-harvesting -spambots. For example, Markdown will turn this: - - - -into something like this: - - address@exa - mple.com - -which will render in a browser as a clickable link to "address@example.com". - -(This sort of entity-encoding trick will indeed fool many, if not -most, address-harvesting bots, but it definitely won't fool all of -them. It's better than nothing, but an address published in this way -will probably eventually start receiving spam.) - - - -

Backslash Escapes

- -Markdown allows you to use backslash escapes to generate literal -characters which would otherwise have special meaning in Markdown's -formatting syntax. For example, if you wanted to surround a word with -literal asterisks (instead of an HTML `` tag), you can backslashes -before the asterisks, like this: - - \*literal asterisks\* - -Markdown provides backslash escapes for the following characters: - - \ backslash - ` backtick - * asterisk - _ underscore - {} curly braces - [] square brackets - () parentheses - # hash mark - + plus sign - - minus sign (hyphen) - . dot - ! exclamation mark - diff --git a/tests/markdown-test/nested-blockquotes.html b/tests/markdown-test/nested-blockquotes.html deleted file mode 100644 index f1b017e..0000000 --- a/tests/markdown-test/nested-blockquotes.html +++ /dev/null @@ -1,7 +0,0 @@ -
-

foo

-
-

bar

-
-

foo

-
\ No newline at end of file diff --git a/tests/markdown-test/nested-blockquotes.txt b/tests/markdown-test/nested-blockquotes.txt deleted file mode 100644 index ed3c624..0000000 --- a/tests/markdown-test/nested-blockquotes.txt +++ /dev/null @@ -1,5 +0,0 @@ -> foo -> -> > bar -> -> foo diff --git a/tests/markdown-test/ordered-and-unordered-list.html b/tests/markdown-test/ordered-and-unordered-list.html deleted file mode 100644 index 090c43c..0000000 --- a/tests/markdown-test/ordered-and-unordered-list.html +++ /dev/null @@ -1,146 +0,0 @@ -

Unordered

-

Asterisks tight:

-
    -
  • asterisk 1
  • -
  • asterisk 2
  • -
  • asterisk 3
  • -
-

Asterisks loose:

-
    -
  • -

    asterisk 1

    -
  • -
  • -

    asterisk 2

    -
  • -
  • -

    asterisk 3

    -
  • -
-
-

Pluses tight:

-
    -
  • Plus 1
  • -
  • Plus 2
  • -
  • Plus 3
  • -
-

Pluses loose:

-
    -
  • -

    Plus 1

    -
  • -
  • -

    Plus 2

    -
  • -
  • -

    Plus 3

    -
  • -
-
-

Minuses tight:

-
    -
  • Minus 1
  • -
  • Minus 2
  • -
  • Minus 3
  • -
-

Minuses loose:

-
    -
  • -

    Minus 1

    -
  • -
  • -

    Minus 2

    -
  • -
  • -

    Minus 3

    -
  • -
-

Ordered

-

Tight:

-
    -
  1. First
  2. -
  3. Second
  4. -
  5. Third
  6. -
-

and:

-
    -
  1. One
  2. -
  3. Two
  4. -
  5. Three
  6. -
-

Loose using tabs:

-
    -
  1. -

    First

    -
  2. -
  3. -

    Second

    -
  4. -
  5. -

    Third

    -
  6. -
-

and using spaces:

-
    -
  1. -

    One

    -
  2. -
  3. -

    Two

    -
  4. -
  5. -

    Three

    -
  6. -
-

Multiple paragraphs:

-
    -
  1. -

    Item 1, graf one.

    -

    Item 2. graf two. The quick brown fox jumped over the lazy dog's -back.

    -
  2. -
  3. -

    Item 2.

    -
  4. -
  5. -

    Item 3.

    -
  6. -
-

Nested

-
    -
  • Tab
      -
    • Tab
        -
      • Tab
      • -
      -
    • -
    -
  • -
-

Here's another:

-
    -
  1. First
  2. -
  3. Second:
      -
    • Fee
    • -
    • Fie
    • -
    • Foe
    • -
    -
  4. -
  5. Third
  6. -
-

Same thing but with paragraphs:

-
    -
  1. -

    First

    -
  2. -
  3. -

    Second:

    -
      -
    • Fee
    • -
    • Fie
    • -
    • Foe
    • -
    -
  4. -
  5. -

    Third

    -
  6. -
\ No newline at end of file diff --git a/tests/markdown-test/ordered-and-unordered-list.txt b/tests/markdown-test/ordered-and-unordered-list.txt deleted file mode 100644 index 621db58..0000000 --- a/tests/markdown-test/ordered-and-unordered-list.txt +++ /dev/null @@ -1,122 +0,0 @@ -## Unordered - -Asterisks tight: - -* asterisk 1 -* asterisk 2 -* asterisk 3 - - -Asterisks loose: - -* asterisk 1 - -* asterisk 2 - -* asterisk 3 - -* * * - -Pluses tight: - -+ Plus 1 -+ Plus 2 -+ Plus 3 - - -Pluses loose: - -+ Plus 1 - -+ Plus 2 - -+ Plus 3 - -* * * - - -Minuses tight: - -- Minus 1 -- Minus 2 -- Minus 3 - - -Minuses loose: - -- Minus 1 - -- Minus 2 - -- Minus 3 - - -## Ordered - -Tight: - -1. First -2. Second -3. Third - -and: - -1. One -2. Two -3. Three - - -Loose using tabs: - -1. First - -2. Second - -3. Third - -and using spaces: - -1. One - -2. Two - -3. Three - -Multiple paragraphs: - -1. Item 1, graf one. - - Item 2. graf two. The quick brown fox jumped over the lazy dog's - back. - -2. Item 2. - -3. Item 3. - - - -## Nested - -* Tab - * Tab - * Tab - -Here's another: - -1. First -2. Second: - * Fee - * Fie - * Foe -3. Third - -Same thing but with paragraphs: - -1. First - -2. Second: - * Fee - * Fie - * Foe - -3. Third diff --git a/tests/markdown-test/strong-and-em-together.html b/tests/markdown-test/strong-and-em-together.html deleted file mode 100644 index 7bf5163..0000000 --- a/tests/markdown-test/strong-and-em-together.html +++ /dev/null @@ -1,4 +0,0 @@ -

This is strong and em.

-

So is this word.

-

This is strong and em.

-

So is this word.

\ No newline at end of file diff --git a/tests/markdown-test/strong-and-em-together.txt b/tests/markdown-test/strong-and-em-together.txt deleted file mode 100644 index 95ee690..0000000 --- a/tests/markdown-test/strong-and-em-together.txt +++ /dev/null @@ -1,7 +0,0 @@ -***This is strong and em.*** - -So is ***this*** word. - -___This is strong and em.___ - -So is ___this___ word. diff --git a/tests/markdown-test/tabs.html b/tests/markdown-test/tabs.html deleted file mode 100644 index b26391b..0000000 --- a/tests/markdown-test/tabs.html +++ /dev/null @@ -1,23 +0,0 @@ -
    -
  • -

    this is a list item -indented with tabs

    -
  • -
  • -

    this is a list item -indented with spaces

    -
  • -
-

Code:

-
this code block is indented by one tab
-
-

And:

-
    this code block is indented by two tabs
-
-

And:

-
+   this is an example list item
-    indented with tabs
-
-+   this is an example list item
-    indented with spaces
-
\ No newline at end of file diff --git a/tests/markdown-test/tabs.txt b/tests/markdown-test/tabs.txt deleted file mode 100644 index 589d113..0000000 --- a/tests/markdown-test/tabs.txt +++ /dev/null @@ -1,21 +0,0 @@ -+ this is a list item - indented with tabs - -+ this is a list item - indented with spaces - -Code: - - this code block is indented by one tab - -And: - - this code block is indented by two tabs - -And: - - + this is an example list item - indented with tabs - - + this is an example list item - indented with spaces diff --git a/tests/markdown-test/tidyness.html b/tests/markdown-test/tidyness.html deleted file mode 100644 index 52b2eaf..0000000 --- a/tests/markdown-test/tidyness.html +++ /dev/null @@ -1,8 +0,0 @@ -
-

A list within a blockquote:

-
    -
  • asterisk 1
  • -
  • asterisk 2
  • -
  • asterisk 3
  • -
-
\ No newline at end of file diff --git a/tests/markdown-test/tidyness.txt b/tests/markdown-test/tidyness.txt deleted file mode 100644 index 5f18b8d..0000000 --- a/tests/markdown-test/tidyness.txt +++ /dev/null @@ -1,5 +0,0 @@ -> A list within a blockquote: -> -> * asterisk 1 -> * asterisk 2 -> * asterisk 3 diff --git a/tests/misc/amp-in-url.html b/tests/misc/amp-in-url.html deleted file mode 100644 index 2170a54..0000000 --- a/tests/misc/amp-in-url.html +++ /dev/null @@ -1 +0,0 @@ -

link

\ No newline at end of file diff --git a/tests/misc/amp-in-url.txt b/tests/misc/amp-in-url.txt deleted file mode 100644 index 471106e..0000000 --- a/tests/misc/amp-in-url.txt +++ /dev/null @@ -1 +0,0 @@ -[link](http://www.freewisdom.org/this&that) diff --git a/tests/misc/ampersand.html b/tests/misc/ampersand.html deleted file mode 100644 index 94ed80c..0000000 --- a/tests/misc/ampersand.html +++ /dev/null @@ -1,2 +0,0 @@ -

&

-

AT&T

\ No newline at end of file diff --git a/tests/misc/ampersand.txt b/tests/misc/ampersand.txt deleted file mode 100644 index 367d32c..0000000 --- a/tests/misc/ampersand.txt +++ /dev/null @@ -1,5 +0,0 @@ -& - -AT&T - - diff --git a/tests/misc/attributes2.html b/tests/misc/attributes2.html deleted file mode 100644 index 5971cc8..0000000 --- a/tests/misc/attributes2.html +++ /dev/null @@ -1,6 +0,0 @@ -

-

    -
  • -
-

Or in the middle of the text

-

\ No newline at end of file diff --git a/tests/misc/attributes2.txt b/tests/misc/attributes2.txt deleted file mode 100644 index d635cb2..0000000 --- a/tests/misc/attributes2.txt +++ /dev/null @@ -1,10 +0,0 @@ -{@id=TABLE.OF.CONTENTS} - - -* {@id=TABLEOFCONTENTS} - - -Or in the middle of the text {@id=TABLEOFCONTENTS} - -{@id=tableofcontents} - diff --git a/tests/misc/backtick-escape.html b/tests/misc/backtick-escape.html index 07f5115..da30541 100644 --- a/tests/misc/backtick-escape.html +++ b/tests/misc/backtick-escape.html @@ -1,3 +1,4 @@ -

\`This should not be in code.\` -`This also should not be in code.` +

`This should not be in code.` +\This should be in code.\\ +\`This should not be in code.\` `And finally this should not be in code.`

\ No newline at end of file diff --git a/tests/misc/backtick-escape.txt b/tests/misc/backtick-escape.txt index b4d80b2..c019463 100644 --- a/tests/misc/backtick-escape.txt +++ b/tests/misc/backtick-escape.txt @@ -1,3 +1,4 @@ -\\`This should not be in code.\\` -\`This also should not be in code.\` +\`This should not be in code.\` +\\`This should be in code.\\` +\\\`This should not be in code.\\\` \`And finally this should not be in code.` diff --git a/tests/misc/bidi.html b/tests/misc/bidi.html index ffe04dc..3cc0444 100644 --- a/tests/misc/bidi.html +++ b/tests/misc/bidi.html @@ -1,7 +1,7 @@

Python(パイソン)は、Guido van Rossum によって作られたオープンソースのオブジェクト指向スクリプト言語。Perlとともに欧米で広く普及している。イギリスのテレビ局 BBC が製作したコメディ番組『空飛ぶモンティ・パイソン』にちなんで名付けられた。 (Pythonには、爬虫類のニシキヘビの意味があり、Python言語のマスコットやアイコンとして使われることがある。)

|||||||||||||||||||||||||||||THIS SHOULD BE LTR|||||||||||||||||||||||||

-

|||||||||||||||||||||||||||||THIS SHOULD BE RTL|||||||||||||||||||||||||

-

(بايثون لغة برمجة حديثة بسيطة، واضحة، سريعة ، تستخدم أسلوب البرمجة الكائنية (THIS SHOULD BE LTR ) وقابلة للتطوير بالإضافة إلى أنها مجانية و مفتوح

+

|||||||||||||||||||||||||||||THIS SHOULD BE RTL|||||||||||||||||||||||||

+

(بايثون لغة برمجة حديثة بسيطة، واضحة، سريعة ، تستخدم أسلوب البرمجة الكائنية (THIS SHOULD BE LTR ) وقابلة للتطوير بالإضافة إلى أنها مجانية و مفتوح

پایتون زبان برنامه‌نویسی تفسیری و سطح بالا ، شی‌گرا و یک زبان برنامه‌نویسی تفسیری سمت سرور قدرتمند است که توسط گیدو ون روسوم در سال ۱۹۹۰ ساخته شد. این زبان در ویژگی‌ها شبیه پرل، روبی، اسکیم، اسمال‌تاک و تی‌سی‌ال است و از مدیریت خودکار حافظه استفاده می‌کند

Python,是一种面向对象的、直譯式的计算机程序设计语言,也是一种功能强大而完善的通用型语言,已经具有十多年的发展历史,成熟且稳定。

ބްލޫ ވޭލްގެ ދޫ މަތީގައި އެއްފަހަރާ 50 މީހުންނަށް ތިބެވިދާނެވެ. ބޮޑު މަހުގެ ދުލަކީ އެހާމެ ބޮޑު އެއްޗެކެވެ.

diff --git a/tests/misc/bidi.txt b/tests/misc/bidi.txt index f11ff1c..7e6dbea 100644 --- a/tests/misc/bidi.txt +++ b/tests/misc/bidi.txt @@ -2,10 +2,10 @@ |||||||||||||||||||||||||||||THIS SHOULD BE LTR||||||||||||||||||||||||| -|||||||||||||||||||||||||||||THIS SHOULD BE RTL||||||||||||||||||||||||| {@dir=rtl} +|||||||||||||||||||||||||||||THIS SHOULD BE RTL||||||||||||||||||||||||| -(**بايثون** لغة برمجة حديثة بسيطة، واضحة، سريعة ، تستخدم أسلوب البرمجة الكائنية (THIS SHOULD BE LTR ) وقابلة للتطوير {@dir=ltr} بالإضافة إلى أنها مجانية و مفتوح +(**بايثون** لغة برمجة حديثة بسيطة، واضحة، سريعة ، تستخدم أسلوب البرمجة الكائنية (THIS SHOULD BE LTR ) وقابلة للتطوير بالإضافة إلى أنها مجانية و مفتوح diff --git a/tests/misc/blank-block-quote.html b/tests/misc/blank-block-quote.html index 23df17a..966078c 100644 --- a/tests/misc/blank-block-quote.html +++ b/tests/misc/blank-block-quote.html @@ -1,3 +1,3 @@

aaaaaaaaaaa

-
+

bbbbbbbbbbb

\ No newline at end of file diff --git a/tests/misc/blank_lines_in_codeblocks.html b/tests/misc/blank_lines_in_codeblocks.html new file mode 100644 index 0000000..57a4c36 --- /dev/null +++ b/tests/misc/blank_lines_in_codeblocks.html @@ -0,0 +1,61 @@ +

Preserve blank lines in code blocks with tabs:

+
a code block
+
+two tabbed lines
+
+
+three tabbed lines
+
+
+
+four tabbed lines
+
+
+
+
+five tabbed lines
+
+
+
+
+
+six tabbed lines
+
+
+
+
+
+
+End of tabbed block
+
+

And without tabs:

+
a code block
+
+two blank lines
+
+
+three blank lines
+
+
+
+four blank lines
+
+
+
+
+five blank lines
+
+
+
+
+
+six blank lines
+
+
+
+
+
+
+End of block
+
+

End of document

\ No newline at end of file diff --git a/tests/misc/blank_lines_in_codeblocks.txt b/tests/misc/blank_lines_in_codeblocks.txt new file mode 100644 index 0000000..e7ae102 --- /dev/null +++ b/tests/misc/blank_lines_in_codeblocks.txt @@ -0,0 +1,73 @@ +Preserve blank lines in code blocks with tabs: + + a code block + + two tabbed lines + + + three tabbed lines + + + + four tabbed lines + + + + + five tabbed lines + + + + + + six tabbed lines + + + + + + + End of tabbed block + + + + + + +And without tabs: + + a code block + + two blank lines + + + three blank lines + + + + four blank lines + + + + + five blank lines + + + + + + six blank lines + + + + + + + End of block + + + + + + +End of document \ No newline at end of file diff --git a/tests/misc/blockquote-hr.html b/tests/misc/blockquote-hr.html index 61c1a3c..e13784f 100644 --- a/tests/misc/blockquote-hr.html +++ b/tests/misc/blockquote-hr.html @@ -13,4 +13,13 @@ With multiple lines. Even a lazy line.


The last line.

+
+

foo

+
+

bar

+
+
+
+
+

baz

\ No newline at end of file diff --git a/tests/misc/blockquote-hr.txt b/tests/misc/blockquote-hr.txt index ef9c44f..8f67b24 100644 --- a/tests/misc/blockquote-hr.txt +++ b/tests/misc/blockquote-hr.txt @@ -19,3 +19,9 @@ Even a lazy line. > --- > The last line. + +foo +> bar +> *** +--- +> baz diff --git a/tests/misc/br.html b/tests/misc/br.html index 08563a5..e8e6fdf 100644 --- a/tests/misc/br.html +++ b/tests/misc/br.html @@ -8,4 +8,4 @@ Or, if you prefer, <strong>use two underscores instead</strong>.<

Lists

Unordered (bulleted) lists use asterisks, pluses, and hyphens (*, +, and -) as list markers. These three markers are -interchangable; this:

\ No newline at end of file +interchangeable; this:

\ No newline at end of file diff --git a/tests/misc/br.txt b/tests/misc/br.txt index 59d29e0..19f4cf1 100644 --- a/tests/misc/br.txt +++ b/tests/misc/br.txt @@ -12,5 +12,5 @@ Output: Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`, `+`, and `-`) as list markers. These three markers are -interchangable; this: +interchangeable; this: diff --git a/tests/misc/brackets-in-img-title.html b/tests/misc/brackets-in-img-title.html new file mode 100644 index 0000000..3677139 --- /dev/null +++ b/tests/misc/brackets-in-img-title.html @@ -0,0 +1,9 @@ +

alt +alt +alt

+

alt +alt

+

alt +alt +alt +alt

\ No newline at end of file diff --git a/tests/misc/brackets-in-img-title.txt b/tests/misc/brackets-in-img-title.txt new file mode 100644 index 0000000..01fcd4e --- /dev/null +++ b/tests/misc/brackets-in-img-title.txt @@ -0,0 +1,12 @@ +![alt](local-img.jpg) +![alt](local-img.jpg "") +![alt](local-img.jpg "normal title") + +![alt](local-img.jpg "(just title in brackets)") +![alt](local-img.jpg "title with brackets (I think)") + +![alt](local-img.jpg "(") +![alt](local-img.jpg "(open only") +![alt](local-img.jpg ")") +![alt](local-img.jpg "close only)") + diff --git a/tests/misc/comments.html b/tests/misc/comments.html deleted file mode 100644 index 005a755..0000000 --- a/tests/misc/comments.html +++ /dev/null @@ -1,5 +0,0 @@ -

X<0

-

X>0

- - -
as if
\ No newline at end of file diff --git a/tests/misc/comments.txt b/tests/misc/comments.txt deleted file mode 100644 index 68302b0..0000000 --- a/tests/misc/comments.txt +++ /dev/null @@ -1,7 +0,0 @@ -X<0 - -X>0 - - - -
as if
diff --git a/tests/misc/div.html b/tests/misc/div.html deleted file mode 100644 index 7cd0d6d..0000000 --- a/tests/misc/div.html +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/tests/misc/div.txt b/tests/misc/div.txt deleted file mode 100644 index ca87745..0000000 --- a/tests/misc/div.txt +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/tests/misc/em-around-links.html b/tests/misc/em-around-links.html index 06bfa8e..cc415f5 100644 --- a/tests/misc/em-around-links.html +++ b/tests/misc/em-around-links.html @@ -1,16 +1,13 @@

Title

- - -

Python in Markdown by some - great folks - This does work as expected.

- +

Python in Markdown by some +great folks - This does work as expected.

\ No newline at end of file diff --git a/tests/misc/em-around-links.txt b/tests/misc/em-around-links.txt index 5b15be4..dbc3644 100644 --- a/tests/misc/em-around-links.txt +++ b/tests/misc/em-around-links.txt @@ -1,14 +1,14 @@ # Title - - *[Python in Markdown](http://www.freewisdom.org/projects/python-markdown/) by some + - *[Python in Markdown](http://example.com) by some great folks* - This *does* work as expected. - - _[Python in Markdown](http://www.freewisdom.org/projects/python-markdown/) by some + - _[Python in Markdown](http://example.com) by some great folks_ - This *does* work as expected. - - [_Python in Markdown_](http://www.freewisdom.org/projects/python-markdown/) by some + - [_Python in Markdown_](http://example.com) by some great folks - This *does* work as expected. - - [_Python in Markdown_](http://www.freewisdom.org/projects/python-markdown/) _by some + - [_Python in Markdown_](http://example.com) _by some great folks_ - This *does* work as expected. -_[Python in Markdown](http://www.freewisdom.org/projects/python-markdown/) by some +_[Python in Markdown](http://example.com) by some great folks_ - This *does* work as expected. diff --git a/tests/misc/em_strong.html b/tests/misc/em_strong.html index 75c92d8..776381b 100644 --- a/tests/misc/em_strong.html +++ b/tests/misc/em_strong.html @@ -7,4 +7,5 @@

three asterisks: ***

with spaces: * * *

three underscores: ___

-

with spaces: _ _ _

\ No newline at end of file +

with spaces: _ _ _

+

One char: a

\ No newline at end of file diff --git a/tests/misc/em_strong.txt b/tests/misc/em_strong.txt index d0774ad..1285665 100644 --- a/tests/misc/em_strong.txt +++ b/tests/misc/em_strong.txt @@ -18,3 +18,4 @@ three underscores: ___ with spaces: _ _ _ +One char: _a_ diff --git a/tests/misc/em_strong_complex.html b/tests/misc/em_strong_complex.html new file mode 100644 index 0000000..65faddf --- /dev/null +++ b/tests/misc/em_strong_complex.html @@ -0,0 +1,14 @@ +

test test test test

+

test test test test

+

test

+

test

+

test test_

+

test test

+

test_test test_test

+

test test test test

+

test test test test

+

*test

+

test

+

test*

+

test test

+

testtest testtest

\ No newline at end of file diff --git a/tests/misc/em_strong_complex.txt b/tests/misc/em_strong_complex.txt new file mode 100644 index 0000000..0425971 --- /dev/null +++ b/tests/misc/em_strong_complex.txt @@ -0,0 +1,27 @@ +___test test__ test test_ + +___test test_ test test__ + +___test___ + +__test__ + +___test_ test___ + +___test_ test__ + +_test_test test_test_ + +***test test** test test* + +***test test* test test** + +**test* + +***test*** + +**test*** + +***test* test** + +*test*test test*test* \ No newline at end of file diff --git a/tests/misc/email.html b/tests/misc/email.html index 0d033bb..8ef799f 100644 --- a/tests/misc/email.html +++ b/tests/misc/email.html @@ -1,2 +1,3 @@

asdfasdfadsfasd yuri@freewisdom.org or you can say -instead yuri@freewisdom.org

\ No newline at end of file +instead yuri@freewisdom.org

+

bob&sue@example.com

\ No newline at end of file diff --git a/tests/misc/email.txt b/tests/misc/email.txt index ece8801..c557c73 100644 --- a/tests/misc/email.txt +++ b/tests/misc/email.txt @@ -1,3 +1,5 @@ asdfasdfadsfasd or you can say instead + + diff --git a/tests/misc/escaped_links.html b/tests/misc/escaped_links.html new file mode 100644 index 0000000..b2a7c96 --- /dev/null +++ b/tests/misc/escaped_links.html @@ -0,0 +1,4 @@ +

Backslashed in links:

+

q=go:GO\:0000307

+

q=go:GO\:0000308

+

a \non-escaped char.

\ No newline at end of file diff --git a/tests/misc/escaped_links.txt b/tests/misc/escaped_links.txt new file mode 100644 index 0000000..c64ab26 --- /dev/null +++ b/tests/misc/escaped_links.txt @@ -0,0 +1,9 @@ +Backslashed in links: + +[q=go:GO\\:0000307](/query?q=go:GO\\:0000307) + +[q=go:GO\\:0000308][foo] + +[foo]: /query?q=go:GO\:0000308 "/query?q=go:GO\:0000308" + +a \non-escaped char. \ No newline at end of file diff --git a/tests/misc/h1.html b/tests/misc/h1.html index fbf9b4d..886b61e 100644 --- a/tests/misc/h1.html +++ b/tests/misc/h1.html @@ -1,3 +1,5 @@

Header

Header 2

-

H3

\ No newline at end of file +

H3

+

H1

+

H2

\ No newline at end of file diff --git a/tests/misc/h1.txt b/tests/misc/h1.txt index 0a1c8f9..f67b921 100644 --- a/tests/misc/h1.txt +++ b/tests/misc/h1.txt @@ -5,3 +5,9 @@ Header 2 ======== ### H3 + +H1 += + +H2 +-- diff --git a/tests/misc/header-in-lists.html b/tests/misc/header-in-lists.html new file mode 100644 index 0000000..351b44a --- /dev/null +++ b/tests/misc/header-in-lists.html @@ -0,0 +1,20 @@ +

Tight List:

+
    +
  • +

    Header1

    +Line 1-2 - not a header or paragraph!
  • +
  • +

    Header2

    +Line 2-2 - not a header or paragraph!
  • +
+

Loose List:

+
    +
  • +

    Header1

    +

    Line 1-2 - a paragraph

    +
  • +
  • +

    Header2

    +

    Line 2-2 - a paragraph

    +
  • +
\ No newline at end of file diff --git a/tests/misc/header-in-lists.txt b/tests/misc/header-in-lists.txt new file mode 100644 index 0000000..b22083e --- /dev/null +++ b/tests/misc/header-in-lists.txt @@ -0,0 +1,14 @@ +Tight List: + +* #Header1 +Line 1-2 - **not** a header *or* paragraph! +* #Header2 +Line 2-2 - not a header or paragraph! + +Loose List: + +* #Header1 +Line 1-2 - *a* paragraph + +* #Header2 +Line 2-2 - a paragraph diff --git a/tests/misc/html-comments.html b/tests/misc/html-comments.html deleted file mode 100644 index 7b36246..0000000 --- a/tests/misc/html-comments.html +++ /dev/null @@ -1,2 +0,0 @@ -

Here is HTML -and once more

\ No newline at end of file diff --git a/tests/misc/html-comments.txt b/tests/misc/html-comments.txt deleted file mode 100644 index cac4da5..0000000 --- a/tests/misc/html-comments.txt +++ /dev/null @@ -1,2 +0,0 @@ -Here is HTML -and once more

diff --git a/tests/misc/html.html b/tests/misc/html.html deleted file mode 100644 index 81ac5ee..0000000 --- a/tests/misc/html.html +++ /dev/null @@ -1,9 +0,0 @@ -

Block level html

- -

Some inline stuff.
-

-

Now some arbitrary tags.

-
More block level html.
- -

And of course .

-

this . - -[this ) - diff --git a/tests/misc/image.html b/tests/misc/image.html deleted file mode 100644 index 16be2d5..0000000 --- a/tests/misc/image.html +++ /dev/null @@ -1 +0,0 @@ -

Poster

\ No newline at end of file diff --git a/tests/misc/image.txt b/tests/misc/image.txt deleted file mode 100644 index 5553bd4..0000000 --- a/tests/misc/image.txt +++ /dev/null @@ -1,2 +0,0 @@ - -![Poster](http://humane_man.jpg "The most humane man.") diff --git a/tests/misc/ins-at-start-of-paragraph.html b/tests/misc/ins-at-start-of-paragraph.html new file mode 100644 index 0000000..a08524e --- /dev/null +++ b/tests/misc/ins-at-start-of-paragraph.html @@ -0,0 +1 @@ +

Hello, fellow developer this ins should be wrapped in a p.

\ No newline at end of file diff --git a/tests/misc/ins-at-start-of-paragraph.txt b/tests/misc/ins-at-start-of-paragraph.txt new file mode 100644 index 0000000..2aee0bc --- /dev/null +++ b/tests/misc/ins-at-start-of-paragraph.txt @@ -0,0 +1 @@ +Hello, fellow developer this ins should be wrapped in a p. diff --git a/tests/misc/lists3.html b/tests/misc/lists3.html index 991395b..7cfe001 100644 --- a/tests/misc/lists3.html +++ b/tests/misc/lists3.html @@ -1,5 +1,5 @@
  • blah blah blah -sdf asdf asdf asdf asdf -asda asdf asdfasd
  • + sdf asdf asdf asdf asdf + asda asdf asdfasd
\ No newline at end of file diff --git a/tests/misc/lists7.html b/tests/misc/lists7.html new file mode 100644 index 0000000..81c1daa --- /dev/null +++ b/tests/misc/lists7.html @@ -0,0 +1,98 @@ +
    +
  • item 1
  • +
  • +
      +
    • item 2-1
    • +
    • item 2-2
    • +
    • item 2-3
    • +
    • item 2-4
    • +
    +
  • +
  • item 3
  • +
  • +
      +
    • +

      item 4-1

      +
    • +
    • +

      item 4-2

      +
    • +
    • +

      item 4-3

      +
    • +
    • +

      item 4-4

      +
    • +
    +
  • +
+

same as above, different spacing

+
    +
  • item 1
  • +
  • +
      +
    • item 2-1
    • +
    • item 2-2
    • +
    +
  • +
  • item 3
  • +
  • +
      +
    • +

      item 4-1

      +
    • +
    • +

      item 4-2

      +
    • +
    +
  • +
+

only 1 item in nested list ##

+
    +
  • item 1
  • +
  • +
      +
    • item 2-1
    • +
    +
  • +
  • item 3
  • +
  • +
      +
    • item 4-1
    • +
    +
  • +
+

Something ludicrous ##

+
    +
  • item 1
  • +
  • +
      +
    • item 2-1
    • +
    • item 2-2
    • +
    • +
        +
      • item 2-2-1
      • +
      • item 2-2-2
      • +
      +
    • +
    • item 2-3
    • +
    +
  • +
  • item 3
  • +
  • +
      +
    • +

      item 4-1

      +
    • +
    • +
        +
      • item 4-1-1
      • +
      • item 4-1-2
      • +
      +
    • +
    • +

      item 4-2

      +
    • +
    +
  • +
\ No newline at end of file diff --git a/tests/misc/lists7.txt b/tests/misc/lists7.txt new file mode 100644 index 0000000..77181c8 --- /dev/null +++ b/tests/misc/lists7.txt @@ -0,0 +1,44 @@ +* item 1 +* * item 2-1 + * item 2-2 + * item 2-3 + * item 2-4 +* item 3 +* * item 4-1 + + * item 4-2 + + * item 4-3 + + * item 4-4 + +## same as above, different spacing +* item 1 +* * item 2-1 + * item 2-2 +* item 3 +* * item 4-1 + + * item 4-2 + +## only 1 item in nested list ## +* item 1 +* * item 2-1 +* item 3 +* * item 4-1 + +## Something ludicrous ## +* item 1 +* * item 2-1 + * item 2-2 + * * item 2-2-1 + * item 2-2-2 + * item 2-3 +* item 3 +* * item 4-1 + + * * item 4-1-1 + * item 4-1-2 + + * item 4-2 + diff --git a/tests/misc/lists8.html b/tests/misc/lists8.html new file mode 100644 index 0000000..8a93a51 --- /dev/null +++ b/tests/misc/lists8.html @@ -0,0 +1,39 @@ +

Lists with blockquotes

+
    +
  1. +
    +

    Four-score and seven years ago...

    +
    +
  2. +
  3. +
    +

    We have nothing to fear...

    +
    +
  4. +
  5. +
    +

    This is it...

    +
    +
  6. +
+

Multi-line blockquotes

+
    +
  • +
    +

    Four-score and sever years ago +our fathers brought forth

    +
    +
  • +
  • +
    +

    We have nothing to fear +but fear itself

    +
    +
  • +
  • +
    +

    This is it +as far as I'm concerned

    +
    +
  • +
\ No newline at end of file diff --git a/tests/misc/lists8.txt b/tests/misc/lists8.txt new file mode 100644 index 0000000..8ab6767 --- /dev/null +++ b/tests/misc/lists8.txt @@ -0,0 +1,16 @@ +# Lists with blockquotes +1. > Four-score and seven years ago... + +2. > We have nothing to fear... + +3. > This is it... + +# Multi-line blockquotes +* > Four-score and sever years ago + > our fathers brought forth + +* > We have nothing to fear + > but fear itself + +* > This is it + > as far as I'm concerned diff --git a/tests/misc/markup-inside-p.html b/tests/misc/markup-inside-p.html deleted file mode 100644 index 1b6b420..0000000 --- a/tests/misc/markup-inside-p.html +++ /dev/null @@ -1,21 +0,0 @@ -

- -_foo_ - -

- -

-_foo_ -

- -

_foo_

- -

- -_foo_ -

- -

-_foo_ - -

\ No newline at end of file diff --git a/tests/misc/markup-inside-p.txt b/tests/misc/markup-inside-p.txt deleted file mode 100644 index ab7dd0f..0000000 --- a/tests/misc/markup-inside-p.txt +++ /dev/null @@ -1,21 +0,0 @@ -

- -_foo_ - -

- -

-_foo_ -

- -

_foo_

- -

- -_foo_ -

- -

-_foo_ - -

diff --git a/tests/misc/mismatched-tags.html b/tests/misc/mismatched-tags.html deleted file mode 100644 index ec087e1..0000000 --- a/tests/misc/mismatched-tags.html +++ /dev/null @@ -1,11 +0,0 @@ -

Some text

- -
some more text
- -

and a bit more

-

And this output

- -

Compatible with PHP Markdown Extra 1.2.2 and Markdown.pl1.0.2b8:

-

text


- -

Should be in p

\ No newline at end of file diff --git a/tests/misc/mismatched-tags.txt b/tests/misc/mismatched-tags.txt deleted file mode 100644 index 8e6a52f..0000000 --- a/tests/misc/mismatched-tags.txt +++ /dev/null @@ -1,9 +0,0 @@ -

Some text

some more text
- -and a bit more - -

And this output

*Compatible with PHP Markdown Extra 1.2.2 and Markdown.pl1.0.2b8:* - -

text


- -Should be in p diff --git a/tests/misc/more_comments.html b/tests/misc/more_comments.html deleted file mode 100644 index 97074d5..0000000 --- a/tests/misc/more_comments.html +++ /dev/null @@ -1,7 +0,0 @@ - - -

- -foo - -

- -
- -

foo

-
\ No newline at end of file diff --git a/tests/misc/multiline-comments.txt b/tests/misc/multiline-comments.txt deleted file mode 100644 index 71bc418..0000000 --- a/tests/misc/multiline-comments.txt +++ /dev/null @@ -1,18 +0,0 @@ - - -

- -foo - -

- - -
- -foo - -
diff --git a/tests/misc/nested-lists.html b/tests/misc/nested-lists.html index bb73784..9af441a 100644 --- a/tests/misc/nested-lists.html +++ b/tests/misc/nested-lists.html @@ -36,4 +36,17 @@
  • item 2
  • +
  • item 3
  • +
  • +

    item 4

    +
      +
    • item 4-1
    • +
    • item 4-2
    • +
    • +

      item 4-3

      +

      Paragraph under item 4-3

      +
    • +
    +

    Paragraph under item 4

    +
  • \ No newline at end of file diff --git a/tests/misc/nested-lists.txt b/tests/misc/nested-lists.txt index 38aae15..a2704b4 100644 --- a/tests/misc/nested-lists.txt +++ b/tests/misc/nested-lists.txt @@ -22,3 +22,12 @@ plain text * item 1-2 * item 1-2-1 * item 2 +* item 3 +* item 4 + * item 4-1 + * item 4-2 + * item 4-3 + + Paragraph under item 4-3 + + Paragraph under item 4 diff --git a/tests/misc/nested-patterns.html b/tests/misc/nested-patterns.html index b90d46d..1c7bb43 100644 --- a/tests/misc/nested-patterns.html +++ b/tests/misc/nested-patterns.html @@ -1,7 +1,10 @@ -

    link -link -link -link -link -link -link

    \ No newline at end of file +

    link +link +link +link +link +link +link

    +

    I am italic and bold I am just bold

    +

    Example bold italic on the same line bold italic.

    +

    Example bold italic on the same line bold italic.

    \ No newline at end of file diff --git a/tests/misc/nested-patterns.txt b/tests/misc/nested-patterns.txt index 3f5dc3e..9032cf1 100644 --- a/tests/misc/nested-patterns.txt +++ b/tests/misc/nested-patterns.txt @@ -1,7 +1,13 @@ -___[link](http://www.freewisdom.org)___ -***[link](http://www.freewisdom.org)*** -**[*link*](http://www.freewisdom.org)** -__[_link_](http://www.freewisdom.org)__ -__[*link*](http://www.freewisdom.org)__ -**[_link_](http://www.freewisdom.org)** -[***link***](http://www.freewisdom.org) +___[link](http://example.com)___ +***[link](http://example.com)*** +**[*link*](http://example.com)** +__[_link_](http://example.com)__ +__[*link*](http://example.com)__ +**[_link_](http://example.com)** +[***link***](http://example.com) + +***I am ___italic_ and__ bold* I am `just` bold** + +Example __*bold italic*__ on the same line __*bold italic*__. + +Example **_bold italic_** on the same line **_bold italic_**. diff --git a/tests/misc/para-with-hr.html b/tests/misc/para-with-hr.html index 8569fec..7607449 100644 --- a/tests/misc/para-with-hr.html +++ b/tests/misc/para-with-hr.html @@ -1,3 +1,6 @@

    Here is a paragraph, followed by a horizontal rule.


    -

    Followed by another paragraph.

    \ No newline at end of file +

    Followed by another paragraph.

    +

    Here is another paragraph, followed by: +*** not an HR. +Followed by more of the same paragraph.

    \ No newline at end of file diff --git a/tests/misc/para-with-hr.txt b/tests/misc/para-with-hr.txt index 20735fb..165bbe3 100644 --- a/tests/misc/para-with-hr.txt +++ b/tests/misc/para-with-hr.txt @@ -2,3 +2,6 @@ Here is a paragraph, followed by a horizontal rule. *** Followed by another paragraph. +Here is another paragraph, followed by: +*** not an HR. +Followed by more of the same paragraph. diff --git a/tests/misc/php.html b/tests/misc/php.html deleted file mode 100644 index 8cd4ed5..0000000 --- a/tests/misc/php.html +++ /dev/null @@ -1,11 +0,0 @@ - - -

    This should have a p tag

    - - -
    This shouldn't
    - - - -

    <?php echo "not_block_level";?>

    \ No newline at end of file diff --git a/tests/misc/php.txt b/tests/misc/php.txt deleted file mode 100644 index ca5be45..0000000 --- a/tests/misc/php.txt +++ /dev/null @@ -1,13 +0,0 @@ - - -This should have a p tag - - - -
    This shouldn't
    - - - - - diff --git a/tests/misc/pre.html b/tests/misc/pre.html deleted file mode 100644 index a44ae12..0000000 --- a/tests/misc/pre.html +++ /dev/null @@ -1,13 +0,0 @@ -
    -
    -aaa
    -
    -bbb
    -
    - -
    -* and this is pre-formatted content
    -* and it should be printed just like this
    -* and not formatted as a list
    -
    -
    \ No newline at end of file diff --git a/tests/misc/pre.txt b/tests/misc/pre.txt deleted file mode 100644 index 31243b5..0000000 --- a/tests/misc/pre.txt +++ /dev/null @@ -1,14 +0,0 @@ -
    -
    -aaa
    -
    -bbb
    -
    - -
    -* and this is pre-formatted content
    -* and it should be printed just like this
    -* and not formatted as a list
    -
    -
    - diff --git a/tests/misc/some-test.html b/tests/misc/some-test.html index a36d1ee..b78683f 100644 --- a/tests/misc/some-test.html +++ b/tests/misc/some-test.html @@ -24,8 +24,10 @@

    Markdown

      -
    • Python - is ok
        +
      • +

        Python + is ok

        +
        • Therefore i am
      • diff --git a/tests/misc/tabs-in-lists.html b/tests/misc/tabs-in-lists.html index a1a92ec..fdb7cb6 100644 --- a/tests/misc/tabs-in-lists.html +++ b/tests/misc/tabs-in-lists.html @@ -19,7 +19,7 @@

        Now a list with 4 spaces and some text:

        • A -abcdef
        • + abcdef
        • B

        Now with a tab and an extra space:

        diff --git a/tests/misc/two-spaces.html b/tests/misc/two-spaces.html index 102d1db..97b54b4 100644 --- a/tests/misc/two-spaces.html +++ b/tests/misc/two-spaces.html @@ -4,14 +4,12 @@ but this line has three
        and this is the second from last line in this test message

          -
        • This list item has two spaces.
          -
        • +
        • This list item has two spaces.
        • This has none. This line has three.
          This line has none. - And this line two.
          -

          + And this line two.

          This line has none.

        • diff --git a/tests/misc/uche.html b/tests/misc/uche.html index e62329d..9134e95 100644 --- a/tests/misc/uche.html +++ b/tests/misc/uche.html @@ -1,3 +1,3 @@

          asif

          -

          +

          Alt text

          text

          \ No newline at end of file diff --git a/tests/misc/uche.txt b/tests/misc/uche.txt index a3dda1a..625d2ae 100644 --- a/tests/misc/uche.txt +++ b/tests/misc/uche.txt @@ -1,7 +1,6 @@ ![asif](http://fourthought.com/images/ftlogo.png "Fourthought logo") -[![{@style=float: left; margin: 10px; border: -none;}](http://fourthought.com/images/ftlogo.png "Fourthought +[![Alt text](http://fourthought.com/images/ftlogo.png "Fourthought logo")](http://fourthought.com/) [![text](x)](http://link.com/) diff --git a/tests/misc/underscores.html b/tests/misc/underscores.html index 54bd9f9..72d51b8 100644 --- a/tests/misc/underscores.html +++ b/tests/misc/underscores.html @@ -1,6 +1,6 @@

          THIS_SHOULD_STAY_AS_IS

          Here is some emphasis, ok?

          Ok, at least this should work.

          -

          THISSHOULDSTAY

          +

          THIS__SHOULD__STAY

          Here is some strong stuff.

          THISSHOULDSTAY?

          \ No newline at end of file diff --git a/tests/php/Auto Links.text b/tests/php/Auto Links.text new file mode 100644 index 0000000..4b10d32 --- /dev/null +++ b/tests/php/Auto Links.text @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/tests/php/Auto Links.xhtml b/tests/php/Auto Links.xhtml new file mode 100644 index 0000000..259c47f --- /dev/null +++ b/tests/php/Auto Links.xhtml @@ -0,0 +1,3 @@ +

          HTTP://WWW.SOMEURL.COM

          + +

          hr@company.com

          \ No newline at end of file diff --git a/tests/php/Backslash escapes.text b/tests/php/Backslash escapes.text new file mode 100644 index 0000000..a5e769b --- /dev/null +++ b/tests/php/Backslash escapes.text @@ -0,0 +1 @@ +Tricky combinaisons: backslash with \\-- two dashes backslash with \\> greater than \\\[test](not a link) \\\*no emphasis* \ No newline at end of file diff --git a/tests/php/Backslash escapes.xhtml b/tests/php/Backslash escapes.xhtml new file mode 100644 index 0000000..08fb8ef --- /dev/null +++ b/tests/php/Backslash escapes.xhtml @@ -0,0 +1 @@ +

          Tricky combinaisons:

          backslash with \-- two dashes

          backslash with \> greater than

          \[test](not a link)

          \*no emphasis*

          \ No newline at end of file diff --git a/tests/php/Code Spans.text b/tests/php/Code Spans.text new file mode 100644 index 0000000..43f2bcf --- /dev/null +++ b/tests/php/Code Spans.text @@ -0,0 +1,6 @@ +From `` +on two lines. + +From `` +on three lines. diff --git a/tests/php/Code Spans.xhtml b/tests/php/Code Spans.xhtml new file mode 100644 index 0000000..9ed0df8 --- /dev/null +++ b/tests/php/Code Spans.xhtml @@ -0,0 +1,6 @@ +

          From <!-- to --> +on two lines.

          + +

          From <!-- +to --> +on three lines.

          diff --git a/tests/php/Code block in a list item.text b/tests/php/Code block in a list item.text new file mode 100644 index 0000000..5093348 --- /dev/null +++ b/tests/php/Code block in a list item.text @@ -0,0 +1,15 @@ + +* List Item: + + code block + + with a blank line + + within a list item. + +* code block + as first element of a list item + +* List Item: + + code block with whitespace on preceding line \ No newline at end of file diff --git a/tests/php/Code block in a list item.xhtml b/tests/php/Code block in a list item.xhtml new file mode 100644 index 0000000..361c1ae --- /dev/null +++ b/tests/php/Code block in a list item.xhtml @@ -0,0 +1,18 @@ +
            +
          • List Item:

            + +
            code block
            +
            +with a blank line
            +
            + +

            within a list item.

          • +
          • code block
            +as first element of a list item
            +
          • + +
          • List Item:

            + +
            code block with whitespace on preceding line
            +
          • +
          \ No newline at end of file diff --git a/tests/php/Code block on second line.text b/tests/php/Code block on second line.text new file mode 100644 index 0000000..b7fcd97 --- /dev/null +++ b/tests/php/Code block on second line.text @@ -0,0 +1,2 @@ + + Codeblock on second line diff --git a/tests/php/Code block on second line.xhtml b/tests/php/Code block on second line.xhtml new file mode 100644 index 0000000..25abb16 --- /dev/null +++ b/tests/php/Code block on second line.xhtml @@ -0,0 +1,2 @@ +
          Codeblock on second line
          +
          diff --git a/tests/php/Email auto links.text b/tests/php/Email auto links.text new file mode 100644 index 0000000..a8af4ec --- /dev/null +++ b/tests/php/Email auto links.text @@ -0,0 +1,3 @@ + + +International domain names: \ No newline at end of file diff --git a/tests/php/Email auto links.xhtml b/tests/php/Email auto links.xhtml new file mode 100644 index 0000000..a32c408 --- /dev/null +++ b/tests/php/Email auto links.xhtml @@ -0,0 +1,3 @@ +

          michel.fortin@michelf.com

          + +

          International domain names: help@tūdaliņ.lv

          diff --git a/tests/php/Emphasis.text b/tests/php/Emphasis.text new file mode 100644 index 0000000..88e93d4 --- /dev/null +++ b/tests/php/Emphasis.text @@ -0,0 +1,80 @@ +Combined emphasis: + +1. ***test test*** +2. ___test test___ +3. *test **test*** +4. **test *test*** +5. ***test* test** +6. ***test** test* +7. ***test* test** +8. **test *test*** +9. *test **test*** +10. _test __test___ +11. __test _test___ +12. ___test_ test__ +13. ___test__ test_ +14. ___test_ test__ +15. __test _test___ +16. _test __test___ + + +Incorrect nesting: + +1. *test **test* test** +2. _test __test_ test__ +3. **test *test** test* +4. __test _test__ test_ +5. *test *test* test* +6. _test _test_ test_ +7. **test **test** test** +8. __test __test__ test__ + + + +No emphasis: + +1. test* test *test +2. test** test **test +3. test_ test _test +4. test__ test __test + + + +Middle-word emphasis (asterisks): + +1. *a*b +2. a*b* +3. a*b*c +4. **a**b +5. a**b** +6. a**b**c + + +Middle-word emphasis (underscore): + +1. _a_b +2. a_b_ +3. a_b_c +4. __a__b +5. a__b__ +6. a__b__c + +my_precious_file.txt + + +## Tricky Cases + +E**. **Test** TestTestTest + +E**. **Test** Test Test Test + + +## Overlong emphasis + +Name: ____________ +Organization: ____ +Region/Country: __ + +_____Cut here_____ + +____Cut here____ diff --git a/tests/php/Emphasis.xhtml b/tests/php/Emphasis.xhtml new file mode 100644 index 0000000..4879070 --- /dev/null +++ b/tests/php/Emphasis.xhtml @@ -0,0 +1,83 @@ +

          Combined emphasis:

          + +
            +
          1. test test
          2. +
          3. test test
          4. +
          5. test test
          6. +
          7. test test
          8. +
          9. test test
          10. +
          11. test test
          12. +
          13. test test
          14. +
          15. test test
          16. +
          17. test test
          18. +
          19. test test
          20. +
          21. test test
          22. +
          23. test test
          24. +
          25. test test
          26. +
          27. test test
          28. +
          29. test test
          30. +
          31. test test
          32. +
          + +

          Incorrect nesting:

          + +
            +
          1. *test test* test
          2. +
          3. _test test_ test
          4. +
          5. test *test test*
          6. +
          7. test _test test_
          8. +
          9. test *test test*
          10. +
          11. test _test test_
          12. +
          13. test **test test**
          14. +
          15. test __test test__
          16. +
          + +

          No emphasis:

          + +
            +
          1. test* test *test
          2. +
          3. test** test **test
          4. +
          5. test_ test _test
          6. +
          7. test__ test __test
          8. +
          + +

          Middle-word emphasis (asterisks):

          + +
            +
          1. ab
          2. +
          3. ab
          4. +
          5. abc
          6. +
          7. ab
          8. +
          9. ab
          10. +
          11. abc
          12. +
          + +

          Middle-word emphasis (underscore):

          + +
            +
          1. ab
          2. +
          3. ab
          4. +
          5. abc
          6. +
          7. ab
          8. +
          9. ab
          10. +
          11. abc
          12. +
          + +

          mypreciousfile.txt

          + +

          Tricky Cases

          + +

          E**. Test TestTestTest

          + +

          E**. Test Test Test Test

          + + +

          Overlong emphasis

          + +

          Name: ____________
          +Organization: ____
          +Region/Country: __

          + +

          _____Cut here_____

          + +

          ____Cut here____

          \ No newline at end of file diff --git a/tests/php/Empty List Item.text b/tests/php/Empty List Item.text new file mode 100644 index 0000000..3c4edba --- /dev/null +++ b/tests/php/Empty List Item.text @@ -0,0 +1,35 @@ +With asterisks + + * List item + * + * List item + +With numbers + +1. List item +2. +3. List item + +With hyphens + +- List item +- +- List item + +With asterisks + + * List item + * List item + * + +With numbers + +1. List item +2. List item +3. + +With hyphens + +- List item +- List item +- diff --git a/tests/php/Empty List Item.xhtml b/tests/php/Empty List Item.xhtml new file mode 100644 index 0000000..02d86ed --- /dev/null +++ b/tests/php/Empty List Item.xhtml @@ -0,0 +1,47 @@ +

          With asterisks

          + +
            +
          • List item
          • +
          • +
          • List item
          • +
          + +

          With numbers

          + +
            +
          1. List item
          2. +
          3. +
          4. List item
          5. +
          + +

          With hyphens

          + +
            +
          • List item
          • +
          • +
          • List item
          • +
          + +

          With asterisks

          + +
            +
          • List item
          • +
          • List item
          • +
          • +
          + +

          With numbers

          + +
            +
          1. List item
          2. +
          3. List item
          4. +
          5. +
          + +

          With hyphens

          + +
            +
          • List item
          • +
          • List item
          • +
          • +
          \ No newline at end of file diff --git a/tests/php/Headers.text b/tests/php/Headers.text new file mode 100644 index 0000000..3a39174 --- /dev/null +++ b/tests/php/Headers.text @@ -0,0 +1,9 @@ +Header ====== Header ------ ### Header + + - - - + +Header ====== Paragraph Header ------ Paragraph ### Header Paragraph + + - - - + +Paragraph Header ====== Paragraph Paragraph Header ------ Paragraph Paragraph ### Header Paragraph \ No newline at end of file diff --git a/tests/php/Headers.xhtml b/tests/php/Headers.xhtml new file mode 100644 index 0000000..3adb470 --- /dev/null +++ b/tests/php/Headers.xhtml @@ -0,0 +1,39 @@ +

          Header

          + +

          Header

          + +

          Header

          + +
          + +

          Header

          + +

          Paragraph

          + +

          Header

          + +

          Paragraph

          + +

          Header

          + +

          Paragraph

          + +
          + +

          Paragraph

          + +

          Header

          + +

          Paragraph

          + +

          Paragraph

          + +

          Header

          + +

          Paragraph

          + +

          Paragraph

          + +

          Header

          + +

          Paragraph

          diff --git a/tests/php/Horizontal Rules.text b/tests/php/Horizontal Rules.text new file mode 100644 index 0000000..8e2da0b --- /dev/null +++ b/tests/php/Horizontal Rules.text @@ -0,0 +1,29 @@ +Horizontal rules: + +- - - + +* * * + +*** + +--- + +___ + +Not horizontal rules (testing for a bug in 1.0.1j): + ++++ + +,,, + +=== + +??? + +AAA + +jjj + +j j j + +n n n diff --git a/tests/php/Horizontal Rules.xhtml b/tests/php/Horizontal Rules.xhtml new file mode 100644 index 0000000..b9170b1 --- /dev/null +++ b/tests/php/Horizontal Rules.xhtml @@ -0,0 +1,30 @@ +

          Horizontal rules:

          + +
          + +
          + +
          + +
          + +
          + +

          Not horizontal rules (testing for a bug in 1.0.1j):

          + +

          +++

          + +

          ,,,

          + +

          ===

          + +

          ???

          + +

          AAA

          + +

          jjj

          + +

          j j j

          + +

          n n n

          + diff --git a/tests/php/Inline HTML (Simple).text b/tests/php/Inline HTML (Simple).text new file mode 100644 index 0000000..9177105 --- /dev/null +++ b/tests/php/Inline HTML (Simple).text @@ -0,0 +1,15 @@ +With some attributes: + +
          + foo +
          + +
          + foo +
          + +Hr's: + +
          diff --git a/tests/php/Inline HTML (Simple).xhtml b/tests/php/Inline HTML (Simple).xhtml new file mode 100644 index 0000000..facfefb --- /dev/null +++ b/tests/php/Inline HTML (Simple).xhtml @@ -0,0 +1,15 @@ +

          With some attributes:

          + +
          + foo +
          + +
          + foo +
          + +

          Hr's:

          + +
          \ No newline at end of file diff --git a/tests/php/Inline HTML (Span).text b/tests/php/Inline HTML (Span).text new file mode 100644 index 0000000..19028bb --- /dev/null +++ b/tests/php/Inline HTML (Span).text @@ -0,0 +1,4 @@ +ACINACS + +SB +SB \ No newline at end of file diff --git a/tests/php/Inline HTML (Span).xhtml b/tests/php/Inline HTML (Span).xhtml new file mode 100644 index 0000000..4d18aff --- /dev/null +++ b/tests/php/Inline HTML (Span).xhtml @@ -0,0 +1,4 @@ +

          ACINACS

          + +

          SB +SB

          \ No newline at end of file diff --git a/tests/php/Inline HTML comments.text b/tests/php/Inline HTML comments.text new file mode 100644 index 0000000..d57d00a --- /dev/null +++ b/tests/php/Inline HTML comments.text @@ -0,0 +1,9 @@ +Paragraph one. + + + +Paragraph two. + + + +The end. diff --git a/tests/php/Inline HTML comments.xhtml b/tests/php/Inline HTML comments.xhtml new file mode 100644 index 0000000..b45f014 --- /dev/null +++ b/tests/php/Inline HTML comments.xhtml @@ -0,0 +1,9 @@ +

          Paragraph one.

          + + + +

          Paragraph two.

          + + + +

          The end.

          diff --git a/tests/php/Ins & del.text b/tests/php/Ins & del.text new file mode 100644 index 0000000..2d54c66 --- /dev/null +++ b/tests/php/Ins & del.text @@ -0,0 +1,17 @@ +Here is a block tag ins: + + +

          Some text

          +
          + +And here it is inside a paragraph. + +And here it is in the middle of a paragraph. + + +

          Some text

          +
          + +And here is ins as a paragraph. + +And here it is in the middle of a paragraph. diff --git a/tests/php/Ins & del.xhtml b/tests/php/Ins & del.xhtml new file mode 100644 index 0000000..60e8c5f --- /dev/null +++ b/tests/php/Ins & del.xhtml @@ -0,0 +1,17 @@ +

          Here is a block tag ins:

          + + +

          Some text

          +
          + +

          And here it is inside a paragraph.

          + +

          And here it is in the middle of a paragraph.

          + + +

          Some text

          +
          + +

          And here is ins as a paragraph.

          + +

          And here it is in the middle of a paragraph.

          diff --git a/tests/php/License b/tests/php/License new file mode 100644 index 0000000..d511905 --- /dev/null +++ b/tests/php/License @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/tests/php/Links, inline style.text b/tests/php/Links, inline style.text new file mode 100644 index 0000000..600a044 --- /dev/null +++ b/tests/php/Links, inline style.text @@ -0,0 +1 @@ +[silly URL w/ angle brackets](). diff --git a/tests/php/Links, inline style.xhtml b/tests/php/Links, inline style.xhtml new file mode 100644 index 0000000..d3e4d11 --- /dev/null +++ b/tests/php/Links, inline style.xhtml @@ -0,0 +1 @@ +

          silly URL w/ angle brackets.

          diff --git a/tests/php/MD5 Hashes.text b/tests/php/MD5 Hashes.text new file mode 100644 index 0000000..7e03221 --- /dev/null +++ b/tests/php/MD5 Hashes.text @@ -0,0 +1,11 @@ +# Character Escapes + +The MD5 value for `+` is "26b17225b626fb9238849fd60eabdf60". + +# HTML Blocks + +

          test

          + +The MD5 value for `

          test

          ` is: + +6205333b793f34273d75379350b36826 \ No newline at end of file diff --git a/tests/php/MD5 Hashes.xhtml b/tests/php/MD5 Hashes.xhtml new file mode 100644 index 0000000..894e4aa --- /dev/null +++ b/tests/php/MD5 Hashes.xhtml @@ -0,0 +1,11 @@ +

          Character Escapes

          + +

          The MD5 value for + is "26b17225b626fb9238849fd60eabdf60".

          + +

          HTML Blocks

          + +

          test

          + +

          The MD5 value for <p>test</p> is:

          + +

          6205333b793f34273d75379350b36826

          diff --git a/tests/php/Mixed OLs and ULs.text b/tests/php/Mixed OLs and ULs.text new file mode 100644 index 0000000..cecde21 --- /dev/null +++ b/tests/php/Mixed OLs and ULs.text @@ -0,0 +1,13 @@ +* test ++ test +- test + +1. test +2. test + +* test ++ test +- test + +1. test +2. test diff --git a/tests/php/Mixed OLs and ULs.xhtml b/tests/php/Mixed OLs and ULs.xhtml new file mode 100644 index 0000000..0872aaa --- /dev/null +++ b/tests/php/Mixed OLs and ULs.xhtml @@ -0,0 +1,21 @@ +
            +
          • test
          • +
          • test
          • +
          • test
          • +
          + +
            +
          1. test
          2. +
          3. test
          4. +
          + +
            +
          • test
          • +
          • test
          • +
          • test
          • +
          + +
            +
          1. test
          2. +
          3. test
          4. +
          diff --git a/tests/php/Nesting.text b/tests/php/Nesting.text new file mode 100644 index 0000000..791538c --- /dev/null +++ b/tests/php/Nesting.text @@ -0,0 +1,11 @@ +Valid nesting: + +**[Link](url)** + +[**Link**](url) + +**[**Link**](url)** + +Invalid nesting: + +[[Link](url)](url) \ No newline at end of file diff --git a/tests/php/Nesting.xhtml b/tests/php/Nesting.xhtml new file mode 100644 index 0000000..37845d3 --- /dev/null +++ b/tests/php/Nesting.xhtml @@ -0,0 +1,11 @@ +

          Valid nesting:

          + +

          Link

          + +

          Link

          + +

          Link

          + +

          Invalid nesting:

          + +

          [Link](url)

          diff --git a/tests/php/PHP-Specific Bugs.text b/tests/php/PHP-Specific Bugs.text new file mode 100644 index 0000000..246b60d --- /dev/null +++ b/tests/php/PHP-Specific Bugs.text @@ -0,0 +1,22 @@ +This tests for a bug where quotes escaped by PHP when using +`preg_replace` with the `/e` modifier must be correctly unescaped +(hence the `_UnslashQuotes` function found only in PHP Markdown). + + + +Headers below should appear exactly as they are typed (no backslash +added or removed). + +Header "quoted\" again \\"" +=========================== + +Header "quoted\" again \\"" +--------------------------- + +### Header "quoted\" again \\"" ### + + + +Test with tabs for `_Detab`: + + Code 'block' with some "tabs" and "quotes" diff --git a/tests/php/PHP-Specific Bugs.xhtml b/tests/php/PHP-Specific Bugs.xhtml new file mode 100644 index 0000000..c982417 --- /dev/null +++ b/tests/php/PHP-Specific Bugs.xhtml @@ -0,0 +1,17 @@ +

          This tests for a bug where quotes escaped by PHP when using +preg_replace with the /e modifier must be correctly unescaped +(hence the _UnslashQuotes function found only in PHP Markdown).

          + +

          Headers below should appear exactly as they are typed (no backslash +added or removed).

          + +

          Header "quoted\" again \""

          + +

          Header "quoted\" again \""

          + +

          Header "quoted\" again \""

          + +

          Test with tabs for _Detab:

          + +
          Code    'block' with    some    "tabs"  and "quotes"
          +
          diff --git a/tests/php/Parens in URL.text b/tests/php/Parens in URL.text new file mode 100644 index 0000000..bb7be4f --- /dev/null +++ b/tests/php/Parens in URL.text @@ -0,0 +1,14 @@ +[Inline link 1 with parens](/url\(test\) "title"). + +[Inline link 2 with parens]( "title"). + +[Inline link 3 with non-escaped parens](/url(test) "title"). + +[Inline link 4 with non-escaped parens]( "title"). + +[Reference link 1 with parens][1]. + +[Reference link 2 with parens][2]. + + [1]: /url(test) "title" + [2]: "title" diff --git a/tests/php/Parens in URL.xhtml b/tests/php/Parens in URL.xhtml new file mode 100644 index 0000000..a81aa02 --- /dev/null +++ b/tests/php/Parens in URL.xhtml @@ -0,0 +1,11 @@ +

          Inline link 1 with parens.

          + +

          Inline link 2 with parens.

          + +

          Inline link 3 with non-escaped parens.

          + +

          Inline link 4 with non-escaped parens.

          + +

          Reference link 1 with parens.

          + +

          Reference link 2 with parens.

          \ No newline at end of file diff --git a/tests/php/Quotes in attributes.text b/tests/php/Quotes in attributes.text new file mode 100644 index 0000000..9792286 --- /dev/null +++ b/tests/php/Quotes in attributes.text @@ -0,0 +1,5 @@ +[Test](/"style="color:red) +[Test](/'style='color:red) + +![](/"style="border-color:red;border-size:1px;border-style:solid) +![](/'style='border-color:red;border-size:1px;border-style:solid) diff --git a/tests/php/Quotes in attributes.xhtml b/tests/php/Quotes in attributes.xhtml new file mode 100644 index 0000000..e3fcfd2 --- /dev/null +++ b/tests/php/Quotes in attributes.xhtml @@ -0,0 +1,5 @@ +

          Test +Test

          + +

          +

          diff --git a/tests/php/Tight blocks.text b/tests/php/Tight blocks.text new file mode 100644 index 0000000..ae4cdcb --- /dev/null +++ b/tests/php/Tight blocks.text @@ -0,0 +1 @@ +Paragraph and no space: * ciao Paragraph and 1 space: * ciao Paragraph and 3 spaces: * ciao Paragraph and 4 spaces: * ciao Paragraph before header: #Header Paragraph before blockquote: >Some quote. \ No newline at end of file diff --git a/tests/php/Tight blocks.xhtml b/tests/php/Tight blocks.xhtml new file mode 100644 index 0000000..8655430 --- /dev/null +++ b/tests/php/Tight blocks.xhtml @@ -0,0 +1,21 @@ +

          Paragraph and no space: +* ciao

          + +

          Paragraph and 1 space: + * ciao

          + +

          Paragraph and 3 spaces: + * ciao

          + +

          Paragraph and 4 spaces: + * ciao

          + +

          Paragraph before header:

          + +

          Header

          + +

          Paragraph before blockquote:

          + +
          +

          Some quote.

          +
          diff --git a/tests/php/extra/Abbr.text b/tests/php/extra/Abbr.text new file mode 100644 index 0000000..ae72f4e --- /dev/null +++ b/tests/php/extra/Abbr.text @@ -0,0 +1,31 @@ +Some text about HTML, SGML and HTML4. + +Let's talk about the U.S.A., (É.U. or É.-U. d'A. in French). + +*[HTML4]: Hyper Text Markup Language version 4 +*[HTML]: Hyper Text Markup Language +*[SGML]: Standard Generalized Markup Language +*[U.S.A.]: United States of America +*[É.U.] : États-Unis d'Amérique +*[É.-U. d'A.] : États-Unis d'Amérique + +And here we have a CD, some CDs, and some other CD's. + +*[CD]: Compact Disk + +Let's transfert documents through TCP/IP, using TCP packets. + +*[IP]: Internet Protocol +*[TCP]: Transmission Control Protocol + + --- + +Bienvenue sur [CMS](http://www.bidulecms.com "Bidule CMS"). + +*[CMS]: Content Management System + + --- + +ATCCE + +*[ATCCE]: Abbreviation "Testing" Correct 'Character' < Escapes > \ No newline at end of file diff --git a/tests/php/extra/Abbr.xhtml b/tests/php/extra/Abbr.xhtml new file mode 100644 index 0000000..8beaa2e --- /dev/null +++ b/tests/php/extra/Abbr.xhtml @@ -0,0 +1,15 @@ +

          Some text about HTML, SGML and HTML4.

          + +

          Let's talk about the U.S.A., (É.U. or É.-U. d'A. in French).

          + +

          And here we have a CD, some CDs, and some other CD's.

          + +

          Let's transfert documents through TCP/IP, using TCP packets.

          + +
          + +

          Bienvenue sur CMS.

          + +
          + +

          ATCCE

          diff --git a/tests/php/extra/Definition Lists.text b/tests/php/extra/Definition Lists.text new file mode 100644 index 0000000..5b3bdb6 --- /dev/null +++ b/tests/php/extra/Definition Lists.text @@ -0,0 +1,115 @@ +A simple definition list: + +Term 1 +: Definition 1 + +Term 2 +: Definition 2 + +With multiple terms: + +Term 1 +Term 2 +: Definition 1 + +Term 3 +Term 4 +: Definition 2 + +With multiple definitions: + +Term 1 +: Definition 1 +: Definition 2 + +Term 2 +: Definition 3 +: Definition 4 + +With multiple lines per definition: + +Term 1 +: Definition 1 line 1 ... +Definition 1 line 2 +: Definition 2 line 1 ... +Definition 2 line 2 + +Term 2 +: Definition 3 line 2 ... + Definition 3 line 2 +: Definition 4 line 2 ... + Definition 4 line 2 + +With paragraphs: + +Term 1 + +: Definition 1 (paragraph) + +Term 2 + +: Definition 2 (paragraph) + +With multiple paragraphs: + +Term 1 + +: Definition 1 paragraph 1 line 1 ... + Definition 1 paragraph 1 line 2 + + Definition 1 paragraph 2 line 1 ... + Definition 1 paragraph 2 line 2 + +Term 2 + +: Definition 1 paragraph 1 line 1 ... +Definition 1 paragraph 1 line 2 (lazy) + + Definition 1 paragraph 2 line 1 ... +Definition 1 paragraph 2 line 2 (lazy) + +* * * + +A mix: + +Term 1 +Term 2 + +: Definition 1 paragraph 1 line 1 ... +Definition 1 paragraph 1 line 2 (lazy) + + Definition 1 paragraph 2 line 1 ... + Definition 1 paragraph 2 line 2 + +: Definition 2 paragraph 1 line 1 ... +Definition 2 paragraph 1 line 2 (lazy) + +Term 3 +: Definition 3 (no paragraph) +: Definition 4 (no paragraph) +: Definition 5 line 1 ... + Definition 5 line 2 (no paragraph) + +: Definition 6 paragraph 1 line 1 ... +Definition 6 paragraph 1 line 2 +: Definition 7 (no paragraph) +: Definition 8 paragraph 1 line 1 (forced paragraph) ... + Definition 8 paragraph 1 line 2 + + Definition 8 paragraph 2 line 1 + +Term 4 +: Definition 9 paragraph 1 line 1 (forced paragraph) ... + Definition 9 paragraph 1 line 2 + + Definition 9 paragraph 2 line 1 +: Definition 10 (no paragraph) + +* * * + +Special cases: + +Term + +: code block + as first element of a definition \ No newline at end of file diff --git a/tests/php/extra/Definition Lists.xhtml b/tests/php/extra/Definition Lists.xhtml new file mode 100644 index 0000000..f99f456 --- /dev/null +++ b/tests/php/extra/Definition Lists.xhtml @@ -0,0 +1,155 @@ +

          A simple definition list:

          + +
          +
          Term 1
          +
          Definition 1
          + +
          Term 2
          +
          Definition 2
          +
          + +

          With multiple terms:

          + +
          +
          Term 1
          +
          Term 2
          +
          Definition 1
          + +
          Term 3
          +
          Term 4
          +
          Definition 2
          +
          + +

          With multiple definitions:

          + +
          +
          Term 1
          +
          Definition 1
          + +
          Definition 2
          + +
          Term 2
          +
          Definition 3
          + +
          Definition 4
          +
          + +

          With multiple lines per definition:

          + +
          +
          Term 1
          +
          Definition 1 line 1 ... +Definition 1 line 2
          + +
          Definition 2 line 1 ... +Definition 2 line 2
          + +
          Term 2
          +
          Definition 3 line 2 ... +Definition 3 line 2
          + +
          Definition 4 line 2 ... +Definition 4 line 2
          +
          + +

          With paragraphs:

          + +
          +
          Term 1
          +
          +

          Definition 1 (paragraph)

          +
          + +
          Term 2
          +
          +

          Definition 2 (paragraph)

          +
          +
          + +

          With multiple paragraphs:

          + +
          +
          Term 1
          +
          +

          Definition 1 paragraph 1 line 1 ... +Definition 1 paragraph 1 line 2

          + +

          Definition 1 paragraph 2 line 1 ... +Definition 1 paragraph 2 line 2

          +
          + +
          Term 2
          +
          +

          Definition 1 paragraph 1 line 1 ... +Definition 1 paragraph 1 line 2 (lazy)

          + +

          Definition 1 paragraph 2 line 1 ... +Definition 1 paragraph 2 line 2 (lazy)

          +
          +
          + +
          + +

          A mix:

          + +
          +
          Term 1
          +
          Term 2
          +
          +

          Definition 1 paragraph 1 line 1 ... +Definition 1 paragraph 1 line 2 (lazy)

          + +

          Definition 1 paragraph 2 line 1 ... +Definition 1 paragraph 2 line 2

          +
          + +
          +

          Definition 2 paragraph 1 line 1 ... +Definition 2 paragraph 1 line 2 (lazy)

          +
          + +
          Term 3
          +
          Definition 3 (no paragraph)
          + +
          Definition 4 (no paragraph)
          + +
          Definition 5 line 1 ... +Definition 5 line 2 (no paragraph)
          + +
          +

          Definition 6 paragraph 1 line 1 ... +Definition 6 paragraph 1 line 2

          +
          + +
          Definition 7 (no paragraph)
          + +
          +

          Definition 8 paragraph 1 line 1 (forced paragraph) ... +Definition 8 paragraph 1 line 2

          + +

          Definition 8 paragraph 2 line 1

          +
          + +
          Term 4
          +
          +

          Definition 9 paragraph 1 line 1 (forced paragraph) ... +Definition 9 paragraph 1 line 2

          + +

          Definition 9 paragraph 2 line 1

          +
          + +
          Definition 10 (no paragraph)
          +
          + +
          + +

          Special cases:

          + +
          +
          Term
          +
          +
          code block
          +as first element of a definition
          +
          +
          +
          diff --git a/tests/php/extra/Emphasis.text b/tests/php/extra/Emphasis.text new file mode 100644 index 0000000..88e93d4 --- /dev/null +++ b/tests/php/extra/Emphasis.text @@ -0,0 +1,80 @@ +Combined emphasis: + +1. ***test test*** +2. ___test test___ +3. *test **test*** +4. **test *test*** +5. ***test* test** +6. ***test** test* +7. ***test* test** +8. **test *test*** +9. *test **test*** +10. _test __test___ +11. __test _test___ +12. ___test_ test__ +13. ___test__ test_ +14. ___test_ test__ +15. __test _test___ +16. _test __test___ + + +Incorrect nesting: + +1. *test **test* test** +2. _test __test_ test__ +3. **test *test** test* +4. __test _test__ test_ +5. *test *test* test* +6. _test _test_ test_ +7. **test **test** test** +8. __test __test__ test__ + + + +No emphasis: + +1. test* test *test +2. test** test **test +3. test_ test _test +4. test__ test __test + + + +Middle-word emphasis (asterisks): + +1. *a*b +2. a*b* +3. a*b*c +4. **a**b +5. a**b** +6. a**b**c + + +Middle-word emphasis (underscore): + +1. _a_b +2. a_b_ +3. a_b_c +4. __a__b +5. a__b__ +6. a__b__c + +my_precious_file.txt + + +## Tricky Cases + +E**. **Test** TestTestTest + +E**. **Test** Test Test Test + + +## Overlong emphasis + +Name: ____________ +Organization: ____ +Region/Country: __ + +_____Cut here_____ + +____Cut here____ diff --git a/tests/php/extra/Emphasis.xhtml b/tests/php/extra/Emphasis.xhtml new file mode 100644 index 0000000..1fa8218 --- /dev/null +++ b/tests/php/extra/Emphasis.xhtml @@ -0,0 +1,83 @@ +

          Combined emphasis:

          + +
            +
          1. test test
          2. +
          3. test test
          4. +
          5. test test
          6. +
          7. test test
          8. +
          9. test test
          10. +
          11. test test
          12. +
          13. test test
          14. +
          15. test test
          16. +
          17. test test
          18. +
          19. test test
          20. +
          21. test test
          22. +
          23. test test
          24. +
          25. test test
          26. +
          27. test test
          28. +
          29. test test
          30. +
          31. test test
          32. +
          + +

          Incorrect nesting:

          + +
            +
          1. *test test* test
          2. +
          3. _test test_ test
          4. +
          5. test *test test*
          6. +
          7. test _test test_
          8. +
          9. test *test test*
          10. +
          11. test _test test_
          12. +
          13. test **test test**
          14. +
          15. test __test test__
          16. +
          + +

          No emphasis:

          + +
            +
          1. test* test *test
          2. +
          3. test** test **test
          4. +
          5. test_ test _test
          6. +
          7. test__ test __test
          8. +
          + +

          Middle-word emphasis (asterisks):

          + +
            +
          1. ab
          2. +
          3. ab
          4. +
          5. abc
          6. +
          7. ab
          8. +
          9. ab
          10. +
          11. abc
          12. +
          + +

          Middle-word emphasis (underscore):

          + +
            +
          1. _a_b
          2. +
          3. a_b_
          4. +
          5. a_b_c
          6. +
          7. __a__b
          8. +
          9. a__b__
          10. +
          11. a__b__c
          12. +
          + +

          my_precious_file.txt

          + +

          Tricky Cases

          + +

          E**. Test TestTestTest

          + +

          E**. Test Test Test Test

          + + +

          Overlong emphasis

          + +

          Name: ____________
          +Organization: ____
          +Region/Country: __

          + +

          _____Cut here_____

          + +

          ____Cut here____

          diff --git a/tests/php/extra/Fenced Code Blocks.text b/tests/php/extra/Fenced Code Blocks.text new file mode 100644 index 0000000..f2400ff --- /dev/null +++ b/tests/php/extra/Fenced Code Blocks.text @@ -0,0 +1,60 @@ +~~~ +Fenced +~~~ + +Code block starting and ending with empty lines: +~~~ + + +Fenced + + +~~~ + +Indented code block containing fenced code block sample: + + ~~~ + Fenced + ~~~ + +Fenced code block with indented code block sample: + +~~~ +Some text + + Indented code block sample code +~~~ + +Fenced code block with long markers: + +~~~~~~~~~~~~~~~~~~ +Fenced +~~~~~~~~~~~~~~~~~~ + +Fenced code block with fenced code block markers of different length in it: + +~~~~ +In code block +~~~ +Still in code block +~~~~~ +Still in code block +~~~~ + +Fenced code block with Markdown header and horizontal rule: + +~~~ +#test +--- +~~~ + +Fenced code block with link definitions, footnote definition and +abbreviation definitions: + +~~~ +[example]: http://example.com/ + +[^1]: Footnote def + +*[HTML]: HyperText Markup Language +~~~ \ No newline at end of file diff --git a/tests/php/extra/Fenced Code Blocks.xhtml b/tests/php/extra/Fenced Code Blocks.xhtml new file mode 100644 index 0000000..518908c --- /dev/null +++ b/tests/php/extra/Fenced Code Blocks.xhtml @@ -0,0 +1,53 @@ +
          Fenced
          +
          + +

          Code block starting and ending with empty lines:

          + +


          Fenced + + +
          + +

          Indented code block containing fenced code block sample:

          + +
          ~~~
          +Fenced
          +~~~
          +
          + +

          Fenced code block with indented code block sample:

          + +
          Some text
          +
          +    Indented code block sample code
          +
          + +

          Fenced code block with long markers:

          + +
          Fenced
          +
          + +

          Fenced code block with fenced code block markers of different length in it:

          + +
          In code block
          +~~~
          +Still in code block
          +~~~~~
          +Still in code block
          +
          + +

          Fenced code block with Markdown header and horizontal rule:

          + +
          #test
          +---
          +
          + +

          Fenced code block with link definitions, footnote definition and +abbreviation definitions:

          + +
          [example]: http://example.com/
          +
          +[^1]: Footnote def
          +
          +*[HTML]: HyperText Markup Language
          +
          diff --git a/tests/php/extra/Footnotes.text b/tests/php/extra/Footnotes.text new file mode 100644 index 0000000..40192e9 --- /dev/null +++ b/tests/php/extra/Footnotes.text @@ -0,0 +1,61 @@ +This is the first paragraph.[^first] + +[^first]: This is the first note. + +* List item one.[^second] +* List item two.[^third] + +[^third]: This is the third note, defined out of order. +[^second]: This is the second note. +[^fourth]: This is the fourth note. + +# Header[^fourth] + +Some paragraph with a footnote[^1], and another[^2]. + +[^1]: Content for fifth footnote. +[^2]: Content for sixth footnote spaning on + three lines, with some span-level markup like + _emphasis_, a [link][]. + +[link]: http://www.michelf.com/ + +Another paragraph with a named footnote[^fn-name]. + +[^fn-name]: + Footnote beginning on the line next to the marker. + +This paragraph should not have a footnote marker since +the footnote is undefined.[^3] + +This paragraph should not have a footnote marker since +the footnote has already been used before.[^1] + +This paragraph links to a footnote with plenty of +block-level content.[^block] + +[^block]: + Paragraph. + + * List item + + > Blockquote + + Code block + +This paragraph host the footnote reference within a +footnote test[^reference]. + +[^reference]: + This footnote has a footnote of its own.[^nested] + +[^nested]: + This footnote should appear even though as it is refered + from another footnote. But [^reference] should be litteral + since the footnote with that name has already been used. + + - - - + +Testing unusual footnote name[^1$^!"']. + +[^1$^!"']: Haha! diff --git a/tests/php/extra/Footnotes.xhtml b/tests/php/extra/Footnotes.xhtml new file mode 100644 index 0000000..e33639d --- /dev/null +++ b/tests/php/extra/Footnotes.xhtml @@ -0,0 +1,96 @@ +

          This is the first paragraph.1

          + +
            +
          • List item one.2
          • +
          • List item two.3
          • +
          + +

          Header4

          + +

          Some paragraph with a footnote5, and another6.

          + +

          Another paragraph with a named footnote7.

          + +

          This paragraph should not have a footnote marker since +the footnote is undefined.[^3]

          + +

          This paragraph should not have a footnote marker since +the footnote has already been used before.[^1]

          + +

          This paragraph links to a footnote with plenty of +block-level content.8

          + +

          This paragraph host the footnote reference within a +footnote test9.

          + +
          + +

          Testing unusual footnote name10.

          + +
          +
          +
            + +
          1. +

            This is the first note. 

            +
          2. + +
          3. +

            This is the second note. 

            +
          4. + +
          5. +

            This is the third note, defined out of order. 

            +
          6. + +
          7. +

            This is the fourth note. 

            +
          8. + +
          9. +

            Content for fifth footnote. 

            +
          10. + +
          11. +

            Content for sixth footnote spaning on +three lines, with some span-level markup like +emphasis, a link

            +
          12. + +
          13. +

            Footnote beginning on the line next to the marker. 

            +
          14. + +
          15. +

            Paragraph.

            + +
              +
            • List item
            • +
            + +
            +

            Blockquote

            +
            + +
            Code block
            +
            + +

            +
          16. + +
          17. +

            This footnote has a footnote of its own.11 

            +
          18. + +
          19. +

            Haha! 

            +
          20. + +
          21. +

            This footnote should appear even though as it is refered +from another footnote. But [^reference] should be litteral +since the footnote with that name has already been used. 

            +
          22. + +
          +
          diff --git a/tests/php/extra/Inline HTML with Markdown content.text b/tests/php/extra/Inline HTML with Markdown content.text new file mode 100644 index 0000000..1eb5450 --- /dev/null +++ b/tests/php/extra/Inline HTML with Markdown content.text @@ -0,0 +1,104 @@ +# Markdown inside code blocks + +
          +foo +
          + +
          +foo +
          + +
          +foo +
          + + + +
          test _emphasis_ (span)
          + + + +
          test _emphasis_ (span)
          + + + +
          test _emphasis_ (block)
          + +## More complicated + + + + + +
          +* this is _not_ a list item
          +* this is _not_ a list item
          +* this _is_ a list item +
          + +## With indent + +
          +
          + This text is no code block: if it was, the + closing `
          ` would be too and the HTML block + would be invalid. + + Markdown content in HTML blocks is assumed to be + indented the same as the block opening tag. + + **This should be the third paragraph after the header.** +
          +
          + +## Code block with rogue `
          `s in Markdown code span and block + +
          +
          + + This is a code block however: + +
          + + Funny isn't it? Here is a code span: `
          `. + +
    +
    + +
    +
    + * List item, not a code block + +Some text + + This is a code block. +
    +
    + +## No code block in markdown span mode + +

    + This is not a code block since Markdown parse paragraph + content as span. Code spans like `

    ` are allowed though. +

    + +

    _Hello_ _world_

    + +## Preserving attributes and tags on more than one line: + +

    +Some _span_ content. +

    + + +## Header confusion bug + + + + + +
    Hello World! +============ + +Hello World!
    diff --git a/tests/php/extra/Inline HTML with Markdown content.xhtml b/tests/php/extra/Inline HTML with Markdown content.xhtml new file mode 100644 index 0000000..4751f78 --- /dev/null +++ b/tests/php/extra/Inline HTML with Markdown content.xhtml @@ -0,0 +1,125 @@ +

    Markdown inside code blocks

    + +
    + +

    foo

    + +
    + +
    + +

    foo

    + +
    + +
    + +

    foo

    + +
    + + + +
    test emphasis (span)
    + + + +
    test emphasis (span)
    + + + +
    + +

    test emphasis (block)

    + +
    + +

    More complicated

    + + + + + +
    +* this is not a list item
    +* this is not a list item
    + +
      +
    • this is a list item
    • +
    + +
    + +

    With indent

    + +
    +
    + +

    This text is no code block: if it was, the +closing <div> would be too and the HTML block +would be invalid.

    + +

    Markdown content in HTML blocks is assumed to be +indented the same as the block opening tag.

    + +

    This should be the third paragraph after the header.

    + +
    +
    + +

    Code block with rogue </div>s in Markdown code span and block

    + +
    +
    + +

    This is a code block however:

    + +
    </div>
    +
    + +

    Funny isn't it? Here is a code span: </div>.

    + +
    +
    + +
    +
    + +
      +
    • List item, not a code block
    • +
    + +

    Some text

    + +
    This is a code block.
    +
    + +
    +
    + +

    No code block in markdown span mode

    + +

    + This is not a code block since Markdown parse paragraph + content as span. Code spans like </p> are allowed though. +

    + +

    Hello world

    + +

    Preserving attributes and tags on more than one line:

    + +

    +Some span content. +

    + +

    Header confusion bug

    + + + + + +
    Hello World! +============ + +Hello World!
    \ No newline at end of file diff --git a/tests/php/extra/Tables.text b/tests/php/extra/Tables.text new file mode 100644 index 0000000..71b93ca --- /dev/null +++ b/tests/php/extra/Tables.text @@ -0,0 +1,104 @@ +# Simple tables + +Header 1 | Header 2 +--------- | --------- +Cell 1 | Cell 2 +Cell 3 | Cell 4 + +With leading pipes: + +| Header 1 | Header 2 +| --------- | --------- +| Cell 1 | Cell 2 +| Cell 3 | Cell 4 + +With tailing pipes: + +Header 1 | Header 2 | +--------- | --------- | +Cell 1 | Cell 2 | +Cell 3 | Cell 4 | + +With leading and tailing pipes: + +| Header 1 | Header 2 | +| --------- | --------- | +| Cell 1 | Cell 2 | +| Cell 3 | Cell 4 | + +* * * + +# One-column one-row table + +With leading pipes: + +| Header +| ------- +| Cell + +With tailing pipes: + +Header | +------- | +Cell | + +With leading and tailing pipes: + +| Header | +| ------- | +| Cell | + +* * * + +Table alignement: + +| Default | Right | Center | Left | +| --------- |:--------- |:---------:| ---------:| +| Long Cell | Long Cell | Long Cell | Long Cell | +| Cell | Cell | Cell | Cell | + +Table alignement (alternate spacing): + +| Default | Right | Center | Left | +| --------- | :-------- | :-------: | --------: | +| Long Cell | Long Cell | Long Cell | Long Cell | +| Cell | Cell | Cell | Cell | + +* * * + +# Empty cells + +| Header 1 | Header 2 | +| --------- | --------- | +| A | B | +| C | | + +Header 1 | Header 2 +--------- | --------- +A | B + | D + +* * * + +# Missing tailing pipe + +Header 1 | Header 2 +--------- | --------- | +Cell | Cell | +Cell | Cell | + +Header 1 | Header 2 | +--------- | --------- +Cell | Cell | +Cell | Cell | + +Header 1 | Header 2 | +--------- | --------- | +Cell | Cell +Cell | Cell | + +Header 1 | Header 2 | +--------- | --------- | +Cell | Cell | +Cell | Cell + diff --git a/tests/php/extra/Tables.xhtml b/tests/php/extra/Tables.xhtml new file mode 100644 index 0000000..e36286c --- /dev/null +++ b/tests/php/extra/Tables.xhtml @@ -0,0 +1,310 @@ +

    Simple tables

    + + + + + + + + + + + + + + + + + + +
    Header 1Header 2
    Cell 1Cell 2
    Cell 3Cell 4
    + +

    With leading pipes:

    + + + + + + + + + + + + + + + + + + +
    Header 1Header 2
    Cell 1Cell 2
    Cell 3Cell 4
    + +

    With tailing pipes:

    + + + + + + + + + + + + + + + + + + +
    Header 1Header 2
    Cell 1Cell 2
    Cell 3Cell 4
    + +

    With leading and tailing pipes:

    + + + + + + + + + + + + + + + + + + +
    Header 1Header 2
    Cell 1Cell 2
    Cell 3Cell 4
    + +
    + +

    One-column one-row table

    + +

    With leading pipes:

    + + + + + + + + + + + + +
    Header
    Cell
    + +

    With tailing pipes:

    + + + + + + + + + + + + +
    Header
    Cell
    + +

    With leading and tailing pipes:

    + + + + + + + + + + + + +
    Header
    Cell
    + +
    + +

    Table alignement:

    + + + + + + + + + + + + + + + + + + + + + + + + +
    DefaultRightCenterLeft
    Long CellLong CellLong CellLong Cell
    CellCellCellCell
    + +

    Table alignement (alternate spacing):

    + + + + + + + + + + + + + + + + + + + + + + + + +
    DefaultRightCenterLeft
    Long CellLong CellLong CellLong Cell
    CellCellCellCell
    + +
    + +

    Empty cells

    + + + + + + + + + + + + + + + + + + +
    Header 1Header 2
    AB
    C
    + + + + + + + + + + + + + + + + + + +
    Header 1Header 2
    AB
    D
    + +
    + +

    Missing tailing pipe

    + + + + + + + + + + + + + + + + + + +
    Header 1Header 2
    CellCell
    CellCell
    + + + + + + + + + + + + + + + + + + +
    Header 1Header 2
    CellCell
    CellCell
    + + + + + + + + + + + + + + + + + + +
    Header 1Header 2
    CellCell
    CellCell
    + + + + + + + + + + + + + + + + + + +
    Header 1Header 2
    CellCell
    CellCell
    \ No newline at end of file diff --git a/tests/pl/Tests_2004/Amps and angle encoding.html b/tests/pl/Tests_2004/Amps and angle encoding.html new file mode 100644 index 0000000..9606860 --- /dev/null +++ b/tests/pl/Tests_2004/Amps and angle encoding.html @@ -0,0 +1,17 @@ +

    AT&T has an ampersand in their name.

    + +

    AT&T is another way to write it.

    + +

    This & that.

    + +

    4 < 5.

    + +

    6 > 5.

    + +

    Here's a link with an ampersand in the URL.

    + +

    Here's a link with an amersand in the link text: AT&T.

    + +

    Here's an inline link.

    + +

    Here's an inline link.

    diff --git a/tests/pl/Tests_2004/Amps and angle encoding.text b/tests/pl/Tests_2004/Amps and angle encoding.text new file mode 100644 index 0000000..0e9527f --- /dev/null +++ b/tests/pl/Tests_2004/Amps and angle encoding.text @@ -0,0 +1,21 @@ +AT&T has an ampersand in their name. + +AT&T is another way to write it. + +This & that. + +4 < 5. + +6 > 5. + +Here's a [link] [1] with an ampersand in the URL. + +Here's a link with an amersand in the link text: [AT&T] [2]. + +Here's an inline [link](/script?foo=1&bar=2). + +Here's an inline [link](). + + +[1]: http://example.com/?foo=1&bar=2 +[2]: http://att.com/ "AT&T" \ No newline at end of file diff --git a/tests/pl/Tests_2004/Auto links.html b/tests/pl/Tests_2004/Auto links.html new file mode 100644 index 0000000..f8df985 --- /dev/null +++ b/tests/pl/Tests_2004/Auto links.html @@ -0,0 +1,18 @@ +

    Link: http://example.com/.

    + +

    With an ampersand: http://example.com/?foo=1&bar=2

    + + + +
    +

    Blockquoted: http://example.com/

    +
    + +

    Auto-links should not occur here: <http://example.com/>

    + +
    or here: <http://example.com/>
    +
    diff --git a/tests/pl/Tests_2004/Auto links.text b/tests/pl/Tests_2004/Auto links.text new file mode 100644 index 0000000..abbc488 --- /dev/null +++ b/tests/pl/Tests_2004/Auto links.text @@ -0,0 +1,13 @@ +Link: . + +With an ampersand: + +* In a list? +* +* It should. + +> Blockquoted: + +Auto-links should not occur here: `` + + or here: \ No newline at end of file diff --git a/tests/pl/Tests_2004/Backslash escapes.html b/tests/pl/Tests_2004/Backslash escapes.html new file mode 100644 index 0000000..77823c3 --- /dev/null +++ b/tests/pl/Tests_2004/Backslash escapes.html @@ -0,0 +1,102 @@ +

    These should all get escaped:

    + +

    Backslash: \

    + +

    Backtick: `

    + +

    Asterisk: *

    + +

    Underscore: _

    + +

    Left brace: {

    + +

    Right brace: }

    + +

    Left bracket: [

    + +

    Right bracket: ]

    + +

    Left paren: (

    + +

    Right paren: )

    + +

    Greater-than: >

    + +

    Hash: #

    + +

    Period: .

    + +

    Bang: !

    + +

    Plus: +

    + +

    Minus: -

    + +

    These should not, because they occur within a code block:

    + +
    Backslash: \\
    +
    +Backtick: \`
    +
    +Asterisk: \*
    +
    +Underscore: \_
    +
    +Left brace: \{
    +
    +Right brace: \}
    +
    +Left bracket: \[
    +
    +Right bracket: \]
    +
    +Left paren: \(
    +
    +Right paren: \)
    +
    +Greater-than: \>
    +
    +Hash: \#
    +
    +Period: \.
    +
    +Bang: \!
    +
    +Plus: \+
    +
    +Minus: \-
    +
    + +

    Nor should these, which occur in code spans:

    + +

    Backslash: \\

    + +

    Backtick: \`

    + +

    Asterisk: \*

    + +

    Underscore: \_

    + +

    Left brace: \{

    + +

    Right brace: \}

    + +

    Left bracket: \[

    + +

    Right bracket: \]

    + +

    Left paren: \(

    + +

    Right paren: \)

    + +

    Greater-than: \>

    + +

    Hash: \#

    + +

    Period: \.

    + +

    Bang: \!

    + +

    Plus: \+

    + +

    Minus: \-

    diff --git a/tests/pl/Tests_2004/Backslash escapes.text b/tests/pl/Tests_2004/Backslash escapes.text new file mode 100644 index 0000000..16447a0 --- /dev/null +++ b/tests/pl/Tests_2004/Backslash escapes.text @@ -0,0 +1,104 @@ +These should all get escaped: + +Backslash: \\ + +Backtick: \` + +Asterisk: \* + +Underscore: \_ + +Left brace: \{ + +Right brace: \} + +Left bracket: \[ + +Right bracket: \] + +Left paren: \( + +Right paren: \) + +Greater-than: \> + +Hash: \# + +Period: \. + +Bang: \! + +Plus: \+ + +Minus: \- + + + +These should not, because they occur within a code block: + + Backslash: \\ + + Backtick: \` + + Asterisk: \* + + Underscore: \_ + + Left brace: \{ + + Right brace: \} + + Left bracket: \[ + + Right bracket: \] + + Left paren: \( + + Right paren: \) + + Greater-than: \> + + Hash: \# + + Period: \. + + Bang: \! + + Plus: \+ + + Minus: \- + + +Nor should these, which occur in code spans: + +Backslash: `\\` + +Backtick: `` \` `` + +Asterisk: `\*` + +Underscore: `\_` + +Left brace: `\{` + +Right brace: `\}` + +Left bracket: `\[` + +Right bracket: `\]` + +Left paren: `\(` + +Right paren: `\)` + +Greater-than: `\>` + +Hash: `\#` + +Period: `\.` + +Bang: `\!` + +Plus: `\+` + +Minus: `\-` diff --git a/tests/pl/Tests_2004/Blockquotes with code blocks.html b/tests/pl/Tests_2004/Blockquotes with code blocks.html new file mode 100644 index 0000000..990202a --- /dev/null +++ b/tests/pl/Tests_2004/Blockquotes with code blocks.html @@ -0,0 +1,15 @@ +
    +

    Example:

    + +
    sub status {
    +    print "working";
    +}
    +
    + +

    Or:

    + +
    sub status {
    +    return "working";
    +}
    +
    +
    diff --git a/tests/pl/Tests_2004/Blockquotes with code blocks.text b/tests/pl/Tests_2004/Blockquotes with code blocks.text new file mode 100644 index 0000000..c31d171 --- /dev/null +++ b/tests/pl/Tests_2004/Blockquotes with code blocks.text @@ -0,0 +1,11 @@ +> Example: +> +> sub status { +> print "working"; +> } +> +> Or: +> +> sub status { +> return "working"; +> } diff --git a/tests/pl/Tests_2004/Hard-wrapped paragraphs with list-like lines.html b/tests/pl/Tests_2004/Hard-wrapped paragraphs with list-like lines.html new file mode 100644 index 0000000..e21ac79 --- /dev/null +++ b/tests/pl/Tests_2004/Hard-wrapped paragraphs with list-like lines.html @@ -0,0 +1,8 @@ +

    In Markdown 1.0.0 and earlier. Version +8. This line turns into a list item. +Because a hard-wrapped line in the +middle of a paragraph looked like a +list item.

    + +

    Here's one with a bullet. +* criminey.

    diff --git a/tests/pl/Tests_2004/Hard-wrapped paragraphs with list-like lines.text b/tests/pl/Tests_2004/Hard-wrapped paragraphs with list-like lines.text new file mode 100644 index 0000000..f8a5b27 --- /dev/null +++ b/tests/pl/Tests_2004/Hard-wrapped paragraphs with list-like lines.text @@ -0,0 +1,8 @@ +In Markdown 1.0.0 and earlier. Version +8. This line turns into a list item. +Because a hard-wrapped line in the +middle of a paragraph looked like a +list item. + +Here's one with a bullet. +* criminey. diff --git a/tests/pl/Tests_2004/Horizontal rules.html b/tests/pl/Tests_2004/Horizontal rules.html new file mode 100644 index 0000000..2dc2ab6 --- /dev/null +++ b/tests/pl/Tests_2004/Horizontal rules.html @@ -0,0 +1,71 @@ +

    Dashes:

    + +
    + +
    + +
    + +
    + +
    ---
    +
    + +
    + +
    + +
    + +
    + +
    - - -
    +
    + +

    Asterisks:

    + +
    + +
    + +
    + +
    + +
    ***
    +
    + +
    + +
    + +
    + +
    + +
    * * *
    +
    + +

    Underscores:

    + +
    + +
    + +
    + +
    + +
    ___
    +
    + +
    + +
    + +
    + +
    + +
    _ _ _
    +
    diff --git a/tests/pl/Tests_2004/Horizontal rules.text b/tests/pl/Tests_2004/Horizontal rules.text new file mode 100644 index 0000000..1594bda --- /dev/null +++ b/tests/pl/Tests_2004/Horizontal rules.text @@ -0,0 +1,67 @@ +Dashes: + +--- + + --- + + --- + + --- + + --- + +- - - + + - - - + + - - - + + - - - + + - - - + + +Asterisks: + +*** + + *** + + *** + + *** + + *** + +* * * + + * * * + + * * * + + * * * + + * * * + + +Underscores: + +___ + + ___ + + ___ + + ___ + + ___ + +_ _ _ + + _ _ _ + + _ _ _ + + _ _ _ + + _ _ _ diff --git a/tests/pl/Tests_2004/Inline HTML (Advanced).html b/tests/pl/Tests_2004/Inline HTML (Advanced).html new file mode 100644 index 0000000..1972d87 --- /dev/null +++ b/tests/pl/Tests_2004/Inline HTML (Advanced).html @@ -0,0 +1,14 @@ +

    Simple block on one line:

    + +
    foo
    + +

    And nested without indentation:

    + +
    +
    +
    +foo +
    +
    +
    bar
    +
    diff --git a/tests/pl/Tests_2004/Inline HTML (Advanced).text b/tests/pl/Tests_2004/Inline HTML (Advanced).text new file mode 100644 index 0000000..9d71ddc --- /dev/null +++ b/tests/pl/Tests_2004/Inline HTML (Advanced).text @@ -0,0 +1,14 @@ +Simple block on one line: + +
    foo
    + +And nested without indentation: + +
    +
    +
    +foo +
    +
    +
    bar
    +
    diff --git a/tests/pl/Tests_2004/Inline HTML (Simple).html b/tests/pl/Tests_2004/Inline HTML (Simple).html new file mode 100644 index 0000000..6bf78f8 --- /dev/null +++ b/tests/pl/Tests_2004/Inline HTML (Simple).html @@ -0,0 +1,72 @@ +

    Here's a simple block:

    + +
    + foo +
    + +

    This should be a code block, though:

    + +
    <div>
    +    foo
    +</div>
    +
    + +

    As should this:

    + +
    <div>foo</div>
    +
    + +

    Now, nested:

    + +
    +
    +
    + foo +
    +
    +
    + +

    This should just be an HTML comment:

    + + + +

    Multiline:

    + + + +

    Code block:

    + +
    <!-- Comment -->
    +
    + +

    Just plain comment, with trailing spaces on the line:

    + + + +

    Code:

    + +
    <hr />
    +
    + +

    Hr's:

    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    diff --git a/tests/pl/Tests_2004/Inline HTML (Simple).text b/tests/pl/Tests_2004/Inline HTML (Simple).text new file mode 100644 index 0000000..14aa2dc --- /dev/null +++ b/tests/pl/Tests_2004/Inline HTML (Simple).text @@ -0,0 +1,69 @@ +Here's a simple block: + +
    + foo +
    + +This should be a code block, though: + +
    + foo +
    + +As should this: + +
    foo
    + +Now, nested: + +
    +
    +
    + foo +
    +
    +
    + +This should just be an HTML comment: + + + +Multiline: + + + +Code block: + + + +Just plain comment, with trailing spaces on the line: + + + +Code: + +
    + +Hr's: + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + diff --git a/tests/pl/Tests_2004/Inline HTML comments.html b/tests/pl/Tests_2004/Inline HTML comments.html new file mode 100644 index 0000000..3f167a1 --- /dev/null +++ b/tests/pl/Tests_2004/Inline HTML comments.html @@ -0,0 +1,13 @@ +

    Paragraph one.

    + + + + + +

    Paragraph two.

    + + + +

    The end.

    diff --git a/tests/pl/Tests_2004/Inline HTML comments.text b/tests/pl/Tests_2004/Inline HTML comments.text new file mode 100644 index 0000000..41d830d --- /dev/null +++ b/tests/pl/Tests_2004/Inline HTML comments.text @@ -0,0 +1,13 @@ +Paragraph one. + + + + + +Paragraph two. + + + +The end. diff --git a/tests/pl/Tests_2004/Links, inline style.html b/tests/pl/Tests_2004/Links, inline style.html new file mode 100644 index 0000000..bdfabb5 --- /dev/null +++ b/tests/pl/Tests_2004/Links, inline style.html @@ -0,0 +1,9 @@ +

    Just a URL.

    + +

    URL and title.

    + +

    URL and title.

    + +

    URL and title.

    + +

    Empty.

    diff --git a/tests/pl/Tests_2004/Links, inline style.text b/tests/pl/Tests_2004/Links, inline style.text new file mode 100644 index 0000000..4d0c1c2 --- /dev/null +++ b/tests/pl/Tests_2004/Links, inline style.text @@ -0,0 +1,9 @@ +Just a [URL](/url/). + +[URL and title](/url/ "title"). + +[URL and title](/url/ "title preceded by two spaces"). + +[URL and title](/url/ "title preceded by a tab"). + +[Empty](). diff --git a/tests/pl/Tests_2004/Links, reference style.html b/tests/pl/Tests_2004/Links, reference style.html new file mode 100644 index 0000000..cf4d833 --- /dev/null +++ b/tests/pl/Tests_2004/Links, reference style.html @@ -0,0 +1,18 @@ +

    Foo bar.

    + +

    Foo bar.

    + +

    Foo bar.

    + +

    With embedded [brackets].

    + +

    Indented once.

    + +

    Indented twice.

    + +

    Indented thrice.

    + +

    Indented [four][] times.

    + +
    [four]: /url
    +
    diff --git a/tests/pl/Tests_2004/Links, reference style.text b/tests/pl/Tests_2004/Links, reference style.text new file mode 100644 index 0000000..b2fa734 --- /dev/null +++ b/tests/pl/Tests_2004/Links, reference style.text @@ -0,0 +1,31 @@ +Foo [bar] [1]. + +Foo [bar][1]. + +Foo [bar] +[1]. + +[1]: /url/ "Title" + + +With [embedded [brackets]] [b]. + + +Indented [once][]. + +Indented [twice][]. + +Indented [thrice][]. + +Indented [four][] times. + + [once]: /url + + [twice]: /url + + [thrice]: /url + + [four]: /url + + +[b]: /url/ diff --git a/tests/pl/Tests_2004/Literal quotes in titles.html b/tests/pl/Tests_2004/Literal quotes in titles.html new file mode 100644 index 0000000..611c1ac --- /dev/null +++ b/tests/pl/Tests_2004/Literal quotes in titles.html @@ -0,0 +1,3 @@ +

    Foo bar.

    + +

    Foo bar.

    diff --git a/tests/pl/Tests_2004/Literal quotes in titles.text b/tests/pl/Tests_2004/Literal quotes in titles.text new file mode 100644 index 0000000..29d0e42 --- /dev/null +++ b/tests/pl/Tests_2004/Literal quotes in titles.text @@ -0,0 +1,7 @@ +Foo [bar][]. + +Foo [bar](/url/ "Title with "quotes" inside"). + + + [bar]: /url/ "Title with "quotes" inside" + diff --git a/tests/pl/Tests_2004/Markdown Documentation - Basics.html b/tests/pl/Tests_2004/Markdown Documentation - Basics.html new file mode 100644 index 0000000..342f0c1 --- /dev/null +++ b/tests/pl/Tests_2004/Markdown Documentation - Basics.html @@ -0,0 +1,314 @@ +

    Markdown: Basics

    + + + +

    Getting the Gist of Markdown's Formatting Syntax

    + +

    This page offers a brief overview of what it's like to use Markdown. +The syntax page provides complete, detailed documentation for +every feature, but Markdown should be very easy to pick up simply by +looking at a few examples of it in action. The examples on this page +are written in a before/after style, showing example syntax and the +HTML output produced by Markdown.

    + +

    It's also helpful to simply try Markdown out; the Dingus is a +web application that allows you type your own Markdown-formatted text +and translate it to XHTML.

    + +

    Note: This document is itself written using Markdown; you +can see the source for it by adding '.text' to the URL.

    + +

    Paragraphs, Headers, Blockquotes

    + +

    A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing spaces or tabs is considered +blank.) Normal paragraphs should not be indented with spaces or tabs.

    + +

    Markdown offers two styles of headers: Setext and atx. +Setext-style headers for <h1> and <h2> are created by +"underlining" with equal signs (=) and hyphens (-), respectively. +To create an atx-style header, you put 1-6 hash marks (#) at the +beginning of the line -- the number of hashes equals the resulting +HTML header level.

    + +

    Blockquotes are indicated using email-style '>' angle brackets.

    + +

    Markdown:

    + +
    A First Level Header
    +====================
    +
    +A Second Level Header
    +---------------------
    +
    +Now is the time for all good men to come to
    +the aid of their country. This is just a
    +regular paragraph.
    +
    +The quick brown fox jumped over the lazy
    +dog's back.
    +
    +### Header 3
    +
    +> This is a blockquote.
    +> 
    +> This is the second paragraph in the blockquote.
    +>
    +> ## This is an H2 in a blockquote
    +
    + +

    Output:

    + +
    <h1>A First Level Header</h1>
    +
    +<h2>A Second Level Header</h2>
    +
    +<p>Now is the time for all good men to come to
    +the aid of their country. This is just a
    +regular paragraph.</p>
    +
    +<p>The quick brown fox jumped over the lazy
    +dog's back.</p>
    +
    +<h3>Header 3</h3>
    +
    +<blockquote>
    +    <p>This is a blockquote.</p>
    +
    +    <p>This is the second paragraph in the blockquote.</p>
    +
    +    <h2>This is an H2 in a blockquote</h2>
    +</blockquote>
    +
    + +

    Phrase Emphasis

    + +

    Markdown uses asterisks and underscores to indicate spans of emphasis.

    + +

    Markdown:

    + +
    Some of these words *are emphasized*.
    +Some of these words _are emphasized also_.
    +
    +Use two asterisks for **strong emphasis**.
    +Or, if you prefer, __use two underscores instead__.
    +
    + +

    Output:

    + +
    <p>Some of these words <em>are emphasized</em>.
    +Some of these words <em>are emphasized also</em>.</p>
    +
    +<p>Use two asterisks for <strong>strong emphasis</strong>.
    +Or, if you prefer, <strong>use two underscores instead</strong>.</p>
    +
    + +

    Lists

    + +

    Unordered (bulleted) lists use asterisks, pluses, and hyphens (*, ++, and -) as list markers. These three markers are +interchangable; this:

    + +
    *   Candy.
    +*   Gum.
    +*   Booze.
    +
    + +

    this:

    + +
    +   Candy.
    ++   Gum.
    ++   Booze.
    +
    + +

    and this:

    + +
    -   Candy.
    +-   Gum.
    +-   Booze.
    +
    + +

    all produce the same output:

    + +
    <ul>
    +<li>Candy.</li>
    +<li>Gum.</li>
    +<li>Booze.</li>
    +</ul>
    +
    + +

    Ordered (numbered) lists use regular numbers, followed by periods, as +list markers:

    + +
    1.  Red
    +2.  Green
    +3.  Blue
    +
    + +

    Output:

    + +
    <ol>
    +<li>Red</li>
    +<li>Green</li>
    +<li>Blue</li>
    +</ol>
    +
    + +

    If you put blank lines between items, you'll get <p> tags for the +list item text. You can create multi-paragraph list items by indenting +the paragraphs by 4 spaces or 1 tab:

    + +
    *   A list item.
    +
    +    With multiple paragraphs.
    +
    +*   Another item in the list.
    +
    + +

    Output:

    + +
    <ul>
    +<li><p>A list item.</p>
    +<p>With multiple paragraphs.</p></li>
    +<li><p>Another item in the list.</p></li>
    +</ul>
    +
    + +

    Links

    + +

    Markdown supports two styles for creating links: inline and +reference. With both styles, you use square brackets to delimit the +text you want to turn into a link.

    + +

    Inline-style links use parentheses immediately after the link text. +For example:

    + +
    This is an [example link](http://example.com/).
    +
    + +

    Output:

    + +
    <p>This is an <a href="http://example.com/">
    +example link</a>.</p>
    +
    + +

    Optionally, you may include a title attribute in the parentheses:

    + +
    This is an [example link](http://example.com/ "With a Title").
    +
    + +

    Output:

    + +
    <p>This is an <a href="http://example.com/" title="With a Title">
    +example link</a>.</p>
    +
    + +

    Reference-style links allow you to refer to your links by names, which +you define elsewhere in your document:

    + +
    I get 10 times more traffic from [Google][1] than from
    +[Yahoo][2] or [MSN][3].
    +
    +[1]: http://google.com/        "Google"
    +[2]: http://search.yahoo.com/  "Yahoo Search"
    +[3]: http://search.msn.com/    "MSN Search"
    +
    + +

    Output:

    + +
    <p>I get 10 times more traffic from <a href="http://google.com/"
    +title="Google">Google</a> than from <a href="http://search.yahoo.com/"
    +title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
    +title="MSN Search">MSN</a>.</p>
    +
    + +

    The title attribute is optional. Link names may contain letters, +numbers and spaces, but are not case sensitive:

    + +
    I start my morning with a cup of coffee and
    +[The New York Times][NY Times].
    +
    +[ny times]: http://www.nytimes.com/
    +
    + +

    Output:

    + +
    <p>I start my morning with a cup of coffee and
    +<a href="http://www.nytimes.com/">The New York Times</a>.</p>
    +
    + +

    Images

    + +

    Image syntax is very much like link syntax.

    + +

    Inline (titles are optional):

    + +
    ![alt text](/path/to/img.jpg "Title")
    +
    + +

    Reference-style:

    + +
    ![alt text][id]
    +
    +[id]: /path/to/img.jpg "Title"
    +
    + +

    Both of the above examples produce the same output:

    + +
    <img src="/path/to/img.jpg" alt="alt text" title="Title" />
    +
    + +

    Code

    + +

    In a regular paragraph, you can create code span by wrapping text in +backtick quotes. Any ampersands (&) and angle brackets (< or +>) will automatically be translated into HTML entities. This makes +it easy to use Markdown to write about HTML example code:

    + +
    I strongly recommend against using any `<blink>` tags.
    +
    +I wish SmartyPants used named entities like `&mdash;`
    +instead of decimal-encoded entites like `&#8212;`.
    +
    + +

    Output:

    + +
    <p>I strongly recommend against using any
    +<code>&lt;blink&gt;</code> tags.</p>
    +
    +<p>I wish SmartyPants used named entities like
    +<code>&amp;mdash;</code> instead of decimal-encoded
    +entites like <code>&amp;#8212;</code>.</p>
    +
    + +

    To specify an entire block of pre-formatted code, indent every line of +the block by 4 spaces or 1 tab. Just like with code spans, &, <, +and > characters will be escaped automatically.

    + +

    Markdown:

    + +
    If you want your page to validate under XHTML 1.0 Strict,
    +you've got to put paragraph tags in your blockquotes:
    +
    +    <blockquote>
    +        <p>For example.</p>
    +    </blockquote>
    +
    + +

    Output:

    + +
    <p>If you want your page to validate under XHTML 1.0 Strict,
    +you've got to put paragraph tags in your blockquotes:</p>
    +
    +<pre><code>&lt;blockquote&gt;
    +    &lt;p&gt;For example.&lt;/p&gt;
    +&lt;/blockquote&gt;
    +</code></pre>
    +
    diff --git a/tests/pl/Tests_2004/Markdown Documentation - Basics.text b/tests/pl/Tests_2004/Markdown Documentation - Basics.text new file mode 100644 index 0000000..2abe24a --- /dev/null +++ b/tests/pl/Tests_2004/Markdown Documentation - Basics.text @@ -0,0 +1,306 @@ +Markdown: Basics +================ + + + + +Getting the Gist of Markdown's Formatting Syntax +------------------------------------------------ + +This page offers a brief overview of what it's like to use Markdown. +The [syntax page] [s] provides complete, detailed documentation for +every feature, but Markdown should be very easy to pick up simply by +looking at a few examples of it in action. The examples on this page +are written in a before/after style, showing example syntax and the +HTML output produced by Markdown. + +It's also helpful to simply try Markdown out; the [Dingus] [d] is a +web application that allows you type your own Markdown-formatted text +and translate it to XHTML. + +**Note:** This document is itself written using Markdown; you +can [see the source for it by adding '.text' to the URL] [src]. + + [s]: /projects/markdown/syntax "Markdown Syntax" + [d]: /projects/markdown/dingus "Markdown Dingus" + [src]: /projects/markdown/basics.text + + +## Paragraphs, Headers, Blockquotes ## + +A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing spaces or tabs is considered +blank.) Normal paragraphs should not be indented with spaces or tabs. + +Markdown offers two styles of headers: *Setext* and *atx*. +Setext-style headers for `

    ` and `

    ` are created by +"underlining" with equal signs (`=`) and hyphens (`-`), respectively. +To create an atx-style header, you put 1-6 hash marks (`#`) at the +beginning of the line -- the number of hashes equals the resulting +HTML header level. + +Blockquotes are indicated using email-style '`>`' angle brackets. + +Markdown: + + A First Level Header + ==================== + + A Second Level Header + --------------------- + + Now is the time for all good men to come to + the aid of their country. This is just a + regular paragraph. + + The quick brown fox jumped over the lazy + dog's back. + + ### Header 3 + + > This is a blockquote. + > + > This is the second paragraph in the blockquote. + > + > ## This is an H2 in a blockquote + + +Output: + +

    A First Level Header

    + +

    A Second Level Header

    + +

    Now is the time for all good men to come to + the aid of their country. This is just a + regular paragraph.

    + +

    The quick brown fox jumped over the lazy + dog's back.

    + +

    Header 3

    + +
    +

    This is a blockquote.

    + +

    This is the second paragraph in the blockquote.

    + +

    This is an H2 in a blockquote

    +
    + + + +### Phrase Emphasis ### + +Markdown uses asterisks and underscores to indicate spans of emphasis. + +Markdown: + + Some of these words *are emphasized*. + Some of these words _are emphasized also_. + + Use two asterisks for **strong emphasis**. + Or, if you prefer, __use two underscores instead__. + +Output: + +

    Some of these words are emphasized. + Some of these words are emphasized also.

    + +

    Use two asterisks for strong emphasis. + Or, if you prefer, use two underscores instead.

    + + + +## Lists ## + +Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`, +`+`, and `-`) as list markers. These three markers are +interchangable; this: + + * Candy. + * Gum. + * Booze. + +this: + + + Candy. + + Gum. + + Booze. + +and this: + + - Candy. + - Gum. + - Booze. + +all produce the same output: + +
      +
    • Candy.
    • +
    • Gum.
    • +
    • Booze.
    • +
    + +Ordered (numbered) lists use regular numbers, followed by periods, as +list markers: + + 1. Red + 2. Green + 3. Blue + +Output: + +
      +
    1. Red
    2. +
    3. Green
    4. +
    5. Blue
    6. +
    + +If you put blank lines between items, you'll get `

    ` tags for the +list item text. You can create multi-paragraph list items by indenting +the paragraphs by 4 spaces or 1 tab: + + * A list item. + + With multiple paragraphs. + + * Another item in the list. + +Output: + +

      +
    • A list item.

      +

      With multiple paragraphs.

    • +
    • Another item in the list.

    • +
    + + + +### Links ### + +Markdown supports two styles for creating links: *inline* and +*reference*. With both styles, you use square brackets to delimit the +text you want to turn into a link. + +Inline-style links use parentheses immediately after the link text. +For example: + + This is an [example link](http://example.com/). + +Output: + +

    This is an + example link.

    + +Optionally, you may include a title attribute in the parentheses: + + This is an [example link](http://example.com/ "With a Title"). + +Output: + +

    This is an + example link.

    + +Reference-style links allow you to refer to your links by names, which +you define elsewhere in your document: + + I get 10 times more traffic from [Google][1] than from + [Yahoo][2] or [MSN][3]. + + [1]: http://google.com/ "Google" + [2]: http://search.yahoo.com/ "Yahoo Search" + [3]: http://search.msn.com/ "MSN Search" + +Output: + +

    I get 10 times more traffic from Google than from Yahoo or MSN.

    + +The title attribute is optional. Link names may contain letters, +numbers and spaces, but are *not* case sensitive: + + I start my morning with a cup of coffee and + [The New York Times][NY Times]. + + [ny times]: http://www.nytimes.com/ + +Output: + +

    I start my morning with a cup of coffee and + The New York Times.

    + + +### Images ### + +Image syntax is very much like link syntax. + +Inline (titles are optional): + + ![alt text](/path/to/img.jpg "Title") + +Reference-style: + + ![alt text][id] + + [id]: /path/to/img.jpg "Title" + +Both of the above examples produce the same output: + + alt text + + + +### Code ### + +In a regular paragraph, you can create code span by wrapping text in +backtick quotes. Any ampersands (`&`) and angle brackets (`<` or +`>`) will automatically be translated into HTML entities. This makes +it easy to use Markdown to write about HTML example code: + + I strongly recommend against using any `` tags. + + I wish SmartyPants used named entities like `—` + instead of decimal-encoded entites like `—`. + +Output: + +

    I strongly recommend against using any + <blink> tags.

    + +

    I wish SmartyPants used named entities like + &mdash; instead of decimal-encoded + entites like &#8212;.

    + + +To specify an entire block of pre-formatted code, indent every line of +the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`, +and `>` characters will be escaped automatically. + +Markdown: + + If you want your page to validate under XHTML 1.0 Strict, + you've got to put paragraph tags in your blockquotes: + +
    +

    For example.

    +
    + +Output: + +

    If you want your page to validate under XHTML 1.0 Strict, + you've got to put paragraph tags in your blockquotes:

    + +
    <blockquote>
    +        <p>For example.</p>
    +    </blockquote>
    +    
    diff --git a/tests/pl/Tests_2004/Markdown Documentation - Syntax.html b/tests/pl/Tests_2004/Markdown Documentation - Syntax.html new file mode 100644 index 0000000..7847793 --- /dev/null +++ b/tests/pl/Tests_2004/Markdown Documentation - Syntax.html @@ -0,0 +1,942 @@ +

    Markdown: Syntax

    + + + + + +

    Note: This document is itself written using Markdown; you +can see the source for it by adding '.text' to the URL.

    + +
    + +

    Overview

    + +

    Philosophy

    + +

    Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

    + +

    Readability, however, is emphasized above all else. A Markdown-formatted +document should be publishable as-is, as plain text, without looking +like it's been marked up with tags or formatting instructions. While +Markdown's syntax has been influenced by several existing text-to-HTML +filters -- including Setext, atx, Textile, reStructuredText, +Grutatext, and EtText -- the single biggest source of +inspiration for Markdown's syntax is the format of plain text email.

    + +

    To this end, Markdown's syntax is comprised entirely of punctuation +characters, which punctuation characters have been carefully chosen so +as to look like what they mean. E.g., asterisks around a word actually +look like *emphasis*. Markdown lists look like, well, lists. Even +blockquotes look like quoted passages of text, assuming you've ever +used email.

    + +

    Inline HTML

    + +

    Markdown's syntax is intended for one purpose: to be used as a +format for writing for the web.

    + +

    Markdown is not a replacement for HTML, or even close to it. Its +syntax is very small, corresponding only to a very small subset of +HTML tags. The idea is not to create a syntax that makes it easier +to insert HTML tags. In my opinion, HTML tags are already easy to +insert. The idea for Markdown is to make it easy to read, write, and +edit prose. HTML is a publishing format; Markdown is a writing +format. Thus, Markdown's formatting syntax only addresses issues that +can be conveyed in plain text.

    + +

    For any markup that is not covered by Markdown's syntax, you simply +use HTML itself. There's no need to preface it or delimit it to +indicate that you're switching from Markdown to HTML; you just use +the tags.

    + +

    The only restrictions are that block-level HTML elements -- e.g. <div>, +<table>, <pre>, <p>, etc. -- must be separated from surrounding +content by blank lines, and the start and end tags of the block should +not be indented with tabs or spaces. Markdown is smart enough not +to add extra (unwanted) <p> tags around HTML block-level tags.

    + +

    For example, to add an HTML table to a Markdown article:

    + +
    This is a regular paragraph.
    +
    +<table>
    +    <tr>
    +        <td>Foo</td>
    +    </tr>
    +</table>
    +
    +This is another regular paragraph.
    +
    + +

    Note that Markdown formatting syntax is not processed within block-level +HTML tags. E.g., you can't use Markdown-style *emphasis* inside an +HTML block.

    + +

    Span-level HTML tags -- e.g. <span>, <cite>, or <del> -- can be +used anywhere in a Markdown paragraph, list item, or header. If you +want, you can even use HTML tags instead of Markdown formatting; e.g. if +you'd prefer to use HTML <a> or <img> tags instead of Markdown's +link or image syntax, go right ahead.

    + +

    Unlike block-level HTML tags, Markdown syntax is processed within +span-level tags.

    + +

    Automatic Escaping for Special Characters

    + +

    In HTML, there are two characters that demand special treatment: < +and &. Left angle brackets are used to start tags; ampersands are +used to denote HTML entities. If you want to use them as literal +characters, you must escape them as entities, e.g. &lt;, and +&amp;.

    + +

    Ampersands in particular are bedeviling for web writers. If you want to +write about 'AT&T', you need to write 'AT&amp;T'. You even need to +escape ampersands within URLs. Thus, if you want to link to:

    + +
    http://images.google.com/images?num=30&q=larry+bird
    +
    + +

    you need to encode the URL as:

    + +
    http://images.google.com/images?num=30&amp;q=larry+bird
    +
    + +

    in your anchor tag href attribute. Needless to say, this is easy to +forget, and is probably the single most common source of HTML validation +errors in otherwise well-marked-up web sites.

    + +

    Markdown allows you to use these characters naturally, taking care of +all the necessary escaping for you. If you use an ampersand as part of +an HTML entity, it remains unchanged; otherwise it will be translated +into &amp;.

    + +

    So, if you want to include a copyright symbol in your article, you can write:

    + +
    &copy;
    +
    + +

    and Markdown will leave it alone. But if you write:

    + +
    AT&T
    +
    + +

    Markdown will translate it to:

    + +
    AT&amp;T
    +
    + +

    Similarly, because Markdown supports inline HTML, if you use +angle brackets as delimiters for HTML tags, Markdown will treat them as +such. But if you write:

    + +
    4 < 5
    +
    + +

    Markdown will translate it to:

    + +
    4 &lt; 5
    +
    + +

    However, inside Markdown code spans and blocks, angle brackets and +ampersands are always encoded automatically. This makes it easy to use +Markdown to write about HTML code. (As opposed to raw HTML, which is a +terrible format for writing about HTML syntax, because every single < +and & in your example code needs to be escaped.)

    + +
    + +

    Block Elements

    + +

    Paragraphs and Line Breaks

    + +

    A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing but spaces or tabs is considered +blank.) Normal paragraphs should not be indented with spaces or tabs.

    + +

    The implication of the "one or more consecutive lines of text" rule is +that Markdown supports "hard-wrapped" text paragraphs. This differs +significantly from most other text-to-HTML formatters (including Movable +Type's "Convert Line Breaks" option) which translate every line break +character in a paragraph into a <br /> tag.

    + +

    When you do want to insert a <br /> break tag using Markdown, you +end a line with two or more spaces, then type return.

    + +

    Yes, this takes a tad more effort to create a <br />, but a simplistic +"every line break is a <br />" rule wouldn't work for Markdown. +Markdown's email-style blockquoting and multi-paragraph list items +work best -- and look better -- when you format them with hard breaks.

    + + + +

    Markdown supports two styles of headers, Setext and atx.

    + +

    Setext-style headers are "underlined" using equal signs (for first-level +headers) and dashes (for second-level headers). For example:

    + +
    This is an H1
    +=============
    +
    +This is an H2
    +-------------
    +
    + +

    Any number of underlining ='s or -'s will work.

    + +

    Atx-style headers use 1-6 hash characters at the start of the line, +corresponding to header levels 1-6. For example:

    + +
    # This is an H1
    +
    +## This is an H2
    +
    +###### This is an H6
    +
    + +

    Optionally, you may "close" atx-style headers. This is purely +cosmetic -- you can use this if you think it looks better. The +closing hashes don't even need to match the number of hashes +used to open the header. (The number of opening hashes +determines the header level.) :

    + +
    # This is an H1 #
    +
    +## This is an H2 ##
    +
    +### This is an H3 ######
    +
    + +

    Blockquotes

    + +

    Markdown uses email-style > characters for blockquoting. If you're +familiar with quoting passages of text in an email message, then you +know how to create a blockquote in Markdown. It looks best if you hard +wrap the text and put a > before every line:

    + +
    > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
    +> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
    +> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
    +> 
    +> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
    +> id sem consectetuer libero luctus adipiscing.
    +
    + +

    Markdown allows you to be lazy and only put the > before the first +line of a hard-wrapped paragraph:

    + +
    > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
    +consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
    +Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
    +
    +> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
    +id sem consectetuer libero luctus adipiscing.
    +
    + +

    Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by +adding additional levels of >:

    + +
    > This is the first level of quoting.
    +>
    +> > This is nested blockquote.
    +>
    +> Back to the first level.
    +
    + +

    Blockquotes can contain other Markdown elements, including headers, lists, +and code blocks:

    + +
    > ## This is a header.
    +> 
    +> 1.   This is the first list item.
    +> 2.   This is the second list item.
    +> 
    +> Here's some example code:
    +> 
    +>     return shell_exec("echo $input | $markdown_script");
    +
    + +

    Any decent text editor should make email-style quoting easy. For +example, with BBEdit, you can make a selection and choose Increase +Quote Level from the Text menu.

    + +

    Lists

    + +

    Markdown supports ordered (numbered) and unordered (bulleted) lists.

    + +

    Unordered lists use asterisks, pluses, and hyphens -- interchangably +-- as list markers:

    + +
    *   Red
    +*   Green
    +*   Blue
    +
    + +

    is equivalent to:

    + +
    +   Red
    ++   Green
    ++   Blue
    +
    + +

    and:

    + +
    -   Red
    +-   Green
    +-   Blue
    +
    + +

    Ordered lists use numbers followed by periods:

    + +
    1.  Bird
    +2.  McHale
    +3.  Parish
    +
    + +

    It's important to note that the actual numbers you use to mark the +list have no effect on the HTML output Markdown produces. The HTML +Markdown produces from the above list is:

    + +
    <ol>
    +<li>Bird</li>
    +<li>McHale</li>
    +<li>Parish</li>
    +</ol>
    +
    + +

    If you instead wrote the list in Markdown like this:

    + +
    1.  Bird
    +1.  McHale
    +1.  Parish
    +
    + +

    or even:

    + +
    3. Bird
    +1. McHale
    +8. Parish
    +
    + +

    you'd get the exact same HTML output. The point is, if you want to, +you can use ordinal numbers in your ordered Markdown lists, so that +the numbers in your source match the numbers in your published HTML. +But if you want to be lazy, you don't have to.

    + +

    If you do use lazy list numbering, however, you should still start the +list with the number 1. At some point in the future, Markdown may support +starting ordered lists at an arbitrary number.

    + +

    List markers typically start at the left margin, but may be indented by +up to three spaces. List markers must be followed by one or more spaces +or a tab.

    + +

    To make lists look nice, you can wrap items with hanging indents:

    + +
    *   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    +    Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
    +    viverra nec, fringilla in, laoreet vitae, risus.
    +*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
    +    Suspendisse id sem consectetuer libero luctus adipiscing.
    +
    + +

    But if you want to be lazy, you don't have to:

    + +
    *   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    +Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
    +viverra nec, fringilla in, laoreet vitae, risus.
    +*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
    +Suspendisse id sem consectetuer libero luctus adipiscing.
    +
    + +

    If list items are separated by blank lines, Markdown will wrap the +items in <p> tags in the HTML output. For example, this input:

    + +
    *   Bird
    +*   Magic
    +
    + +

    will turn into:

    + +
    <ul>
    +<li>Bird</li>
    +<li>Magic</li>
    +</ul>
    +
    + +

    But this:

    + +
    *   Bird
    +
    +*   Magic
    +
    + +

    will turn into:

    + +
    <ul>
    +<li><p>Bird</p></li>
    +<li><p>Magic</p></li>
    +</ul>
    +
    + +

    List items may consist of multiple paragraphs. Each subsequent +paragraph in a list item must be indented by either 4 spaces +or one tab:

    + +
    1.  This is a list item with two paragraphs. Lorem ipsum dolor
    +    sit amet, consectetuer adipiscing elit. Aliquam hendrerit
    +    mi posuere lectus.
    +
    +    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
    +    vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
    +    sit amet velit.
    +
    +2.  Suspendisse id sem consectetuer libero luctus adipiscing.
    +
    + +

    It looks nice if you indent every line of the subsequent +paragraphs, but here again, Markdown will allow you to be +lazy:

    + +
    *   This is a list item with two paragraphs.
    +
    +    This is the second paragraph in the list item. You're
    +only required to indent the first line. Lorem ipsum dolor
    +sit amet, consectetuer adipiscing elit.
    +
    +*   Another item in the same list.
    +
    + +

    To put a blockquote within a list item, the blockquote's > +delimiters need to be indented:

    + +
    *   A list item with a blockquote:
    +
    +    > This is a blockquote
    +    > inside a list item.
    +
    + +

    To put a code block within a list item, the code block needs +to be indented twice -- 8 spaces or two tabs:

    + +
    *   A list item with a code block:
    +
    +        <code goes here>
    +
    + +

    It's worth noting that it's possible to trigger an ordered list by +accident, by writing something like this:

    + +
    1986. What a great season.
    +
    + +

    In other words, a number-period-space sequence at the beginning of a +line. To avoid this, you can backslash-escape the period:

    + +
    1986\. What a great season.
    +
    + +

    Code Blocks

    + +

    Pre-formatted code blocks are used for writing about programming or +markup source code. Rather than forming normal paragraphs, the lines +of a code block are interpreted literally. Markdown wraps a code block +in both <pre> and <code> tags.

    + +

    To produce a code block in Markdown, simply indent every line of the +block by at least 4 spaces or 1 tab. For example, given this input:

    + +
    This is a normal paragraph:
    +
    +    This is a code block.
    +
    + +

    Markdown will generate:

    + +
    <p>This is a normal paragraph:</p>
    +
    +<pre><code>This is a code block.
    +</code></pre>
    +
    + +

    One level of indentation -- 4 spaces or 1 tab -- is removed from each +line of the code block. For example, this:

    + +
    Here is an example of AppleScript:
    +
    +    tell application "Foo"
    +        beep
    +    end tell
    +
    + +

    will turn into:

    + +
    <p>Here is an example of AppleScript:</p>
    +
    +<pre><code>tell application "Foo"
    +    beep
    +end tell
    +</code></pre>
    +
    + +

    A code block continues until it reaches a line that is not indented +(or the end of the article).

    + +

    Within a code block, ampersands (&) and angle brackets (< and >) +are automatically converted into HTML entities. This makes it very +easy to include example HTML source code using Markdown -- just paste +it and indent it, and Markdown will handle the hassle of encoding the +ampersands and angle brackets. For example, this:

    + +
        <div class="footer">
    +        &copy; 2004 Foo Corporation
    +    </div>
    +
    + +

    will turn into:

    + +
    <pre><code>&lt;div class="footer"&gt;
    +    &amp;copy; 2004 Foo Corporation
    +&lt;/div&gt;
    +</code></pre>
    +
    + +

    Regular Markdown syntax is not processed within code blocks. E.g., +asterisks are just literal asterisks within a code block. This means +it's also easy to use Markdown to write about Markdown's own syntax.

    + +

    Horizontal Rules

    + +

    You can produce a horizontal rule tag (<hr />) by placing three or +more hyphens, asterisks, or underscores on a line by themselves. If you +wish, you may use spaces between the hyphens or asterisks. Each of the +following lines will produce a horizontal rule:

    + +
    * * *
    +
    +***
    +
    +*****
    +
    +- - -
    +
    +---------------------------------------
    +
    +_ _ _
    +
    + +
    + +

    Span Elements

    + + + +

    Markdown supports two style of links: inline and reference.

    + +

    In both styles, the link text is delimited by [square brackets].

    + +

    To create an inline link, use a set of regular parentheses immediately +after the link text's closing square bracket. Inside the parentheses, +put the URL where you want the link to point, along with an optional +title for the link, surrounded in quotes. For example:

    + +
    This is [an example](http://example.com/ "Title") inline link.
    +
    +[This link](http://example.net/) has no title attribute.
    +
    + +

    Will produce:

    + +
    <p>This is <a href="http://example.com/" title="Title">
    +an example</a> inline link.</p>
    +
    +<p><a href="http://example.net/">This link</a> has no
    +title attribute.</p>
    +
    + +

    If you're referring to a local resource on the same server, you can +use relative paths:

    + +
    See my [About](/about/) page for details.
    +
    + +

    Reference-style links use a second set of square brackets, inside +which you place a label of your choosing to identify the link:

    + +
    This is [an example][id] reference-style link.
    +
    + +

    You can optionally use a space to separate the sets of brackets:

    + +
    This is [an example] [id] reference-style link.
    +
    + +

    Then, anywhere in the document, you define your link label like this, +on a line by itself:

    + +
    [id]: http://example.com/  "Optional Title Here"
    +
    + +

    That is:

    + +
      +
    • Square brackets containing the link identifier (optionally +indented from the left margin using up to three spaces);
    • +
    • followed by a colon;
    • +
    • followed by one or more spaces (or tabs);
    • +
    • followed by the URL for the link;
    • +
    • optionally followed by a title attribute for the link, enclosed +in double or single quotes.
    • +
    + +

    The link URL may, optionally, be surrounded by angle brackets:

    + +
    [id]: <http://example.com/>  "Optional Title Here"
    +
    + +

    You can put the title attribute on the next line and use extra spaces +or tabs for padding, which tends to look better with longer URLs:

    + +
    [id]: http://example.com/longish/path/to/resource/here
    +    "Optional Title Here"
    +
    + +

    Link definitions are only used for creating links during Markdown +processing, and are stripped from your document in the HTML output.

    + +

    Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are not case sensitive. E.g. these two links:

    + +
    [link text][a]
    +[link text][A]
    +
    + +

    are equivalent.

    + +

    The implicit link name shortcut allows you to omit the name of the +link, in which case the link text itself is used as the name. +Just use an empty set of square brackets -- e.g., to link the word +"Google" to the google.com web site, you could simply write:

    + +
    [Google][]
    +
    + +

    And then define the link:

    + +
    [Google]: http://google.com/
    +
    + +

    Because link names may contain spaces, this shortcut even works for +multiple words in the link text:

    + +
    Visit [Daring Fireball][] for more information.
    +
    + +

    And then define the link:

    + +
    [Daring Fireball]: http://daringfireball.net/
    +
    + +

    Link definitions can be placed anywhere in your Markdown document. I +tend to put them immediately after each paragraph in which they're +used, but if you want, you can put them all at the end of your +document, sort of like footnotes.

    + +

    Here's an example of reference links in action:

    + +
    I get 10 times more traffic from [Google] [1] than from
    +[Yahoo] [2] or [MSN] [3].
    +
    +  [1]: http://google.com/        "Google"
    +  [2]: http://search.yahoo.com/  "Yahoo Search"
    +  [3]: http://search.msn.com/    "MSN Search"
    +
    + +

    Using the implicit link name shortcut, you could instead write:

    + +
    I get 10 times more traffic from [Google][] than from
    +[Yahoo][] or [MSN][].
    +
    +  [google]: http://google.com/        "Google"
    +  [yahoo]:  http://search.yahoo.com/  "Yahoo Search"
    +  [msn]:    http://search.msn.com/    "MSN Search"
    +
    + +

    Both of the above examples will produce the following HTML output:

    + +
    <p>I get 10 times more traffic from <a href="http://google.com/"
    +title="Google">Google</a> than from
    +<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
    +or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
    +
    + +

    For comparison, here is the same paragraph written using +Markdown's inline link style:

    + +
    I get 10 times more traffic from [Google](http://google.com/ "Google")
    +than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
    +[MSN](http://search.msn.com/ "MSN Search").
    +
    + +

    The point of reference-style links is not that they're easier to +write. The point is that with reference-style links, your document +source is vastly more readable. Compare the above examples: using +reference-style links, the paragraph itself is only 81 characters +long; with inline-style links, it's 176 characters; and as raw HTML, +it's 234 characters. In the raw HTML, there's more markup than there +is text.

    + +

    With Markdown's reference-style links, a source document much more +closely resembles the final output, as rendered in a browser. By +allowing you to move the markup-related metadata out of the paragraph, +you can add links without interrupting the narrative flow of your +prose.

    + +

    Emphasis

    + +

    Markdown treats asterisks (*) and underscores (_) as indicators of +emphasis. Text wrapped with one * or _ will be wrapped with an +HTML <em> tag; double *'s or _'s will be wrapped with an HTML +<strong> tag. E.g., this input:

    + +
    *single asterisks*
    +
    +_single underscores_
    +
    +**double asterisks**
    +
    +__double underscores__
    +
    + +

    will produce:

    + +
    <em>single asterisks</em>
    +
    +<em>single underscores</em>
    +
    +<strong>double asterisks</strong>
    +
    +<strong>double underscores</strong>
    +
    + +

    You can use whichever style you prefer; the lone restriction is that +the same character must be used to open and close an emphasis span.

    + +

    Emphasis can be used in the middle of a word:

    + +
    un*fucking*believable
    +
    + +

    But if you surround an * or _ with spaces, it'll be treated as a +literal asterisk or underscore.

    + +

    To produce a literal asterisk or underscore at a position where it +would otherwise be used as an emphasis delimiter, you can backslash +escape it:

    + +
    \*this text is surrounded by literal asterisks\*
    +
    + +

    Code

    + +

    To indicate a span of code, wrap it with backtick quotes (`). +Unlike a pre-formatted code block, a code span indicates code within a +normal paragraph. For example:

    + +
    Use the `printf()` function.
    +
    + +

    will produce:

    + +
    <p>Use the <code>printf()</code> function.</p>
    +
    + +

    To include a literal backtick character within a code span, you can use +multiple backticks as the opening and closing delimiters:

    + +
    ``There is a literal backtick (`) here.``
    +
    + +

    which will produce this:

    + +
    <p><code>There is a literal backtick (`) here.</code></p>
    +
    + +

    The backtick delimiters surrounding a code span may include spaces -- +one after the opening, one before the closing. This allows you to place +literal backtick characters at the beginning or end of a code span:

    + +
    A single backtick in a code span: `` ` ``
    +
    +A backtick-delimited string in a code span: `` `foo` ``
    +
    + +

    will produce:

    + +
    <p>A single backtick in a code span: <code>`</code></p>
    +
    +<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
    +
    + +

    With a code span, ampersands and angle brackets are encoded as HTML +entities automatically, which makes it easy to include example HTML +tags. Markdown will turn this:

    + +
    Please don't use any `<blink>` tags.
    +
    + +

    into:

    + +
    <p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
    +
    + +

    You can write this:

    + +
    `&#8212;` is the decimal-encoded equivalent of `&mdash;`.
    +
    + +

    to produce:

    + +
    <p><code>&amp;#8212;</code> is the decimal-encoded
    +equivalent of <code>&amp;mdash;</code>.</p>
    +
    + +

    Images

    + +

    Admittedly, it's fairly difficult to devise a "natural" syntax for +placing images into a plain text document format.

    + +

    Markdown uses an image syntax that is intended to resemble the syntax +for links, allowing for two styles: inline and reference.

    + +

    Inline image syntax looks like this:

    + +
    ![Alt text](/path/to/img.jpg)
    +
    +![Alt text](/path/to/img.jpg "Optional title")
    +
    + +

    That is:

    + +
      +
    • An exclamation mark: !;
    • +
    • followed by a set of square brackets, containing the alt +attribute text for the image;
    • +
    • followed by a set of parentheses, containing the URL or path to +the image, and an optional title attribute enclosed in double +or single quotes.
    • +
    + +

    Reference-style image syntax looks like this:

    + +
    ![Alt text][id]
    +
    + +

    Where "id" is the name of a defined image reference. Image references +are defined using syntax identical to link references:

    + +
    [id]: url/to/image  "Optional title attribute"
    +
    + +

    As of this writing, Markdown has no syntax for specifying the +dimensions of an image; if this is important to you, you can simply +use regular HTML <img> tags.

    + +
    + +

    Miscellaneous

    + + + +

    Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

    + +
    <http://example.com/>
    +
    + +

    Markdown will turn this into:

    + +
    <a href="http://example.com/">http://example.com/</a>
    +
    + +

    Automatic links for email addresses work similarly, except that +Markdown will also perform a bit of randomized decimal and hex +entity-encoding to help obscure your address from address-harvesting +spambots. For example, Markdown will turn this:

    + +
    <address@example.com>
    +
    + +

    into something like this:

    + +
    <a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
    +&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
    +&#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
    +&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
    +
    + +

    which will render in a browser as a clickable link to "address@example.com".

    + +

    (This sort of entity-encoding trick will indeed fool many, if not +most, address-harvesting bots, but it definitely won't fool all of +them. It's better than nothing, but an address published in this way +will probably eventually start receiving spam.)

    + +

    Backslash Escapes

    + +

    Markdown allows you to use backslash escapes to generate literal +characters which would otherwise have special meaning in Markdown's +formatting syntax. For example, if you wanted to surround a word with +literal asterisks (instead of an HTML <em> tag), you can backslashes +before the asterisks, like this:

    + +
    \*literal asterisks\*
    +
    + +

    Markdown provides backslash escapes for the following characters:

    + +
    \   backslash
    +`   backtick
    +*   asterisk
    +_   underscore
    +{}  curly braces
    +[]  square brackets
    +()  parentheses
    +#   hash mark
    ++   plus sign
    +-   minus sign (hyphen)
    +.   dot
    +!   exclamation mark
    +
    diff --git a/tests/pl/Tests_2004/Markdown Documentation - Syntax.text b/tests/pl/Tests_2004/Markdown Documentation - Syntax.text new file mode 100644 index 0000000..e0a3d1c --- /dev/null +++ b/tests/pl/Tests_2004/Markdown Documentation - Syntax.text @@ -0,0 +1,888 @@ +Markdown: Syntax +================ + + + + +* [Overview](#overview) + * [Philosophy](#philosophy) + * [Inline HTML](#html) + * [Automatic Escaping for Special Characters](#autoescape) +* [Block Elements](#block) + * [Paragraphs and Line Breaks](#p) + * [Headers](#header) + * [Blockquotes](#blockquote) + * [Lists](#list) + * [Code Blocks](#precode) + * [Horizontal Rules](#hr) +* [Span Elements](#span) + * [Links](#link) + * [Emphasis](#em) + * [Code](#code) + * [Images](#img) +* [Miscellaneous](#misc) + * [Backslash Escapes](#backslash) + * [Automatic Links](#autolink) + + +**Note:** This document is itself written using Markdown; you +can [see the source for it by adding '.text' to the URL][src]. + + [src]: /projects/markdown/syntax.text + +* * * + +

    Overview

    + +

    Philosophy

    + +Markdown is intended to be as easy-to-read and easy-to-write as is feasible. + +Readability, however, is emphasized above all else. A Markdown-formatted +document should be publishable as-is, as plain text, without looking +like it's been marked up with tags or formatting instructions. While +Markdown's syntax has been influenced by several existing text-to-HTML +filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4], +[Grutatext] [5], and [EtText] [6] -- the single biggest source of +inspiration for Markdown's syntax is the format of plain text email. + + [1]: http://docutils.sourceforge.net/mirror/setext.html + [2]: http://www.aaronsw.com/2002/atx/ + [3]: http://textism.com/tools/textile/ + [4]: http://docutils.sourceforge.net/rst.html + [5]: http://www.triptico.com/software/grutatxt.html + [6]: http://ettext.taint.org/doc/ + +To this end, Markdown's syntax is comprised entirely of punctuation +characters, which punctuation characters have been carefully chosen so +as to look like what they mean. E.g., asterisks around a word actually +look like \*emphasis\*. Markdown lists look like, well, lists. Even +blockquotes look like quoted passages of text, assuming you've ever +used email. + + + +

    Inline HTML

    + +Markdown's syntax is intended for one purpose: to be used as a +format for *writing* for the web. + +Markdown is not a replacement for HTML, or even close to it. Its +syntax is very small, corresponding only to a very small subset of +HTML tags. The idea is *not* to create a syntax that makes it easier +to insert HTML tags. In my opinion, HTML tags are already easy to +insert. The idea for Markdown is to make it easy to read, write, and +edit prose. HTML is a *publishing* format; Markdown is a *writing* +format. Thus, Markdown's formatting syntax only addresses issues that +can be conveyed in plain text. + +For any markup that is not covered by Markdown's syntax, you simply +use HTML itself. There's no need to preface it or delimit it to +indicate that you're switching from Markdown to HTML; you just use +the tags. + +The only restrictions are that block-level HTML elements -- e.g. `
    `, +``, `
    `, `

    `, etc. -- must be separated from surrounding +content by blank lines, and the start and end tags of the block should +not be indented with tabs or spaces. Markdown is smart enough not +to add extra (unwanted) `

    ` tags around HTML block-level tags. + +For example, to add an HTML table to a Markdown article: + + This is a regular paragraph. + +

    + + + +
    Foo
    + + This is another regular paragraph. + +Note that Markdown formatting syntax is not processed within block-level +HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an +HTML block. + +Span-level HTML tags -- e.g. ``, ``, or `` -- can be +used anywhere in a Markdown paragraph, list item, or header. If you +want, you can even use HTML tags instead of Markdown formatting; e.g. if +you'd prefer to use HTML `` or `` tags instead of Markdown's +link or image syntax, go right ahead. + +Unlike block-level HTML tags, Markdown syntax *is* processed within +span-level tags. + + +

    Automatic Escaping for Special Characters

    + +In HTML, there are two characters that demand special treatment: `<` +and `&`. Left angle brackets are used to start tags; ampersands are +used to denote HTML entities. If you want to use them as literal +characters, you must escape them as entities, e.g. `<`, and +`&`. + +Ampersands in particular are bedeviling for web writers. If you want to +write about 'AT&T', you need to write '`AT&T`'. You even need to +escape ampersands within URLs. Thus, if you want to link to: + + http://images.google.com/images?num=30&q=larry+bird + +you need to encode the URL as: + + http://images.google.com/images?num=30&q=larry+bird + +in your anchor tag `href` attribute. Needless to say, this is easy to +forget, and is probably the single most common source of HTML validation +errors in otherwise well-marked-up web sites. + +Markdown allows you to use these characters naturally, taking care of +all the necessary escaping for you. If you use an ampersand as part of +an HTML entity, it remains unchanged; otherwise it will be translated +into `&`. + +So, if you want to include a copyright symbol in your article, you can write: + + © + +and Markdown will leave it alone. But if you write: + + AT&T + +Markdown will translate it to: + + AT&T + +Similarly, because Markdown supports [inline HTML](#html), if you use +angle brackets as delimiters for HTML tags, Markdown will treat them as +such. But if you write: + + 4 < 5 + +Markdown will translate it to: + + 4 < 5 + +However, inside Markdown code spans and blocks, angle brackets and +ampersands are *always* encoded automatically. This makes it easy to use +Markdown to write about HTML code. (As opposed to raw HTML, which is a +terrible format for writing about HTML syntax, because every single `<` +and `&` in your example code needs to be escaped.) + + +* * * + + +

    Block Elements

    + + +

    Paragraphs and Line Breaks

    + +A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing but spaces or tabs is considered +blank.) Normal paragraphs should not be indented with spaces or tabs. + +The implication of the "one or more consecutive lines of text" rule is +that Markdown supports "hard-wrapped" text paragraphs. This differs +significantly from most other text-to-HTML formatters (including Movable +Type's "Convert Line Breaks" option) which translate every line break +character in a paragraph into a `
    ` tag. + +When you *do* want to insert a `
    ` break tag using Markdown, you +end a line with two or more spaces, then type return. + +Yes, this takes a tad more effort to create a `
    `, but a simplistic +"every line break is a `
    `" rule wouldn't work for Markdown. +Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l] +work best -- and look better -- when you format them with hard breaks. + + [bq]: #blockquote + [l]: #list + + + + + +Markdown supports two styles of headers, [Setext] [1] and [atx] [2]. + +Setext-style headers are "underlined" using equal signs (for first-level +headers) and dashes (for second-level headers). For example: + + This is an H1 + ============= + + This is an H2 + ------------- + +Any number of underlining `=`'s or `-`'s will work. + +Atx-style headers use 1-6 hash characters at the start of the line, +corresponding to header levels 1-6. For example: + + # This is an H1 + + ## This is an H2 + + ###### This is an H6 + +Optionally, you may "close" atx-style headers. This is purely +cosmetic -- you can use this if you think it looks better. The +closing hashes don't even need to match the number of hashes +used to open the header. (The number of opening hashes +determines the header level.) : + + # This is an H1 # + + ## This is an H2 ## + + ### This is an H3 ###### + + +

    Blockquotes

    + +Markdown uses email-style `>` characters for blockquoting. If you're +familiar with quoting passages of text in an email message, then you +know how to create a blockquote in Markdown. It looks best if you hard +wrap the text and put a `>` before every line: + + > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, + > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. + > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + > + > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse + > id sem consectetuer libero luctus adipiscing. + +Markdown allows you to be lazy and only put the `>` before the first +line of a hard-wrapped paragraph: + + > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, + consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. + Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + + > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse + id sem consectetuer libero luctus adipiscing. + +Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by +adding additional levels of `>`: + + > This is the first level of quoting. + > + > > This is nested blockquote. + > + > Back to the first level. + +Blockquotes can contain other Markdown elements, including headers, lists, +and code blocks: + + > ## This is a header. + > + > 1. This is the first list item. + > 2. This is the second list item. + > + > Here's some example code: + > + > return shell_exec("echo $input | $markdown_script"); + +Any decent text editor should make email-style quoting easy. For +example, with BBEdit, you can make a selection and choose Increase +Quote Level from the Text menu. + + +

    Lists

    + +Markdown supports ordered (numbered) and unordered (bulleted) lists. + +Unordered lists use asterisks, pluses, and hyphens -- interchangably +-- as list markers: + + * Red + * Green + * Blue + +is equivalent to: + + + Red + + Green + + Blue + +and: + + - Red + - Green + - Blue + +Ordered lists use numbers followed by periods: + + 1. Bird + 2. McHale + 3. Parish + +It's important to note that the actual numbers you use to mark the +list have no effect on the HTML output Markdown produces. The HTML +Markdown produces from the above list is: + +
      +
    1. Bird
    2. +
    3. McHale
    4. +
    5. Parish
    6. +
    + +If you instead wrote the list in Markdown like this: + + 1. Bird + 1. McHale + 1. Parish + +or even: + + 3. Bird + 1. McHale + 8. Parish + +you'd get the exact same HTML output. The point is, if you want to, +you can use ordinal numbers in your ordered Markdown lists, so that +the numbers in your source match the numbers in your published HTML. +But if you want to be lazy, you don't have to. + +If you do use lazy list numbering, however, you should still start the +list with the number 1. At some point in the future, Markdown may support +starting ordered lists at an arbitrary number. + +List markers typically start at the left margin, but may be indented by +up to three spaces. List markers must be followed by one or more spaces +or a tab. + +To make lists look nice, you can wrap items with hanging indents: + + * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. + * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +But if you want to be lazy, you don't have to: + + * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. + * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +If list items are separated by blank lines, Markdown will wrap the +items in `

    ` tags in the HTML output. For example, this input: + + * Bird + * Magic + +will turn into: + +

      +
    • Bird
    • +
    • Magic
    • +
    + +But this: + + * Bird + + * Magic + +will turn into: + +
      +
    • Bird

    • +
    • Magic

    • +
    + +List items may consist of multiple paragraphs. Each subsequent +paragraph in a list item must be indented by either 4 spaces +or one tab: + + 1. This is a list item with two paragraphs. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. Aliquam hendrerit + mi posuere lectus. + + Vestibulum enim wisi, viverra nec, fringilla in, laoreet + vitae, risus. Donec sit amet nisl. Aliquam semper ipsum + sit amet velit. + + 2. Suspendisse id sem consectetuer libero luctus adipiscing. + +It looks nice if you indent every line of the subsequent +paragraphs, but here again, Markdown will allow you to be +lazy: + + * This is a list item with two paragraphs. + + This is the second paragraph in the list item. You're + only required to indent the first line. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. + + * Another item in the same list. + +To put a blockquote within a list item, the blockquote's `>` +delimiters need to be indented: + + * A list item with a blockquote: + + > This is a blockquote + > inside a list item. + +To put a code block within a list item, the code block needs +to be indented *twice* -- 8 spaces or two tabs: + + * A list item with a code block: + + + + +It's worth noting that it's possible to trigger an ordered list by +accident, by writing something like this: + + 1986. What a great season. + +In other words, a *number-period-space* sequence at the beginning of a +line. To avoid this, you can backslash-escape the period: + + 1986\. What a great season. + + + +

    Code Blocks

    + +Pre-formatted code blocks are used for writing about programming or +markup source code. Rather than forming normal paragraphs, the lines +of a code block are interpreted literally. Markdown wraps a code block +in both `
    ` and `` tags.
    +
    +To produce a code block in Markdown, simply indent every line of the
    +block by at least 4 spaces or 1 tab. For example, given this input:
    +
    +    This is a normal paragraph:
    +
    +        This is a code block.
    +
    +Markdown will generate:
    +
    +    

    This is a normal paragraph:

    + +
    This is a code block.
    +    
    + +One level of indentation -- 4 spaces or 1 tab -- is removed from each +line of the code block. For example, this: + + Here is an example of AppleScript: + + tell application "Foo" + beep + end tell + +will turn into: + +

    Here is an example of AppleScript:

    + +
    tell application "Foo"
    +        beep
    +    end tell
    +    
    + +A code block continues until it reaches a line that is not indented +(or the end of the article). + +Within a code block, ampersands (`&`) and angle brackets (`<` and `>`) +are automatically converted into HTML entities. This makes it very +easy to include example HTML source code using Markdown -- just paste +it and indent it, and Markdown will handle the hassle of encoding the +ampersands and angle brackets. For example, this: + + + +will turn into: + +
    <div class="footer">
    +        &copy; 2004 Foo Corporation
    +    </div>
    +    
    + +Regular Markdown syntax is not processed within code blocks. E.g., +asterisks are just literal asterisks within a code block. This means +it's also easy to use Markdown to write about Markdown's own syntax. + + + +

    Horizontal Rules

    + +You can produce a horizontal rule tag (`
    `) by placing three or +more hyphens, asterisks, or underscores on a line by themselves. If you +wish, you may use spaces between the hyphens or asterisks. Each of the +following lines will produce a horizontal rule: + + * * * + + *** + + ***** + + - - - + + --------------------------------------- + + _ _ _ + + +* * * + +

    Span Elements

    + + + +Markdown supports two style of links: *inline* and *reference*. + +In both styles, the link text is delimited by [square brackets]. + +To create an inline link, use a set of regular parentheses immediately +after the link text's closing square bracket. Inside the parentheses, +put the URL where you want the link to point, along with an *optional* +title for the link, surrounded in quotes. For example: + + This is [an example](http://example.com/ "Title") inline link. + + [This link](http://example.net/) has no title attribute. + +Will produce: + +

    This is + an example inline link.

    + +

    This link has no + title attribute.

    + +If you're referring to a local resource on the same server, you can +use relative paths: + + See my [About](/about/) page for details. + +Reference-style links use a second set of square brackets, inside +which you place a label of your choosing to identify the link: + + This is [an example][id] reference-style link. + +You can optionally use a space to separate the sets of brackets: + + This is [an example] [id] reference-style link. + +Then, anywhere in the document, you define your link label like this, +on a line by itself: + + [id]: http://example.com/ "Optional Title Here" + +That is: + +* Square brackets containing the link identifier (optionally + indented from the left margin using up to three spaces); +* followed by a colon; +* followed by one or more spaces (or tabs); +* followed by the URL for the link; +* optionally followed by a title attribute for the link, enclosed + in double or single quotes. + +The link URL may, optionally, be surrounded by angle brackets: + + [id]: "Optional Title Here" + +You can put the title attribute on the next line and use extra spaces +or tabs for padding, which tends to look better with longer URLs: + + [id]: http://example.com/longish/path/to/resource/here + "Optional Title Here" + +Link definitions are only used for creating links during Markdown +processing, and are stripped from your document in the HTML output. + +Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links: + + [link text][a] + [link text][A] + +are equivalent. + +The *implicit link name* shortcut allows you to omit the name of the +link, in which case the link text itself is used as the name. +Just use an empty set of square brackets -- e.g., to link the word +"Google" to the google.com web site, you could simply write: + + [Google][] + +And then define the link: + + [Google]: http://google.com/ + +Because link names may contain spaces, this shortcut even works for +multiple words in the link text: + + Visit [Daring Fireball][] for more information. + +And then define the link: + + [Daring Fireball]: http://daringfireball.net/ + +Link definitions can be placed anywhere in your Markdown document. I +tend to put them immediately after each paragraph in which they're +used, but if you want, you can put them all at the end of your +document, sort of like footnotes. + +Here's an example of reference links in action: + + I get 10 times more traffic from [Google] [1] than from + [Yahoo] [2] or [MSN] [3]. + + [1]: http://google.com/ "Google" + [2]: http://search.yahoo.com/ "Yahoo Search" + [3]: http://search.msn.com/ "MSN Search" + +Using the implicit link name shortcut, you could instead write: + + I get 10 times more traffic from [Google][] than from + [Yahoo][] or [MSN][]. + + [google]: http://google.com/ "Google" + [yahoo]: http://search.yahoo.com/ "Yahoo Search" + [msn]: http://search.msn.com/ "MSN Search" + +Both of the above examples will produce the following HTML output: + +

    I get 10 times more traffic from Google than from + Yahoo + or MSN.

    + +For comparison, here is the same paragraph written using +Markdown's inline link style: + + I get 10 times more traffic from [Google](http://google.com/ "Google") + than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or + [MSN](http://search.msn.com/ "MSN Search"). + +The point of reference-style links is not that they're easier to +write. The point is that with reference-style links, your document +source is vastly more readable. Compare the above examples: using +reference-style links, the paragraph itself is only 81 characters +long; with inline-style links, it's 176 characters; and as raw HTML, +it's 234 characters. In the raw HTML, there's more markup than there +is text. + +With Markdown's reference-style links, a source document much more +closely resembles the final output, as rendered in a browser. By +allowing you to move the markup-related metadata out of the paragraph, +you can add links without interrupting the narrative flow of your +prose. + + +

    Emphasis

    + +Markdown treats asterisks (`*`) and underscores (`_`) as indicators of +emphasis. Text wrapped with one `*` or `_` will be wrapped with an +HTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML +`` tag. E.g., this input: + + *single asterisks* + + _single underscores_ + + **double asterisks** + + __double underscores__ + +will produce: + + single asterisks + + single underscores + + double asterisks + + double underscores + +You can use whichever style you prefer; the lone restriction is that +the same character must be used to open and close an emphasis span. + +Emphasis can be used in the middle of a word: + + un*fucking*believable + +But if you surround an `*` or `_` with spaces, it'll be treated as a +literal asterisk or underscore. + +To produce a literal asterisk or underscore at a position where it +would otherwise be used as an emphasis delimiter, you can backslash +escape it: + + \*this text is surrounded by literal asterisks\* + + + +

    Code

    + +To indicate a span of code, wrap it with backtick quotes (`` ` ``). +Unlike a pre-formatted code block, a code span indicates code within a +normal paragraph. For example: + + Use the `printf()` function. + +will produce: + +

    Use the printf() function.

    + +To include a literal backtick character within a code span, you can use +multiple backticks as the opening and closing delimiters: + + ``There is a literal backtick (`) here.`` + +which will produce this: + +

    There is a literal backtick (`) here.

    + +The backtick delimiters surrounding a code span may include spaces -- +one after the opening, one before the closing. This allows you to place +literal backtick characters at the beginning or end of a code span: + + A single backtick in a code span: `` ` `` + + A backtick-delimited string in a code span: `` `foo` `` + +will produce: + +

    A single backtick in a code span: `

    + +

    A backtick-delimited string in a code span: `foo`

    + +With a code span, ampersands and angle brackets are encoded as HTML +entities automatically, which makes it easy to include example HTML +tags. Markdown will turn this: + + Please don't use any `` tags. + +into: + +

    Please don't use any <blink> tags.

    + +You can write this: + + `—` is the decimal-encoded equivalent of `—`. + +to produce: + +

    &#8212; is the decimal-encoded + equivalent of &mdash;.

    + + + +

    Images

    + +Admittedly, it's fairly difficult to devise a "natural" syntax for +placing images into a plain text document format. + +Markdown uses an image syntax that is intended to resemble the syntax +for links, allowing for two styles: *inline* and *reference*. + +Inline image syntax looks like this: + + ![Alt text](/path/to/img.jpg) + + ![Alt text](/path/to/img.jpg "Optional title") + +That is: + +* An exclamation mark: `!`; +* followed by a set of square brackets, containing the `alt` + attribute text for the image; +* followed by a set of parentheses, containing the URL or path to + the image, and an optional `title` attribute enclosed in double + or single quotes. + +Reference-style image syntax looks like this: + + ![Alt text][id] + +Where "id" is the name of a defined image reference. Image references +are defined using syntax identical to link references: + + [id]: url/to/image "Optional title attribute" + +As of this writing, Markdown has no syntax for specifying the +dimensions of an image; if this is important to you, you can simply +use regular HTML `` tags. + + +* * * + + +

    Miscellaneous

    + + + +Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this: + + + +Markdown will turn this into: + + http://example.com/ + +Automatic links for email addresses work similarly, except that +Markdown will also perform a bit of randomized decimal and hex +entity-encoding to help obscure your address from address-harvesting +spambots. For example, Markdown will turn this: + + + +into something like this: + + address@exa + mple.com + +which will render in a browser as a clickable link to "address@example.com". + +(This sort of entity-encoding trick will indeed fool many, if not +most, address-harvesting bots, but it definitely won't fool all of +them. It's better than nothing, but an address published in this way +will probably eventually start receiving spam.) + + + +

    Backslash Escapes

    + +Markdown allows you to use backslash escapes to generate literal +characters which would otherwise have special meaning in Markdown's +formatting syntax. For example, if you wanted to surround a word with +literal asterisks (instead of an HTML `` tag), you can backslashes +before the asterisks, like this: + + \*literal asterisks\* + +Markdown provides backslash escapes for the following characters: + + \ backslash + ` backtick + * asterisk + _ underscore + {} curly braces + [] square brackets + () parentheses + # hash mark + + plus sign + - minus sign (hyphen) + . dot + ! exclamation mark + diff --git a/tests/pl/Tests_2004/Nested blockquotes.html b/tests/pl/Tests_2004/Nested blockquotes.html new file mode 100644 index 0000000..d8ec7f8 --- /dev/null +++ b/tests/pl/Tests_2004/Nested blockquotes.html @@ -0,0 +1,9 @@ +
    +

    foo

    + +
    +

    bar

    +
    + +

    foo

    +
    diff --git a/tests/pl/Tests_2004/Nested blockquotes.text b/tests/pl/Tests_2004/Nested blockquotes.text new file mode 100644 index 0000000..ed3c624 --- /dev/null +++ b/tests/pl/Tests_2004/Nested blockquotes.text @@ -0,0 +1,5 @@ +> foo +> +> > bar +> +> foo diff --git a/tests/pl/Tests_2004/Ordered and unordered lists.html b/tests/pl/Tests_2004/Ordered and unordered lists.html new file mode 100644 index 0000000..ce85c3a --- /dev/null +++ b/tests/pl/Tests_2004/Ordered and unordered lists.html @@ -0,0 +1,137 @@ +

    Unordered

    + +

    Asterisks tight:

    + +
      +
    • asterisk 1
    • +
    • asterisk 2
    • +
    • asterisk 3
    • +
    + +

    Asterisks loose:

    + +
      +
    • asterisk 1

    • +
    • asterisk 2

    • +
    • asterisk 3

    • +
    + +
    + +

    Pluses tight:

    + +
      +
    • Plus 1
    • +
    • Plus 2
    • +
    • Plus 3
    • +
    + +

    Pluses loose:

    + +
      +
    • Plus 1

    • +
    • Plus 2

    • +
    • Plus 3

    • +
    + +
    + +

    Minuses tight:

    + +
      +
    • Minus 1
    • +
    • Minus 2
    • +
    • Minus 3
    • +
    + +

    Minuses loose:

    + +
      +
    • Minus 1

    • +
    • Minus 2

    • +
    • Minus 3

    • +
    + +

    Ordered

    + +

    Tight:

    + +
      +
    1. First
    2. +
    3. Second
    4. +
    5. Third
    6. +
    + +

    and:

    + +
      +
    1. One
    2. +
    3. Two
    4. +
    5. Three
    6. +
    + +

    Loose using tabs:

    + +
      +
    1. First

    2. +
    3. Second

    4. +
    5. Third

    6. +
    + +

    and using spaces:

    + +
      +
    1. One

    2. +
    3. Two

    4. +
    5. Three

    6. +
    + +

    Multiple paragraphs:

    + +
      +
    1. Item 1, graf one.

      + +

      Item 2. graf two. The quick brown fox jumped over the lazy dog's +back.

    2. +
    3. Item 2.

    4. +
    5. Item 3.

    6. +
    + +

    Nested

    + +
      +
    • Tab +
        +
      • Tab +
          +
        • Tab
        • +
      • +
    • +
    + +

    Here's another:

    + +
      +
    1. First
    2. +
    3. Second: +
        +
      • Fee
      • +
      • Fie
      • +
      • Foe
      • +
    4. +
    5. Third
    6. +
    + +

    Same thing but with paragraphs:

    + +
      +
    1. First

    2. +
    3. Second:

      + +
        +
      • Fee
      • +
      • Fie
      • +
      • Foe
      • +
    4. +
    5. Third

    6. +
    diff --git a/tests/pl/Tests_2004/Ordered and unordered lists.text b/tests/pl/Tests_2004/Ordered and unordered lists.text new file mode 100644 index 0000000..621db58 --- /dev/null +++ b/tests/pl/Tests_2004/Ordered and unordered lists.text @@ -0,0 +1,122 @@ +## Unordered + +Asterisks tight: + +* asterisk 1 +* asterisk 2 +* asterisk 3 + + +Asterisks loose: + +* asterisk 1 + +* asterisk 2 + +* asterisk 3 + +* * * + +Pluses tight: + ++ Plus 1 ++ Plus 2 ++ Plus 3 + + +Pluses loose: + ++ Plus 1 + ++ Plus 2 + ++ Plus 3 + +* * * + + +Minuses tight: + +- Minus 1 +- Minus 2 +- Minus 3 + + +Minuses loose: + +- Minus 1 + +- Minus 2 + +- Minus 3 + + +## Ordered + +Tight: + +1. First +2. Second +3. Third + +and: + +1. One +2. Two +3. Three + + +Loose using tabs: + +1. First + +2. Second + +3. Third + +and using spaces: + +1. One + +2. Two + +3. Three + +Multiple paragraphs: + +1. Item 1, graf one. + + Item 2. graf two. The quick brown fox jumped over the lazy dog's + back. + +2. Item 2. + +3. Item 3. + + + +## Nested + +* Tab + * Tab + * Tab + +Here's another: + +1. First +2. Second: + * Fee + * Fie + * Foe +3. Third + +Same thing but with paragraphs: + +1. First + +2. Second: + * Fee + * Fie + * Foe + +3. Third diff --git a/tests/pl/Tests_2004/Strong and em together.html b/tests/pl/Tests_2004/Strong and em together.html new file mode 100644 index 0000000..71ec78c --- /dev/null +++ b/tests/pl/Tests_2004/Strong and em together.html @@ -0,0 +1,7 @@ +

    This is strong and em.

    + +

    So is this word.

    + +

    This is strong and em.

    + +

    So is this word.

    diff --git a/tests/pl/Tests_2004/Strong and em together.text b/tests/pl/Tests_2004/Strong and em together.text new file mode 100644 index 0000000..95ee690 --- /dev/null +++ b/tests/pl/Tests_2004/Strong and em together.text @@ -0,0 +1,7 @@ +***This is strong and em.*** + +So is ***this*** word. + +___This is strong and em.___ + +So is ___this___ word. diff --git a/tests/pl/Tests_2004/Tabs.html b/tests/pl/Tests_2004/Tabs.html new file mode 100644 index 0000000..3301ba8 --- /dev/null +++ b/tests/pl/Tests_2004/Tabs.html @@ -0,0 +1,25 @@ +
      +
    • this is a list item +indented with tabs

    • +
    • this is a list item +indented with spaces

    • +
    + +

    Code:

    + +
    this code block is indented by one tab
    +
    + +

    And:

    + +
        this code block is indented by two tabs
    +
    + +

    And:

    + +
    +   this is an example list item
    +    indented with tabs
    +
    ++   this is an example list item
    +    indented with spaces
    +
    diff --git a/tests/pl/Tests_2004/Tabs.text b/tests/pl/Tests_2004/Tabs.text new file mode 100644 index 0000000..589d113 --- /dev/null +++ b/tests/pl/Tests_2004/Tabs.text @@ -0,0 +1,21 @@ ++ this is a list item + indented with tabs + ++ this is a list item + indented with spaces + +Code: + + this code block is indented by one tab + +And: + + this code block is indented by two tabs + +And: + + + this is an example list item + indented with tabs + + + this is an example list item + indented with spaces diff --git a/tests/pl/Tests_2004/Tidyness.html b/tests/pl/Tests_2004/Tidyness.html new file mode 100644 index 0000000..f2a8ce7 --- /dev/null +++ b/tests/pl/Tests_2004/Tidyness.html @@ -0,0 +1,8 @@ +
    +

    A list within a blockquote:

    +
      +
    • asterisk 1
    • +
    • asterisk 2
    • +
    • asterisk 3
    • +
    +
    diff --git a/tests/pl/Tests_2004/Tidyness.text b/tests/pl/Tests_2004/Tidyness.text new file mode 100644 index 0000000..5f18b8d --- /dev/null +++ b/tests/pl/Tests_2004/Tidyness.text @@ -0,0 +1,5 @@ +> A list within a blockquote: +> +> * asterisk 1 +> * asterisk 2 +> * asterisk 3 diff --git a/tests/pl/Tests_2004/Yuri-Attributes.html b/tests/pl/Tests_2004/Yuri-Attributes.html new file mode 100644 index 0000000..057da2f --- /dev/null +++ b/tests/pl/Tests_2004/Yuri-Attributes.html @@ -0,0 +1,28 @@ + + +

    Lorem ipsum

    +

    Dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor + incididunt ut labore et dolore magna aliqua. +

    +
      +
    • Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris + nisi ut aliquip ex ea commodo consequat. +

      + +
    • + +
    • Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur2. Excepteur sint occaecat + cupidatat non proident, sunt in culpa qui officia deserunt mollit + anim id est laborum. +

      + +
    • +
    +

    Duis aute irure dolor in reprehenderit in voluptate + velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint + occaecat cupidatat non proident, sunt in culpa qui officia deserunt + mollit anim id est laborum. +

    + + diff --git a/tests/pl/Tests_2004/Yuri-Attributes.text b/tests/pl/Tests_2004/Yuri-Attributes.text new file mode 100644 index 0000000..8ee512d --- /dev/null +++ b/tests/pl/Tests_2004/Yuri-Attributes.text @@ -0,0 +1,19 @@ + +Lorem ipsum {@id=lorem} +================================= + +Dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor +incididunt ut labore et dolore magna aliqua. + +* Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris + nisi ut aliquip ex ea commodo consequat.{@class=first_item} + +* Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur2. Excepteur sint occaecat + cupidatat non proident, sunt in culpa qui officia deserunt mollit + anim id est laborum. + +Duis aute **irure{@type=term}** dolor in reprehenderit in voluptate +velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint +occaecat cupidatat non proident, sunt in culpa qui officia deserunt +mollit anim id est laborum. diff --git a/tests/pl/Tests_2004/Yuri-Email.html b/tests/pl/Tests_2004/Yuri-Email.html new file mode 100644 index 0000000..bf1d149 --- /dev/null +++ b/tests/pl/Tests_2004/Yuri-Email.html @@ -0,0 +1,18 @@ + +

    Lorem ipsum yuri@domain.org, etc. +

    +
      +
    • + An email address in a list +
    • + +
    • + yuri@domain.org +
    • + +
    • + Another item. +
    • +
    + + diff --git a/tests/pl/Tests_2004/Yuri-Email.text b/tests/pl/Tests_2004/Yuri-Email.text new file mode 100644 index 0000000..8f9c779 --- /dev/null +++ b/tests/pl/Tests_2004/Yuri-Email.text @@ -0,0 +1,7 @@ +Lorem ipsum , etc. + +* An email address in a list +* +* Another item. + + diff --git a/tests/pl/Tests_2004/Yuri-Footnotes.html b/tests/pl/Tests_2004/Yuri-Footnotes.html new file mode 100644 index 0000000..cadb040 --- /dev/null +++ b/tests/pl/Tests_2004/Yuri-Footnotes.html @@ -0,0 +1,46 @@ + +

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua1. Ut enim ad minim + veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea + commodo consequat. Duis aute irure dolor in reprehenderit in voluptate + velit esse cillum dolore eu fugiat nulla pariatur2. Excepteur sint + occaecat cupidatat non proident, sunt in culpa qui officia deserunt + mollit anim id est laborum. +

    +
      +
    • + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do + eiusmod tempor incididunt ut labore et dolore3 magna aliqua. +
    • +
    +

    Duis aute irure dolor in reprehenderit in voluptate + velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint + occaecat cupidatat non proident, sunt in culpa qui officia deserunt + mollit anim id est laborum. +

    + +

      +
    1. + Sed ut perspiciatis unde omnis iste natus error sit voluptatem + accusantium doloremque laudantium, totam rem aperiam, eaque ipsa + quae ab illo inventore veritatis et quasi architecto beatae vitae + dicta sunt explicabo. +
    2. + +
    3. + Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit + aut fugit, sed quia consequuntur magni dolores eos qui ratione + voluptatem sequi nesciunt.

      Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, + consectetur, adipisci velit, sed quia non numquam eius modi + tempora incidunt ut labore et dolore magnam aliquam quaerat + voluptatem. +

      + +
    4. + +
    5. + Ut enim ad minim veniam, quis nostrud exercitation ullamco + laboris nisi ut aliquip ex ea commodo consequat. +
    6. +
    +
    diff --git a/tests/pl/Tests_2004/Yuri-Footnotes.text b/tests/pl/Tests_2004/Yuri-Footnotes.text new file mode 100644 index 0000000..16fe402 --- /dev/null +++ b/tests/pl/Tests_2004/Yuri-Footnotes.text @@ -0,0 +1,32 @@ +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod +tempor incididunt ut labore et dolore magna aliqua[^2]. Ut enim ad minim +veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea +commodo consequat. Duis aute irure dolor in reprehenderit in voluptate +velit esse cillum dolore eu fugiat nulla pariatur[^1]. Excepteur sint +occaecat cupidatat non proident, sunt in culpa qui officia deserunt +mollit anim id est laborum. + +[^1]: Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit + aut fugit, sed quia consequuntur magni dolores eos qui ratione + voluptatem sequi nesciunt. + + Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, + consectetur, adipisci velit, sed quia non numquam eius modi + tempora incidunt ut labore et dolore magnam aliquam quaerat + voluptatem. + +[^2]: Sed ut perspiciatis unde omnis iste natus error sit voluptatem + accusantium doloremque laudantium, totam rem aperiam, eaque ipsa + quae ab illo inventore veritatis et quasi architecto beatae vitae + dicta sunt explicabo. + +* Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do + eiusmod tempor incididunt ut labore et dolore[^foo] magna aliqua. + +[^foo]: Ut enim ad minim veniam, quis nostrud exercitation ullamco + laboris nisi ut aliquip ex ea commodo consequat. + +Duis aute irure dolor in reprehenderit in voluptate +velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint +occaecat cupidatat non proident, sunt in culpa qui officia deserunt +mollit anim id est laborum. diff --git a/tests/pl/Tests_2004/Yuri-Links-in-Headers.html b/tests/pl/Tests_2004/Yuri-Links-in-Headers.html new file mode 100644 index 0000000..6afc56e --- /dev/null +++ b/tests/pl/Tests_2004/Yuri-Links-in-Headers.html @@ -0,0 +1,15 @@ +

    A plain header

    + +

    Let's first have a plain header

    + +

    An underlined header

    + +

    (That's also useful)

    + +

    A header with a link

    + +

    First with a hash

    + +

    Another with a link

    + +

    This time underlined

    diff --git a/tests/pl/Tests_2004/Yuri-Links-in-Headers.text b/tests/pl/Tests_2004/Yuri-Links-in-Headers.text new file mode 100644 index 0000000..d06a9e1 --- /dev/null +++ b/tests/pl/Tests_2004/Yuri-Links-in-Headers.text @@ -0,0 +1,18 @@ +## A plain header + +Let's first have a plain header + +An underlined header +==================== + +(That's also useful) + +# A header with a [link](http://www.link.com) + +First with a hash + +Another with a [link][a] +------------------------ +This time underlined + +[a]: http://www.link.com/ diff --git a/tests/pl/Tests_2007/Amps and angle encoding.html b/tests/pl/Tests_2007/Amps and angle encoding.html new file mode 100644 index 0000000..9606860 --- /dev/null +++ b/tests/pl/Tests_2007/Amps and angle encoding.html @@ -0,0 +1,17 @@ +

    AT&T has an ampersand in their name.

    + +

    AT&T is another way to write it.

    + +

    This & that.

    + +

    4 < 5.

    + +

    6 > 5.

    + +

    Here's a link with an ampersand in the URL.

    + +

    Here's a link with an amersand in the link text: AT&T.

    + +

    Here's an inline link.

    + +

    Here's an inline link.

    diff --git a/tests/pl/Tests_2007/Amps and angle encoding.text b/tests/pl/Tests_2007/Amps and angle encoding.text new file mode 100644 index 0000000..0e9527f --- /dev/null +++ b/tests/pl/Tests_2007/Amps and angle encoding.text @@ -0,0 +1,21 @@ +AT&T has an ampersand in their name. + +AT&T is another way to write it. + +This & that. + +4 < 5. + +6 > 5. + +Here's a [link] [1] with an ampersand in the URL. + +Here's a link with an amersand in the link text: [AT&T] [2]. + +Here's an inline [link](/script?foo=1&bar=2). + +Here's an inline [link](). + + +[1]: http://example.com/?foo=1&bar=2 +[2]: http://att.com/ "AT&T" \ No newline at end of file diff --git a/tests/pl/Tests_2007/Auto links.html b/tests/pl/Tests_2007/Auto links.html new file mode 100644 index 0000000..f8df985 --- /dev/null +++ b/tests/pl/Tests_2007/Auto links.html @@ -0,0 +1,18 @@ +

    Link: http://example.com/.

    + +

    With an ampersand: http://example.com/?foo=1&bar=2

    + + + +
    +

    Blockquoted: http://example.com/

    +
    + +

    Auto-links should not occur here: <http://example.com/>

    + +
    or here: <http://example.com/>
    +
    diff --git a/tests/pl/Tests_2007/Auto links.text b/tests/pl/Tests_2007/Auto links.text new file mode 100644 index 0000000..abbc488 --- /dev/null +++ b/tests/pl/Tests_2007/Auto links.text @@ -0,0 +1,13 @@ +Link: . + +With an ampersand: + +* In a list? +* +* It should. + +> Blockquoted: + +Auto-links should not occur here: `` + + or here: \ No newline at end of file diff --git a/tests/pl/Tests_2007/Backslash escapes.html b/tests/pl/Tests_2007/Backslash escapes.html new file mode 100644 index 0000000..29870da --- /dev/null +++ b/tests/pl/Tests_2007/Backslash escapes.html @@ -0,0 +1,118 @@ +

    These should all get escaped:

    + +

    Backslash: \

    + +

    Backtick: `

    + +

    Asterisk: *

    + +

    Underscore: _

    + +

    Left brace: {

    + +

    Right brace: }

    + +

    Left bracket: [

    + +

    Right bracket: ]

    + +

    Left paren: (

    + +

    Right paren: )

    + +

    Greater-than: >

    + +

    Hash: #

    + +

    Period: .

    + +

    Bang: !

    + +

    Plus: +

    + +

    Minus: -

    + +

    These should not, because they occur within a code block:

    + +
    Backslash: \\
    +
    +Backtick: \`
    +
    +Asterisk: \*
    +
    +Underscore: \_
    +
    +Left brace: \{
    +
    +Right brace: \}
    +
    +Left bracket: \[
    +
    +Right bracket: \]
    +
    +Left paren: \(
    +
    +Right paren: \)
    +
    +Greater-than: \>
    +
    +Hash: \#
    +
    +Period: \.
    +
    +Bang: \!
    +
    +Plus: \+
    +
    +Minus: \-
    +
    + +

    Nor should these, which occur in code spans:

    + +

    Backslash: \\

    + +

    Backtick: \`

    + +

    Asterisk: \*

    + +

    Underscore: \_

    + +

    Left brace: \{

    + +

    Right brace: \}

    + +

    Left bracket: \[

    + +

    Right bracket: \]

    + +

    Left paren: \(

    + +

    Right paren: \)

    + +

    Greater-than: \>

    + +

    Hash: \#

    + +

    Period: \.

    + +

    Bang: \!

    + +

    Plus: \+

    + +

    Minus: \-

    + + +

    These should get escaped, even though they're matching pairs for +other Markdown constructs:

    + +

    *asterisks*

    + +

    _underscores_

    + +

    `backticks`

    + +

    This is a code span with a literal backslash-backtick sequence: \`

    + +

    This is a tag with unescaped backticks bar.

    + +

    This is a tag with backslashes bar.

    diff --git a/tests/pl/Tests_2007/Backslash escapes.text b/tests/pl/Tests_2007/Backslash escapes.text new file mode 100644 index 0000000..5b014cb --- /dev/null +++ b/tests/pl/Tests_2007/Backslash escapes.text @@ -0,0 +1,120 @@ +These should all get escaped: + +Backslash: \\ + +Backtick: \` + +Asterisk: \* + +Underscore: \_ + +Left brace: \{ + +Right brace: \} + +Left bracket: \[ + +Right bracket: \] + +Left paren: \( + +Right paren: \) + +Greater-than: \> + +Hash: \# + +Period: \. + +Bang: \! + +Plus: \+ + +Minus: \- + + + +These should not, because they occur within a code block: + + Backslash: \\ + + Backtick: \` + + Asterisk: \* + + Underscore: \_ + + Left brace: \{ + + Right brace: \} + + Left bracket: \[ + + Right bracket: \] + + Left paren: \( + + Right paren: \) + + Greater-than: \> + + Hash: \# + + Period: \. + + Bang: \! + + Plus: \+ + + Minus: \- + + +Nor should these, which occur in code spans: + +Backslash: `\\` + +Backtick: `` \` `` + +Asterisk: `\*` + +Underscore: `\_` + +Left brace: `\{` + +Right brace: `\}` + +Left bracket: `\[` + +Right bracket: `\]` + +Left paren: `\(` + +Right paren: `\)` + +Greater-than: `\>` + +Hash: `\#` + +Period: `\.` + +Bang: `\!` + +Plus: `\+` + +Minus: `\-` + + +These should get escaped, even though they're matching pairs for +other Markdown constructs: + +\*asterisks\* + +\_underscores\_ + +\`backticks\` + +This is a code span with a literal backslash-backtick sequence: `` \` `` + +This is a tag with unescaped backticks bar. + +This is a tag with backslashes bar. diff --git a/tests/pl/Tests_2007/Blockquotes with code blocks.html b/tests/pl/Tests_2007/Blockquotes with code blocks.html new file mode 100644 index 0000000..990202a --- /dev/null +++ b/tests/pl/Tests_2007/Blockquotes with code blocks.html @@ -0,0 +1,15 @@ +
    +

    Example:

    + +
    sub status {
    +    print "working";
    +}
    +
    + +

    Or:

    + +
    sub status {
    +    return "working";
    +}
    +
    +
    diff --git a/tests/pl/Tests_2007/Blockquotes with code blocks.text b/tests/pl/Tests_2007/Blockquotes with code blocks.text new file mode 100644 index 0000000..c31d171 --- /dev/null +++ b/tests/pl/Tests_2007/Blockquotes with code blocks.text @@ -0,0 +1,11 @@ +> Example: +> +> sub status { +> print "working"; +> } +> +> Or: +> +> sub status { +> return "working"; +> } diff --git a/tests/pl/Tests_2007/Code Blocks.html b/tests/pl/Tests_2007/Code Blocks.html new file mode 100644 index 0000000..32703f5 --- /dev/null +++ b/tests/pl/Tests_2007/Code Blocks.html @@ -0,0 +1,18 @@ +
    code block on the first line
    +
    + +

    Regular text.

    + +
    code block indented by spaces
    +
    + +

    Regular text.

    + +
    the lines in this block  
    +all contain trailing spaces  
    +
    + +

    Regular Text.

    + +
    code block on the last line
    +
    diff --git a/tests/pl/Tests_2007/Code Blocks.text b/tests/pl/Tests_2007/Code Blocks.text new file mode 100644 index 0000000..b54b092 --- /dev/null +++ b/tests/pl/Tests_2007/Code Blocks.text @@ -0,0 +1,14 @@ + code block on the first line + +Regular text. + + code block indented by spaces + +Regular text. + + the lines in this block + all contain trailing spaces + +Regular Text. + + code block on the last line \ No newline at end of file diff --git a/tests/pl/Tests_2007/Code Spans.html b/tests/pl/Tests_2007/Code Spans.html new file mode 100644 index 0000000..b057457 --- /dev/null +++ b/tests/pl/Tests_2007/Code Spans.html @@ -0,0 +1,5 @@ +

    <test a=" content of attribute ">

    + +

    Fix for backticks within HTML tag: like this

    + +

    Here's how you put `backticks` in a code span.

    diff --git a/tests/pl/Tests_2007/Code Spans.text b/tests/pl/Tests_2007/Code Spans.text new file mode 100644 index 0000000..5c229c7 --- /dev/null +++ b/tests/pl/Tests_2007/Code Spans.text @@ -0,0 +1,5 @@ +`` + +Fix for backticks within HTML tag: like this + +Here's how you put `` `backticks` `` in a code span. \ No newline at end of file diff --git a/tests/pl/Tests_2007/Hard-wrapped paragraphs with list-like lines.html b/tests/pl/Tests_2007/Hard-wrapped paragraphs with list-like lines.html new file mode 100644 index 0000000..e21ac79 --- /dev/null +++ b/tests/pl/Tests_2007/Hard-wrapped paragraphs with list-like lines.html @@ -0,0 +1,8 @@ +

    In Markdown 1.0.0 and earlier. Version +8. This line turns into a list item. +Because a hard-wrapped line in the +middle of a paragraph looked like a +list item.

    + +

    Here's one with a bullet. +* criminey.

    diff --git a/tests/pl/Tests_2007/Hard-wrapped paragraphs with list-like lines.text b/tests/pl/Tests_2007/Hard-wrapped paragraphs with list-like lines.text new file mode 100644 index 0000000..f8a5b27 --- /dev/null +++ b/tests/pl/Tests_2007/Hard-wrapped paragraphs with list-like lines.text @@ -0,0 +1,8 @@ +In Markdown 1.0.0 and earlier. Version +8. This line turns into a list item. +Because a hard-wrapped line in the +middle of a paragraph looked like a +list item. + +Here's one with a bullet. +* criminey. diff --git a/tests/pl/Tests_2007/Horizontal rules.html b/tests/pl/Tests_2007/Horizontal rules.html new file mode 100644 index 0000000..2dc2ab6 --- /dev/null +++ b/tests/pl/Tests_2007/Horizontal rules.html @@ -0,0 +1,71 @@ +

    Dashes:

    + +
    + +
    + +
    + +
    + +
    ---
    +
    + +
    + +
    + +
    + +
    + +
    - - -
    +
    + +

    Asterisks:

    + +
    + +
    + +
    + +
    + +
    ***
    +
    + +
    + +
    + +
    + +
    + +
    * * *
    +
    + +

    Underscores:

    + +
    + +
    + +
    + +
    + +
    ___
    +
    + +
    + +
    + +
    + +
    + +
    _ _ _
    +
    diff --git a/tests/pl/Tests_2007/Horizontal rules.text b/tests/pl/Tests_2007/Horizontal rules.text new file mode 100644 index 0000000..1594bda --- /dev/null +++ b/tests/pl/Tests_2007/Horizontal rules.text @@ -0,0 +1,67 @@ +Dashes: + +--- + + --- + + --- + + --- + + --- + +- - - + + - - - + + - - - + + - - - + + - - - + + +Asterisks: + +*** + + *** + + *** + + *** + + *** + +* * * + + * * * + + * * * + + * * * + + * * * + + +Underscores: + +___ + + ___ + + ___ + + ___ + + ___ + +_ _ _ + + _ _ _ + + _ _ _ + + _ _ _ + + _ _ _ diff --git a/tests/pl/Tests_2007/Images.html b/tests/pl/Tests_2007/Images.html new file mode 100644 index 0000000..217f028 --- /dev/null +++ b/tests/pl/Tests_2007/Images.html @@ -0,0 +1,21 @@ +

    Alt text

    + +

    Alt text

    + +

    Inline within a paragraph: alt text.

    + +

    alt text

    + +

    alt text

    + +

    alt text

    + +

    alt text.

    + +

    Empty

    + +

    this is a stupid URL

    + +

    alt text

    + +

    alt text

    diff --git a/tests/pl/Tests_2007/Images.text b/tests/pl/Tests_2007/Images.text new file mode 100644 index 0000000..5707590 --- /dev/null +++ b/tests/pl/Tests_2007/Images.text @@ -0,0 +1,26 @@ +![Alt text](/path/to/img.jpg) + +![Alt text](/path/to/img.jpg "Optional title") + +Inline within a paragraph: [alt text](/url/). + +![alt text](/url/ "title preceded by two spaces") + +![alt text](/url/ "title has spaces afterward" ) + +![alt text]() + +![alt text]( "with a title"). + +![Empty]() + +![this is a stupid URL](http://example.com/(parens).jpg) + + +![alt text][foo] + + [foo]: /url/ + +![alt text][bar] + + [bar]: /url/ "Title here" \ No newline at end of file diff --git a/tests/pl/Tests_2007/Inline HTML (Advanced).html b/tests/pl/Tests_2007/Inline HTML (Advanced).html new file mode 100644 index 0000000..884f14c --- /dev/null +++ b/tests/pl/Tests_2007/Inline HTML (Advanced).html @@ -0,0 +1,30 @@ +

    Simple block on one line:

    + +
    foo
    + +

    And nested without indentation:

    + +
    +
    +
    +foo +
    +
    +
    +
    bar
    +
    + +

    And with attributes:

    + +
    +
    +
    +
    + +

    This was broken in 1.0.2b7:

    + +
    +
    +foo +
    +
    diff --git a/tests/pl/Tests_2007/Inline HTML (Advanced).text b/tests/pl/Tests_2007/Inline HTML (Advanced).text new file mode 100644 index 0000000..3633f81 --- /dev/null +++ b/tests/pl/Tests_2007/Inline HTML (Advanced).text @@ -0,0 +1,30 @@ +Simple block on one line: + +
    foo
    + +And nested without indentation: + +
    +
    +
    +foo +
    +
    +
    +
    bar
    +
    + +And with attributes: + +
    +
    +
    +
    + +This was broken in 1.0.2b7: + +
    +
    +foo +
    +
    diff --git a/tests/pl/Tests_2007/Inline HTML (Simple).html b/tests/pl/Tests_2007/Inline HTML (Simple).html new file mode 100644 index 0000000..6bf78f8 --- /dev/null +++ b/tests/pl/Tests_2007/Inline HTML (Simple).html @@ -0,0 +1,72 @@ +

    Here's a simple block:

    + +
    + foo +
    + +

    This should be a code block, though:

    + +
    <div>
    +    foo
    +</div>
    +
    + +

    As should this:

    + +
    <div>foo</div>
    +
    + +

    Now, nested:

    + +
    +
    +
    + foo +
    +
    +
    + +

    This should just be an HTML comment:

    + + + +

    Multiline:

    + + + +

    Code block:

    + +
    <!-- Comment -->
    +
    + +

    Just plain comment, with trailing spaces on the line:

    + + + +

    Code:

    + +
    <hr />
    +
    + +

    Hr's:

    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    diff --git a/tests/pl/Tests_2007/Inline HTML (Simple).text b/tests/pl/Tests_2007/Inline HTML (Simple).text new file mode 100644 index 0000000..14aa2dc --- /dev/null +++ b/tests/pl/Tests_2007/Inline HTML (Simple).text @@ -0,0 +1,69 @@ +Here's a simple block: + +
    + foo +
    + +This should be a code block, though: + +
    + foo +
    + +As should this: + +
    foo
    + +Now, nested: + +
    +
    +
    + foo +
    +
    +
    + +This should just be an HTML comment: + + + +Multiline: + + + +Code block: + + + +Just plain comment, with trailing spaces on the line: + + + +Code: + +
    + +Hr's: + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + diff --git a/tests/pl/Tests_2007/Inline HTML comments.html b/tests/pl/Tests_2007/Inline HTML comments.html new file mode 100644 index 0000000..3f167a1 --- /dev/null +++ b/tests/pl/Tests_2007/Inline HTML comments.html @@ -0,0 +1,13 @@ +

    Paragraph one.

    + + + + + +

    Paragraph two.

    + + + +

    The end.

    diff --git a/tests/pl/Tests_2007/Inline HTML comments.text b/tests/pl/Tests_2007/Inline HTML comments.text new file mode 100644 index 0000000..41d830d --- /dev/null +++ b/tests/pl/Tests_2007/Inline HTML comments.text @@ -0,0 +1,13 @@ +Paragraph one. + + + + + +Paragraph two. + + + +The end. diff --git a/tests/pl/Tests_2007/Links, inline style.html b/tests/pl/Tests_2007/Links, inline style.html new file mode 100644 index 0000000..9f351ef --- /dev/null +++ b/tests/pl/Tests_2007/Links, inline style.html @@ -0,0 +1,23 @@ +

    Just a URL.

    + +

    URL and title.

    + +

    URL and title.

    + +

    URL and title.

    + +

    URL and title.

    + +

    URL wrapped in angle brackets.

    + +

    URL w/ angle brackets + title.

    + +

    Empty.

    + +

    With parens in the URL

    + +

    (With outer parens and parens in url)

    + +

    With parens in the URL

    + +

    (With outer parens and parens in url)

    diff --git a/tests/pl/Tests_2007/Links, inline style.text b/tests/pl/Tests_2007/Links, inline style.text new file mode 100644 index 0000000..aba9658 --- /dev/null +++ b/tests/pl/Tests_2007/Links, inline style.text @@ -0,0 +1,24 @@ +Just a [URL](/url/). + +[URL and title](/url/ "title"). + +[URL and title](/url/ "title preceded by two spaces"). + +[URL and title](/url/ "title preceded by a tab"). + +[URL and title](/url/ "title has spaces afterward" ). + +[URL wrapped in angle brackets](). + +[URL w/ angle brackets + title]( "Here's the title"). + +[Empty](). + +[With parens in the URL](http://en.wikipedia.org/wiki/WIMP_(computing)) + +(With outer parens and [parens in url](/foo(bar))) + + +[With parens in the URL](/foo(bar) "and a title") + +(With outer parens and [parens in url](/foo(bar) "and a title")) diff --git a/tests/pl/Tests_2007/Links, reference style.html b/tests/pl/Tests_2007/Links, reference style.html new file mode 100644 index 0000000..8e70c32 --- /dev/null +++ b/tests/pl/Tests_2007/Links, reference style.html @@ -0,0 +1,52 @@ +

    Foo bar.

    + +

    Foo bar.

    + +

    Foo bar.

    + +

    With embedded [brackets].

    + +

    Indented once.

    + +

    Indented twice.

    + +

    Indented thrice.

    + +

    Indented [four][] times.

    + +
    [four]: /url
    +
    + +
    + +

    this should work

    + +

    So should this.

    + +

    And this.

    + +

    And this.

    + +

    And this.

    + +

    But not [that] [].

    + +

    Nor [that][].

    + +

    Nor [that].

    + +

    [Something in brackets like this should work]

    + +

    [Same with this.]

    + +

    In this case, this points to something else.

    + +

    Backslashing should suppress [this] and [this].

    + +
    + +

    Here's one where the link +breaks across lines.

    + +

    Here's another where the link +breaks across lines, but with a line-ending space.

    diff --git a/tests/pl/Tests_2007/Links, reference style.text b/tests/pl/Tests_2007/Links, reference style.text new file mode 100644 index 0000000..341ec88 --- /dev/null +++ b/tests/pl/Tests_2007/Links, reference style.text @@ -0,0 +1,71 @@ +Foo [bar] [1]. + +Foo [bar][1]. + +Foo [bar] +[1]. + +[1]: /url/ "Title" + + +With [embedded [brackets]] [b]. + + +Indented [once][]. + +Indented [twice][]. + +Indented [thrice][]. + +Indented [four][] times. + + [once]: /url + + [twice]: /url + + [thrice]: /url + + [four]: /url + + +[b]: /url/ + +* * * + +[this] [this] should work + +So should [this][this]. + +And [this] []. + +And [this][]. + +And [this]. + +But not [that] []. + +Nor [that][]. + +Nor [that]. + +[Something in brackets like [this][] should work] + +[Same with [this].] + +In this case, [this](/somethingelse/) points to something else. + +Backslashing should suppress \[this] and [this\]. + +[this]: foo + + +* * * + +Here's one where the [link +breaks] across lines. + +Here's another where the [link +breaks] across lines, but with a line-ending space. + + +[link breaks]: /url/ diff --git a/tests/pl/Tests_2007/Links, shortcut references.html b/tests/pl/Tests_2007/Links, shortcut references.html new file mode 100644 index 0000000..bf81e93 --- /dev/null +++ b/tests/pl/Tests_2007/Links, shortcut references.html @@ -0,0 +1,9 @@ +

    This is the simple case.

    + +

    This one has a line +break.

    + +

    This one has a line +break with a line-ending space.

    + +

    this and the other

    diff --git a/tests/pl/Tests_2007/Links, shortcut references.text b/tests/pl/Tests_2007/Links, shortcut references.text new file mode 100644 index 0000000..8c44c98 --- /dev/null +++ b/tests/pl/Tests_2007/Links, shortcut references.text @@ -0,0 +1,20 @@ +This is the [simple case]. + +[simple case]: /simple + + + +This one has a [line +break]. + +This one has a [line +break] with a line-ending space. + +[line break]: /foo + + +[this] [that] and the [other] + +[this]: /this +[that]: /that +[other]: /other diff --git a/tests/pl/Tests_2007/Literal quotes in titles.html b/tests/pl/Tests_2007/Literal quotes in titles.html new file mode 100644 index 0000000..611c1ac --- /dev/null +++ b/tests/pl/Tests_2007/Literal quotes in titles.html @@ -0,0 +1,3 @@ +

    Foo bar.

    + +

    Foo bar.

    diff --git a/tests/pl/Tests_2007/Literal quotes in titles.text b/tests/pl/Tests_2007/Literal quotes in titles.text new file mode 100644 index 0000000..29d0e42 --- /dev/null +++ b/tests/pl/Tests_2007/Literal quotes in titles.text @@ -0,0 +1,7 @@ +Foo [bar][]. + +Foo [bar](/url/ "Title with "quotes" inside"). + + + [bar]: /url/ "Title with "quotes" inside" + diff --git a/tests/pl/Tests_2007/Markdown Documentation - Basics.html b/tests/pl/Tests_2007/Markdown Documentation - Basics.html new file mode 100644 index 0000000..342f0c1 --- /dev/null +++ b/tests/pl/Tests_2007/Markdown Documentation - Basics.html @@ -0,0 +1,314 @@ +

    Markdown: Basics

    + + + +

    Getting the Gist of Markdown's Formatting Syntax

    + +

    This page offers a brief overview of what it's like to use Markdown. +The syntax page provides complete, detailed documentation for +every feature, but Markdown should be very easy to pick up simply by +looking at a few examples of it in action. The examples on this page +are written in a before/after style, showing example syntax and the +HTML output produced by Markdown.

    + +

    It's also helpful to simply try Markdown out; the Dingus is a +web application that allows you type your own Markdown-formatted text +and translate it to XHTML.

    + +

    Note: This document is itself written using Markdown; you +can see the source for it by adding '.text' to the URL.

    + +

    Paragraphs, Headers, Blockquotes

    + +

    A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing spaces or tabs is considered +blank.) Normal paragraphs should not be indented with spaces or tabs.

    + +

    Markdown offers two styles of headers: Setext and atx. +Setext-style headers for <h1> and <h2> are created by +"underlining" with equal signs (=) and hyphens (-), respectively. +To create an atx-style header, you put 1-6 hash marks (#) at the +beginning of the line -- the number of hashes equals the resulting +HTML header level.

    + +

    Blockquotes are indicated using email-style '>' angle brackets.

    + +

    Markdown:

    + +
    A First Level Header
    +====================
    +
    +A Second Level Header
    +---------------------
    +
    +Now is the time for all good men to come to
    +the aid of their country. This is just a
    +regular paragraph.
    +
    +The quick brown fox jumped over the lazy
    +dog's back.
    +
    +### Header 3
    +
    +> This is a blockquote.
    +> 
    +> This is the second paragraph in the blockquote.
    +>
    +> ## This is an H2 in a blockquote
    +
    + +

    Output:

    + +
    <h1>A First Level Header</h1>
    +
    +<h2>A Second Level Header</h2>
    +
    +<p>Now is the time for all good men to come to
    +the aid of their country. This is just a
    +regular paragraph.</p>
    +
    +<p>The quick brown fox jumped over the lazy
    +dog's back.</p>
    +
    +<h3>Header 3</h3>
    +
    +<blockquote>
    +    <p>This is a blockquote.</p>
    +
    +    <p>This is the second paragraph in the blockquote.</p>
    +
    +    <h2>This is an H2 in a blockquote</h2>
    +</blockquote>
    +
    + +

    Phrase Emphasis

    + +

    Markdown uses asterisks and underscores to indicate spans of emphasis.

    + +

    Markdown:

    + +
    Some of these words *are emphasized*.
    +Some of these words _are emphasized also_.
    +
    +Use two asterisks for **strong emphasis**.
    +Or, if you prefer, __use two underscores instead__.
    +
    + +

    Output:

    + +
    <p>Some of these words <em>are emphasized</em>.
    +Some of these words <em>are emphasized also</em>.</p>
    +
    +<p>Use two asterisks for <strong>strong emphasis</strong>.
    +Or, if you prefer, <strong>use two underscores instead</strong>.</p>
    +
    + +

    Lists

    + +

    Unordered (bulleted) lists use asterisks, pluses, and hyphens (*, ++, and -) as list markers. These three markers are +interchangable; this:

    + +
    *   Candy.
    +*   Gum.
    +*   Booze.
    +
    + +

    this:

    + +
    +   Candy.
    ++   Gum.
    ++   Booze.
    +
    + +

    and this:

    + +
    -   Candy.
    +-   Gum.
    +-   Booze.
    +
    + +

    all produce the same output:

    + +
    <ul>
    +<li>Candy.</li>
    +<li>Gum.</li>
    +<li>Booze.</li>
    +</ul>
    +
    + +

    Ordered (numbered) lists use regular numbers, followed by periods, as +list markers:

    + +
    1.  Red
    +2.  Green
    +3.  Blue
    +
    + +

    Output:

    + +
    <ol>
    +<li>Red</li>
    +<li>Green</li>
    +<li>Blue</li>
    +</ol>
    +
    + +

    If you put blank lines between items, you'll get <p> tags for the +list item text. You can create multi-paragraph list items by indenting +the paragraphs by 4 spaces or 1 tab:

    + +
    *   A list item.
    +
    +    With multiple paragraphs.
    +
    +*   Another item in the list.
    +
    + +

    Output:

    + +
    <ul>
    +<li><p>A list item.</p>
    +<p>With multiple paragraphs.</p></li>
    +<li><p>Another item in the list.</p></li>
    +</ul>
    +
    + +

    Links

    + +

    Markdown supports two styles for creating links: inline and +reference. With both styles, you use square brackets to delimit the +text you want to turn into a link.

    + +

    Inline-style links use parentheses immediately after the link text. +For example:

    + +
    This is an [example link](http://example.com/).
    +
    + +

    Output:

    + +
    <p>This is an <a href="http://example.com/">
    +example link</a>.</p>
    +
    + +

    Optionally, you may include a title attribute in the parentheses:

    + +
    This is an [example link](http://example.com/ "With a Title").
    +
    + +

    Output:

    + +
    <p>This is an <a href="http://example.com/" title="With a Title">
    +example link</a>.</p>
    +
    + +

    Reference-style links allow you to refer to your links by names, which +you define elsewhere in your document:

    + +
    I get 10 times more traffic from [Google][1] than from
    +[Yahoo][2] or [MSN][3].
    +
    +[1]: http://google.com/        "Google"
    +[2]: http://search.yahoo.com/  "Yahoo Search"
    +[3]: http://search.msn.com/    "MSN Search"
    +
    + +

    Output:

    + +
    <p>I get 10 times more traffic from <a href="http://google.com/"
    +title="Google">Google</a> than from <a href="http://search.yahoo.com/"
    +title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
    +title="MSN Search">MSN</a>.</p>
    +
    + +

    The title attribute is optional. Link names may contain letters, +numbers and spaces, but are not case sensitive:

    + +
    I start my morning with a cup of coffee and
    +[The New York Times][NY Times].
    +
    +[ny times]: http://www.nytimes.com/
    +
    + +

    Output:

    + +
    <p>I start my morning with a cup of coffee and
    +<a href="http://www.nytimes.com/">The New York Times</a>.</p>
    +
    + +

    Images

    + +

    Image syntax is very much like link syntax.

    + +

    Inline (titles are optional):

    + +
    ![alt text](/path/to/img.jpg "Title")
    +
    + +

    Reference-style:

    + +
    ![alt text][id]
    +
    +[id]: /path/to/img.jpg "Title"
    +
    + +

    Both of the above examples produce the same output:

    + +
    <img src="/path/to/img.jpg" alt="alt text" title="Title" />
    +
    + +

    Code

    + +

    In a regular paragraph, you can create code span by wrapping text in +backtick quotes. Any ampersands (&) and angle brackets (< or +>) will automatically be translated into HTML entities. This makes +it easy to use Markdown to write about HTML example code:

    + +
    I strongly recommend against using any `<blink>` tags.
    +
    +I wish SmartyPants used named entities like `&mdash;`
    +instead of decimal-encoded entites like `&#8212;`.
    +
    + +

    Output:

    + +
    <p>I strongly recommend against using any
    +<code>&lt;blink&gt;</code> tags.</p>
    +
    +<p>I wish SmartyPants used named entities like
    +<code>&amp;mdash;</code> instead of decimal-encoded
    +entites like <code>&amp;#8212;</code>.</p>
    +
    + +

    To specify an entire block of pre-formatted code, indent every line of +the block by 4 spaces or 1 tab. Just like with code spans, &, <, +and > characters will be escaped automatically.

    + +

    Markdown:

    + +
    If you want your page to validate under XHTML 1.0 Strict,
    +you've got to put paragraph tags in your blockquotes:
    +
    +    <blockquote>
    +        <p>For example.</p>
    +    </blockquote>
    +
    + +

    Output:

    + +
    <p>If you want your page to validate under XHTML 1.0 Strict,
    +you've got to put paragraph tags in your blockquotes:</p>
    +
    +<pre><code>&lt;blockquote&gt;
    +    &lt;p&gt;For example.&lt;/p&gt;
    +&lt;/blockquote&gt;
    +</code></pre>
    +
    diff --git a/tests/pl/Tests_2007/Markdown Documentation - Basics.text b/tests/pl/Tests_2007/Markdown Documentation - Basics.text new file mode 100644 index 0000000..2abe24a --- /dev/null +++ b/tests/pl/Tests_2007/Markdown Documentation - Basics.text @@ -0,0 +1,306 @@ +Markdown: Basics +================ + + + + +Getting the Gist of Markdown's Formatting Syntax +------------------------------------------------ + +This page offers a brief overview of what it's like to use Markdown. +The [syntax page] [s] provides complete, detailed documentation for +every feature, but Markdown should be very easy to pick up simply by +looking at a few examples of it in action. The examples on this page +are written in a before/after style, showing example syntax and the +HTML output produced by Markdown. + +It's also helpful to simply try Markdown out; the [Dingus] [d] is a +web application that allows you type your own Markdown-formatted text +and translate it to XHTML. + +**Note:** This document is itself written using Markdown; you +can [see the source for it by adding '.text' to the URL] [src]. + + [s]: /projects/markdown/syntax "Markdown Syntax" + [d]: /projects/markdown/dingus "Markdown Dingus" + [src]: /projects/markdown/basics.text + + +## Paragraphs, Headers, Blockquotes ## + +A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing spaces or tabs is considered +blank.) Normal paragraphs should not be indented with spaces or tabs. + +Markdown offers two styles of headers: *Setext* and *atx*. +Setext-style headers for `

    ` and `

    ` are created by +"underlining" with equal signs (`=`) and hyphens (`-`), respectively. +To create an atx-style header, you put 1-6 hash marks (`#`) at the +beginning of the line -- the number of hashes equals the resulting +HTML header level. + +Blockquotes are indicated using email-style '`>`' angle brackets. + +Markdown: + + A First Level Header + ==================== + + A Second Level Header + --------------------- + + Now is the time for all good men to come to + the aid of their country. This is just a + regular paragraph. + + The quick brown fox jumped over the lazy + dog's back. + + ### Header 3 + + > This is a blockquote. + > + > This is the second paragraph in the blockquote. + > + > ## This is an H2 in a blockquote + + +Output: + +

    A First Level Header

    + +

    A Second Level Header

    + +

    Now is the time for all good men to come to + the aid of their country. This is just a + regular paragraph.

    + +

    The quick brown fox jumped over the lazy + dog's back.

    + +

    Header 3

    + +
    +

    This is a blockquote.

    + +

    This is the second paragraph in the blockquote.

    + +

    This is an H2 in a blockquote

    +
    + + + +### Phrase Emphasis ### + +Markdown uses asterisks and underscores to indicate spans of emphasis. + +Markdown: + + Some of these words *are emphasized*. + Some of these words _are emphasized also_. + + Use two asterisks for **strong emphasis**. + Or, if you prefer, __use two underscores instead__. + +Output: + +

    Some of these words are emphasized. + Some of these words are emphasized also.

    + +

    Use two asterisks for strong emphasis. + Or, if you prefer, use two underscores instead.

    + + + +## Lists ## + +Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`, +`+`, and `-`) as list markers. These three markers are +interchangable; this: + + * Candy. + * Gum. + * Booze. + +this: + + + Candy. + + Gum. + + Booze. + +and this: + + - Candy. + - Gum. + - Booze. + +all produce the same output: + +
      +
    • Candy.
    • +
    • Gum.
    • +
    • Booze.
    • +
    + +Ordered (numbered) lists use regular numbers, followed by periods, as +list markers: + + 1. Red + 2. Green + 3. Blue + +Output: + +
      +
    1. Red
    2. +
    3. Green
    4. +
    5. Blue
    6. +
    + +If you put blank lines between items, you'll get `

    ` tags for the +list item text. You can create multi-paragraph list items by indenting +the paragraphs by 4 spaces or 1 tab: + + * A list item. + + With multiple paragraphs. + + * Another item in the list. + +Output: + +

      +
    • A list item.

      +

      With multiple paragraphs.

    • +
    • Another item in the list.

    • +
    + + + +### Links ### + +Markdown supports two styles for creating links: *inline* and +*reference*. With both styles, you use square brackets to delimit the +text you want to turn into a link. + +Inline-style links use parentheses immediately after the link text. +For example: + + This is an [example link](http://example.com/). + +Output: + +

    This is an + example link.

    + +Optionally, you may include a title attribute in the parentheses: + + This is an [example link](http://example.com/ "With a Title"). + +Output: + +

    This is an + example link.

    + +Reference-style links allow you to refer to your links by names, which +you define elsewhere in your document: + + I get 10 times more traffic from [Google][1] than from + [Yahoo][2] or [MSN][3]. + + [1]: http://google.com/ "Google" + [2]: http://search.yahoo.com/ "Yahoo Search" + [3]: http://search.msn.com/ "MSN Search" + +Output: + +

    I get 10 times more traffic from Google than from Yahoo or MSN.

    + +The title attribute is optional. Link names may contain letters, +numbers and spaces, but are *not* case sensitive: + + I start my morning with a cup of coffee and + [The New York Times][NY Times]. + + [ny times]: http://www.nytimes.com/ + +Output: + +

    I start my morning with a cup of coffee and + The New York Times.

    + + +### Images ### + +Image syntax is very much like link syntax. + +Inline (titles are optional): + + ![alt text](/path/to/img.jpg "Title") + +Reference-style: + + ![alt text][id] + + [id]: /path/to/img.jpg "Title" + +Both of the above examples produce the same output: + + alt text + + + +### Code ### + +In a regular paragraph, you can create code span by wrapping text in +backtick quotes. Any ampersands (`&`) and angle brackets (`<` or +`>`) will automatically be translated into HTML entities. This makes +it easy to use Markdown to write about HTML example code: + + I strongly recommend against using any `` tags. + + I wish SmartyPants used named entities like `—` + instead of decimal-encoded entites like `—`. + +Output: + +

    I strongly recommend against using any + <blink> tags.

    + +

    I wish SmartyPants used named entities like + &mdash; instead of decimal-encoded + entites like &#8212;.

    + + +To specify an entire block of pre-formatted code, indent every line of +the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`, +and `>` characters will be escaped automatically. + +Markdown: + + If you want your page to validate under XHTML 1.0 Strict, + you've got to put paragraph tags in your blockquotes: + +
    +

    For example.

    +
    + +Output: + +

    If you want your page to validate under XHTML 1.0 Strict, + you've got to put paragraph tags in your blockquotes:

    + +
    <blockquote>
    +        <p>For example.</p>
    +    </blockquote>
    +    
    diff --git a/tests/pl/Tests_2007/Markdown Documentation - Syntax.html b/tests/pl/Tests_2007/Markdown Documentation - Syntax.html new file mode 100644 index 0000000..7847793 --- /dev/null +++ b/tests/pl/Tests_2007/Markdown Documentation - Syntax.html @@ -0,0 +1,942 @@ +

    Markdown: Syntax

    + + + + + +

    Note: This document is itself written using Markdown; you +can see the source for it by adding '.text' to the URL.

    + +
    + +

    Overview

    + +

    Philosophy

    + +

    Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

    + +

    Readability, however, is emphasized above all else. A Markdown-formatted +document should be publishable as-is, as plain text, without looking +like it's been marked up with tags or formatting instructions. While +Markdown's syntax has been influenced by several existing text-to-HTML +filters -- including Setext, atx, Textile, reStructuredText, +Grutatext, and EtText -- the single biggest source of +inspiration for Markdown's syntax is the format of plain text email.

    + +

    To this end, Markdown's syntax is comprised entirely of punctuation +characters, which punctuation characters have been carefully chosen so +as to look like what they mean. E.g., asterisks around a word actually +look like *emphasis*. Markdown lists look like, well, lists. Even +blockquotes look like quoted passages of text, assuming you've ever +used email.

    + +

    Inline HTML

    + +

    Markdown's syntax is intended for one purpose: to be used as a +format for writing for the web.

    + +

    Markdown is not a replacement for HTML, or even close to it. Its +syntax is very small, corresponding only to a very small subset of +HTML tags. The idea is not to create a syntax that makes it easier +to insert HTML tags. In my opinion, HTML tags are already easy to +insert. The idea for Markdown is to make it easy to read, write, and +edit prose. HTML is a publishing format; Markdown is a writing +format. Thus, Markdown's formatting syntax only addresses issues that +can be conveyed in plain text.

    + +

    For any markup that is not covered by Markdown's syntax, you simply +use HTML itself. There's no need to preface it or delimit it to +indicate that you're switching from Markdown to HTML; you just use +the tags.

    + +

    The only restrictions are that block-level HTML elements -- e.g. <div>, +<table>, <pre>, <p>, etc. -- must be separated from surrounding +content by blank lines, and the start and end tags of the block should +not be indented with tabs or spaces. Markdown is smart enough not +to add extra (unwanted) <p> tags around HTML block-level tags.

    + +

    For example, to add an HTML table to a Markdown article:

    + +
    This is a regular paragraph.
    +
    +<table>
    +    <tr>
    +        <td>Foo</td>
    +    </tr>
    +</table>
    +
    +This is another regular paragraph.
    +
    + +

    Note that Markdown formatting syntax is not processed within block-level +HTML tags. E.g., you can't use Markdown-style *emphasis* inside an +HTML block.

    + +

    Span-level HTML tags -- e.g. <span>, <cite>, or <del> -- can be +used anywhere in a Markdown paragraph, list item, or header. If you +want, you can even use HTML tags instead of Markdown formatting; e.g. if +you'd prefer to use HTML <a> or <img> tags instead of Markdown's +link or image syntax, go right ahead.

    + +

    Unlike block-level HTML tags, Markdown syntax is processed within +span-level tags.

    + +

    Automatic Escaping for Special Characters

    + +

    In HTML, there are two characters that demand special treatment: < +and &. Left angle brackets are used to start tags; ampersands are +used to denote HTML entities. If you want to use them as literal +characters, you must escape them as entities, e.g. &lt;, and +&amp;.

    + +

    Ampersands in particular are bedeviling for web writers. If you want to +write about 'AT&T', you need to write 'AT&amp;T'. You even need to +escape ampersands within URLs. Thus, if you want to link to:

    + +
    http://images.google.com/images?num=30&q=larry+bird
    +
    + +

    you need to encode the URL as:

    + +
    http://images.google.com/images?num=30&amp;q=larry+bird
    +
    + +

    in your anchor tag href attribute. Needless to say, this is easy to +forget, and is probably the single most common source of HTML validation +errors in otherwise well-marked-up web sites.

    + +

    Markdown allows you to use these characters naturally, taking care of +all the necessary escaping for you. If you use an ampersand as part of +an HTML entity, it remains unchanged; otherwise it will be translated +into &amp;.

    + +

    So, if you want to include a copyright symbol in your article, you can write:

    + +
    &copy;
    +
    + +

    and Markdown will leave it alone. But if you write:

    + +
    AT&T
    +
    + +

    Markdown will translate it to:

    + +
    AT&amp;T
    +
    + +

    Similarly, because Markdown supports inline HTML, if you use +angle brackets as delimiters for HTML tags, Markdown will treat them as +such. But if you write:

    + +
    4 < 5
    +
    + +

    Markdown will translate it to:

    + +
    4 &lt; 5
    +
    + +

    However, inside Markdown code spans and blocks, angle brackets and +ampersands are always encoded automatically. This makes it easy to use +Markdown to write about HTML code. (As opposed to raw HTML, which is a +terrible format for writing about HTML syntax, because every single < +and & in your example code needs to be escaped.)

    + +
    + +

    Block Elements

    + +

    Paragraphs and Line Breaks

    + +

    A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing but spaces or tabs is considered +blank.) Normal paragraphs should not be indented with spaces or tabs.

    + +

    The implication of the "one or more consecutive lines of text" rule is +that Markdown supports "hard-wrapped" text paragraphs. This differs +significantly from most other text-to-HTML formatters (including Movable +Type's "Convert Line Breaks" option) which translate every line break +character in a paragraph into a <br /> tag.

    + +

    When you do want to insert a <br /> break tag using Markdown, you +end a line with two or more spaces, then type return.

    + +

    Yes, this takes a tad more effort to create a <br />, but a simplistic +"every line break is a <br />" rule wouldn't work for Markdown. +Markdown's email-style blockquoting and multi-paragraph list items +work best -- and look better -- when you format them with hard breaks.

    + + + +

    Markdown supports two styles of headers, Setext and atx.

    + +

    Setext-style headers are "underlined" using equal signs (for first-level +headers) and dashes (for second-level headers). For example:

    + +
    This is an H1
    +=============
    +
    +This is an H2
    +-------------
    +
    + +

    Any number of underlining ='s or -'s will work.

    + +

    Atx-style headers use 1-6 hash characters at the start of the line, +corresponding to header levels 1-6. For example:

    + +
    # This is an H1
    +
    +## This is an H2
    +
    +###### This is an H6
    +
    + +

    Optionally, you may "close" atx-style headers. This is purely +cosmetic -- you can use this if you think it looks better. The +closing hashes don't even need to match the number of hashes +used to open the header. (The number of opening hashes +determines the header level.) :

    + +
    # This is an H1 #
    +
    +## This is an H2 ##
    +
    +### This is an H3 ######
    +
    + +

    Blockquotes

    + +

    Markdown uses email-style > characters for blockquoting. If you're +familiar with quoting passages of text in an email message, then you +know how to create a blockquote in Markdown. It looks best if you hard +wrap the text and put a > before every line:

    + +
    > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
    +> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
    +> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
    +> 
    +> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
    +> id sem consectetuer libero luctus adipiscing.
    +
    + +

    Markdown allows you to be lazy and only put the > before the first +line of a hard-wrapped paragraph:

    + +
    > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
    +consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
    +Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
    +
    +> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
    +id sem consectetuer libero luctus adipiscing.
    +
    + +

    Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by +adding additional levels of >:

    + +
    > This is the first level of quoting.
    +>
    +> > This is nested blockquote.
    +>
    +> Back to the first level.
    +
    + +

    Blockquotes can contain other Markdown elements, including headers, lists, +and code blocks:

    + +
    > ## This is a header.
    +> 
    +> 1.   This is the first list item.
    +> 2.   This is the second list item.
    +> 
    +> Here's some example code:
    +> 
    +>     return shell_exec("echo $input | $markdown_script");
    +
    + +

    Any decent text editor should make email-style quoting easy. For +example, with BBEdit, you can make a selection and choose Increase +Quote Level from the Text menu.

    + +

    Lists

    + +

    Markdown supports ordered (numbered) and unordered (bulleted) lists.

    + +

    Unordered lists use asterisks, pluses, and hyphens -- interchangably +-- as list markers:

    + +
    *   Red
    +*   Green
    +*   Blue
    +
    + +

    is equivalent to:

    + +
    +   Red
    ++   Green
    ++   Blue
    +
    + +

    and:

    + +
    -   Red
    +-   Green
    +-   Blue
    +
    + +

    Ordered lists use numbers followed by periods:

    + +
    1.  Bird
    +2.  McHale
    +3.  Parish
    +
    + +

    It's important to note that the actual numbers you use to mark the +list have no effect on the HTML output Markdown produces. The HTML +Markdown produces from the above list is:

    + +
    <ol>
    +<li>Bird</li>
    +<li>McHale</li>
    +<li>Parish</li>
    +</ol>
    +
    + +

    If you instead wrote the list in Markdown like this:

    + +
    1.  Bird
    +1.  McHale
    +1.  Parish
    +
    + +

    or even:

    + +
    3. Bird
    +1. McHale
    +8. Parish
    +
    + +

    you'd get the exact same HTML output. The point is, if you want to, +you can use ordinal numbers in your ordered Markdown lists, so that +the numbers in your source match the numbers in your published HTML. +But if you want to be lazy, you don't have to.

    + +

    If you do use lazy list numbering, however, you should still start the +list with the number 1. At some point in the future, Markdown may support +starting ordered lists at an arbitrary number.

    + +

    List markers typically start at the left margin, but may be indented by +up to three spaces. List markers must be followed by one or more spaces +or a tab.

    + +

    To make lists look nice, you can wrap items with hanging indents:

    + +
    *   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    +    Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
    +    viverra nec, fringilla in, laoreet vitae, risus.
    +*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
    +    Suspendisse id sem consectetuer libero luctus adipiscing.
    +
    + +

    But if you want to be lazy, you don't have to:

    + +
    *   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    +Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
    +viverra nec, fringilla in, laoreet vitae, risus.
    +*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
    +Suspendisse id sem consectetuer libero luctus adipiscing.
    +
    + +

    If list items are separated by blank lines, Markdown will wrap the +items in <p> tags in the HTML output. For example, this input:

    + +
    *   Bird
    +*   Magic
    +
    + +

    will turn into:

    + +
    <ul>
    +<li>Bird</li>
    +<li>Magic</li>
    +</ul>
    +
    + +

    But this:

    + +
    *   Bird
    +
    +*   Magic
    +
    + +

    will turn into:

    + +
    <ul>
    +<li><p>Bird</p></li>
    +<li><p>Magic</p></li>
    +</ul>
    +
    + +

    List items may consist of multiple paragraphs. Each subsequent +paragraph in a list item must be indented by either 4 spaces +or one tab:

    + +
    1.  This is a list item with two paragraphs. Lorem ipsum dolor
    +    sit amet, consectetuer adipiscing elit. Aliquam hendrerit
    +    mi posuere lectus.
    +
    +    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
    +    vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
    +    sit amet velit.
    +
    +2.  Suspendisse id sem consectetuer libero luctus adipiscing.
    +
    + +

    It looks nice if you indent every line of the subsequent +paragraphs, but here again, Markdown will allow you to be +lazy:

    + +
    *   This is a list item with two paragraphs.
    +
    +    This is the second paragraph in the list item. You're
    +only required to indent the first line. Lorem ipsum dolor
    +sit amet, consectetuer adipiscing elit.
    +
    +*   Another item in the same list.
    +
    + +

    To put a blockquote within a list item, the blockquote's > +delimiters need to be indented:

    + +
    *   A list item with a blockquote:
    +
    +    > This is a blockquote
    +    > inside a list item.
    +
    + +

    To put a code block within a list item, the code block needs +to be indented twice -- 8 spaces or two tabs:

    + +
    *   A list item with a code block:
    +
    +        <code goes here>
    +
    + +

    It's worth noting that it's possible to trigger an ordered list by +accident, by writing something like this:

    + +
    1986. What a great season.
    +
    + +

    In other words, a number-period-space sequence at the beginning of a +line. To avoid this, you can backslash-escape the period:

    + +
    1986\. What a great season.
    +
    + +

    Code Blocks

    + +

    Pre-formatted code blocks are used for writing about programming or +markup source code. Rather than forming normal paragraphs, the lines +of a code block are interpreted literally. Markdown wraps a code block +in both <pre> and <code> tags.

    + +

    To produce a code block in Markdown, simply indent every line of the +block by at least 4 spaces or 1 tab. For example, given this input:

    + +
    This is a normal paragraph:
    +
    +    This is a code block.
    +
    + +

    Markdown will generate:

    + +
    <p>This is a normal paragraph:</p>
    +
    +<pre><code>This is a code block.
    +</code></pre>
    +
    + +

    One level of indentation -- 4 spaces or 1 tab -- is removed from each +line of the code block. For example, this:

    + +
    Here is an example of AppleScript:
    +
    +    tell application "Foo"
    +        beep
    +    end tell
    +
    + +

    will turn into:

    + +
    <p>Here is an example of AppleScript:</p>
    +
    +<pre><code>tell application "Foo"
    +    beep
    +end tell
    +</code></pre>
    +
    + +

    A code block continues until it reaches a line that is not indented +(or the end of the article).

    + +

    Within a code block, ampersands (&) and angle brackets (< and >) +are automatically converted into HTML entities. This makes it very +easy to include example HTML source code using Markdown -- just paste +it and indent it, and Markdown will handle the hassle of encoding the +ampersands and angle brackets. For example, this:

    + +
        <div class="footer">
    +        &copy; 2004 Foo Corporation
    +    </div>
    +
    + +

    will turn into:

    + +
    <pre><code>&lt;div class="footer"&gt;
    +    &amp;copy; 2004 Foo Corporation
    +&lt;/div&gt;
    +</code></pre>
    +
    + +

    Regular Markdown syntax is not processed within code blocks. E.g., +asterisks are just literal asterisks within a code block. This means +it's also easy to use Markdown to write about Markdown's own syntax.

    + +

    Horizontal Rules

    + +

    You can produce a horizontal rule tag (<hr />) by placing three or +more hyphens, asterisks, or underscores on a line by themselves. If you +wish, you may use spaces between the hyphens or asterisks. Each of the +following lines will produce a horizontal rule:

    + +
    * * *
    +
    +***
    +
    +*****
    +
    +- - -
    +
    +---------------------------------------
    +
    +_ _ _
    +
    + +
    + +

    Span Elements

    + + + +

    Markdown supports two style of links: inline and reference.

    + +

    In both styles, the link text is delimited by [square brackets].

    + +

    To create an inline link, use a set of regular parentheses immediately +after the link text's closing square bracket. Inside the parentheses, +put the URL where you want the link to point, along with an optional +title for the link, surrounded in quotes. For example:

    + +
    This is [an example](http://example.com/ "Title") inline link.
    +
    +[This link](http://example.net/) has no title attribute.
    +
    + +

    Will produce:

    + +
    <p>This is <a href="http://example.com/" title="Title">
    +an example</a> inline link.</p>
    +
    +<p><a href="http://example.net/">This link</a> has no
    +title attribute.</p>
    +
    + +

    If you're referring to a local resource on the same server, you can +use relative paths:

    + +
    See my [About](/about/) page for details.
    +
    + +

    Reference-style links use a second set of square brackets, inside +which you place a label of your choosing to identify the link:

    + +
    This is [an example][id] reference-style link.
    +
    + +

    You can optionally use a space to separate the sets of brackets:

    + +
    This is [an example] [id] reference-style link.
    +
    + +

    Then, anywhere in the document, you define your link label like this, +on a line by itself:

    + +
    [id]: http://example.com/  "Optional Title Here"
    +
    + +

    That is:

    + +
      +
    • Square brackets containing the link identifier (optionally +indented from the left margin using up to three spaces);
    • +
    • followed by a colon;
    • +
    • followed by one or more spaces (or tabs);
    • +
    • followed by the URL for the link;
    • +
    • optionally followed by a title attribute for the link, enclosed +in double or single quotes.
    • +
    + +

    The link URL may, optionally, be surrounded by angle brackets:

    + +
    [id]: <http://example.com/>  "Optional Title Here"
    +
    + +

    You can put the title attribute on the next line and use extra spaces +or tabs for padding, which tends to look better with longer URLs:

    + +
    [id]: http://example.com/longish/path/to/resource/here
    +    "Optional Title Here"
    +
    + +

    Link definitions are only used for creating links during Markdown +processing, and are stripped from your document in the HTML output.

    + +

    Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are not case sensitive. E.g. these two links:

    + +
    [link text][a]
    +[link text][A]
    +
    + +

    are equivalent.

    + +

    The implicit link name shortcut allows you to omit the name of the +link, in which case the link text itself is used as the name. +Just use an empty set of square brackets -- e.g., to link the word +"Google" to the google.com web site, you could simply write:

    + +
    [Google][]
    +
    + +

    And then define the link:

    + +
    [Google]: http://google.com/
    +
    + +

    Because link names may contain spaces, this shortcut even works for +multiple words in the link text:

    + +
    Visit [Daring Fireball][] for more information.
    +
    + +

    And then define the link:

    + +
    [Daring Fireball]: http://daringfireball.net/
    +
    + +

    Link definitions can be placed anywhere in your Markdown document. I +tend to put them immediately after each paragraph in which they're +used, but if you want, you can put them all at the end of your +document, sort of like footnotes.

    + +

    Here's an example of reference links in action:

    + +
    I get 10 times more traffic from [Google] [1] than from
    +[Yahoo] [2] or [MSN] [3].
    +
    +  [1]: http://google.com/        "Google"
    +  [2]: http://search.yahoo.com/  "Yahoo Search"
    +  [3]: http://search.msn.com/    "MSN Search"
    +
    + +

    Using the implicit link name shortcut, you could instead write:

    + +
    I get 10 times more traffic from [Google][] than from
    +[Yahoo][] or [MSN][].
    +
    +  [google]: http://google.com/        "Google"
    +  [yahoo]:  http://search.yahoo.com/  "Yahoo Search"
    +  [msn]:    http://search.msn.com/    "MSN Search"
    +
    + +

    Both of the above examples will produce the following HTML output:

    + +
    <p>I get 10 times more traffic from <a href="http://google.com/"
    +title="Google">Google</a> than from
    +<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
    +or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
    +
    + +

    For comparison, here is the same paragraph written using +Markdown's inline link style:

    + +
    I get 10 times more traffic from [Google](http://google.com/ "Google")
    +than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
    +[MSN](http://search.msn.com/ "MSN Search").
    +
    + +

    The point of reference-style links is not that they're easier to +write. The point is that with reference-style links, your document +source is vastly more readable. Compare the above examples: using +reference-style links, the paragraph itself is only 81 characters +long; with inline-style links, it's 176 characters; and as raw HTML, +it's 234 characters. In the raw HTML, there's more markup than there +is text.

    + +

    With Markdown's reference-style links, a source document much more +closely resembles the final output, as rendered in a browser. By +allowing you to move the markup-related metadata out of the paragraph, +you can add links without interrupting the narrative flow of your +prose.

    + +

    Emphasis

    + +

    Markdown treats asterisks (*) and underscores (_) as indicators of +emphasis. Text wrapped with one * or _ will be wrapped with an +HTML <em> tag; double *'s or _'s will be wrapped with an HTML +<strong> tag. E.g., this input:

    + +
    *single asterisks*
    +
    +_single underscores_
    +
    +**double asterisks**
    +
    +__double underscores__
    +
    + +

    will produce:

    + +
    <em>single asterisks</em>
    +
    +<em>single underscores</em>
    +
    +<strong>double asterisks</strong>
    +
    +<strong>double underscores</strong>
    +
    + +

    You can use whichever style you prefer; the lone restriction is that +the same character must be used to open and close an emphasis span.

    + +

    Emphasis can be used in the middle of a word:

    + +
    un*fucking*believable
    +
    + +

    But if you surround an * or _ with spaces, it'll be treated as a +literal asterisk or underscore.

    + +

    To produce a literal asterisk or underscore at a position where it +would otherwise be used as an emphasis delimiter, you can backslash +escape it:

    + +
    \*this text is surrounded by literal asterisks\*
    +
    + +

    Code

    + +

    To indicate a span of code, wrap it with backtick quotes (`). +Unlike a pre-formatted code block, a code span indicates code within a +normal paragraph. For example:

    + +
    Use the `printf()` function.
    +
    + +

    will produce:

    + +
    <p>Use the <code>printf()</code> function.</p>
    +
    + +

    To include a literal backtick character within a code span, you can use +multiple backticks as the opening and closing delimiters:

    + +
    ``There is a literal backtick (`) here.``
    +
    + +

    which will produce this:

    + +
    <p><code>There is a literal backtick (`) here.</code></p>
    +
    + +

    The backtick delimiters surrounding a code span may include spaces -- +one after the opening, one before the closing. This allows you to place +literal backtick characters at the beginning or end of a code span:

    + +
    A single backtick in a code span: `` ` ``
    +
    +A backtick-delimited string in a code span: `` `foo` ``
    +
    + +

    will produce:

    + +
    <p>A single backtick in a code span: <code>`</code></p>
    +
    +<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
    +
    + +

    With a code span, ampersands and angle brackets are encoded as HTML +entities automatically, which makes it easy to include example HTML +tags. Markdown will turn this:

    + +
    Please don't use any `<blink>` tags.
    +
    + +

    into:

    + +
    <p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
    +
    + +

    You can write this:

    + +
    `&#8212;` is the decimal-encoded equivalent of `&mdash;`.
    +
    + +

    to produce:

    + +
    <p><code>&amp;#8212;</code> is the decimal-encoded
    +equivalent of <code>&amp;mdash;</code>.</p>
    +
    + +

    Images

    + +

    Admittedly, it's fairly difficult to devise a "natural" syntax for +placing images into a plain text document format.

    + +

    Markdown uses an image syntax that is intended to resemble the syntax +for links, allowing for two styles: inline and reference.

    + +

    Inline image syntax looks like this:

    + +
    ![Alt text](/path/to/img.jpg)
    +
    +![Alt text](/path/to/img.jpg "Optional title")
    +
    + +

    That is:

    + +
      +
    • An exclamation mark: !;
    • +
    • followed by a set of square brackets, containing the alt +attribute text for the image;
    • +
    • followed by a set of parentheses, containing the URL or path to +the image, and an optional title attribute enclosed in double +or single quotes.
    • +
    + +

    Reference-style image syntax looks like this:

    + +
    ![Alt text][id]
    +
    + +

    Where "id" is the name of a defined image reference. Image references +are defined using syntax identical to link references:

    + +
    [id]: url/to/image  "Optional title attribute"
    +
    + +

    As of this writing, Markdown has no syntax for specifying the +dimensions of an image; if this is important to you, you can simply +use regular HTML <img> tags.

    + +
    + +

    Miscellaneous

    + + + +

    Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

    + +
    <http://example.com/>
    +
    + +

    Markdown will turn this into:

    + +
    <a href="http://example.com/">http://example.com/</a>
    +
    + +

    Automatic links for email addresses work similarly, except that +Markdown will also perform a bit of randomized decimal and hex +entity-encoding to help obscure your address from address-harvesting +spambots. For example, Markdown will turn this:

    + +
    <address@example.com>
    +
    + +

    into something like this:

    + +
    <a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
    +&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
    +&#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
    +&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
    +
    + +

    which will render in a browser as a clickable link to "address@example.com".

    + +

    (This sort of entity-encoding trick will indeed fool many, if not +most, address-harvesting bots, but it definitely won't fool all of +them. It's better than nothing, but an address published in this way +will probably eventually start receiving spam.)

    + +

    Backslash Escapes

    + +

    Markdown allows you to use backslash escapes to generate literal +characters which would otherwise have special meaning in Markdown's +formatting syntax. For example, if you wanted to surround a word with +literal asterisks (instead of an HTML <em> tag), you can backslashes +before the asterisks, like this:

    + +
    \*literal asterisks\*
    +
    + +

    Markdown provides backslash escapes for the following characters:

    + +
    \   backslash
    +`   backtick
    +*   asterisk
    +_   underscore
    +{}  curly braces
    +[]  square brackets
    +()  parentheses
    +#   hash mark
    ++   plus sign
    +-   minus sign (hyphen)
    +.   dot
    +!   exclamation mark
    +
    diff --git a/tests/pl/Tests_2007/Markdown Documentation - Syntax.text b/tests/pl/Tests_2007/Markdown Documentation - Syntax.text new file mode 100644 index 0000000..f175fa9 --- /dev/null +++ b/tests/pl/Tests_2007/Markdown Documentation - Syntax.text @@ -0,0 +1,888 @@ +Markdown: Syntax +================ + + + + +* [Overview](#overview) + * [Philosophy](#philosophy) + * [Inline HTML](#html) + * [Automatic Escaping for Special Characters](#autoescape) +* [Block Elements](#block) + * [Paragraphs and Line Breaks](#p) + * [Headers](#header) + * [Blockquotes](#blockquote) + * [Lists](#list) + * [Code Blocks](#precode) + * [Horizontal Rules](#hr) +* [Span Elements](#span) + * [Links](#link) + * [Emphasis](#em) + * [Code](#code) + * [Images](#img) +* [Miscellaneous](#misc) + * [Backslash Escapes](#backslash) + * [Automatic Links](#autolink) + + +**Note:** This document is itself written using Markdown; you +can [see the source for it by adding '.text' to the URL][src]. + + [src]: /projects/markdown/syntax.text + +* * * + +

    Overview

    + +

    Philosophy

    + +Markdown is intended to be as easy-to-read and easy-to-write as is feasible. + +Readability, however, is emphasized above all else. A Markdown-formatted +document should be publishable as-is, as plain text, without looking +like it's been marked up with tags or formatting instructions. While +Markdown's syntax has been influenced by several existing text-to-HTML +filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4], +[Grutatext] [5], and [EtText] [6] -- the single biggest source of +inspiration for Markdown's syntax is the format of plain text email. + + [1]: http://docutils.sourceforge.net/mirror/setext.html + [2]: http://www.aaronsw.com/2002/atx/ + [3]: http://textism.com/tools/textile/ + [4]: http://docutils.sourceforge.net/rst.html + [5]: http://www.triptico.com/software/grutatxt.html + [6]: http://ettext.taint.org/doc/ + +To this end, Markdown's syntax is comprised entirely of punctuation +characters, which punctuation characters have been carefully chosen so +as to look like what they mean. E.g., asterisks around a word actually +look like \*emphasis\*. Markdown lists look like, well, lists. Even +blockquotes look like quoted passages of text, assuming you've ever +used email. + + + +

    Inline HTML

    + +Markdown's syntax is intended for one purpose: to be used as a +format for *writing* for the web. + +Markdown is not a replacement for HTML, or even close to it. Its +syntax is very small, corresponding only to a very small subset of +HTML tags. The idea is *not* to create a syntax that makes it easier +to insert HTML tags. In my opinion, HTML tags are already easy to +insert. The idea for Markdown is to make it easy to read, write, and +edit prose. HTML is a *publishing* format; Markdown is a *writing* +format. Thus, Markdown's formatting syntax only addresses issues that +can be conveyed in plain text. + +For any markup that is not covered by Markdown's syntax, you simply +use HTML itself. There's no need to preface it or delimit it to +indicate that you're switching from Markdown to HTML; you just use +the tags. + +The only restrictions are that block-level HTML elements -- e.g. `
    `, +``, `
    `, `

    `, etc. -- must be separated from surrounding +content by blank lines, and the start and end tags of the block should +not be indented with tabs or spaces. Markdown is smart enough not +to add extra (unwanted) `

    ` tags around HTML block-level tags. + +For example, to add an HTML table to a Markdown article: + + This is a regular paragraph. + +

    + + + +
    Foo
    + + This is another regular paragraph. + +Note that Markdown formatting syntax is not processed within block-level +HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an +HTML block. + +Span-level HTML tags -- e.g. ``, ``, or `` -- can be +used anywhere in a Markdown paragraph, list item, or header. If you +want, you can even use HTML tags instead of Markdown formatting; e.g. if +you'd prefer to use HTML `` or `` tags instead of Markdown's +link or image syntax, go right ahead. + +Unlike block-level HTML tags, Markdown syntax *is* processed within +span-level tags. + + +

    Automatic Escaping for Special Characters

    + +In HTML, there are two characters that demand special treatment: `<` +and `&`. Left angle brackets are used to start tags; ampersands are +used to denote HTML entities. If you want to use them as literal +characters, you must escape them as entities, e.g. `<`, and +`&`. + +Ampersands in particular are bedeviling for web writers. If you want to +write about 'AT&T', you need to write '`AT&T`'. You even need to +escape ampersands within URLs. Thus, if you want to link to: + + http://images.google.com/images?num=30&q=larry+bird + +you need to encode the URL as: + + http://images.google.com/images?num=30&q=larry+bird + +in your anchor tag `href` attribute. Needless to say, this is easy to +forget, and is probably the single most common source of HTML validation +errors in otherwise well-marked-up web sites. + +Markdown allows you to use these characters naturally, taking care of +all the necessary escaping for you. If you use an ampersand as part of +an HTML entity, it remains unchanged; otherwise it will be translated +into `&`. + +So, if you want to include a copyright symbol in your article, you can write: + + © + +and Markdown will leave it alone. But if you write: + + AT&T + +Markdown will translate it to: + + AT&T + +Similarly, because Markdown supports [inline HTML](#html), if you use +angle brackets as delimiters for HTML tags, Markdown will treat them as +such. But if you write: + + 4 < 5 + +Markdown will translate it to: + + 4 < 5 + +However, inside Markdown code spans and blocks, angle brackets and +ampersands are *always* encoded automatically. This makes it easy to use +Markdown to write about HTML code. (As opposed to raw HTML, which is a +terrible format for writing about HTML syntax, because every single `<` +and `&` in your example code needs to be escaped.) + + +* * * + + +

    Block Elements

    + + +

    Paragraphs and Line Breaks

    + +A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing but spaces or tabs is considered +blank.) Normal paragraphs should not be indented with spaces or tabs. + +The implication of the "one or more consecutive lines of text" rule is +that Markdown supports "hard-wrapped" text paragraphs. This differs +significantly from most other text-to-HTML formatters (including Movable +Type's "Convert Line Breaks" option) which translate every line break +character in a paragraph into a `
    ` tag. + +When you *do* want to insert a `
    ` break tag using Markdown, you +end a line with two or more spaces, then type return. + +Yes, this takes a tad more effort to create a `
    `, but a simplistic +"every line break is a `
    `" rule wouldn't work for Markdown. +Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l] +work best -- and look better -- when you format them with hard breaks. + + [bq]: #blockquote + [l]: #list + + + + + +Markdown supports two styles of headers, [Setext] [1] and [atx] [2]. + +Setext-style headers are "underlined" using equal signs (for first-level +headers) and dashes (for second-level headers). For example: + + This is an H1 + ============= + + This is an H2 + ------------- + +Any number of underlining `=`'s or `-`'s will work. + +Atx-style headers use 1-6 hash characters at the start of the line, +corresponding to header levels 1-6. For example: + + # This is an H1 + + ## This is an H2 + + ###### This is an H6 + +Optionally, you may "close" atx-style headers. This is purely +cosmetic -- you can use this if you think it looks better. The +closing hashes don't even need to match the number of hashes +used to open the header. (The number of opening hashes +determines the header level.) : + + # This is an H1 # + + ## This is an H2 ## + + ### This is an H3 ###### + + +

    Blockquotes

    + +Markdown uses email-style `>` characters for blockquoting. If you're +familiar with quoting passages of text in an email message, then you +know how to create a blockquote in Markdown. It looks best if you hard +wrap the text and put a `>` before every line: + + > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, + > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. + > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + > + > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse + > id sem consectetuer libero luctus adipiscing. + +Markdown allows you to be lazy and only put the `>` before the first +line of a hard-wrapped paragraph: + + > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, + consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. + Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + + > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse + id sem consectetuer libero luctus adipiscing. + +Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by +adding additional levels of `>`: + + > This is the first level of quoting. + > + > > This is nested blockquote. + > + > Back to the first level. + +Blockquotes can contain other Markdown elements, including headers, lists, +and code blocks: + + > ## This is a header. + > + > 1. This is the first list item. + > 2. This is the second list item. + > + > Here's some example code: + > + > return shell_exec("echo $input | $markdown_script"); + +Any decent text editor should make email-style quoting easy. For +example, with BBEdit, you can make a selection and choose Increase +Quote Level from the Text menu. + + +

    Lists

    + +Markdown supports ordered (numbered) and unordered (bulleted) lists. + +Unordered lists use asterisks, pluses, and hyphens -- interchangably +-- as list markers: + + * Red + * Green + * Blue + +is equivalent to: + + + Red + + Green + + Blue + +and: + + - Red + - Green + - Blue + +Ordered lists use numbers followed by periods: + + 1. Bird + 2. McHale + 3. Parish + +It's important to note that the actual numbers you use to mark the +list have no effect on the HTML output Markdown produces. The HTML +Markdown produces from the above list is: + +
      +
    1. Bird
    2. +
    3. McHale
    4. +
    5. Parish
    6. +
    + +If you instead wrote the list in Markdown like this: + + 1. Bird + 1. McHale + 1. Parish + +or even: + + 3. Bird + 1. McHale + 8. Parish + +you'd get the exact same HTML output. The point is, if you want to, +you can use ordinal numbers in your ordered Markdown lists, so that +the numbers in your source match the numbers in your published HTML. +But if you want to be lazy, you don't have to. + +If you do use lazy list numbering, however, you should still start the +list with the number 1. At some point in the future, Markdown may support +starting ordered lists at an arbitrary number. + +List markers typically start at the left margin, but may be indented by +up to three spaces. List markers must be followed by one or more spaces +or a tab. + +To make lists look nice, you can wrap items with hanging indents: + + * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. + * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +But if you want to be lazy, you don't have to: + + * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. + * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +If list items are separated by blank lines, Markdown will wrap the +items in `

    ` tags in the HTML output. For example, this input: + + * Bird + * Magic + +will turn into: + +

      +
    • Bird
    • +
    • Magic
    • +
    + +But this: + + * Bird + + * Magic + +will turn into: + +
      +
    • Bird

    • +
    • Magic

    • +
    + +List items may consist of multiple paragraphs. Each subsequent +paragraph in a list item must be indented by either 4 spaces +or one tab: + + 1. This is a list item with two paragraphs. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. Aliquam hendrerit + mi posuere lectus. + + Vestibulum enim wisi, viverra nec, fringilla in, laoreet + vitae, risus. Donec sit amet nisl. Aliquam semper ipsum + sit amet velit. + + 2. Suspendisse id sem consectetuer libero luctus adipiscing. + +It looks nice if you indent every line of the subsequent +paragraphs, but here again, Markdown will allow you to be +lazy: + + * This is a list item with two paragraphs. + + This is the second paragraph in the list item. You're + only required to indent the first line. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. + + * Another item in the same list. + +To put a blockquote within a list item, the blockquote's `>` +delimiters need to be indented: + + * A list item with a blockquote: + + > This is a blockquote + > inside a list item. + +To put a code block within a list item, the code block needs +to be indented *twice* -- 8 spaces or two tabs: + + * A list item with a code block: + + + + +It's worth noting that it's possible to trigger an ordered list by +accident, by writing something like this: + + 1986. What a great season. + +In other words, a *number-period-space* sequence at the beginning of a +line. To avoid this, you can backslash-escape the period: + + 1986\. What a great season. + + + +

    Code Blocks

    + +Pre-formatted code blocks are used for writing about programming or +markup source code. Rather than forming normal paragraphs, the lines +of a code block are interpreted literally. Markdown wraps a code block +in both `
    ` and `` tags.
    +
    +To produce a code block in Markdown, simply indent every line of the
    +block by at least 4 spaces or 1 tab. For example, given this input:
    +
    +    This is a normal paragraph:
    +
    +        This is a code block.
    +
    +Markdown will generate:
    +
    +    

    This is a normal paragraph:

    + +
    This is a code block.
    +    
    + +One level of indentation -- 4 spaces or 1 tab -- is removed from each +line of the code block. For example, this: + + Here is an example of AppleScript: + + tell application "Foo" + beep + end tell + +will turn into: + +

    Here is an example of AppleScript:

    + +
    tell application "Foo"
    +        beep
    +    end tell
    +    
    + +A code block continues until it reaches a line that is not indented +(or the end of the article). + +Within a code block, ampersands (`&`) and angle brackets (`<` and `>`) +are automatically converted into HTML entities. This makes it very +easy to include example HTML source code using Markdown -- just paste +it and indent it, and Markdown will handle the hassle of encoding the +ampersands and angle brackets. For example, this: + + + +will turn into: + +
    <div class="footer">
    +        &copy; 2004 Foo Corporation
    +    </div>
    +    
    + +Regular Markdown syntax is not processed within code blocks. E.g., +asterisks are just literal asterisks within a code block. This means +it's also easy to use Markdown to write about Markdown's own syntax. + + + +

    Horizontal Rules

    + +You can produce a horizontal rule tag (`
    `) by placing three or +more hyphens, asterisks, or underscores on a line by themselves. If you +wish, you may use spaces between the hyphens or asterisks. Each of the +following lines will produce a horizontal rule: + + * * * + + *** + + ***** + + - - - + + --------------------------------------- + + _ _ _ + + +* * * + +

    Span Elements

    + + + +Markdown supports two style of links: *inline* and *reference*. + +In both styles, the link text is delimited by [square brackets]. + +To create an inline link, use a set of regular parentheses immediately +after the link text's closing square bracket. Inside the parentheses, +put the URL where you want the link to point, along with an *optional* +title for the link, surrounded in quotes. For example: + + This is [an example](http://example.com/ "Title") inline link. + + [This link](http://example.net/) has no title attribute. + +Will produce: + +

    This is + an example inline link.

    + +

    This link has no + title attribute.

    + +If you're referring to a local resource on the same server, you can +use relative paths: + + See my [About](/about/) page for details. + +Reference-style links use a second set of square brackets, inside +which you place a label of your choosing to identify the link: + + This is [an example][id] reference-style link. + +You can optionally use a space to separate the sets of brackets: + + This is [an example] [id] reference-style link. + +Then, anywhere in the document, you define your link label like this, +on a line by itself: + + [id]: http://example.com/ "Optional Title Here" + +That is: + +* Square brackets containing the link identifier (optionally + indented from the left margin using up to three spaces); +* followed by a colon; +* followed by one or more spaces (or tabs); +* followed by the URL for the link; +* optionally followed by a title attribute for the link, enclosed + in double or single quotes. + +The link URL may, optionally, be surrounded by angle brackets: + + [id]: "Optional Title Here" + +You can put the title attribute on the next line and use extra spaces +or tabs for padding, which tends to look better with longer URLs: + + [id]: http://example.com/longish/path/to/resource/here + "Optional Title Here" + +Link definitions are only used for creating links during Markdown +processing, and are stripped from your document in the HTML output. + +Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links: + + [link text][a] + [link text][A] + +are equivalent. + +The *implicit link name* shortcut allows you to omit the name of the +link, in which case the link text itself is used as the name. +Just use an empty set of square brackets -- e.g., to link the word +"Google" to the google.com web site, you could simply write: + + [Google][] + +And then define the link: + + [Google]: http://google.com/ + +Because link names may contain spaces, this shortcut even works for +multiple words in the link text: + + Visit [Daring Fireball][] for more information. + +And then define the link: + + [Daring Fireball]: http://daringfireball.net/ + +Link definitions can be placed anywhere in your Markdown document. I +tend to put them immediately after each paragraph in which they're +used, but if you want, you can put them all at the end of your +document, sort of like footnotes. + +Here's an example of reference links in action: + + I get 10 times more traffic from [Google] [1] than from + [Yahoo] [2] or [MSN] [3]. + + [1]: http://google.com/ "Google" + [2]: http://search.yahoo.com/ "Yahoo Search" + [3]: http://search.msn.com/ "MSN Search" + +Using the implicit link name shortcut, you could instead write: + + I get 10 times more traffic from [Google][] than from + [Yahoo][] or [MSN][]. + + [google]: http://google.com/ "Google" + [yahoo]: http://search.yahoo.com/ "Yahoo Search" + [msn]: http://search.msn.com/ "MSN Search" + +Both of the above examples will produce the following HTML output: + +

    I get 10 times more traffic from Google than from + Yahoo + or MSN.

    + +For comparison, here is the same paragraph written using +Markdown's inline link style: + + I get 10 times more traffic from [Google](http://google.com/ "Google") + than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or + [MSN](http://search.msn.com/ "MSN Search"). + +The point of reference-style links is not that they're easier to +write. The point is that with reference-style links, your document +source is vastly more readable. Compare the above examples: using +reference-style links, the paragraph itself is only 81 characters +long; with inline-style links, it's 176 characters; and as raw HTML, +it's 234 characters. In the raw HTML, there's more markup than there +is text. + +With Markdown's reference-style links, a source document much more +closely resembles the final output, as rendered in a browser. By +allowing you to move the markup-related metadata out of the paragraph, +you can add links without interrupting the narrative flow of your +prose. + + +

    Emphasis

    + +Markdown treats asterisks (`*`) and underscores (`_`) as indicators of +emphasis. Text wrapped with one `*` or `_` will be wrapped with an +HTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML +`` tag. E.g., this input: + + *single asterisks* + + _single underscores_ + + **double asterisks** + + __double underscores__ + +will produce: + + single asterisks + + single underscores + + double asterisks + + double underscores + +You can use whichever style you prefer; the lone restriction is that +the same character must be used to open and close an emphasis span. + +Emphasis can be used in the middle of a word: + + un*fucking*believable + +But if you surround an `*` or `_` with spaces, it'll be treated as a +literal asterisk or underscore. + +To produce a literal asterisk or underscore at a position where it +would otherwise be used as an emphasis delimiter, you can backslash +escape it: + + \*this text is surrounded by literal asterisks\* + + + +

    Code

    + +To indicate a span of code, wrap it with backtick quotes (`` ` ``). +Unlike a pre-formatted code block, a code span indicates code within a +normal paragraph. For example: + + Use the `printf()` function. + +will produce: + +

    Use the printf() function.

    + +To include a literal backtick character within a code span, you can use +multiple backticks as the opening and closing delimiters: + + ``There is a literal backtick (`) here.`` + +which will produce this: + +

    There is a literal backtick (`) here.

    + +The backtick delimiters surrounding a code span may include spaces -- +one after the opening, one before the closing. This allows you to place +literal backtick characters at the beginning or end of a code span: + + A single backtick in a code span: `` ` `` + + A backtick-delimited string in a code span: `` `foo` `` + +will produce: + +

    A single backtick in a code span: `

    + +

    A backtick-delimited string in a code span: `foo`

    + +With a code span, ampersands and angle brackets are encoded as HTML +entities automatically, which makes it easy to include example HTML +tags. Markdown will turn this: + + Please don't use any `` tags. + +into: + +

    Please don't use any <blink> tags.

    + +You can write this: + + `—` is the decimal-encoded equivalent of `—`. + +to produce: + +

    &#8212; is the decimal-encoded + equivalent of &mdash;.

    + + + +

    Images

    + +Admittedly, it's fairly difficult to devise a "natural" syntax for +placing images into a plain text document format. + +Markdown uses an image syntax that is intended to resemble the syntax +for links, allowing for two styles: *inline* and *reference*. + +Inline image syntax looks like this: + + ![Alt text](/path/to/img.jpg) + + ![Alt text](/path/to/img.jpg "Optional title") + +That is: + +* An exclamation mark: `!`; +* followed by a set of square brackets, containing the `alt` + attribute text for the image; +* followed by a set of parentheses, containing the URL or path to + the image, and an optional `title` attribute enclosed in double + or single quotes. + +Reference-style image syntax looks like this: + + ![Alt text][id] + +Where "id" is the name of a defined image reference. Image references +are defined using syntax identical to link references: + + [id]: url/to/image "Optional title attribute" + +As of this writing, Markdown has no syntax for specifying the +dimensions of an image; if this is important to you, you can simply +use regular HTML `` tags. + + +* * * + + +

    Miscellaneous

    + + + +Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this: + + + +Markdown will turn this into: + + http://example.com/ + +Automatic links for email addresses work similarly, except that +Markdown will also perform a bit of randomized decimal and hex +entity-encoding to help obscure your address from address-harvesting +spambots. For example, Markdown will turn this: + + + +into something like this: + + address@exa + mple.com + +which will render in a browser as a clickable link to "address@example.com". + +(This sort of entity-encoding trick will indeed fool many, if not +most, address-harvesting bots, but it definitely won't fool all of +them. It's better than nothing, but an address published in this way +will probably eventually start receiving spam.) + + + +

    Backslash Escapes

    + +Markdown allows you to use backslash escapes to generate literal +characters which would otherwise have special meaning in Markdown's +formatting syntax. For example, if you wanted to surround a word with +literal asterisks (instead of an HTML `` tag), you can backslashes +before the asterisks, like this: + + \*literal asterisks\* + +Markdown provides backslash escapes for the following characters: + + \ backslash + ` backtick + * asterisk + _ underscore + {} curly braces + [] square brackets + () parentheses + # hash mark + + plus sign + - minus sign (hyphen) + . dot + ! exclamation mark + diff --git a/tests/pl/Tests_2007/Nested blockquotes.html b/tests/pl/Tests_2007/Nested blockquotes.html new file mode 100644 index 0000000..d8ec7f8 --- /dev/null +++ b/tests/pl/Tests_2007/Nested blockquotes.html @@ -0,0 +1,9 @@ +
    +

    foo

    + +
    +

    bar

    +
    + +

    foo

    +
    diff --git a/tests/pl/Tests_2007/Nested blockquotes.text b/tests/pl/Tests_2007/Nested blockquotes.text new file mode 100644 index 0000000..ed3c624 --- /dev/null +++ b/tests/pl/Tests_2007/Nested blockquotes.text @@ -0,0 +1,5 @@ +> foo +> +> > bar +> +> foo diff --git a/tests/pl/Tests_2007/Ordered and unordered lists.html b/tests/pl/Tests_2007/Ordered and unordered lists.html new file mode 100644 index 0000000..ba71eab --- /dev/null +++ b/tests/pl/Tests_2007/Ordered and unordered lists.html @@ -0,0 +1,148 @@ +

    Unordered

    + +

    Asterisks tight:

    + +
      +
    • asterisk 1
    • +
    • asterisk 2
    • +
    • asterisk 3
    • +
    + +

    Asterisks loose:

    + +
      +
    • asterisk 1

    • +
    • asterisk 2

    • +
    • asterisk 3

    • +
    + +
    + +

    Pluses tight:

    + +
      +
    • Plus 1
    • +
    • Plus 2
    • +
    • Plus 3
    • +
    + +

    Pluses loose:

    + +
      +
    • Plus 1

    • +
    • Plus 2

    • +
    • Plus 3

    • +
    + +
    + +

    Minuses tight:

    + +
      +
    • Minus 1
    • +
    • Minus 2
    • +
    • Minus 3
    • +
    + +

    Minuses loose:

    + +
      +
    • Minus 1

    • +
    • Minus 2

    • +
    • Minus 3

    • +
    + +

    Ordered

    + +

    Tight:

    + +
      +
    1. First
    2. +
    3. Second
    4. +
    5. Third
    6. +
    + +

    and:

    + +
      +
    1. One
    2. +
    3. Two
    4. +
    5. Three
    6. +
    + +

    Loose using tabs:

    + +
      +
    1. First

    2. +
    3. Second

    4. +
    5. Third

    6. +
    + +

    and using spaces:

    + +
      +
    1. One

    2. +
    3. Two

    4. +
    5. Three

    6. +
    + +

    Multiple paragraphs:

    + +
      +
    1. Item 1, graf one.

      + +

      Item 2. graf two. The quick brown fox jumped over the lazy dog's +back.

    2. +
    3. Item 2.

    4. +
    5. Item 3.

    6. +
    + +

    Nested

    + +
      +
    • Tab +
        +
      • Tab +
          +
        • Tab
        • +
      • +
    • +
    + +

    Here's another:

    + +
      +
    1. First
    2. +
    3. Second: +
        +
      • Fee
      • +
      • Fie
      • +
      • Foe
      • +
    4. +
    5. Third
    6. +
    + +

    Same thing but with paragraphs:

    + +
      +
    1. First

    2. +
    3. Second:

      + +
        +
      • Fee
      • +
      • Fie
      • +
      • Foe
      • +
    4. +
    5. Third

    6. +
    + + +

    This was an error in Markdown 1.0.1:

    + +
      +
    • this

      + +
      • sub
      + +

      that

    • +
    diff --git a/tests/pl/Tests_2007/Ordered and unordered lists.text b/tests/pl/Tests_2007/Ordered and unordered lists.text new file mode 100644 index 0000000..7f3b497 --- /dev/null +++ b/tests/pl/Tests_2007/Ordered and unordered lists.text @@ -0,0 +1,131 @@ +## Unordered + +Asterisks tight: + +* asterisk 1 +* asterisk 2 +* asterisk 3 + + +Asterisks loose: + +* asterisk 1 + +* asterisk 2 + +* asterisk 3 + +* * * + +Pluses tight: + ++ Plus 1 ++ Plus 2 ++ Plus 3 + + +Pluses loose: + ++ Plus 1 + ++ Plus 2 + ++ Plus 3 + +* * * + + +Minuses tight: + +- Minus 1 +- Minus 2 +- Minus 3 + + +Minuses loose: + +- Minus 1 + +- Minus 2 + +- Minus 3 + + +## Ordered + +Tight: + +1. First +2. Second +3. Third + +and: + +1. One +2. Two +3. Three + + +Loose using tabs: + +1. First + +2. Second + +3. Third + +and using spaces: + +1. One + +2. Two + +3. Three + +Multiple paragraphs: + +1. Item 1, graf one. + + Item 2. graf two. The quick brown fox jumped over the lazy dog's + back. + +2. Item 2. + +3. Item 3. + + + +## Nested + +* Tab + * Tab + * Tab + +Here's another: + +1. First +2. Second: + * Fee + * Fie + * Foe +3. Third + +Same thing but with paragraphs: + +1. First + +2. Second: + * Fee + * Fie + * Foe + +3. Third + + +This was an error in Markdown 1.0.1: + +* this + + * sub + + that diff --git a/tests/pl/Tests_2007/Strong and em together.html b/tests/pl/Tests_2007/Strong and em together.html new file mode 100644 index 0000000..71ec78c --- /dev/null +++ b/tests/pl/Tests_2007/Strong and em together.html @@ -0,0 +1,7 @@ +

    This is strong and em.

    + +

    So is this word.

    + +

    This is strong and em.

    + +

    So is this word.

    diff --git a/tests/pl/Tests_2007/Strong and em together.text b/tests/pl/Tests_2007/Strong and em together.text new file mode 100644 index 0000000..95ee690 --- /dev/null +++ b/tests/pl/Tests_2007/Strong and em together.text @@ -0,0 +1,7 @@ +***This is strong and em.*** + +So is ***this*** word. + +___This is strong and em.___ + +So is ___this___ word. diff --git a/tests/pl/Tests_2007/Tabs.html b/tests/pl/Tests_2007/Tabs.html new file mode 100644 index 0000000..3301ba8 --- /dev/null +++ b/tests/pl/Tests_2007/Tabs.html @@ -0,0 +1,25 @@ +
      +
    • this is a list item +indented with tabs

    • +
    • this is a list item +indented with spaces

    • +
    + +

    Code:

    + +
    this code block is indented by one tab
    +
    + +

    And:

    + +
        this code block is indented by two tabs
    +
    + +

    And:

    + +
    +   this is an example list item
    +    indented with tabs
    +
    ++   this is an example list item
    +    indented with spaces
    +
    diff --git a/tests/pl/Tests_2007/Tabs.text b/tests/pl/Tests_2007/Tabs.text new file mode 100644 index 0000000..589d113 --- /dev/null +++ b/tests/pl/Tests_2007/Tabs.text @@ -0,0 +1,21 @@ ++ this is a list item + indented with tabs + ++ this is a list item + indented with spaces + +Code: + + this code block is indented by one tab + +And: + + this code block is indented by two tabs + +And: + + + this is an example list item + indented with tabs + + + this is an example list item + indented with spaces diff --git a/tests/pl/Tests_2007/Tidyness.html b/tests/pl/Tests_2007/Tidyness.html new file mode 100644 index 0000000..f2a8ce7 --- /dev/null +++ b/tests/pl/Tests_2007/Tidyness.html @@ -0,0 +1,8 @@ +
    +

    A list within a blockquote:

    +
      +
    • asterisk 1
    • +
    • asterisk 2
    • +
    • asterisk 3
    • +
    +
    diff --git a/tests/pl/Tests_2007/Tidyness.text b/tests/pl/Tests_2007/Tidyness.text new file mode 100644 index 0000000..5f18b8d --- /dev/null +++ b/tests/pl/Tests_2007/Tidyness.text @@ -0,0 +1,5 @@ +> A list within a blockquote: +> +> * asterisk 1 +> * asterisk 2 +> * asterisk 3 diff --git a/tests/safe_mode/inline-html-advanced.html b/tests/safe_mode/inline-html-advanced.html deleted file mode 100644 index e9dd2ec..0000000 --- a/tests/safe_mode/inline-html-advanced.html +++ /dev/null @@ -1,11 +0,0 @@ -

    Simple block on one line:

    -

    <div>foo</div>

    -

    And nested without indentation:

    -

    <div> -<div> -<div> -foo -</div> -</div> -<div>bar</div> -</div>

    \ No newline at end of file diff --git a/tests/safe_mode/inline-html-advanced.txt b/tests/safe_mode/inline-html-advanced.txt deleted file mode 100644 index 9d71ddc..0000000 --- a/tests/safe_mode/inline-html-advanced.txt +++ /dev/null @@ -1,14 +0,0 @@ -Simple block on one line: - -
    foo
    - -And nested without indentation: - -
    -
    -
    -foo -
    -
    -
    bar
    -
    diff --git a/tests/safe_mode/inline-html-comments.html b/tests/safe_mode/inline-html-comments.html deleted file mode 100644 index 0f1e417..0000000 --- a/tests/safe_mode/inline-html-comments.html +++ /dev/null @@ -1,8 +0,0 @@ -

    Paragraph one.

    -

    <!-- This is a simple comment -->

    -

    <!-- - This is another comment. --->

    -

    Paragraph two.

    -

    <!-- one comment block -- -- with two comments -->

    -

    The end.

    \ No newline at end of file diff --git a/tests/safe_mode/inline-html-comments.txt b/tests/safe_mode/inline-html-comments.txt deleted file mode 100644 index 41d830d..0000000 --- a/tests/safe_mode/inline-html-comments.txt +++ /dev/null @@ -1,13 +0,0 @@ -Paragraph one. - - - - - -Paragraph two. - - - -The end. diff --git a/tests/safe_mode/inline-html-simple.html b/tests/safe_mode/inline-html-simple.html deleted file mode 100644 index ad19a77..0000000 --- a/tests/safe_mode/inline-html-simple.html +++ /dev/null @@ -1,45 +0,0 @@ -

    Here's a simple block:

    -

    <div> - foo -</div>

    -

    This should be a code block, though:

    -
    <div>
    -    foo
    -</div>
    -
    -

    As should this:

    -
    <div>foo</div>
    -
    -

    Now, nested:

    -

    <div> - <div> - <div> - foo - </div> - </div> -</div>

    -

    This should just be an HTML comment:

    -

    <!-- Comment -->

    -

    Multiline:

    -

    <!-- -Blah -Blah --->

    -

    Code block:

    -
    <!-- Comment -->
    -
    -

    Just plain comment, with trailing spaces on the line:

    -

    <!-- foo -->

    -

    Code:

    -
    <hr />
    -
    -

    Hr's:

    -

    <hr>

    -

    <hr/>

    -

    <hr />

    -

    <hr>

    -

    <hr/>

    -

    <hr />

    -

    <hr class="foo" id="bar" />

    -

    <hr class="foo" id="bar"/>

    -

    <hr class="foo" id="bar" >

    \ No newline at end of file diff --git a/tests/safe_mode/inline-html-simple.txt b/tests/safe_mode/inline-html-simple.txt deleted file mode 100644 index 14aa2dc..0000000 --- a/tests/safe_mode/inline-html-simple.txt +++ /dev/null @@ -1,69 +0,0 @@ -Here's a simple block: - -
    - foo -
    - -This should be a code block, though: - -
    - foo -
    - -As should this: - -
    foo
    - -Now, nested: - -
    -
    -
    - foo -
    -
    -
    - -This should just be an HTML comment: - - - -Multiline: - - - -Code block: - - - -Just plain comment, with trailing spaces on the line: - - - -Code: - -
    - -Hr's: - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - diff --git a/tests/safe_mode/script_tags.html b/tests/safe_mode/script_tags.html deleted file mode 100644 index df63ffc..0000000 --- a/tests/safe_mode/script_tags.html +++ /dev/null @@ -1,28 +0,0 @@ -

    This should be stripped/escaped in safe_mode.

    -

    <script> -alert("Hello world!") -</script>

    -

    With blank lines.

    -

    <script> - -alert("Hello world!") - -</script>

    -

    Now with some weirdness

    -

    <script <!-- -alert("Hello world!") -</script <> `

    -

    Try another way.

    -

    <script <!-- -alert("Hello world!") -</script <> - -This time with blank lines. - -<script <!-- - -alert("Hello world!") - -</script <> - -

    \ No newline at end of file diff --git a/tests/safe_mode/script_tags.txt b/tests/safe_mode/script_tags.txt deleted file mode 100644 index 44041c2..0000000 --- a/tests/safe_mode/script_tags.txt +++ /dev/null @@ -1,33 +0,0 @@ -This should be stripped/escaped in safe_mode. - - - -With blank lines. - - - -Now with some weirdness - -`` - -This time with blank lines. - -' + '
    tail text' + ) + + def testXhtml(self): + """" Test XHTML serialization. """ + el = etree.Element('div') + el.set('id', 'foo<&">') + p = etree.SubElement(el, 'p') + p.text = 'foo<&escaped>' + p.set('hidden', 'hidden') + etree.SubElement(el, 'hr') + non_element = etree.SubElement(el, None) + non_element.text = 'non-element text' + script = etree.SubElement(non_element, 'script') + script.text = '<&"test\nescaping">' + el.tail = "tail text" + self.assertEqual( + markdown.serializers.to_xhtml_string(el), + '
    ' + '' + '
    ' + 'non-element text' + '' + '
    tail text' + ) + + def testMixedCaseTags(self): + """" Test preservation of tag case. """ + el = etree.Element('MixedCase') + el.text = 'not valid ' + em = etree.SubElement(el, 'EMPHASIS') + em.text = 'html' + etree.SubElement(el, 'HR') + self.assertEqual( + markdown.serializers.to_xhtml_string(el), + 'not valid html
    ' + ) + + def testProsessingInstruction(self): + """ Test serialization of ProcessignInstruction. """ + pi = ProcessingInstruction('foo', text='<&"test\nescaping">') + self.assertIs(pi.tag, ProcessingInstruction) + self.assertEqual( + markdown.serializers.to_xhtml_string(pi), + '' + ) + + def testQNameTag(self): + """ Test serialization of QName tag. """ + div = etree.Element('div') + qname = etree.QName('http://www.w3.org/1998/Math/MathML', 'math') + math = etree.SubElement(div, qname) + math.set('display', 'block') + sem = etree.SubElement(math, 'semantics') + msup = etree.SubElement(sem, 'msup') + mi = etree.SubElement(msup, 'mi') + mi.text = 'x' + mn = etree.SubElement(msup, 'mn') + mn.text = '2' + ann = etree.SubElement(sem, 'annotations') + ann.text = 'x^2' + self.assertEqual( + markdown.serializers.to_xhtml_string(div), + '
    ' + '' + '' + '' + 'x' + '2' + '' + 'x^2' + '' + '' + '
    ' + ) + + def testQNameAttribute(self): + """ Test serialization of QName attribute. """ + div = etree.Element('div') + div.set(etree.QName('foo'), etree.QName('bar')) + self.assertEqual( + markdown.serializers.to_xhtml_string(div), + '
    ' + ) + + def testBadQNameTag(self): + """ Test serialization of QName with no tag. """ + qname = etree.QName('http://www.w3.org/1998/Math/MathML') + el = etree.Element(qname) + self.assertRaises(ValueError, markdown.serializers.to_xhtml_string, el) + + def testQNameEscaping(self): + """ Test QName escaping. """ + qname = etree.QName('<&"test\nescaping">', 'div') + el = etree.Element(qname) + self.assertEqual( + markdown.serializers.to_xhtml_string(el), + '
    ' + ) + + def testQNamePreEscaping(self): + """ Test QName that is already partially escaped. """ + qname = etree.QName('<&"test escaping">', 'div') + el = etree.Element(qname) + self.assertEqual( + markdown.serializers.to_xhtml_string(el), + '
    ' + ) + + def buildExtension(self): + """ Build an extension which registers fakeSerializer. """ + def fakeSerializer(elem): + # Ignore input and return hardcoded output + return '

    foo

    ' + + class registerFakeSerializer(markdown.extensions.Extension): + def extendMarkdown(self, md): + md.output_formats['fake'] = fakeSerializer + + return registerFakeSerializer() + + def testRegisterSerializer(self): + self.assertEqual( + markdown.markdown( + 'baz', extensions=[self.buildExtension()], output_format='fake' + ), + '

    foo

    ' + ) + + def testXHTMLOutput(self): + self.assertEqual( + markdown.markdown('foo \nbar', output_format='xhtml'), + '

    foo
    \nbar

    ' + ) + + def testHTMLOutput(self): + self.assertEqual( + markdown.markdown('foo \nbar', output_format='html'), + '

    foo
    \nbar

    ' + ) + + +class testAtomicString(unittest.TestCase): + """ Test that AtomicStrings are honored (not parsed). """ + + def setUp(self): + md = markdown.Markdown() + self.inlineprocessor = md.treeprocessors['inline'] + + def testString(self): + """ Test that a regular string is parsed. """ + tree = etree.Element('div') + p = etree.SubElement(tree, 'p') + p.text = 'some *text*' + new = self.inlineprocessor.run(tree) + self.assertEqual( + markdown.serializers.to_html_string(new), + '

    some text

    ' + ) + + def testSimpleAtomicString(self): + """ Test that a simple AtomicString is not parsed. """ + tree = etree.Element('div') + p = etree.SubElement(tree, 'p') + p.text = markdown.util.AtomicString('some *text*') + new = self.inlineprocessor.run(tree) + self.assertEqual( + markdown.serializers.to_html_string(new), + '

    some *text*

    ' + ) + + def testNestedAtomicString(self): + """ Test that a nested AtomicString is not parsed. """ + tree = etree.Element('div') + p = etree.SubElement(tree, 'p') + p.text = markdown.util.AtomicString('*some* ') + span1 = etree.SubElement(p, 'span') + span1.text = markdown.util.AtomicString('*more* ') + span2 = etree.SubElement(span1, 'span') + span2.text = markdown.util.AtomicString('*text* ') + span3 = etree.SubElement(span2, 'span') + span3.text = markdown.util.AtomicString('*here*') + span3.tail = markdown.util.AtomicString(' *to*') + span2.tail = markdown.util.AtomicString(' *test*') + span1.tail = markdown.util.AtomicString(' *with*') + new = self.inlineprocessor.run(tree) + self.assertEqual( + markdown.serializers.to_html_string(new), + '

    *some* *more* *text* *here* ' + '*to* *test* *with*

    ' + ) + + +class TestConfigParsing(unittest.TestCase): + def assertParses(self, value, result): + self.assertIs(markdown.util.parseBoolValue(value, False), result) + + def testBooleansParsing(self): + self.assertParses(True, True) + self.assertParses('novalue', None) + self.assertParses('yES', True) + self.assertParses('FALSE', False) + self.assertParses(0., False) + self.assertParses('none', False) + + def testPreserveNone(self): + self.assertIsNone(markdown.util.parseBoolValue('None', preserve_none=True)) + self.assertIsNone(markdown.util.parseBoolValue(None, preserve_none=True)) + + def testInvalidBooleansParsing(self): + self.assertRaises(ValueError, markdown.util.parseBoolValue, 'novalue') + + +class TestCliOptionParsing(unittest.TestCase): + """ Test parsing of Command Line Interface Options. """ + + def setUp(self): + self.default_options = { + 'input': None, + 'output': None, + 'encoding': None, + 'output_format': 'xhtml', + 'lazy_ol': True, + 'extensions': [], + 'extension_configs': {}, + } + self.tempfile = '' + + def tearDown(self): + if os.path.isfile(self.tempfile): + os.remove(self.tempfile) + + def testNoOptions(self): + options, logging_level = parse_options([]) + self.assertEqual(options, self.default_options) + self.assertEqual(logging_level, CRITICAL) + + def testQuietOption(self): + options, logging_level = parse_options(['-q']) + self.assertGreater(logging_level, CRITICAL) + + def testVerboseOption(self): + options, logging_level = parse_options(['-v']) + self.assertEqual(logging_level, WARNING) + + def testNoisyOption(self): + options, logging_level = parse_options(['--noisy']) + self.assertEqual(logging_level, DEBUG) + + def testInputFileOption(self): + options, logging_level = parse_options(['foo.txt']) + self.default_options['input'] = 'foo.txt' + self.assertEqual(options, self.default_options) + + def testOutputFileOption(self): + options, logging_level = parse_options(['-f', 'foo.html']) + self.default_options['output'] = 'foo.html' + self.assertEqual(options, self.default_options) + + def testInputAndOutputFileOptions(self): + options, logging_level = parse_options(['-f', 'foo.html', 'foo.txt']) + self.default_options['output'] = 'foo.html' + self.default_options['input'] = 'foo.txt' + self.assertEqual(options, self.default_options) + + def testEncodingOption(self): + options, logging_level = parse_options(['-e', 'utf-8']) + self.default_options['encoding'] = 'utf-8' + self.assertEqual(options, self.default_options) + + def testOutputFormatOption(self): + options, logging_level = parse_options(['-o', 'html']) + self.default_options['output_format'] = 'html' + self.assertEqual(options, self.default_options) + + def testNoLazyOlOption(self): + options, logging_level = parse_options(['-n']) + self.default_options['lazy_ol'] = False + self.assertEqual(options, self.default_options) + + def testExtensionOption(self): + options, logging_level = parse_options(['-x', 'markdown.extensions.footnotes']) + self.default_options['extensions'] = ['markdown.extensions.footnotes'] + self.assertEqual(options, self.default_options) + + def testMultipleExtensionOptions(self): + options, logging_level = parse_options([ + '-x', 'markdown.extensions.footnotes', + '-x', 'markdown.extensions.smarty' + ]) + self.default_options['extensions'] = [ + 'markdown.extensions.footnotes', + 'markdown.extensions.smarty' + ] + self.assertEqual(options, self.default_options) + + def create_config_file(self, config): + """ Helper to create temp config files. """ + if not isinstance(config, str): + # convert to string + config = yaml.dump(config) + fd, self.tempfile = tempfile.mkstemp('.yml') + with os.fdopen(fd, 'w') as fp: + fp.write(config) + + def testExtensionConfigOption(self): + config = { + 'markdown.extensions.wikilinks': { + 'base_url': 'http://example.com/', + 'end_url': '.html', + 'html_class': 'test', + }, + 'markdown.extensions.footnotes:FootnotesExtension': { + 'PLACE_MARKER': '~~~footnotes~~~' + } + } + self.create_config_file(config) + options, logging_level = parse_options(['-c', self.tempfile]) + self.default_options['extension_configs'] = config + self.assertEqual(options, self.default_options) + + def textBoolExtensionConfigOption(self): + config = { + 'markdown.extensions.toc': { + 'title': 'Some Title', + 'anchorlink': True, + 'permalink': True + } + } + self.create_config_file(config) + options, logging_level = parse_options(['-c', self.tempfile]) + self.default_options['extension_configs'] = config + self.assertEqual(options, self.default_options) + + def testExtensionConfigOptionAsJSON(self): + config = { + 'markdown.extensions.wikilinks': { + 'base_url': 'http://example.com/', + 'end_url': '.html', + 'html_class': 'test', + }, + 'markdown.extensions.footnotes:FootnotesExtension': { + 'PLACE_MARKER': '~~~footnotes~~~' + } + } + import json + self.create_config_file(json.dumps(config)) + options, logging_level = parse_options(['-c', self.tempfile]) + self.default_options['extension_configs'] = config + self.assertEqual(options, self.default_options) + + def testExtensionConfigOptionMissingFile(self): + self.assertRaises(IOError, parse_options, ['-c', 'missing_file.yaml']) + + def testExtensionConfigOptionBadFormat(self): + config = """ +[footnotes] +PLACE_MARKER= ~~~footnotes~~~ +""" + self.create_config_file(config) + self.assertRaises(yaml.YAMLError, parse_options, ['-c', self.tempfile]) + + +class TestEscapeAppend(unittest.TestCase): + """ Tests escape character append. """ + + def testAppend(self): + """ Test that appended escapes are only in the current instance. """ + md = markdown.Markdown() + md.ESCAPED_CHARS.append('|') + self.assertEqual('|' in md.ESCAPED_CHARS, True) + md2 = markdown.Markdown() + self.assertEqual('|' not in md2.ESCAPED_CHARS, True) + + +class TestBlockAppend(unittest.TestCase): + """ Tests block kHTML append. """ + + def testBlockAppend(self): + """ Test that appended escapes are only in the current instance. """ + md = markdown.Markdown() + md.block_level_elements.append('test') + self.assertEqual('test' in md.block_level_elements, True) + md2 = markdown.Markdown() + self.assertEqual('test' not in md2.block_level_elements, True) + + +class TestAncestorExclusion(unittest.TestCase): + """ Tests exclusion of tags in ancestor list. """ + + class AncestorExample(markdown.inlinepatterns.SimpleTagInlineProcessor): + """ Ancestor Test. """ + + ANCESTOR_EXCLUDES = ('a',) + + def handleMatch(self, m, data): + """ Handle match. """ + el = etree.Element(self.tag) + el.text = m.group(2) + return el, m.start(0), m.end(0) + + class AncestorExtension(markdown.Extension): + + def __init__(self, *args, **kwargs): + """Initialize.""" + + self.config = {} + + def extendMarkdown(self, md): + """Modify inline patterns.""" + + pattern = r'(\+)([^\+]+)\1' + md.inlinePatterns.register(TestAncestorExclusion.AncestorExample(pattern, 'strong'), 'ancestor-test', 0) + + def setUp(self): + """Setup markdown object.""" + self.md = markdown.Markdown(extensions=[TestAncestorExclusion.AncestorExtension()]) + + def test_ancestors(self): + """ Test that an extension can exclude parent tags. """ + test = """ +Some +test+ and a [+link+](http://test.com) +""" + result = """

    Some test and a +link+

    """ + + self.md.reset() + self.assertEqual(self.md.convert(test), result) + + def test_ancestors_tail(self): + """ Test that an extension can exclude parent tags when dealing with a tail. """ + test = """ +[***+em+*+strong+**](http://test.com) +""" + result = """

    +em++strong+

    """ + + self.md.reset() + self.assertEqual(self.md.convert(test), result) diff --git a/tests/test_extensions.py b/tests/test_extensions.py new file mode 100644 index 0000000..b19d10a --- /dev/null +++ b/tests/test_extensions.py @@ -0,0 +1,665 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). + +Python-Markdown Extension Regression Tests +========================================== + +A collection of regression tests to confirm that the included extensions +continue to work as advertised. This used to be accomplished by doctests. +""" + +import unittest +import markdown + + +class TestCaseWithAssertStartsWith(unittest.TestCase): + + def assertStartsWith(self, expectedPrefix, text, msg=None): + if not text.startswith(expectedPrefix): + if len(expectedPrefix) + 5 < len(text): + text = text[:len(expectedPrefix) + 5] + '...' + standardMsg = '{} not found at the start of {}'.format(repr(expectedPrefix), + repr(text)) + self.fail(self._formatMessage(msg, standardMsg)) + + +class TestExtensionClass(unittest.TestCase): + """ Test markdown.extensions.Extension. """ + + def setUp(self): + class TestExtension(markdown.extensions.Extension): + config = { + 'foo': ['bar', 'Description of foo'], + 'bar': ['baz', 'Description of bar'] + } + + self.ext = TestExtension() + self.ExtKlass = TestExtension + + def testGetConfig(self): + self.assertEqual(self.ext.getConfig('foo'), 'bar') + + def testGetConfigDefault(self): + self.assertEqual(self.ext.getConfig('baz'), '') + self.assertEqual(self.ext.getConfig('baz', default='missing'), 'missing') + + def testGetConfigs(self): + self.assertEqual(self.ext.getConfigs(), {'foo': 'bar', 'bar': 'baz'}) + + def testGetConfigInfo(self): + self.assertEqual( + dict(self.ext.getConfigInfo()), + dict([ + ('foo', 'Description of foo'), + ('bar', 'Description of bar') + ]) + ) + + def testSetConfig(self): + self.ext.setConfig('foo', 'baz') + self.assertEqual(self.ext.getConfigs(), {'foo': 'baz', 'bar': 'baz'}) + + def testSetConfigWithBadKey(self): + # self.ext.setConfig('bad', 'baz) ==> KeyError + self.assertRaises(KeyError, self.ext.setConfig, 'bad', 'baz') + + def testConfigAsKwargsOnInit(self): + ext = self.ExtKlass(foo='baz', bar='blah') + self.assertEqual(ext.getConfigs(), {'foo': 'baz', 'bar': 'blah'}) + + +class TestAbbr(unittest.TestCase): + """ Test abbr extension. """ + + def setUp(self): + self.md = markdown.Markdown(extensions=['abbr']) + + def testSimpleAbbr(self): + """ Test Abbreviations. """ + text = 'Some text with an ABBR and a REF. Ignore REFERENCE and ref.' + \ + '\n\n*[ABBR]: Abbreviation\n' + \ + '*[REF]: Abbreviation Reference' + self.assertEqual( + self.md.convert(text), + '

    Some text with an ABBR ' + 'and a REF. Ignore ' + 'REFERENCE and ref.

    ' + ) + + def testNestedAbbr(self): + """ Test Nested Abbreviations. """ + text = '[ABBR](/foo) and _ABBR_\n\n' + \ + '*[ABBR]: Abbreviation' + self.assertEqual( + self.md.convert(text), + '

    ABBR ' + 'and ABBR

    ' + ) + + +class TestMetaData(unittest.TestCase): + """ Test MetaData extension. """ + + def setUp(self): + self.md = markdown.Markdown(extensions=['meta']) + + def testBasicMetaData(self): + """ Test basic metadata. """ + + text = '''Title: A Test Doc. +Author: Waylan Limberg + John Doe +Blank_Data: + +The body. This is paragraph one.''' + self.assertEqual( + self.md.convert(text), + '

    The body. This is paragraph one.

    ' + ) + self.assertEqual( + self.md.Meta, { + 'author': ['Waylan Limberg', 'John Doe'], + 'blank_data': [''], + 'title': ['A Test Doc.'] + } + ) + + def testYamlMetaData(self): + """ Test metadata specified as simple YAML. """ + + text = '''--- +Title: A Test Doc. +Author: [Waylan Limberg, John Doe] +Blank_Data: +--- + +The body. This is paragraph one.''' + self.assertEqual( + self.md.convert(text), + '

    The body. This is paragraph one.

    ' + ) + self.assertEqual( + self.md.Meta, { + 'author': ['[Waylan Limberg, John Doe]'], + 'blank_data': [''], + 'title': ['A Test Doc.'] + } + ) + + def testMissingMetaData(self): + """ Test document without Meta Data. """ + + text = ' Some Code - not extra lines of meta data.' + self.assertEqual( + self.md.convert(text), + '
    Some Code - not extra lines of meta data.\n'
    +            '
    ' + ) + self.assertEqual(self.md.Meta, {}) + + def testMetaDataWithoutNewline(self): + """ Test document with only metadata and no newline at end.""" + text = 'title: No newline' + self.assertEqual(self.md.convert(text), '') + self.assertEqual(self.md.Meta, {'title': ['No newline']}) + + def testMetaDataReset(self): + """ Test that reset call remove Meta entirely """ + + text = '''Title: A Test Doc. +Author: Waylan Limberg + John Doe +Blank_Data: + +The body. This is paragraph one.''' + self.md.convert(text) + + self.md.reset() + self.assertEqual(self.md.Meta, {}) + + +class TestWikiLinks(unittest.TestCase): + """ Test Wikilinks Extension. """ + + def setUp(self): + self.md = markdown.Markdown(extensions=['wikilinks']) + self.text = "Some text with a [[WikiLink]]." + + def testBasicWikilinks(self): + """ Test [[wikilinks]]. """ + + self.assertEqual( + self.md.convert(self.text), + '

    Some text with a ' + 'WikiLink.

    ' + ) + + def testWikilinkWhitespace(self): + """ Test whitespace in wikilinks. """ + self.assertEqual( + self.md.convert('[[ foo bar_baz ]]'), + '

    foo bar_baz

    ' + ) + self.assertEqual( + self.md.convert('foo [[ ]] bar'), + '

    foo bar

    ' + ) + + def testSimpleSettings(self): + """ Test Simple Settings. """ + + self.assertEqual(markdown.markdown( + self.text, extensions=[ + markdown.extensions.wikilinks.WikiLinkExtension( + base_url='/wiki/', + end_url='.html', + html_class='foo') + ] + ), + '

    Some text with a ' + 'WikiLink.

    ') + + def testComplexSettings(self): + """ Test Complex Settings. """ + + md = markdown.Markdown( + extensions=['wikilinks'], + extension_configs={ + 'wikilinks': [ + ('base_url', 'http://example.com/'), + ('end_url', '.html'), + ('html_class', '') + ] + }, + safe_mode=True + ) + self.assertEqual( + md.convert(self.text), + '

    Some text with a ' + 'WikiLink.

    ' + ) + + def testWikilinksMetaData(self): + """ test MetaData with Wikilinks Extension. """ + + text = """wiki_base_url: http://example.com/ +wiki_end_url: .html +wiki_html_class: + +Some text with a [[WikiLink]].""" + md = markdown.Markdown(extensions=['meta', 'wikilinks']) + self.assertEqual( + md.convert(text), + '

    Some text with a ' + 'WikiLink.

    ' + ) + + # MetaData should not carry over to next document: + self.assertEqual( + md.convert("No [[MetaData]] here."), + '

    No MetaData ' + 'here.

    ' + ) + + def testURLCallback(self): + """ Test used of a custom URL builder. """ + + from markdown.extensions.wikilinks import WikiLinkExtension + + def my_url_builder(label, base, end): + return '/bar/' + + md = markdown.Markdown(extensions=[WikiLinkExtension(build_url=my_url_builder)]) + self.assertEqual( + md.convert('[[foo]]'), + '

    foo

    ' + ) + + +class TestAdmonition(unittest.TestCase): + """ Test Admonition Extension. """ + + def setUp(self): + self.md = markdown.Markdown(extensions=['admonition']) + + def testRE(self): + RE = self.md.parser.blockprocessors['admonition'].RE + tests = [ + ('!!! note', ('note', None)), + ('!!! note "Please Note"', ('note', 'Please Note')), + ('!!! note ""', ('note', '')), + ] + for test, expected in tests: + self.assertEqual(RE.match(test).groups(), expected) + + +class TestTOC(TestCaseWithAssertStartsWith): + """ Test TOC Extension. """ + + def setUp(self): + self.md = markdown.Markdown(extensions=['toc']) + + def testMarker(self): + """ Test TOC with a Marker. """ + text = '[TOC]\n\n# Header 1\n\n## Header 2' + self.assertEqual( + self.md.convert(text), + '
    \n' + '
      \n' # noqa + '
    • Header 1' # noqa + '\n' # noqa + '
    • \n' # noqa + '
    \n' # noqa + '
    \n' + '

    Header 1

    \n' + '

    Header 2

    ' + ) + + def testNoMarker(self): + """ Test TOC without a Marker. """ + text = '# Header 1\n\n## Header 2' + self.assertEqual( + self.md.convert(text), + '

    Header 1

    \n' + '

    Header 2

    ' + ) + self.assertEqual( + self.md.toc, + '
    \n' + '
      \n' # noqa + '
    • Header 1' # noqa + '\n' # noqa + '
    • \n' # noqa + '
    \n' # noqa + '
    \n' + ) + + def testAlternateMarker(self): + """ Test TOC with user defined marker. """ + md = markdown.Markdown( + extensions=[markdown.extensions.toc.TocExtension(marker='{{marker}}')] + ) + text = '{{marker}}\n\n# Header 1\n\n## Header 2' + self.assertEqual( + md.convert(text), + '
    \n' + '
      \n' # noqa + '
    • Header 1' # noqa + '\n' # noqa + '
    • \n' # noqa + '
    \n' # noqa + '
    \n' + '

    Header 1

    \n' + '

    Header 2

    ' + ) + + def testDisabledMarker(self): + """ Test TOC with disabled marker. """ + md = markdown.Markdown( + extensions=[markdown.extensions.toc.TocExtension(marker='')] + ) + text = '[TOC]\n\n# Header 1\n\n## Header 2' + self.assertEqual( + md.convert(text), + '

    [TOC]

    \n' + '

    Header 1

    \n' + '

    Header 2

    ' + ) + self.assertStartsWith('
    ', md.toc) + + def testReset(self): + """ Test TOC Reset. """ + self.assertEqual(self.md.toc, '') + self.md.convert('# Header 1\n\n## Header 2') + self.assertStartsWith('
    ', self.md.toc) + self.md.reset() + self.assertEqual(self.md.toc, '') + self.assertEqual(self.md.toc_tokens, []) + + def testUniqueIds(self): + """ Test Unique IDs. """ + + text = '#Header\n#Header\n#Header' + self.assertEqual( + self.md.convert(text), + '

    Header

    \n' + '

    Header

    \n' + '

    Header

    ' + ) + self.assertEqual( + self.md.toc, + '
    \n' + '\n' # noqa + '
    \n' + ) + self.assertEqual(self.md.toc_tokens, [ + {'level': 1, 'id': 'header', 'name': 'Header', 'children': []}, + {'level': 1, 'id': 'header_1', 'name': 'Header', 'children': []}, + {'level': 1, 'id': 'header_2', 'name': 'Header', 'children': []}, + ]) + + def testHtmlEntities(self): + """ Test Headers with HTML Entities. """ + text = '# Foo & bar' + self.assertEqual( + self.md.convert(text), + '

    Foo & bar

    ' + ) + self.assertEqual( + self.md.toc, + '
    \n' + '\n' # noqa + '
    \n' + ) + self.assertEqual(self.md.toc_tokens, [ + {'level': 1, 'id': 'foo-bar', 'name': 'Foo & bar', 'children': []}, + ]) + + def testHtmlSpecialChars(self): + """ Test Headers with HTML special characters. """ + text = '# Foo > & bar' + self.assertEqual( + self.md.convert(text), + '

    Foo > & bar

    ' + ) + self.assertEqual( + self.md.toc, + '
    \n' + '\n' # noqa + '
    \n' + ) + self.assertEqual(self.md.toc_tokens, [ + {'level': 1, 'id': 'foo-bar', 'name': 'Foo > & bar', 'children': []}, + ]) + + def testRawHtml(self): + """ Test Headers with raw HTML. """ + text = '# Foo Bar Baz.' + self.assertEqual( + self.md.convert(text), + '

    Foo Bar Baz.

    ' + ) + self.assertEqual( + self.md.toc, + '
    \n' + '\n' # noqa + '
    \n' + ) + self.assertEqual(self.md.toc_tokens, [ + {'level': 1, 'id': 'foo-bar-baz', 'name': 'Foo Bar Baz.', 'children': []}, + ]) + + def testBaseLevel(self): + """ Test Header Base Level. """ + md = markdown.Markdown( + extensions=[markdown.extensions.toc.TocExtension(baselevel=5)] + ) + text = '# Some Header\n\n## Next Level\n\n### Too High' + self.assertEqual( + md.convert(text), + '
    Some Header
    \n' + '
    Next Level
    \n' + '
    Too High
    ' + ) + self.assertEqual( + md.toc, + '
    \n' + '\n' # noqa + '
    \n' + ) + self.assertEqual(md.toc_tokens, [ + {'level': 5, 'id': 'some-header', 'name': 'Some Header', 'children': [ + {'level': 6, 'id': 'next-level', 'name': 'Next Level', 'children': []}, + {'level': 6, 'id': 'too-high', 'name': 'Too High', 'children': []}, + ]}, + ]) + + def testHeaderInlineMarkup(self): + """ Test Headers with inline markup. """ + + text = '#Some *Header* with [markup](http://example.com).' + self.assertEqual( + self.md.convert(text), + '

    Some Header with ' + 'markup.

    ' + ) + self.assertEqual( + self.md.toc, + '
    \n' + '\n' # noqa + '
    \n' + ) + self.assertEqual(self.md.toc_tokens, [ + {'level': 1, 'id': 'some-header-with-markup', 'name': 'Some Header with markup.', 'children': []}, + ]) + + def testTitle(self): + """ Test TOC Title. """ + md = markdown.Markdown( + extensions=[markdown.extensions.toc.TocExtension(title='Table of Contents')] + ) + md.convert('# Header 1\n\n## Header 2') + self.assertStartsWith( + '
    Table of Contents
      ', + md.toc + ) + + def testWithAttrList(self): + """ Test TOC with attr_list Extension. """ + md = markdown.Markdown(extensions=['toc', 'attr_list']) + text = ('# Header 1\n\n' + '## Header 2 { #foo }\n\n' + '## Header 3 { data-toc-label="Foo Bar" }\n\n' + '# Header 4 { data-toc-label="Foo > Baz" }\n\n' + '# Header 5 { data-toc-label="Foo Quux" }') + + self.assertEqual( + md.convert(text), + '

      Header 1

      \n' + '

      Header 2

      \n' + '

      Header 3

      \n' + '

      Header 4

      \n' + '

      Header 5

      ' + ) + self.assertEqual( + md.toc, + '
      \n' + '\n' # noqa + '
      \n' + ) + self.assertEqual(md.toc_tokens, [ + {'level': 1, 'id': 'header-1', 'name': 'Header 1', 'children': [ + {'level': 2, 'id': 'foo', 'name': 'Header 2', 'children': []}, + {'level': 2, 'id': 'header-3', 'name': 'Foo Bar', 'children': []} + ]}, + {'level': 1, 'id': 'header-4', 'name': 'Foo > Baz', 'children': []}, + {'level': 1, 'id': 'header-5', 'name': 'Foo Quux', 'children': []}, + ]) + + def testUniqueFunc(self): + """ Test 'unique' function. """ + from markdown.extensions.toc import unique + ids = {'foo'} + self.assertEqual(unique('foo', ids), 'foo_1') + self.assertEqual(ids, {'foo', 'foo_1'}) + + def testTocInHeaders(self): + + text = '[TOC]\n#[TOC]' + self.assertEqual( + self.md.convert(text), + '
      \n' # noqa + '
        \n' # noqa + '
      • [TOC]
      • \n' # noqa + '
      \n' # noqa + '
      \n' # noqa + '

      [TOC]

      ' # noqa + ) + + text = '#[TOC]\n[TOC]' + self.assertEqual( + self.md.convert(text), + '

      [TOC]

      \n' # noqa + '
      \n' # noqa + '
        \n' # noqa + '
      • [TOC]
      • \n' # noqa + '
      \n' # noqa + '
      ' # noqa + ) + + text = '[TOC]\n# *[TOC]*' + self.assertEqual( + self.md.convert(text), + '
      \n' # noqa + '
        \n' # noqa + '
      • [TOC]
      • \n' # noqa + '
      \n' # noqa + '
      \n' # noqa + '

      [TOC]

      ' # noqa + ) + + +class TestSmarty(unittest.TestCase): + def setUp(self): + config = { + 'smarty': [ + ('smart_angled_quotes', True), + ('substitutions', { + 'ndash': '\u2013', + 'mdash': '\u2014', + 'ellipsis': '\u2026', + 'left-single-quote': '‚', # sb is not a typo! + 'right-single-quote': '‘', + 'left-double-quote': '„', + 'right-double-quote': '“', + 'left-angle-quote': '[', + 'right-angle-quote': ']', + }), + ] + } + self.md = markdown.Markdown( + extensions=['smarty'], + extension_configs=config + ) + + def testCustomSubstitutions(self): + text = """<< The "Unicode char of the year 2014" +is the 'mdash': --- +Must not be confused with 'ndash' (--) ... >> +""" + correct = """

      [ The „Unicode char of the year 2014“ +is the ‚mdash‘: \u2014 +Must not be confused with ‚ndash‘ (\u2013) \u2026 ]

      """ + self.assertEqual(self.md.convert(text), correct) diff --git a/tests/test_legacy.py b/tests/test_legacy.py new file mode 100644 index 0000000..62bc075 --- /dev/null +++ b/tests/test_legacy.py @@ -0,0 +1,194 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + +from markdown.test_tools import LegacyTestCase, Kwargs +import os +import warnings + +# Warnings should cause tests to fail... +warnings.simplefilter('error') +# Except for the warnings that shouldn't +warnings.filterwarnings('default', category=PendingDeprecationWarning) +warnings.filterwarnings('default', category=DeprecationWarning, module='markdown') + +parent_test_dir = os.path.abspath(os.path.dirname(__file__)) + + +class TestBasic(LegacyTestCase): + location = os.path.join(parent_test_dir, 'basic') + + +class TestMisc(LegacyTestCase): + location = os.path.join(parent_test_dir, 'misc') + + +class TestPhp(LegacyTestCase): + """ + Notes on "excluded" tests: + + Quotes in attributes: attributes get output in different order + + Inline HTML (Span): Backtick in raw HTML attribute TODO: fixme + + Backslash escapes: Weird whitespace issue in output + + Ins & del: Our behavior follows markdown.pl I think PHP is wrong here + + Auto Links: TODO: fix raw HTML so is doesn't match as a
      . + + Empty List Item: We match markdown.pl here. Maybe someday we'll support this + + Headers: TODO: fix headers to not require blank line before + + Mixed OLs and ULs: We match markdown.pl here. I think PHP is wrong here + + Emphasis: We have various minor differences in combined & incorrect em markup. + Maybe fix a few of them - but most aren't too important + + Code block in a list item: We match markdown.pl - not sure how php gets that output?? + + PHP-Specific Bugs: Not sure what to make of the escaping stuff here. + Why is PHP not removing a blackslash? + """ + location = os.path.join(parent_test_dir, 'php') + normalize = True + input_ext = '.text' + output_ext = '.xhtml' + exclude = [ + 'Quotes_in_attributes', + 'Inline_HTML_(Span)', + 'Backslash_escapes', + 'Ins_&_del', + 'Auto_Links', + 'Empty_List_Item', + 'Headers', + 'Mixed_OLs_and_ULs', + 'Emphasis', + 'Code_block_in_a_list_item', + 'PHP_Specific_Bugs' + ] + + +# class TestPhpExtra(LegacyTestCase): +# location = os.path.join(parent_test_dir, 'php/extra') +# normalize = True +# input_ext = '.text' +# output_ext = '.xhtml' +# default_kwargs = Kwargs(extensions=['extra']) + + +class TestPl2004(LegacyTestCase): + location = os.path.join(parent_test_dir, 'pl/Tests_2004') + normalize = True + input_ext = '.text' + exclude = ['Yuri_Footnotes', 'Yuri_Attributes'] + + +class TestPl2007(LegacyTestCase): + """ + Notes on "excluded" tests: + + Images: the attributes don't get ordered the same so we skip this + + Code Blocks: some weird whitespace issue + + Links, reference style: weird issue with nested brackets TODO: fixme + + Backslash escapes: backticks in raw html attributes TODO: fixme + + Code Spans: more backticks in raw html attributes TODO: fixme + """ + location = os.path.join(parent_test_dir, 'pl/Tests_2007') + normalize = True + input_ext = '.text' + exclude = [ + 'Images', + 'Code_Blocks', + 'Links,_reference_style', + 'Backslash_escapes', + 'Code_Spans' + ] + + +class TestExtensions(LegacyTestCase): + location = os.path.join(parent_test_dir, 'extensions') + exclude = ['codehilite'] + + attr_list = Kwargs(extensions=['attr_list', 'def_list', 'smarty']) + + codehilite = Kwargs(extensions=['codehilite']) + + toc = Kwargs(extensions=['toc']) + + toc_invalid = Kwargs(extensions=['toc']) + + toc_out_of_order = Kwargs(extensions=['toc']) + + toc_nested = Kwargs( + extensions=['toc'], + extension_configs={'toc': {'permalink': True}} + ) + + toc_nested2 = Kwargs( + extensions=['toc'], + extension_configs={'toc': {'permalink': "[link]"}} + ) + + toc_nested_list = Kwargs(extensions=['toc']) + + wikilinks = Kwargs(extensions=['wikilinks']) + + github_flavored = Kwargs(extensions=['fenced_code']) + + sane_lists = Kwargs(extensions=['sane_lists']) + + nl2br_w_attr_list = Kwargs(extensions=['nl2br', 'attr_list']) + + admonition = Kwargs(extensions=['admonition']) + + smarty = Kwargs( + extensions=['smarty'], + extension_configs={'smarty': {'smart_angled_quotes': True}} + ) + + +class TestExtensionsExtra(LegacyTestCase): + location = os.path.join(parent_test_dir, 'extensions/extra') + default_kwargs = Kwargs(extensions=['extra']) + + loose_def_list = Kwargs(extensions=['def_list']) + + simple_def_lists = Kwargs(extensions=['def_list']) + + abbr = Kwargs(extensions=['abbr']) + + footnotes = Kwargs(extensions=['footnotes']) + + extra_config = Kwargs( + extensions=['extra'], + extension_configs={ + 'extra': { + 'footnotes': { + 'PLACE_MARKER': '~~~placemarker~~~' + } + } + } + ) diff --git a/tests/test_meta.py b/tests/test_meta.py new file mode 100644 index 0000000..10a2d33 --- /dev/null +++ b/tests/test_meta.py @@ -0,0 +1,24 @@ +import unittest +from markdown.__meta__ import _get_version, __version__ + + +class TestVersion(unittest.TestCase): + + def test_get_version(self): + """Test that _get_version formats __version_info__ as required by PEP 440.""" + + self.assertEqual(_get_version((1, 1, 2, 'dev', 0)), "1.1.2.dev0") + self.assertEqual(_get_version((1, 1, 2, 'alpha', 1)), "1.1.2a1") + self.assertEqual(_get_version((1, 2, 0, 'beta', 2)), "1.2b2") + self.assertEqual(_get_version((1, 2, 0, 'rc', 4)), "1.2rc4") + self.assertEqual(_get_version((1, 2, 0, 'final', 0)), "1.2") + + def test__version__IsValid(self): + """Test that __version__ is valid and normalized.""" + + try: + import packaging.version + except ImportError: + from pkg_resources.extern import packaging + + self.assertEqual(__version__, str(packaging.version.Version(__version__))) diff --git a/tests/test_syntax/__init__.py b/tests/test_syntax/__init__.py new file mode 100644 index 0000000..564ba3b --- /dev/null +++ b/tests/test_syntax/__init__.py @@ -0,0 +1,20 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" diff --git a/tests/test_syntax/blocks/__init__.py b/tests/test_syntax/blocks/__init__.py new file mode 100644 index 0000000..564ba3b --- /dev/null +++ b/tests/test_syntax/blocks/__init__.py @@ -0,0 +1,20 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" diff --git a/tests/test_syntax/blocks/test_blockquotes.py b/tests/test_syntax/blocks/test_blockquotes.py new file mode 100644 index 0000000..3422f9f --- /dev/null +++ b/tests/test_syntax/blocks/test_blockquotes.py @@ -0,0 +1,51 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2020 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + +from markdown.test_tools import TestCase, recursionlimit + + +class TestBlockquoteBlocks(TestCase): + + # TODO: Move legacy tests here + + def test_nesting_limit(self): + # Test that the nesting limit is within 100 levels of recursion limit. Future code changes could cause the + # recursion limit to need adjusted here. We need to account for all of Markdown's internal calls. Finally, we + # need to account for the 100 level cushion which we are testing. + with recursionlimit(120): + self.assertMarkdownRenders( + '>>>>>>>>>>', + self.dedent( + """ +
      +
      +
      +
      +
      +

      >>>>>

      +
      +
      +
      +
      +
      + """ + ) + ) diff --git a/tests/test_syntax/blocks/test_code_blocks.py b/tests/test_syntax/blocks/test_code_blocks.py new file mode 100644 index 0000000..54b6860 --- /dev/null +++ b/tests/test_syntax/blocks/test_code_blocks.py @@ -0,0 +1,88 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + +from markdown.test_tools import TestCase + + +class TestCodeBlocks(TestCase): + + def test_spaced_codeblock(self): + self.assertMarkdownRenders( + ' # A code block.', + + self.dedent( + """ +
      # A code block.
      +                
      + """ + ) + ) + + def test_tabbed_codeblock(self): + self.assertMarkdownRenders( + '\t# A code block.', + + self.dedent( + """ +
      # A code block.
      +                
      + """ + ) + ) + + def test_multiline_codeblock(self): + self.assertMarkdownRenders( + ' # Line 1\n # Line 2\n', + + self.dedent( + """ +
      # Line 1
      +                # Line 2
      +                
      + """ + ) + ) + + def test_codeblock_with_blankline(self): + self.assertMarkdownRenders( + ' # Line 1\n\n # Line 2\n', + + self.dedent( + """ +
      # Line 1
      +
      +                # Line 2
      +                
      + """ + ) + ) + + def test_codeblock_escape(self): + self.assertMarkdownRenders( + ' ', + + self.dedent( + """ +
      <foo & bar>
      +                
      + """ + ) + ) diff --git a/tests/test_syntax/blocks/test_headers.py b/tests/test_syntax/blocks/test_headers.py new file mode 100644 index 0000000..ca065a5 --- /dev/null +++ b/tests/test_syntax/blocks/test_headers.py @@ -0,0 +1,729 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + +import unittest +from markdown.test_tools import TestCase + + +class TestSetextHeaders(TestCase): + + def test_setext_h1(self): + self.assertMarkdownRenders( + self.dedent( + """ + This is an H1 + ============= + """ + ), + + '

      This is an H1

      ' + ) + + def test_setext_h2(self): + self.assertMarkdownRenders( + self.dedent( + """ + This is an H2 + ------------- + """ + ), + + '

      This is an H2

      ' + ) + + def test_setext_h1_mismatched_length(self): + self.assertMarkdownRenders( + self.dedent( + """ + This is an H1 + === + """ + ), + + '

      This is an H1

      ' + ) + + def test_setext_h2_mismatched_length(self): + self.assertMarkdownRenders( + self.dedent( + """ + This is an H2 + --- + """ + ), + + '

      This is an H2

      ' + ) + + def test_setext_h1_followed_by_p(self): + self.assertMarkdownRenders( + self.dedent( + """ + This is an H1 + ============= + Followed by a Paragraph with no blank line. + """ + ), + self.dedent( + """ +

      This is an H1

      +

      Followed by a Paragraph with no blank line.

      + """ + ) + ) + + def test_setext_h2_followed_by_p(self): + self.assertMarkdownRenders( + self.dedent( + """ + This is an H2 + ------------- + Followed by a Paragraph with no blank line. + """ + ), + self.dedent( + """ +

      This is an H2

      +

      Followed by a Paragraph with no blank line.

      + """ + ) + ) + + # TODO: fix this + # see https://johnmacfarlane.net/babelmark2/?normalize=1&text=Paragraph%0AAn+H1%0A%3D%3D%3D%3D%3D + @unittest.skip('This is broken in Python-Markdown') + def test_p_followed_by_setext_h1(self): + self.assertMarkdownRenders( + self.dedent( + """ + This is a Paragraph. + Followed by an H1 with no blank line. + ===================================== + """ + ), + self.dedent( + """ +

      This is a Paragraph.

      +

      Followed by an H1 with no blank line.

      + """ + ) + ) + + # TODO: fix this + # see https://johnmacfarlane.net/babelmark2/?normalize=1&text=Paragraph%0AAn+H2%0A----- + @unittest.skip('This is broken in Python-Markdown') + def test_p_followed_by_setext_h2(self): + self.assertMarkdownRenders( + self.dedent( + """ + This is a Paragraph. + Followed by an H2 with no blank line. + ------------------------------------- + """ + ), + self.dedent( + """ +

      This is a Paragraph.

      +

      Followed by an H2 with no blank line.

      + """ + ) + ) + + +class TestHashHeaders(TestCase): + + def test_hash_h1_open(self): + self.assertMarkdownRenders( + '# This is an H1', + + '

      This is an H1

      ' + ) + + def test_hash_h2_open(self): + self.assertMarkdownRenders( + '## This is an H2', + + '

      This is an H2

      ' + ) + + def test_hash_h3_open(self): + self.assertMarkdownRenders( + '### This is an H3', + + '

      This is an H3

      ' + ) + + def test_hash_h4_open(self): + self.assertMarkdownRenders( + '#### This is an H4', + + '

      This is an H4

      ' + ) + + def test_hash_h5_open(self): + self.assertMarkdownRenders( + '##### This is an H5', + + '
      This is an H5
      ' + ) + + def test_hash_h6_open(self): + self.assertMarkdownRenders( + '###### This is an H6', + + '
      This is an H6
      ' + ) + + def test_hash_gt6_open(self): + self.assertMarkdownRenders( + '####### This is an H6', + + '
      # This is an H6
      ' + ) + + def test_hash_h1_open_missing_space(self): + self.assertMarkdownRenders( + '#This is an H1', + + '

      This is an H1

      ' + ) + + def test_hash_h2_open_missing_space(self): + self.assertMarkdownRenders( + '##This is an H2', + + '

      This is an H2

      ' + ) + + def test_hash_h3_open_missing_space(self): + self.assertMarkdownRenders( + '###This is an H3', + + '

      This is an H3

      ' + ) + + def test_hash_h4_open_missing_space(self): + self.assertMarkdownRenders( + '####This is an H4', + + '

      This is an H4

      ' + ) + + def test_hash_h5_open_missing_space(self): + self.assertMarkdownRenders( + '#####This is an H5', + + '
      This is an H5
      ' + ) + + def test_hash_h6_open_missing_space(self): + self.assertMarkdownRenders( + '######This is an H6', + + '
      This is an H6
      ' + ) + + def test_hash_gt6_open_missing_space(self): + self.assertMarkdownRenders( + '#######This is an H6', + + '
      #This is an H6
      ' + ) + + def test_hash_h1_closed(self): + self.assertMarkdownRenders( + '# This is an H1 #', + + '

      This is an H1

      ' + ) + + def test_hash_h2_closed(self): + self.assertMarkdownRenders( + '## This is an H2 ##', + + '

      This is an H2

      ' + ) + + def test_hash_h3_closed(self): + self.assertMarkdownRenders( + '### This is an H3 ###', + + '

      This is an H3

      ' + ) + + def test_hash_h4_closed(self): + self.assertMarkdownRenders( + '#### This is an H4 ####', + + '

      This is an H4

      ' + ) + + def test_hash_h5_closed(self): + self.assertMarkdownRenders( + '##### This is an H5 #####', + + '
      This is an H5
      ' + ) + + def test_hash_h6_closed(self): + self.assertMarkdownRenders( + '###### This is an H6 ######', + + '
      This is an H6
      ' + ) + + def test_hash_gt6_closed(self): + self.assertMarkdownRenders( + '####### This is an H6 #######', + + '
      # This is an H6
      ' + ) + + def test_hash_h1_closed_missing_space(self): + self.assertMarkdownRenders( + '#This is an H1#', + + '

      This is an H1

      ' + ) + + def test_hash_h2_closed_missing_space(self): + self.assertMarkdownRenders( + '##This is an H2##', + + '

      This is an H2

      ' + ) + + def test_hash_h3_closed_missing_space(self): + self.assertMarkdownRenders( + '###This is an H3###', + + '

      This is an H3

      ' + ) + + def test_hash_h4_closed_missing_space(self): + self.assertMarkdownRenders( + '####This is an H4####', + + '

      This is an H4

      ' + ) + + def test_hash_h5_closed_missing_space(self): + self.assertMarkdownRenders( + '#####This is an H5#####', + + '
      This is an H5
      ' + ) + + def test_hash_h6_closed_missing_space(self): + self.assertMarkdownRenders( + '######This is an H6######', + + '
      This is an H6
      ' + ) + + def test_hash_gt6_closed_missing_space(self): + self.assertMarkdownRenders( + '#######This is an H6#######', + + '
      #This is an H6
      ' + ) + + def test_hash_h1_closed_mismatch(self): + self.assertMarkdownRenders( + '# This is an H1 ##', + + '

      This is an H1

      ' + ) + + def test_hash_h2_closed_mismatch(self): + self.assertMarkdownRenders( + '## This is an H2 #', + + '

      This is an H2

      ' + ) + + def test_hash_h3_closed_mismatch(self): + self.assertMarkdownRenders( + '### This is an H3 #', + + '

      This is an H3

      ' + ) + + def test_hash_h4_closed_mismatch(self): + self.assertMarkdownRenders( + '#### This is an H4 #', + + '

      This is an H4

      ' + ) + + def test_hash_h5_closed_mismatch(self): + self.assertMarkdownRenders( + '##### This is an H5 #', + + '
      This is an H5
      ' + ) + + def test_hash_h6_closed_mismatch(self): + self.assertMarkdownRenders( + '###### This is an H6 #', + + '
      This is an H6
      ' + ) + + def test_hash_gt6_closed_mismatch(self): + self.assertMarkdownRenders( + '####### This is an H6 ##################', + + '
      # This is an H6
      ' + ) + + def test_hash_h1_followed_by_p(self): + self.assertMarkdownRenders( + self.dedent( + """ + # This is an H1 + Followed by a Paragraph with no blank line. + """ + ), + self.dedent( + """ +

      This is an H1

      +

      Followed by a Paragraph with no blank line.

      + """ + ) + ) + + def test_hash_h2_followed_by_p(self): + self.assertMarkdownRenders( + self.dedent( + """ + ## This is an H2 + Followed by a Paragraph with no blank line. + """ + ), + self.dedent( + """ +

      This is an H2

      +

      Followed by a Paragraph with no blank line.

      + """ + ) + ) + + def test_hash_h3_followed_by_p(self): + self.assertMarkdownRenders( + self.dedent( + """ + ### This is an H3 + Followed by a Paragraph with no blank line. + """ + ), + self.dedent( + """ +

      This is an H3

      +

      Followed by a Paragraph with no blank line.

      + """ + ) + ) + + def test_hash_h4_followed_by_p(self): + self.assertMarkdownRenders( + self.dedent( + """ + #### This is an H4 + Followed by a Paragraph with no blank line. + """ + ), + self.dedent( + """ +

      This is an H4

      +

      Followed by a Paragraph with no blank line.

      + """ + ) + ) + + def test_hash_h5_followed_by_p(self): + self.assertMarkdownRenders( + self.dedent( + """ + ##### This is an H5 + Followed by a Paragraph with no blank line. + """ + ), + self.dedent( + """ +
      This is an H5
      +

      Followed by a Paragraph with no blank line.

      + """ + ) + ) + + def test_hash_h6_followed_by_p(self): + self.assertMarkdownRenders( + self.dedent( + """ + ###### This is an H6 + Followed by a Paragraph with no blank line. + """ + ), + self.dedent( + """ +
      This is an H6
      +

      Followed by a Paragraph with no blank line.

      + """ + ) + ) + + def test_hash_h1_leading_space(self): + self.assertMarkdownRenders( + ' # This is an H1', + + '

      # This is an H1

      ' + ) + + def test_hash_h2_leading_space(self): + self.assertMarkdownRenders( + ' ## This is an H2', + + '

      ## This is an H2

      ' + ) + + def test_hash_h3_leading_space(self): + self.assertMarkdownRenders( + ' ### This is an H3', + + '

      ### This is an H3

      ' + ) + + def test_hash_h4_leading_space(self): + self.assertMarkdownRenders( + ' #### This is an H4', + + '

      #### This is an H4

      ' + ) + + def test_hash_h5_leading_space(self): + self.assertMarkdownRenders( + ' ##### This is an H5', + + '

      ##### This is an H5

      ' + ) + + def test_hash_h6_leading_space(self): + self.assertMarkdownRenders( + ' ###### This is an H6', + + '

      ###### This is an H6

      ' + ) + + def test_hash_h1_open_trailing_space(self): + self.assertMarkdownRenders( + '# This is an H1 ', + + '

      This is an H1

      ' + ) + + def test_hash_h2_open_trailing_space(self): + self.assertMarkdownRenders( + '## This is an H2 ', + + '

      This is an H2

      ' + ) + + def test_hash_h3_open_trailing_space(self): + self.assertMarkdownRenders( + '### This is an H3 ', + + '

      This is an H3

      ' + ) + + def test_hash_h4_open_trailing_space(self): + self.assertMarkdownRenders( + '#### This is an H4 ', + + '

      This is an H4

      ' + ) + + def test_hash_h5_open_trailing_space(self): + self.assertMarkdownRenders( + '##### This is an H5 ', + + '
      This is an H5
      ' + ) + + def test_hash_h6_open_trailing_space(self): + self.assertMarkdownRenders( + '###### This is an H6 ', + + '
      This is an H6
      ' + ) + + def test_hash_gt6_open_trailing_space(self): + self.assertMarkdownRenders( + '####### This is an H6 ', + + '
      # This is an H6
      ' + ) + + # TODO: Possibly change the following behavior. While this follows the behavior + # of markdown.pl, it is rather uncommon and not necessarily intuitive. + # See: https://johnmacfarlane.net/babelmark2/?normalize=1&text=%23+This+is+an+H1+%23+ + def test_hash_h1_closed_trailing_space(self): + self.assertMarkdownRenders( + '# This is an H1 # ', + + '

      This is an H1 #

      ' + ) + + def test_hash_h2_closed_trailing_space(self): + self.assertMarkdownRenders( + '## This is an H2 ## ', + + '

      This is an H2 ##

      ' + ) + + def test_hash_h3_closed_trailing_space(self): + self.assertMarkdownRenders( + '### This is an H3 ### ', + + '

      This is an H3 ###

      ' + ) + + def test_hash_h4_closed_trailing_space(self): + self.assertMarkdownRenders( + '#### This is an H4 #### ', + + '

      This is an H4 ####

      ' + ) + + def test_hash_h5_closed_trailing_space(self): + self.assertMarkdownRenders( + '##### This is an H5 ##### ', + + '
      This is an H5 #####
      ' + ) + + def test_hash_h6_closed_trailing_space(self): + self.assertMarkdownRenders( + '###### This is an H6 ###### ', + + '
      This is an H6 ######
      ' + ) + + def test_hash_gt6_closed_trailing_space(self): + self.assertMarkdownRenders( + '####### This is an H6 ####### ', + + '
      # This is an H6 #######
      ' + ) + + def test_no_blank_lines_between_hashs(self): + self.assertMarkdownRenders( + self.dedent( + """ + # This is an H1 + ## This is an H2 + """ + ), + self.dedent( + """ +

      This is an H1

      +

      This is an H2

      + """ + ) + ) + + def test_random_hash_levels(self): + self.assertMarkdownRenders( + self.dedent( + """ + ### H3 + ###### H6 + # H1 + ##### H5 + #### H4 + ## H2 + ### H3 + """ + ), + self.dedent( + """ +

      H3

      +
      H6
      +

      H1

      +
      H5
      +

      H4

      +

      H2

      +

      H3

      + """ + ) + ) + + def test_hash_followed_by_p(self): + self.assertMarkdownRenders( + self.dedent( + """ + # This is an H1 + Followed by a Paragraph with no blank line. + """ + ), + self.dedent( + """ +

      This is an H1

      +

      Followed by a Paragraph with no blank line.

      + """ + ) + ) + + def test_p_followed_by_hash(self): + self.assertMarkdownRenders( + self.dedent( + """ + This is a Paragraph. + # Followed by an H1 with no blank line. + """ + ), + self.dedent( + """ +

      This is a Paragraph.

      +

      Followed by an H1 with no blank line.

      + """ + ) + ) + + def test_escaped_hash(self): + self.assertMarkdownRenders( + "### H3 \\###", + self.dedent( + """ +

      H3 #

      + """ + ) + ) + + def test_unescaped_hash(self): + self.assertMarkdownRenders( + "### H3 \\\\###", + self.dedent( + """ +

      H3 \\

      + """ + ) + ) diff --git a/tests/test_syntax/blocks/test_hr.py b/tests/test_syntax/blocks/test_hr.py new file mode 100644 index 0000000..85a51b3 --- /dev/null +++ b/tests/test_syntax/blocks/test_hr.py @@ -0,0 +1,402 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + +from markdown.test_tools import TestCase + + +class TestHorizontalRules(TestCase): + + def test_hr_asterisks(self): + self.assertMarkdownRenders( + '***', + + '
      ' + ) + + def test_hr_asterisks_spaces(self): + self.assertMarkdownRenders( + '* * *', + + '
      ' + ) + + def test_hr_asterisks_long(self): + self.assertMarkdownRenders( + '*******', + + '
      ' + ) + + def test_hr_asterisks_spaces_long(self): + self.assertMarkdownRenders( + '* * * * * * *', + + '
      ' + ) + + def test_hr_asterisks_1_indent(self): + self.assertMarkdownRenders( + ' ***', + + '
      ' + ) + + def test_hr_asterisks_spaces_1_indent(self): + self.assertMarkdownRenders( + ' * * *', + + '
      ' + ) + + def test_hr_asterisks_2_indent(self): + self.assertMarkdownRenders( + ' ***', + + '
      ' + ) + + def test_hr_asterisks_spaces_2_indent(self): + self.assertMarkdownRenders( + ' * * *', + + '
      ' + ) + + def test_hr_asterisks_3_indent(self): + self.assertMarkdownRenders( + ' ***', + + '
      ' + ) + + def test_hr_asterisks_spaces_3_indent(self): + self.assertMarkdownRenders( + ' * * *', + + '
      ' + ) + + def test_hr_asterisks_trailing_space(self): + self.assertMarkdownRenders( + '*** ', + + '
      ' + ) + + def test_hr_asterisks_spaces_trailing_space(self): + self.assertMarkdownRenders( + '* * * ', + + '
      ' + ) + + def test_hr_hyphens(self): + self.assertMarkdownRenders( + '---', + + '
      ' + ) + + def test_hr_hyphens_spaces(self): + self.assertMarkdownRenders( + '- - -', + + '
      ' + ) + + def test_hr_hyphens_long(self): + self.assertMarkdownRenders( + '-------', + + '
      ' + ) + + def test_hr_hyphens_spaces_long(self): + self.assertMarkdownRenders( + '- - - - - - -', + + '
      ' + ) + + def test_hr_hyphens_1_indent(self): + self.assertMarkdownRenders( + ' ---', + + '
      ' + ) + + def test_hr_hyphens_spaces_1_indent(self): + self.assertMarkdownRenders( + ' - - -', + + '
      ' + ) + + def test_hr_hyphens_2_indent(self): + self.assertMarkdownRenders( + ' ---', + + '
      ' + ) + + def test_hr_hyphens_spaces_2_indent(self): + self.assertMarkdownRenders( + ' - - -', + + '
      ' + ) + + def test_hr_hyphens_3_indent(self): + self.assertMarkdownRenders( + ' ---', + + '
      ' + ) + + def test_hr_hyphens_spaces_3_indent(self): + self.assertMarkdownRenders( + ' - - -', + + '
      ' + ) + + def test_hr_hyphens_trailing_space(self): + self.assertMarkdownRenders( + '--- ', + + '
      ' + ) + + def test_hr_hyphens_spaces_trailing_space(self): + self.assertMarkdownRenders( + '- - - ', + + '
      ' + ) + + def test_hr_underscores(self): + self.assertMarkdownRenders( + '___', + + '
      ' + ) + + def test_hr_underscores_spaces(self): + self.assertMarkdownRenders( + '_ _ _', + + '
      ' + ) + + def test_hr_underscores_long(self): + self.assertMarkdownRenders( + '_______', + + '
      ' + ) + + def test_hr_underscores_spaces_long(self): + self.assertMarkdownRenders( + '_ _ _ _ _ _ _', + + '
      ' + ) + + def test_hr_underscores_1_indent(self): + self.assertMarkdownRenders( + ' ___', + + '
      ' + ) + + def test_hr_underscores_spaces_1_indent(self): + self.assertMarkdownRenders( + ' _ _ _', + + '
      ' + ) + + def test_hr_underscores_2_indent(self): + self.assertMarkdownRenders( + ' ___', + + '
      ' + ) + + def test_hr_underscores_spaces_2_indent(self): + self.assertMarkdownRenders( + ' _ _ _', + + '
      ' + ) + + def test_hr_underscores_3_indent(self): + self.assertMarkdownRenders( + ' ___', + + '
      ' + ) + + def test_hr_underscores_spaces_3_indent(self): + self.assertMarkdownRenders( + ' _ _ _', + + '
      ' + ) + + def test_hr_underscores_trailing_space(self): + self.assertMarkdownRenders( + '___ ', + + '
      ' + ) + + def test_hr_underscores_spaces_trailing_space(self): + self.assertMarkdownRenders( + '_ _ _ ', + + '
      ' + ) + + def test_hr_before_paragraph(self): + self.assertMarkdownRenders( + self.dedent( + """ + *** + An HR followed by a paragraph with no blank line. + """ + ), + self.dedent( + """ +
      +

      An HR followed by a paragraph with no blank line.

      + """ + ) + ) + + def test_hr_after_paragraph(self): + self.assertMarkdownRenders( + self.dedent( + """ + A paragraph followed by an HR with no blank line. + *** + """ + ), + self.dedent( + """ +

      A paragraph followed by an HR with no blank line.

      +
      + """ + ) + ) + + def test_hr_after_emstrong(self): + self.assertMarkdownRenders( + self.dedent( + """ + ***text*** + *** + """ + ), + self.dedent( + """ +

      text

      +
      + """ + ) + ) + + def test_not_hr_2_asterisks(self): + self.assertMarkdownRenders( + '**', + + '

      **

      ' + ) + + def test_not_hr_2_asterisks_spaces(self): + self.assertMarkdownRenders( + '* *', + + self.dedent( + """ +
        +
      • *
      • +
      + """ + ) + ) + + def test_not_hr_2_hyphens(self): + self.assertMarkdownRenders( + '--', + + '

      --

      ' + ) + + def test_not_hr_2_hyphens_spaces(self): + self.assertMarkdownRenders( + '- -', + + self.dedent( + """ +
        +
      • -
      • +
      + """ + ) + ) + + def test_not_hr_2_underscores(self): + self.assertMarkdownRenders( + '__', + + '

      __

      ' + ) + + def test_not_hr_2_underscores_spaces(self): + self.assertMarkdownRenders( + '_ _', + + '

      _ _

      ' + ) + + def test_2_consecutive_hr(self): + self.assertMarkdownRenders( + self.dedent( + """ + - - - + - - - + """ + ), + self.dedent( + """ +
      +
      + """ + ) + ) + + def test_not_hr_end_in_char(self): + self.assertMarkdownRenders( + '--------------------------------------c', + + '

      --------------------------------------c

      ' + ) diff --git a/tests/test_syntax/blocks/test_html_blocks.py b/tests/test_syntax/blocks/test_html_blocks.py new file mode 100644 index 0000000..9ec0668 --- /dev/null +++ b/tests/test_syntax/blocks/test_html_blocks.py @@ -0,0 +1,1619 @@ +# -*- coding: utf-8 -*- +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + +from markdown.test_tools import TestCase +import markdown + + +class TestHTMLBlocks(TestCase): + + def test_raw_paragraph(self): + self.assertMarkdownRenders( + '

      A raw paragraph.

      ', + '

      A raw paragraph.

      ' + ) + + def test_raw_skip_inline_markdown(self): + self.assertMarkdownRenders( + '

      A *raw* paragraph.

      ', + '

      A *raw* paragraph.

      ' + ) + + def test_raw_indent_one_space(self): + self.assertMarkdownRenders( + '

      A *raw* paragraph.

      ', + '

      A *raw* paragraph.

      ' + ) + + def test_raw_indent_two_spaces(self): + self.assertMarkdownRenders( + '

      A *raw* paragraph.

      ', + '

      A *raw* paragraph.

      ' + ) + + def test_raw_indent_three_spaces(self): + self.assertMarkdownRenders( + '

      A *raw* paragraph.

      ', + '

      A *raw* paragraph.

      ' + ) + + def test_raw_indent_four_spaces(self): + self.assertMarkdownRenders( + '

      code block

      ', + self.dedent( + """ +
      <p>code block</p>
      +                
      + """ + ) + ) + + def test_raw_span(self): + self.assertMarkdownRenders( + '*inline*', + '

      inline

      ' + ) + + def test_code_span(self): + self.assertMarkdownRenders( + '`

      code span

      `', + '

      <p>code span</p>

      ' + ) + + def test_code_span_open_gt(self): + self.assertMarkdownRenders( + '*bar* `<` *foo*', + '

      bar < foo

      ' + ) + + def test_raw_empty(self): + self.assertMarkdownRenders( + '

      ', + '

      ' + ) + + def test_raw_empty_space(self): + self.assertMarkdownRenders( + '

      ', + '

      ' + ) + + def test_raw_empty_newline(self): + self.assertMarkdownRenders( + '

      \n

      ', + '

      \n

      ' + ) + + def test_raw_empty_blank_line(self): + self.assertMarkdownRenders( + '

      \n\n

      ', + '

      \n\n

      ' + ) + + def test_raw_uppercase(self): + self.assertMarkdownRenders( + '
      *foo*
      ', + '
      *foo*
      ' + ) + + def test_raw_uppercase_multiline(self): + self.assertMarkdownRenders( + self.dedent( + """ +
      + *foo* +
      + """ + ), + self.dedent( + """ +
      + *foo* +
      + """ + ) + ) + + def test_multiple_raw_single_line(self): + self.assertMarkdownRenders( + '

      *foo*

      *bar*
      ', + self.dedent( + """ +

      *foo*

      +
      *bar*
      + """ + ) + ) + + def test_multiple_raw_single_line_with_pi(self): + self.assertMarkdownRenders( + "

      *foo*

      '; ?>", + self.dedent( + """ +

      *foo*

      + '; ?> + """ + ) + ) + + def test_multiline_raw(self): + self.assertMarkdownRenders( + self.dedent( + """ +

      + A raw paragraph + with multiple lines. +

      + """ + ), + self.dedent( + """ +

      + A raw paragraph + with multiple lines. +

      + """ + ) + ) + + def test_blank_lines_in_raw(self): + self.assertMarkdownRenders( + self.dedent( + """ +

      + + A raw paragraph... + + with many blank lines. + +

      + """ + ), + self.dedent( + """ +

      + + A raw paragraph... + + with many blank lines. + +

      + """ + ) + ) + + def test_raw_surrounded_by_Markdown(self): + self.assertMarkdownRenders( + self.dedent( + """ + Some *Markdown* text. + +

      *Raw* HTML.

      + + More *Markdown* text. + """ + ), + self.dedent( + """ +

      Some Markdown text.

      +

      *Raw* HTML.

      + +

      More Markdown text.

      + """ + ) + ) + + def test_raw_surrounded_by_text_without_blank_lines(self): + self.assertMarkdownRenders( + self.dedent( + """ + Some *Markdown* text. +

      *Raw* HTML.

      + More *Markdown* text. + """ + ), + self.dedent( + """ +

      Some Markdown text.

      +

      *Raw* HTML.

      +

      More Markdown text.

      + """ + ) + ) + + def test_multiline_markdown_with_code_span(self): + self.assertMarkdownRenders( + self.dedent( + """ + A paragraph with a block-level + `

      code span

      `, which is + at the start of a line. + """ + ), + self.dedent( + """ +

      A paragraph with a block-level + <p>code span</p>, which is + at the start of a line.

      + """ + ) + ) + + def test_raw_block_preceded_by_markdown_code_span_with_unclosed_block_tag(self): + self.assertMarkdownRenders( + self.dedent( + """ + A paragraph with a block-level code span: `
      `. + +

      *not markdown*

      + + This is *markdown* + """ + ), + self.dedent( + """ +

      A paragraph with a block-level code span: <div>.

      +

      *not markdown*

      + +

      This is markdown

      + """ + ) + ) + + def test_raw_one_line_followed_by_text(self): + self.assertMarkdownRenders( + '

      *foo*

      *bar*', + self.dedent( + """ +

      *foo*

      +

      bar

      + """ + ) + ) + + def test_raw_one_line_followed_by_span(self): + self.assertMarkdownRenders( + "

      *foo*

      *bar*", + self.dedent( + """ +

      *foo*

      +

      bar

      + """ + ) + ) + + def test_raw_with_markdown_blocks(self): + self.assertMarkdownRenders( + self.dedent( + """ +
      + Not a Markdown paragraph. + + * Not a list item. + * Another non-list item. + + Another non-Markdown paragraph. +
      + """ + ), + self.dedent( + """ +
      + Not a Markdown paragraph. + + * Not a list item. + * Another non-list item. + + Another non-Markdown paragraph. +
      + """ + ) + ) + + def test_adjacent_raw_blocks(self): + self.assertMarkdownRenders( + self.dedent( + """ +

      A raw paragraph.

      +

      A second raw paragraph.

      + """ + ), + self.dedent( + """ +

      A raw paragraph.

      +

      A second raw paragraph.

      + """ + ) + ) + + def test_adjacent_raw_blocks_with_blank_lines(self): + self.assertMarkdownRenders( + self.dedent( + """ +

      A raw paragraph.

      + +

      A second raw paragraph.

      + """ + ), + self.dedent( + """ +

      A raw paragraph.

      + +

      A second raw paragraph.

      + """ + ) + ) + + def test_nested_raw_one_line(self): + self.assertMarkdownRenders( + '

      *foo*

      ', + '

      *foo*

      ' + ) + + def test_nested_raw_block(self): + self.assertMarkdownRenders( + self.dedent( + """ +
      +

      A raw paragraph.

      +
      + """ + ), + self.dedent( + """ +
      +

      A raw paragraph.

      +
      + """ + ) + ) + + def test_nested_indented_raw_block(self): + self.assertMarkdownRenders( + self.dedent( + """ +
      +

      A raw paragraph.

      +
      + """ + ), + self.dedent( + """ +
      +

      A raw paragraph.

      +
      + """ + ) + ) + + def test_nested_raw_blocks(self): + self.assertMarkdownRenders( + self.dedent( + """ +
      +

      A raw paragraph.

      +

      A second raw paragraph.

      +
      + """ + ), + self.dedent( + """ +
      +

      A raw paragraph.

      +

      A second raw paragraph.

      +
      + """ + ) + ) + + def test_nested_raw_blocks_with_blank_lines(self): + self.assertMarkdownRenders( + self.dedent( + """ +
      + +

      A raw paragraph.

      + +

      A second raw paragraph.

      + +
      + """ + ), + self.dedent( + """ +
      + +

      A raw paragraph.

      + +

      A second raw paragraph.

      + +
      + """ + ) + ) + + def test_nested_inline_one_line(self): + self.assertMarkdownRenders( + '

      foo

      ', + '

      foo

      ' + ) + + def test_raw_nested_inline(self): + self.assertMarkdownRenders( + self.dedent( + """ +
      +

      + *text* +

      +
      + """ + ), + self.dedent( + """ +
      +

      + *text* +

      +
      + """ + ) + ) + + def test_raw_nested_inline_with_blank_lines(self): + self.assertMarkdownRenders( + self.dedent( + """ +
      + +

      + + *text* + +

      + +
      + """ + ), + self.dedent( + """ +
      + +

      + + *text* + +

      + +
      + """ + ) + ) + + def test_raw_html5(self): + self.assertMarkdownRenders( + self.dedent( + """ +
      +
      +
      +

      Hello :-)

      +
      +
      +
      + +
      Caption
      +
      +
      +

      Some footer

      +
      +
      + """ + ), + self.dedent( + """ +
      +
      +
      +

      Hello :-)

      +
      +
      +
      + +
      Caption
      +
      +
      +

      Some footer

      +
      +
      + """ + ) + ) + + def test_raw_pre_tag(self): + self.assertMarkdownRenders( + self.dedent( + """ + Preserve whitespace in raw html + +
      +                class Foo():
      +                    bar = 'bar'
      +
      +                    @property
      +                    def baz(self):
      +                        return self.bar
      +                
      + """ + ), + self.dedent( + """ +

      Preserve whitespace in raw html

      +
      +                class Foo():
      +                    bar = 'bar'
      +
      +                    @property
      +                    def baz(self):
      +                        return self.bar
      +                
      + """ + ) + ) + + def test_raw_pre_tag_nested_escaped_html(self): + self.assertMarkdownRenders( + self.dedent( + """ +
      +                <p>foo</p>
      +                
      + """ + ), + self.dedent( + """ +
      +                <p>foo</p>
      +                
      + """ + ) + ) + + def test_raw_p_no_end_tag(self): + self.assertMarkdownRenders( + '

      *text*', + '

      *text*' + ) + + def test_raw_multiple_p_no_end_tag(self): + self.assertMarkdownRenders( + self.dedent( + """ +

      *text*' + +

      more *text* + """ + ), + self.dedent( + """ +

      *text*' + +

      more *text* + """ + ) + ) + + def test_raw_p_no_end_tag_followed_by_blank_line(self): + self.assertMarkdownRenders( + self.dedent( + """ +

      *raw text*' + + Still part of *raw* text. + """ + ), + self.dedent( + """ +

      *raw text*' + + Still part of *raw* text. + """ + ) + ) + + def test_raw_nested_p_no_end_tag(self): + self.assertMarkdownRenders( + '

      *text*

      ', + '

      *text*

      ' + ) + + def test_raw_open_bracket_only(self): + self.assertMarkdownRenders( + '<', + '

      <

      ' + ) + + def test_raw_open_bracket_followed_by_space(self): + self.assertMarkdownRenders( + '< foo', + '

      < foo

      ' + ) + + def test_raw_missing_close_bracket(self): + self.assertMarkdownRenders( + '<foo

      ' + ) + + def test_raw_unclosed_tag_in_code_span(self): + self.assertMarkdownRenders( + self.dedent( + """ + ` + hello +
      + """ + ), + self.dedent( + """ +

      <div.

      +
      + hello +
      + """ + ) + ) + + def test_raw_unclosed_tag_in_code_span_space(self): + self.assertMarkdownRenders( + self.dedent( + """ + `
      + hello +
      + """ + ), + self.dedent( + """ +

      <div.

      +
      + hello +
      + """ + ) + ) + + def test_raw_attributes(self): + self.assertMarkdownRenders( + '

      text

      ', + '

      text

      ' + ) + + def test_raw_attributes_nested(self): + self.assertMarkdownRenders( + self.dedent( + """ +
      +

      + +

      +
      + """ + ), + self.dedent( + """ +
      +

      + +

      +
      + """ + ) + ) + + def test_raw_comment_one_line(self): + self.assertMarkdownRenders( + '', + '' + ) + + def test_raw_comment_one_line_with_tag(self): + self.assertMarkdownRenders( + '', + '' + ) + + def test_comment_in_code_span(self): + self.assertMarkdownRenders( + '``', + '

      <!-- *foo* -->

      ' + ) + + def test_raw_comment_one_line_followed_by_text(self): + self.assertMarkdownRenders( + '*bar*', + self.dedent( + """ + +

      bar

      + """ + ) + ) + + def test_raw_comment_one_line_followed_by_html(self): + self.assertMarkdownRenders( + '

      *bar*

      ', + self.dedent( + """ + +

      *bar*

      + """ + ) + ) + + # Note: Trailing (insignificant) whitespace is not preserved, which does not match the + # reference implementation. However, it is not a change in behavior for Python-Markdown. + def test_raw_comment_trailing_whitespace(self): + self.assertMarkdownRenders( + ' ', + '' + ) + + # Note: this is a change in behavior for Python-Markdown, which does *not* match the reference + # implementation. However, it does match the HTML5 spec. Declarations must start with either + # `', + '' + ) + + def test_raw_multiline_comment(self): + self.assertMarkdownRenders( + self.dedent( + """ + + """ + ), + self.dedent( + """ + + """ + ) + ) + + def test_raw_multiline_comment_with_tag(self): + self.assertMarkdownRenders( + self.dedent( + """ + + """ + ), + self.dedent( + """ + + """ + ) + ) + + def test_raw_multiline_comment_first_line(self): + self.assertMarkdownRenders( + self.dedent( + """ + + """ + ), + self.dedent( + """ + + """ + ) + ) + + def test_raw_multiline_comment_last_line(self): + self.assertMarkdownRenders( + self.dedent( + """ + + """ + ), + self.dedent( + """ + + """ + ) + ) + + def test_raw_comment_with_blank_lines(self): + self.assertMarkdownRenders( + self.dedent( + """ + + """ + ), + self.dedent( + """ + + """ + ) + ) + + def test_raw_comment_with_blank_lines_with_tag(self): + self.assertMarkdownRenders( + self.dedent( + """ + + """ + ), + self.dedent( + """ + + """ + ) + ) + + def test_raw_comment_with_blank_lines_first_line(self): + self.assertMarkdownRenders( + self.dedent( + """ + + """ + ), + self.dedent( + """ + + """ + ) + ) + + def test_raw_comment_with_blank_lines_last_line(self): + self.assertMarkdownRenders( + self.dedent( + """ + + """ + ), + self.dedent( + """ + + """ + ) + ) + + def test_raw_comment_indented(self): + self.assertMarkdownRenders( + self.dedent( + """ + + """ + ), + self.dedent( + """ + + """ + ) + ) + + def test_raw_comment_indented_with_tag(self): + self.assertMarkdownRenders( + self.dedent( + """ + + """ + ), + self.dedent( + """ + + """ + ) + ) + + def test_raw_comment_nested(self): + self.assertMarkdownRenders( + self.dedent( + """ +
      + +
      + """ + ), + self.dedent( + """ +
      + +
      + """ + ) + ) + + def test_comment_in_code_block(self): + self.assertMarkdownRenders( + ' ', + self.dedent( + """ +
      <!-- *foo* -->
      +                
      + """ + ) + ) + + # Note: This is a change in behavior. Previously, Python-Markdown interpreted this in the same manner + # as browsers and all text after the opening comment tag was considered to be in a comment. However, + # that did not match the reference implementation. The new behavior does. + def test_unclosed_comment_(self): + self.assertMarkdownRenders( + self.dedent( + """ + + A *Markdown* paragraph. +
    + """ + ), + self.dedent( + """ +
    +

    A Markdown paragraph.

    + +

    A Markdown paragraph.

    +
    + """ + ) + ) + + def test_md1_nested_link_ref(self): + self.assertMarkdownRenders( + self.dedent( + """ +
    + [link]: http://example.com +
    + [link][link] +
    +
    + """ + ), + self.dedent( + """ +
    +
    +

    link

    +
    +
    + """ + ) + ) + + def test_md1_hr_only_start(self): + self.assertMarkdownRenders( + self.dedent( + """ + *emphasis1* +
    + *emphasis2* + """ + ), + self.dedent( + """ +

    emphasis1

    +
    +

    emphasis2

    + """ + ) + ) + + def test_md1_hr_self_close(self): + self.assertMarkdownRenders( + self.dedent( + """ + *emphasis1* +
    + *emphasis2* + """ + ), + self.dedent( + """ +

    emphasis1

    +
    +

    emphasis2

    + """ + ) + ) + + def test_md1_hr_start_and_end(self): + # Browsers ignore ending hr tags, so we don't try to do anything to handle them special. + self.assertMarkdownRenders( + self.dedent( + """ + *emphasis1* +
    + *emphasis2* + """ + ), + self.dedent( + """ +

    emphasis1

    +
    +

    + emphasis2

    + """ + ) + ) + + def test_md1_hr_only_end(self): + # Browsers ignore ending hr tags, so we don't try to do anything to handle them special. + self.assertMarkdownRenders( + self.dedent( + """ + *emphasis1* + + *emphasis2* + """ + ), + self.dedent( + """ +

    emphasis1 + + emphasis2

    + """ + ) + ) + + def test_md1_hr_with_content(self): + # Browsers ignore ending hr tags, so we don't try to do anything to handle them special. + # Content is not allowed and will be treated as normal content between two hr tags + self.assertMarkdownRenders( + self.dedent( + """ + *emphasis1* +
    + **content** + + *emphasis2* + """ + ), + self.dedent( + """ +

    emphasis1

    +
    +

    content + + emphasis2

    + """ + ) + ) + + def test_no_md1_hr_with_content(self): + # Browsers ignore ending hr tags, so we don't try to do anything to handle them special. + # Content is not allowed and will be treated as normal content between two hr tags + self.assertMarkdownRenders( + self.dedent( + """ + *emphasis1* +
    + **content** + + *emphasis2* + """ + ), + self.dedent( + """ +

    emphasis1

    +
    +

    content + + emphasis2

    + """ + ) + ) + + def test_md1_nested_abbr_ref(self): + self.assertMarkdownRenders( + self.dedent( + """ +
    + *[abbr]: Abbreviation +
    + abbr +
    +
    + """ + ), + self.dedent( + """ +
    +
    +

    abbr

    +
    +
    + """ + ), + extensions=['md_in_html', 'abbr'] + ) + + def test_md1_nested_footnote_ref(self): + self.assertMarkdownRenders( + self.dedent( + """ +
    + [^1]: The footnote. +
    + Paragraph with a footnote.[^1] +
    +
    + """ + ), + '
    \n' + '
    \n' + '

    Paragraph with a footnote.1

    \n' + '
    \n' + '
    \n' + '
    \n' + '
    \n' + '
      \n' + '
    1. \n' + '

      The footnote. ' + '' + '

      \n' + '
    2. \n' + '
    \n' + '
    ', + extensions=['md_in_html', 'footnotes'] + ) + + +def load_tests(loader, tests, pattern): + ''' Ensure TestHTMLBlocks doesn't get run twice by excluding it here. ''' + suite = TestSuite() + for test_class in [TestDefaultwMdInHTML, TestMdInHTML, TestMarkdownInHTMLPostProcessor]: + tests = loader.loadTestsFromTestCase(test_class) + suite.addTests(tests) + return suite diff --git a/tests/test_syntax/extensions/test_smarty.py b/tests/test_syntax/extensions/test_smarty.py new file mode 100644 index 0000000..fc635ad --- /dev/null +++ b/tests/test_syntax/extensions/test_smarty.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2022 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + +from markdown.test_tools import TestCase + + +class TestSmarty(TestCase): + + default_kwargs = {'extensions': ['smarty']} + + def test_escaped_attr(self): + self.assertMarkdownRenders( + '![x\"x](x)', + '

    x"x

    ' + ) + + # TODO: Move rest of smarty tests here. diff --git a/tests/test_syntax/extensions/test_tables.py b/tests/test_syntax/extensions/test_tables.py new file mode 100644 index 0000000..cd3fbe4 --- /dev/null +++ b/tests/test_syntax/extensions/test_tables.py @@ -0,0 +1,922 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + +from markdown.test_tools import TestCase +from markdown.extensions.tables import TableExtension + + +class TestTableBlocks(TestCase): + + def test_empty_cells(self): + """Empty cells (nbsp).""" + + text = """ +  | Second Header +------------- | ------------- +  | Content Cell +Content Cell |   +""" + + self.assertMarkdownRenders( + text, + self.dedent( + """ + + + + + + + + + + + + + + + + + +
     Second Header
     Content Cell
    Content Cell 
    + """ + ), + extensions=['tables'] + ) + + def test_no_sides(self): + self.assertMarkdownRenders( + self.dedent( + """ + First Header | Second Header + ------------- | ------------- + Content Cell | Content Cell + Content Cell | Content Cell + """ + ), + self.dedent( + """ + + + + + + + + + + + + + + + + + +
    First HeaderSecond Header
    Content CellContent Cell
    Content CellContent Cell
    + """ + ), + extensions=['tables'] + ) + + def test_both_sides(self): + self.assertMarkdownRenders( + self.dedent( + """ + | First Header | Second Header | + | ------------- | ------------- | + | Content Cell | Content Cell | + | Content Cell | Content Cell | + """ + ), + self.dedent( + """ + + + + + + + + + + + + + + + + + +
    First HeaderSecond Header
    Content CellContent Cell
    Content CellContent Cell
    + """ + ), + extensions=['tables'] + ) + + def test_align_columns(self): + self.assertMarkdownRenders( + self.dedent( + """ + | Item | Value | + | :-------- | -----:| + | Computer | $1600 | + | Phone | $12 | + | Pipe | $1 | + """ + ), + self.dedent( + """ + + + + + + + + + + + + + + + + + + + + + +
    ItemValue
    Computer$1600
    Phone$12
    Pipe$1
    + """ + ), + extensions=['tables'] + ) + + def test_styles_in_tables(self): + self.assertMarkdownRenders( + self.dedent( + """ + | Function name | Description | + | ------------- | ------------------------------ | + | `help()` | Display the help window. | + | `destroy()` | **Destroy your computer!** | + """ + ), + self.dedent( + """ + + + + + + + + + + + + + + + + + +
    Function nameDescription
    help()Display the help window.
    destroy()Destroy your computer!
    + """ + ), + extensions=['tables'] + ) + + def test_align_three(self): + self.assertMarkdownRenders( + self.dedent( + """ + |foo|bar|baz| + |:--|:-:|--:| + | | Q | | + |W | | W| + """ + ), + self.dedent( + """ + + + + + + + + + + + + + + + + + + + + +
    foobarbaz
    Q
    WW
    + """ + ), + extensions=['tables'] + ) + + def test_three_columns(self): + self.assertMarkdownRenders( + self.dedent( + """ + foo|bar|baz + ---|---|--- + | Q | + W | | W + """ + ), + self.dedent( + """ + + + + + + + + + + + + + + + + + + + + +
    foobarbaz
    Q
    WW
    + """ + ), + extensions=['tables'] + ) + + def test_three_spaces_prefix(self): + self.assertMarkdownRenders( + self.dedent( + """ + Three spaces in front of a table: + + First Header | Second Header + ------------ | ------------- + Content Cell | Content Cell + Content Cell | Content Cell + + | First Header | Second Header | + | ------------ | ------------- | + | Content Cell | Content Cell | + | Content Cell | Content Cell | + """), + self.dedent( + """ +

    Three spaces in front of a table:

    + + + + + + + + + + + + + + + + + +
    First HeaderSecond Header
    Content CellContent Cell
    Content CellContent Cell
    + + + + + + + + + + + + + + + + + +
    First HeaderSecond Header
    Content CellContent Cell
    Content CellContent Cell
    + """ + ), + extensions=['tables'] + ) + + def test_code_block_table(self): + self.assertMarkdownRenders( + self.dedent( + """ + Four spaces is a code block: + + First Header | Second Header + ------------ | ------------- + Content Cell | Content Cell + Content Cell | Content Cell + + | First Header | Second Header | + | ------------ | ------------- | + """), + self.dedent( + """ +

    Four spaces is a code block:

    +
    First Header | Second Header
    +                ------------ | -------------
    +                Content Cell | Content Cell
    +                Content Cell | Content Cell
    +                
    + + + + + + + + + + + + + +
    First HeaderSecond Header
    + """ + ), + extensions=['tables'] + ) + + def test_inline_code_blocks(self): + self.assertMarkdownRenders( + self.dedent( + """ + More inline code block tests + + Column 1 | Column 2 | Column 3 + ---------|----------|--------- + word 1 | word 2 | word 3 + word 1 | `word 2` | word 3 + word 1 | \\`word 2 | word 3 + word 1 | `word 2 | word 3 + word 1 | `word |2` | word 3 + words |`` some | code `` | more words + words |``` some | code ``` | more words + words |```` some | code ```` | more words + words |`` some ` | ` code `` | more words + words |``` some ` | ` code ``` | more words + words |```` some ` | ` code ```` | more words + """), + self.dedent( + """ +

    More inline code block tests

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Column 1Column 2Column 3
    word 1word 2word 3
    word 1word 2word 3
    word 1`word 2word 3
    word 1`word 2word 3
    word 1word |2word 3
    wordssome | codemore words
    wordssome | codemore words
    wordssome | codemore words
    wordssome ` | ` codemore words
    wordssome ` | ` codemore words
    wordssome ` | ` codemore words
    + """ + ), + extensions=['tables'] + ) + + def test_issue_440(self): + self.assertMarkdownRenders( + self.dedent( + """ + A test for issue #440: + + foo | bar + --- | --- + foo | (`bar`) and `baz`. + """), + self.dedent( + """ +

    A test for issue #440:

    + + + + + + + + + + + + + +
    foobar
    foo(bar) and baz.
    + """ + ), + extensions=['tables'] + ) + + def test_lists_not_tables(self): + self.assertMarkdownRenders( + self.dedent( + """ + Lists are not tables + + - this | should | not + - be | a | table + """), + self.dedent( + """ +

    Lists are not tables

    +
      +
    • this | should | not
    • +
    • be | a | table
    • +
    + """ + ), + extensions=['tables'] + ) + + def test_issue_449(self): + self.assertMarkdownRenders( + self.dedent( + r""" + Add tests for issue #449 + + Odd backticks | Even backticks + ------------ | ------------- + ``[!\"\#$%&'()*+,\-./:;<=>?@\[\\\]^_`{|}~]`` | ``[!\"\#$%&'()*+,\-./:;<=>?@\[\\\]^`_`{|}~]`` + + Escapes | More Escapes + ------- | ------ + `` `\`` | `\` + + Only the first backtick can be escaped + + Escaped | Bacticks + ------- | ------ + \`` \` | \`\` + + Test escaped pipes + + Column 1 | Column 2 + -------- | -------- + `|` \| | Pipes are okay in code and escaped. \| + + | Column 1 | Column 2 | + | -------- | -------- | + | row1 | row1 \| + | row2 | row2 | + + Test header escapes + + | `` `\`` \| | `\` \| + | ---------- | ---- | + | row1 | row1 | + | row2 | row2 | + + Escaped pipes in format row should not be a table + + | Column1 | Column2 | + | ------- \|| ------- | + | row1 | row1 | + | row2 | row2 | + + Test escaped code in Table + + Should not be code | Should be code + ------------------ | -------------- + \`Not code\` | \\`code` + \\\`Not code\\\` | \\\\`code` + """), + self.dedent( + """ +

    Add tests for issue #449

    + + + + + + + + + + + + + +
    Odd backticksEven backticks
    [!\\"\\#$%&'()*+,\\-./:;<=>?@\\[\\\\\\]^_`{|}~][!\\"\\#$%&'()*+,\\-./:;<=>?@\\[\\\\\\]^`_`{|}~]
    + + + + + + + + + + + + + +
    EscapesMore Escapes
    `\\\\
    +

    Only the first backtick can be escaped

    + + + + + + + + + + + + + +
    EscapedBacticks
    `\\``
    +

    Test escaped pipes

    + + + + + + + + + + + + + +
    Column 1Column 2
    | |Pipes are okay in code and escaped. |
    + + + + + + + + + + + + + + + + + +
    Column 1Column 2
    row1row1 |
    row2row2
    +

    Test header escapes

    + + + + + + + + + + + + + + + + + +
    `\\ |\\ |
    row1row1
    row2row2
    +

    Escaped pipes in format row should not be a table

    +

    | Column1 | Column2 | + | ------- || ------- | + | row1 | row1 | + | row2 | row2 |

    +

    Test escaped code in Table

    + + + + + + + + + + + + + + + + + +
    Should not be codeShould be code
    `Not code`\\code
    \\`Not code\\`\\\\code
    + """ + ), + extensions=['tables'] + ) + + def test_single_column_tables(self): + self.assertMarkdownRenders( + self.dedent( + """ + Single column tables + + | Is a Table | + | ---------- | + + | Is a Table + | ---------- + + Is a Table | + ---------- | + + | Is a Table | + | ---------- | + | row | + + | Is a Table + | ---------- + | row + + Is a Table | + ---------- | + row | + + | Is not a Table + -------------- + | row + + Is not a Table | + -------------- + row | + + | Is not a Table + | -------------- + row + + Is not a Table | + -------------- | + row + """), + self.dedent( + """ +

    Single column tables

    + + + + + + + + + + + +
    Is a Table
    + + + + + + + + + + + +
    Is a Table
    + + + + + + + + + + + +
    Is a Table
    + + + + + + + + + + + +
    Is a Table
    row
    + + + + + + + + + + + +
    Is a Table
    row
    + + + + + + + + + + + +
    Is a Table
    row
    +

    | Is not a Table

    +

    | row

    +

    Is not a Table |

    +

    row |

    +

    | Is not a Table + | -------------- + row

    +

    Is not a Table | + -------------- | + row

    + """ + ), + extensions=['tables'] + ) + + def test_align_columns_legacy(self): + self.assertMarkdownRenders( + self.dedent( + """ + | Item | Value | + | :-------- | -----:| + | Computer | $1600 | + | Phone | $12 | + | Pipe | $1 | + """ + ), + self.dedent( + """ + + + + + + + + + + + + + + + + + + + + + +
    ItemValue
    Computer$1600
    Phone$12
    Pipe$1
    + """ + ), + extensions=[TableExtension(use_align_attribute=True)] + ) + + def test_align_three_legacy(self): + self.assertMarkdownRenders( + self.dedent( + """ + |foo|bar|baz| + |:--|:-:|--:| + | | Q | | + |W | | W| + """ + ), + self.dedent( + """ + + + + + + + + + + + + + + + + + + + + +
    foobarbaz
    Q
    WW
    + """ + ), + extensions=[TableExtension(use_align_attribute=True)] + ) diff --git a/tests/test_syntax/extensions/test_toc.py b/tests/test_syntax/extensions/test_toc.py new file mode 100644 index 0000000..d879f6e --- /dev/null +++ b/tests/test_syntax/extensions/test_toc.py @@ -0,0 +1,614 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2019 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + +from markdown.test_tools import TestCase +from markdown.extensions.toc import TocExtension +from markdown.extensions.nl2br import Nl2BrExtension + + +class TestTOC(TestCase): + maxDiff = None + + # TODO: Move the rest of the TOC tests here. + + def testAnchorLink(self): + self.assertMarkdownRenders( + self.dedent( + ''' + # Header 1 + + ## Header *2* + ''' + ), + self.dedent( + ''' +

    Header 1

    +

    Header 2

    + ''' + ), + extensions=[TocExtension(anchorlink=True)] + ) + + def testAnchorLinkWithSingleInlineCode(self): + self.assertMarkdownRenders( + '# This is `code`.', + '

    ' # noqa + '' # noqa + 'This is code.' # noqa + '' # noqa + '

    ', # noqa + extensions=[TocExtension(anchorlink=True)] + ) + + def testAnchorLinkWithDoubleInlineCode(self): + self.assertMarkdownRenders( + '# This is `code` and `this` too.', + '

    ' # noqa + '' # noqa + 'This is code and this too.' # noqa + '' # noqa + '

    ', # noqa + extensions=[TocExtension(anchorlink=True)] + ) + + def testPermalink(self): + self.assertMarkdownRenders( + '# Header', + '

    ' # noqa + 'Header' # noqa + '' # noqa + '

    ', # noqa + extensions=[TocExtension(permalink=True)] + ) + + def testPermalinkWithSingleInlineCode(self): + self.assertMarkdownRenders( + '# This is `code`.', + '

    ' # noqa + 'This is code.' # noqa + '' # noqa + '

    ', # noqa + extensions=[TocExtension(permalink=True)] + ) + + def testPermalinkWithDoubleInlineCode(self): + self.assertMarkdownRenders( + '# This is `code` and `this` too.', + '

    ' # noqa + 'This is code and this too.' # noqa + '' # noqa + '

    ', # noqa + extensions=[TocExtension(permalink=True)] + ) + + def testMinMaxLevel(self): + self.assertMarkdownRenders( + self.dedent( + ''' + # Header 1 not in TOC + + ## Header 2 not in TOC + + ### Header 3 + + #### Header 4 + + ##### Header 5 not in TOC + ''' + ), + self.dedent( + ''' +

    Header 1 not in TOC

    +

    Header 2 not in TOC

    +

    Header 3

    +

    Header 4

    +
    Header 5 not in TOC
    + ''' + ), + expected_attrs={ + 'toc': ( + '
    \n' + '
      \n' # noqa + '
    • Header 3' # noqa + '\n' # noqa + '
    • \n' # noqa + '
    \n' # noqa + '
    \n' # noqa + ), + 'toc_tokens': [ + { + 'level': 3, + 'id': 'header-3', + 'name': 'Header 3', + 'children': [ + { + 'level': 4, + 'id': 'header-4', + 'name': 'Header 4', + 'children': [] + } + ] + } + ] + }, + extensions=[TocExtension(toc_depth='3-4')] + ) + + def testMaxLevel(self): + self.assertMarkdownRenders( + self.dedent( + ''' + # Header 1 + + ## Header 2 + + ### Header 3 not in TOC + ''' + ), + self.dedent( + ''' +

    Header 1

    +

    Header 2

    +

    Header 3 not in TOC

    + ''' + ), + expected_attrs={ + 'toc': ( + '
    \n' + '
      \n' # noqa + '
    • Header 1' # noqa + '\n' # noqa + '
    • \n' # noqa + '
    \n' # noqa + '
    \n' # noqa + ), + 'toc_tokens': [ + { + 'level': 1, + 'id': 'header-1', + 'name': 'Header 1', + 'children': [ + { + 'level': 2, + 'id': 'header-2', + 'name': 'Header 2', + 'children': [] + } + ] + } + ] + }, + extensions=[TocExtension(toc_depth=2)] + ) + + def testMinMaxLevelwithAnchorLink(self): + self.assertMarkdownRenders( + self.dedent( + ''' + # Header 1 not in TOC + + ## Header 2 not in TOC + + ### Header 3 + + #### Header 4 + + ##### Header 5 not in TOC + ''' + ), + '

    ' # noqa + 'Header 1 not in TOC

    \n' # noqa + '

    ' # noqa + 'Header 2 not in TOC

    \n' # noqa + '

    ' # noqa + 'Header 3

    \n' # noqa + '

    ' # noqa + 'Header 4

    \n' # noqa + '
    ' # noqa + 'Header 5 not in TOC
    ', # noqa + expected_attrs={ + 'toc': ( + '
    \n' + '
      \n' # noqa + '
    • Header 3' # noqa + '\n' # noqa + '
    • \n' # noqa + '
    \n' # noqa + '
    \n' # noqa + ), + 'toc_tokens': [ + { + 'level': 3, + 'id': 'header-3', + 'name': 'Header 3', + 'children': [ + { + 'level': 4, + 'id': 'header-4', + 'name': 'Header 4', + 'children': [] + } + ] + } + ] + }, + extensions=[TocExtension(toc_depth='3-4', anchorlink=True)] + ) + + def testMinMaxLevelwithPermalink(self): + self.assertMarkdownRenders( + self.dedent( + ''' + # Header 1 not in TOC + + ## Header 2 not in TOC + + ### Header 3 + + #### Header 4 + + ##### Header 5 not in TOC + ''' + ), + '

    Header 1 not in TOC' # noqa + '

    \n' # noqa + '

    Header 2 not in TOC' # noqa + '

    \n' # noqa + '

    Header 3' # noqa + '

    \n' # noqa + '

    Header 4' # noqa + '

    \n' # noqa + '
    Header 5 not in TOC' # noqa + '
    ', # noqa + expected_attrs={ + 'toc': ( + '
    \n' + '
      \n' # noqa + '
    • Header 3' # noqa + '\n' # noqa + '
    • \n' # noqa + '
    \n' # noqa + '
    \n' # noqa + ), + 'toc_tokens': [ + { + 'level': 3, + 'id': 'header-3', + 'name': 'Header 3', + 'children': [ + { + 'level': 4, + 'id': 'header-4', + 'name': 'Header 4', + 'children': [] + } + ] + } + ] + }, + extensions=[TocExtension(toc_depth='3-4', permalink=True)] + ) + + def testMinMaxLevelwithBaseLevel(self): + self.assertMarkdownRenders( + self.dedent( + ''' + # First Header + + ## Second Level + + ### Third Level + + #### Forth Level + ''' + ), + self.dedent( + ''' +

    First Header

    +

    Second Level

    +
    Third Level
    +
    Forth Level
    + ''' + ), + expected_attrs={ + 'toc': ( + '
    \n' + '\n' # noqa + '
    \n' # noqa + ), + 'toc_tokens': [ + { + 'level': 4, + 'id': 'second-level', + 'name': 'Second Level', + 'children': [ + { + 'level': 5, + 'id': 'third-level', + 'name': 'Third Level', + 'children': [] + } + ] + } + ] + }, + extensions=[TocExtension(toc_depth='4-5', baselevel=3)] + ) + + def testMaxLevelwithBaseLevel(self): + self.assertMarkdownRenders( + self.dedent( + ''' + # Some Header + + ## Next Level + + ### Too High + ''' + ), + self.dedent( + ''' +

    Some Header

    +

    Next Level

    +

    Too High

    + ''' + ), + expected_attrs={ + 'toc': ( + '
    \n' + '\n' # noqa + '
    \n' # noqa + ), + 'toc_tokens': [ + { + 'level': 2, + 'id': 'some-header', + 'name': 'Some Header', + 'children': [ + { + 'level': 3, + 'id': 'next-level', + 'name': 'Next Level', + 'children': [] + } + ] + } + ] + }, + extensions=[TocExtension(toc_depth=3, baselevel=2)] + ) + + def test_escaped_code(self): + self.assertMarkdownRenders( + self.dedent( + ''' + [TOC] + + # `` + ''' + ), + self.dedent( + ''' +
    + +
    +

    <test>

    + ''' + ), + extensions=['toc'] + ) + + def test_escaped_char_in_id(self): + self.assertMarkdownRenders( + r'# escaped\_character', + '

    escaped_character

    ', + extensions=['toc'] + ) + + def testAnchorLinkWithCustomClass(self): + self.assertMarkdownRenders( + self.dedent( + ''' + # Header 1 + + ## Header *2* + ''' + ), + self.dedent( + ''' +

    Header 1

    +

    Header 2

    + ''' + ), + extensions=[TocExtension(anchorlink=True, anchorlink_class="custom")] + ) + + def testAnchorLinkWithCustomClasses(self): + self.assertMarkdownRenders( + self.dedent( + ''' + # Header 1 + + ## Header *2* + ''' + ), + self.dedent( + ''' +

    Header 1

    +

    Header 2

    + ''' + ), + extensions=[TocExtension(anchorlink=True, anchorlink_class="custom1 custom2")] + ) + + def testPermalinkWithEmptyText(self): + self.assertMarkdownRenders( + '# Header', + '

    ' # noqa + 'Header' # noqa + '' # noqa + '

    ', # noqa + extensions=[TocExtension(permalink="")] + ) + + def testPermalinkWithCustomClass(self): + self.assertMarkdownRenders( + '# Header', + '

    ' # noqa + 'Header' # noqa + '' # noqa + '

    ', # noqa + extensions=[TocExtension(permalink=True, permalink_class="custom")] + ) + + def testPermalinkWithCustomClasses(self): + self.assertMarkdownRenders( + '# Header', + '

    ' # noqa + 'Header' # noqa + '' # noqa + '

    ', # noqa + extensions=[TocExtension(permalink=True, permalink_class="custom1 custom2")] + ) + + def testPermalinkWithCustomTitle(self): + self.assertMarkdownRenders( + '# Header', + '

    ' # noqa + 'Header' # noqa + '' # noqa + '

    ', # noqa + extensions=[TocExtension(permalink=True, permalink_title="custom")] + ) + + def testPermalinkWithEmptyTitle(self): + self.assertMarkdownRenders( + '# Header', + '

    ' # noqa + 'Header' # noqa + '' # noqa + '

    ', # noqa + extensions=[TocExtension(permalink=True, permalink_title="")] + ) + + def testPermalinkWithUnicodeInID(self): + from markdown.extensions.toc import slugify_unicode + self.assertMarkdownRenders( + '# Unicode ヘッダー', + '

    ' # noqa + 'Unicode ヘッダー' # noqa + '' # noqa + '

    ', # noqa + extensions=[TocExtension(permalink=True, slugify=slugify_unicode)] + ) + + def testPermalinkWithUnicodeTitle(self): + from markdown.extensions.toc import slugify_unicode + self.assertMarkdownRenders( + '# Unicode ヘッダー', + '

    ' # noqa + 'Unicode ヘッダー' # noqa + '' # noqa + '

    ', # noqa + extensions=[TocExtension(permalink=True, permalink_title="パーマリンク", slugify=slugify_unicode)] + ) + + def testPermalinkWithExtendedLatinInID(self): + self.assertMarkdownRenders( + '# Théâtre', + '

    ' # noqa + 'Théâtre' # noqa + '' # noqa + '

    ', # noqa + extensions=[TocExtension(permalink=True)] + ) + + def testNl2brCompatibility(self): + self.assertMarkdownRenders( + '[TOC]\ntext', + '

    [TOC]
    \ntext

    ', + extensions=[TocExtension(), Nl2BrExtension()] + ) + + def testTOCWithCustomClass(self): + + self.assertMarkdownRenders( + self.dedent( + ''' + [TOC] + # Header + ''' + ), + self.dedent( + ''' +
    + +
    +

    Header

    + ''' + ), + extensions=[TocExtension(toc_class="custom")] + ) + + def testTOCWithCustomClasses(self): + self.assertMarkdownRenders( + self.dedent( + ''' + [TOC] + # Header + ''' + ), + self.dedent( + ''' +
    + +
    +

    Header

    + ''' + ), + extensions=[TocExtension(toc_class="custom1 custom2")] + ) diff --git a/tests/test_syntax/inline/__init__.py b/tests/test_syntax/inline/__init__.py new file mode 100644 index 0000000..564ba3b --- /dev/null +++ b/tests/test_syntax/inline/__init__.py @@ -0,0 +1,20 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" diff --git a/tests/test_syntax/inline/test_autolinks.py b/tests/test_syntax/inline/test_autolinks.py new file mode 100644 index 0000000..b6bd1cf --- /dev/null +++ b/tests/test_syntax/inline/test_autolinks.py @@ -0,0 +1,63 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2021 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + +from markdown.test_tools import TestCase + + +class TestAutomaticLinks(TestCase): + + def test_email_address(self): + self.assertMarkdownRenders( + 'asdfasdfadsfasd or you can say ', + '

    asdfasdfadsfasd yuri@freewisd' + 'om.org or you can say

    ' + ) + + def test_mailto_email_address(self): + self.assertMarkdownRenders( + 'instead ', + '

    instead ' + 'yuri@freewisdom' + '.org

    ' + ) + + def test_email_address_with_ampersand(self): + self.assertMarkdownRenders( + '', + '

    bob&' + 'sue@example.com

    ' + ) + + def test_invalid_email_address_local_part(self): + self.assertMarkdownRenders( + 'Missing local-part <@domain>', + '

    Missing local-part <@domain>

    ' + ) + + def test_invalid_email_address_domain(self): + self.assertMarkdownRenders( + 'Missing domain ', + '

    Missing domain <local-part@>

    ' + ) diff --git a/tests/test_syntax/inline/test_emphasis.py b/tests/test_syntax/inline/test_emphasis.py new file mode 100644 index 0000000..1e7fafa --- /dev/null +++ b/tests/test_syntax/inline/test_emphasis.py @@ -0,0 +1,130 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2019 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + +from markdown.test_tools import TestCase + + +class TestNotEmphasis(TestCase): + + def test_standalone_asterisk(self): + self.assertMarkdownRenders( + '*', + '

    *

    ' + ) + + def test_standalone_understore(self): + self.assertMarkdownRenders( + '_', + '

    _

    ' + ) + + def test_standalone_asterisk_in_text(self): + self.assertMarkdownRenders( + 'foo * bar', + '

    foo * bar

    ' + ) + + def test_standalone_understore_in_text(self): + self.assertMarkdownRenders( + 'foo _ bar', + '

    foo _ bar

    ' + ) + + def test_standalone_asterisks_in_text(self): + self.assertMarkdownRenders( + 'foo * bar * baz', + '

    foo * bar * baz

    ' + ) + + def test_standalone_understores_in_text(self): + self.assertMarkdownRenders( + 'foo _ bar _ baz', + '

    foo _ bar _ baz

    ' + ) + + def test_standalone_asterisks_with_newlines(self): + self.assertMarkdownRenders( + 'foo\n* bar *\nbaz', + '

    foo\n* bar *\nbaz

    ' + ) + + def test_standalone_understores_with_newlines(self): + self.assertMarkdownRenders( + 'foo\n_ bar _\nbaz', + '

    foo\n_ bar _\nbaz

    ' + ) + + def test_standalone_asterisks_at_end(self): + self.assertMarkdownRenders( + 'foo * bar *', + '

    foo * bar *

    ' + ) + + def test_standalone_understores_at_begin_end(self): + self.assertMarkdownRenders( + '_ bar _', + '

    _ bar _

    ' + ) + + def test_complex_emphasis_asterisk(self): + self.assertMarkdownRenders( + 'This is text **bold *italic bold*** with more text', + '

    This is text bold italic bold with more text

    ' + ) + + def test_complex_emphasis_asterisk_mid_word(self): + self.assertMarkdownRenders( + 'This is text **bold*italic bold*** with more text', + '

    This is text bolditalic bold with more text

    ' + ) + + def test_complex_emphasis_smart_underscore(self): + self.assertMarkdownRenders( + 'This is text __bold _italic bold___ with more text', + '

    This is text bold italic bold with more text

    ' + ) + + def test_complex_emphasis_smart_underscore_mid_word(self): + self.assertMarkdownRenders( + 'This is text __bold_italic bold___ with more text', + '

    This is text __bold_italic bold___ with more text

    ' + ) + + def test_nested_emphasis(self): + + self.assertMarkdownRenders( + 'This text is **bold *italic* *italic* bold**', + '

    This text is bold italic italic bold

    ' + ) + + def test_complex_multple_emphasis_type(self): + + self.assertMarkdownRenders( + 'traced ***along*** bla **blocked** if other ***or***', + '

    traced along bla blocked if other or

    ' # noqa: E501 + ) + + def test_complex_multple_emphasis_type_variant2(self): + + self.assertMarkdownRenders( + 'on the **1-4 row** of the AP Combat Table ***and*** receive', + '

    on the 1-4 row of the AP Combat Table and receive

    ' + ) diff --git a/tests/test_syntax/inline/test_entities.py b/tests/test_syntax/inline/test_entities.py new file mode 100644 index 0000000..34cc2e7 --- /dev/null +++ b/tests/test_syntax/inline/test_entities.py @@ -0,0 +1,43 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + +from markdown.test_tools import TestCase + + +class TestEntities(TestCase): + + def test_named_entities(self): + self.assertMarkdownRenders("&", "

    &

    ") + self.assertMarkdownRenders("²", "

    ²

    ") + self.assertMarkdownRenders("Á", "

    Á

    ") + + def test_decimal_entities(self): + self.assertMarkdownRenders("&", "

    &

    ") + self.assertMarkdownRenders("²", "

    ²

    ") + + def test_hexadecimal_entities(self): + self.assertMarkdownRenders("&", "

    &

    ") + self.assertMarkdownRenders("²", "

    ²

    ") + + def test_false_entities(self): + self.assertMarkdownRenders("¬ an entity;", "

    &not an entity;

    ") + self.assertMarkdownRenders("&#B2;", "

    &#B2;

    ") + self.assertMarkdownRenders("&#xnothex;", "

    &#xnothex;

    ") diff --git a/tests/test_syntax/inline/test_images.py b/tests/test_syntax/inline/test_images.py new file mode 100644 index 0000000..c9c7cb8 --- /dev/null +++ b/tests/test_syntax/inline/test_images.py @@ -0,0 +1,184 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + +from markdown.test_tools import TestCase + + +class TestAdvancedImages(TestCase): + + def test_nested_square_brackets(self): + self.assertMarkdownRenders( + """![Text[[[[[[[]]]]]]][]](http://link.com/image.png) more text""", + """

    Text[[[[[[[]]]]]]][] more text

    """ + ) + + def test_nested_round_brackets(self): + self.assertMarkdownRenders( + """![Text](http://link.com/(((((((()))))))()).png) more text""", + """

    Text more text

    """ + ) + + def test_uneven_brackets_with_titles1(self): + self.assertMarkdownRenders( + """![Text](http://link.com/(.png"title") more text""", + """

    Text more text

    """ + ) + + def test_uneven_brackets_with_titles2(self): + self.assertMarkdownRenders( + """![Text](http://link.com/('.png"title") more text""", + """

    Text more text

    """ + ) + + def test_uneven_brackets_with_titles3(self): + self.assertMarkdownRenders( + """![Text](http://link.com/(.png"title)") more text""", + """

    Text more text

    """ + ) + + def test_uneven_brackets_with_titles4(self): + self.assertMarkdownRenders( + """![Text](http://link.com/(.png "title") more text""", + """

    Text more text

    """ + ) + + def test_uneven_brackets_with_titles5(self): + self.assertMarkdownRenders( + """![Text](http://link.com/(.png "title)") more text""", + """

    Text more text

    """ + ) + + def test_mixed_title_quotes1(self): + self.assertMarkdownRenders( + """![Text](http://link.com/'.png"title") more text""", + """

    Text more text

    """ + ) + + def test_mixed_title_quotes2(self): + self.assertMarkdownRenders( + """![Text](http://link.com/".png'title') more text""", + """

    Text more text

    """ + ) + + def test_mixed_title_quotes3(self): + self.assertMarkdownRenders( + """![Text](http://link.com/with spaces.png'"and quotes" 'and title') more text""", + """

    Text""" + """ more text

    """ + ) + + def test_mixed_title_quotes4(self): + self.assertMarkdownRenders( + """![Text](http://link.com/with spaces'.png"and quotes" 'and title") more text""", + """

    Text""" + """ more text

    """ + ) + + def test_mixed_title_quotes5(self): + self.assertMarkdownRenders( + """![Text](http://link.com/with spaces .png'"and quotes" 'and title') more text""", + """

    Text more text

    """ + ) + + def test_mixed_title_quotes6(self): + self.assertMarkdownRenders( + """![Text](http://link.com/with spaces "and quotes".png 'and title') more text""", + """

    Text""" + """ more text

    """ + ) + + def test_single_quote(self): + self.assertMarkdownRenders( + """![test](link"notitle.png)""", + """

    test

    """ + ) + + def test_angle_with_mixed_title_quotes(self): + self.assertMarkdownRenders( + """![Text]( 'and title') more text""", + """

    Text""" + """ more text

    """ + ) + + def test_misc(self): + self.assertMarkdownRenders( + """![Poster](http://humane_man.jpg "The most humane man.")""", + """

    Poster

    """ + ) + + def test_misc_ref(self): + self.assertMarkdownRenders( + self.dedent( + """ + ![Poster][] + + [Poster]:http://humane_man.jpg "The most humane man." + """ + ), + self.dedent( + """ +

    Poster

    + """ + ) + ) + + def test_misc_blank(self): + self.assertMarkdownRenders( + """![Blank]()""", + """

    Blank

    """ + ) + + def test_misc_img_title(self): + self.assertMarkdownRenders( + """![Image](http://humane man.jpg "The most humane man.")""", + """

    Image

    """ + ) + + def test_misc_img(self): + self.assertMarkdownRenders( + """![Image](http://humane man.jpg)""", + """

    Image

    """ + ) + + def test_short_ref(self): + self.assertMarkdownRenders( + self.dedent( + """ + ![ref] + + [ref]: ./image.jpg + """ + ), + '

    ref

    ' + ) + + def test_short_ref_in_link(self): + self.assertMarkdownRenders( + self.dedent( + """ + [![img ref]](http://example.com/) + + [img ref]: ./image.jpg + """ + ), + '

    img ref

    ' + ) diff --git a/tests/test_syntax/inline/test_links.py b/tests/test_syntax/inline/test_links.py new file mode 100644 index 0000000..0458756 --- /dev/null +++ b/tests/test_syntax/inline/test_links.py @@ -0,0 +1,386 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + +from markdown.test_tools import TestCase + + +class TestInlineLinks(TestCase): + + def test_nested_square_brackets(self): + self.assertMarkdownRenders( + """[Text[[[[[[[]]]]]]][]](http://link.com) more text""", + """

    Text[[[[[[[]]]]]]][] more text

    """ + ) + + def test_nested_round_brackets(self): + self.assertMarkdownRenders( + """[Text](http://link.com/(((((((()))))))())) more text""", + """

    Text more text

    """ + ) + + def test_uneven_brackets_with_titles1(self): + self.assertMarkdownRenders( + """[Text](http://link.com/("title") more text""", + """

    Text more text

    """ + ) + + def test_uneven_brackets_with_titles2(self): + self.assertMarkdownRenders( + """[Text](http://link.com/('"title") more text""", + """

    Text more text

    """ + ) + + def test_uneven_brackets_with_titles3(self): + self.assertMarkdownRenders( + """[Text](http://link.com/("title)") more text""", + """

    Text more text

    """ + ) + + def test_uneven_brackets_with_titles4(self): + self.assertMarkdownRenders( + """[Text](http://link.com/( "title") more text""", + """

    Text more text

    """ + ) + + def test_uneven_brackets_with_titles5(self): + self.assertMarkdownRenders( + """[Text](http://link.com/( "title)") more text""", + """

    Text more text

    """ + ) + + def test_mixed_title_quotes1(self): + self.assertMarkdownRenders( + """[Text](http://link.com/'"title") more text""", + """

    Text more text

    """ + ) + + def test_mixed_title_quotes2(self): + self.assertMarkdownRenders( + """[Text](http://link.com/"'title') more text""", + """

    Text more text

    """ + ) + + def test_mixed_title_quotes3(self): + self.assertMarkdownRenders( + """[Text](http://link.com/with spaces'"and quotes" 'and title') more text""", + """

    """ + """Text more text

    """ + ) + + def test_mixed_title_quotes4(self): + self.assertMarkdownRenders( + """[Text](http://link.com/with spaces'"and quotes" 'and title") more text""", + """

    Text more text

    """ + ) + + def test_mixed_title_quotes5(self): + self.assertMarkdownRenders( + """[Text](http://link.com/with spaces '"and quotes" 'and title') more text""", + """

    """ + """Text more text

    """ + ) + + def test_mixed_title_quotes6(self): + self.assertMarkdownRenders( + """[Text](http://link.com/with spaces "and quotes" 'and title') more text""", + """

    """ + """Text more text

    """ + ) + + def test_single_quote(self): + self.assertMarkdownRenders( + """[test](link"notitle)""", + """

    test

    """ + ) + + def test_angle_with_mixed_title_quotes(self): + self.assertMarkdownRenders( + """[Text]( 'and title') more text""", + """

    """ + """Text more text

    """ + ) + + def test_amp_in_url(self): + """Test amp in URLs.""" + + self.assertMarkdownRenders( + '[link](http://www.freewisdom.org/this&that)', + '

    link

    ' + ) + self.assertMarkdownRenders( + '[title](http://example.com/?a=1&b=2)', + '

    title

    ' + ) + self.assertMarkdownRenders( + '[title](http://example.com/?a=1&b=2)', + '

    title

    ' + ) + + +class TestReferenceLinks(TestCase): + + def test_ref_link(self): + self.assertMarkdownRenders( + self.dedent( + """ + [Text] + + [Text]: http://example.com + """ + ), + """

    Text

    """ + ) + + def test_ref_link_angle_brackets(self): + self.assertMarkdownRenders( + self.dedent( + """ + [Text] + + [Text]: + """ + ), + """

    Text

    """ + ) + + def test_ref_link_no_space(self): + self.assertMarkdownRenders( + self.dedent( + """ + [Text] + + [Text]:http://example.com + """ + ), + """

    Text

    """ + ) + + def test_ref_link_angle_brackets_no_space(self): + self.assertMarkdownRenders( + self.dedent( + """ + [Text] + + [Text]: + """ + ), + """

    Text

    """ + ) + + def test_ref_link_angle_brackets_title(self): + self.assertMarkdownRenders( + self.dedent( + """ + [Text] + + [Text]: "title" + """ + ), + """

    Text

    """ + ) + + def test_ref_link_title(self): + self.assertMarkdownRenders( + self.dedent( + """ + [Text] + + [Text]: http://example.com "title" + """ + ), + """

    Text

    """ + ) + + def test_ref_link_angle_brackets_title_no_space(self): + # TODO: Maybe reevaluate this? + self.assertMarkdownRenders( + self.dedent( + """ + [Text] + + [Text]: "title" + """ + ), + """

    Text

    """ + ) + + def test_ref_link_title_no_space(self): + self.assertMarkdownRenders( + self.dedent( + """ + [Text] + + [Text]: http://example.com"title" + """ + ), + """

    Text

    """ + ) + + def test_ref_link_single_quoted_title(self): + self.assertMarkdownRenders( + self.dedent( + """ + [Text] + + [Text]: http://example.com 'title' + """ + ), + """

    Text

    """ + ) + + def test_ref_link_title_nested_quote(self): + self.assertMarkdownRenders( + self.dedent( + """ + [Text] + + [Text]: http://example.com "title'" + """ + ), + """

    Text

    """ + ) + + def test_ref_link_single_quoted_title_nested_quote(self): + self.assertMarkdownRenders( + self.dedent( + """ + [Text] + + [Text]: http://example.com 'title"' + """ + ), + """

    Text

    """ + ) + + def test_ref_link_override(self): + self.assertMarkdownRenders( + self.dedent( + """ + [Text] + + [Text]: http://example.com 'ignore' + [Text]: https://example.com 'override' + """ + ), + """

    Text

    """ + ) + + def test_ref_link_title_no_blank_lines(self): + self.assertMarkdownRenders( + self.dedent( + """ + [Text] + [Text]: http://example.com "title" + [Text] + """ + ), + self.dedent( + """ +

    Text

    +

    Text

    + """ + ) + ) + + def test_ref_link_multi_line(self): + self.assertMarkdownRenders( + self.dedent( + """ + [Text] + + [Text]: + http://example.com + "title" + """ + ), + """

    Text

    """ + ) + + def test_reference_newlines(self): + """Test reference id whitespace cleanup.""" + + self.assertMarkdownRenders( + self.dedent( + """ + Two things: + + - I would like to tell you about the [code of + conduct][] we are using in this project. + - Only one in fact. + + [code of conduct]: https://github.com/Python-Markdown/markdown/blob/master/CODE_OF_CONDUCT.md + """ + ), + '

    Two things:

    \n
      \n
    • I would like to tell you about the ' + 'code of\n' + ' conduct we are using in this project.
    • \n
    • Only one in fact.
    • \n
    ' + ) + + def test_reference_across_blocks(self): + """Test references across blocks.""" + + self.assertMarkdownRenders( + self.dedent( + """ + I would like to tell you about the [code of + + conduct][] we are using in this project. + + [code of conduct]: https://github.com/Python-Markdown/markdown/blob/master/CODE_OF_CONDUCT.md + """ + ), + '

    I would like to tell you about the [code of

    \n' + '

    conduct][] we are using in this project.

    ' + ) + + def test_ref_link_nested_left_bracket(self): + self.assertMarkdownRenders( + self.dedent( + """ + [Text[] + + [Text[]: http://example.com + """ + ), + self.dedent( + """ +

    [Text[]

    +

    [Text[]: http://example.com

    + """ + ) + ) + + def test_ref_link_nested_right_bracket(self): + self.assertMarkdownRenders( + self.dedent( + """ + [Text]] + + [Text]]: http://example.com + """ + ), + self.dedent( + """ +

    [Text]]

    +

    [Text]]: http://example.com

    + """ + ) + ) diff --git a/tests/test_syntax/inline/test_raw_html.py b/tests/test_syntax/inline/test_raw_html.py new file mode 100644 index 0000000..a9c4857 --- /dev/null +++ b/tests/test_syntax/inline/test_raw_html.py @@ -0,0 +1,30 @@ +""" +Python Markdown + +A Python implementation of John Gruber's Markdown. + +Documentation: https://python-markdown.github.io/ +GitHub: https://github.com/Python-Markdown/markdown/ +PyPI: https://pypi.org/project/Markdown/ + +Started by Manfred Stienstra (http://www.dwerg.net/). +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). +Currently maintained by Waylan Limberg (https://github.com/waylan), +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). + +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) +Copyright 2004 Manfred Stienstra (the original version) + +License: BSD (see LICENSE.md for details). +""" + +from markdown.test_tools import TestCase + + +class TestRawHtml(TestCase): + def test_inline_html_angle_brackets(self): + self.assertMarkdownRenders("e", "

    e<c

    ") + self.assertMarkdownRenders("e>c", "

    e>c

    ") + self.assertMarkdownRenders("e < c", "

    e < c

    ") + self.assertMarkdownRenders("e > c", "

    e > c

    ") diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..0c76754 --- /dev/null +++ b/tox.ini @@ -0,0 +1,43 @@ +[tox] +envlist = py{37, 38, 39, 310}, pypy{37, 38, 39}, pygments, flake8, checkspelling, pep517check, checklinks +isolated_build = True + +[testenv] +extras = testing +deps = pytidylib +commands = + coverage run --source=markdown -m unittest discover {toxinidir}/tests + coverage xml + coverage report --show-missing + +[testenv:pygments] +# Run tests with pygments installed (override deps only). +setenv = + PYGMENTS_VERSION = 2.7.1 +deps = + pytidylib + pygments=={env:PYGMENTS_VERSION} + +[testenv:flake8] +deps = flake8 +commands = flake8 {toxinidir}/markdown {toxinidir}/tests {toxinidir}/setup.py +skip_install = true + +[testenv:checkspelling] +deps = + mkdocs + mkdocs_nature +commands = {toxinidir}/checkspelling.sh + +[testenv:checklinks] +whitelist_externals = markdown-link-check +deps = +commands = {toxinidir}/checklinks.sh + +[testenv:pep517check] +deps = pep517 +commands = python -m pep517.check {toxinidir} +skip_install = true + +[flake8] +max-line-length = 119 -- cgit v1.2.3