Repository: evilstreak/markdown-js Branch: master Commit: 14344a8f0eb1 Files: 786 Total size: 466.7 KB Directory structure: gitextract_2zijr1dr/ ├── .gitignore ├── .travis.yml ├── Changes.md ├── Gruntfile.js ├── README.md ├── bin/ │ └── md2html.js ├── bower.json ├── inc/ │ ├── footer-node.js │ ├── footer-web.js │ ├── header.js │ └── tasks/ │ └── build_markdown.js ├── lib/ │ └── index.js ├── package.json ├── seed.yml ├── src/ │ ├── core.js │ ├── dialects/ │ │ ├── dialect_helpers.js │ │ ├── gruber.js │ │ └── maruku.js │ ├── markdown.js │ ├── markdown_helpers.js │ ├── parser.js │ └── render_tree.js └── test/ ├── features/ │ ├── blockquotes/ │ │ ├── contains_code.json │ │ ├── contains_code.text │ │ ├── lazy_wrapping.json │ │ ├── lazy_wrapping.text │ │ ├── leading_paras.json │ │ ├── leading_paras.text │ │ ├── nested.json │ │ ├── nested.text │ │ ├── simple.json │ │ ├── simple.text │ │ ├── spaceless.json │ │ ├── spaceless.text │ │ ├── spaces_before.json │ │ ├── spaces_before.text │ │ ├── threequotes.json │ │ └── threequotes.text │ ├── code/ │ │ ├── blank_lines.json │ │ ├── blank_lines.text │ │ ├── block.json │ │ ├── block.text │ │ ├── embedded_backtick.json │ │ ├── embedded_backtick.text │ │ ├── horizontal_rules.json │ │ ├── horizontal_rules.text │ │ ├── in_lists.json │ │ ├── in_lists.text │ │ ├── inline.json │ │ ├── inline.text │ │ ├── inline_multiline.json │ │ ├── inline_multiline.text │ │ ├── trailing_para.json │ │ ├── trailing_para.text │ │ ├── with_greater_than.json │ │ └── with_greater_than.text │ ├── definition_lists/ │ │ ├── inline.json │ │ ├── inline.text │ │ ├── long.json │ │ ├── long.text │ │ ├── multiple_definitions.json │ │ ├── multiple_definitions.text │ │ ├── multiple_terms.json │ │ ├── multiple_terms.text │ │ ├── tight.json │ │ └── tight.text │ ├── emphasis/ │ │ ├── multiple_lines.json │ │ ├── multiple_lines.text │ │ ├── nested.json │ │ ├── nested.text │ │ ├── simple.json │ │ └── simple.text │ ├── headers/ │ │ ├── atx.json │ │ ├── atx.text │ │ ├── atx_closing_hashes.json │ │ ├── atx_closing_hashes.text │ │ ├── inline.json │ │ ├── inline.text │ │ ├── setext.json │ │ ├── setext.text │ │ ├── trailing_paras.json │ │ └── trailing_paras.text │ ├── horizontal_rules/ │ │ ├── abutting_blocks.json │ │ ├── abutting_blocks.text │ │ ├── dashes.json │ │ ├── dashes.text │ │ ├── front_matter.json │ │ ├── front_matter.text │ │ ├── leading_spaces.json │ │ ├── leading_spaces.text │ │ ├── long.json │ │ ├── long.text │ │ ├── long_loose.json │ │ ├── long_loose.text │ │ ├── loose_dashes.json │ │ ├── loose_dashes.text │ │ ├── loose_stars.json │ │ ├── loose_stars.text │ │ ├── loose_underscores.json │ │ ├── loose_underscores.text │ │ ├── stars.json │ │ ├── stars.text │ │ ├── underscores.json │ │ └── underscores.text │ ├── images/ │ │ ├── basic.json │ │ ├── basic.text │ │ ├── crotcheted_url.json │ │ ├── crotcheted_url.text │ │ ├── crotcheted_url_with_title.json │ │ ├── crotcheted_url_with_title.text │ │ ├── empty.json │ │ ├── empty.text │ │ ├── incomplete_image.json │ │ ├── incomplete_image.text │ │ ├── inside_link.json │ │ ├── inside_link.text │ │ ├── ref.json │ │ ├── ref.text │ │ ├── spaces_in_href.json │ │ ├── spaces_in_href.text │ │ ├── spaces_round_title.json │ │ ├── spaces_round_title.text │ │ ├── title.json │ │ └── title.text │ ├── linebreaks/ │ │ ├── simple.json │ │ └── simple.text │ ├── links/ │ │ ├── apostrophe.json │ │ ├── apostrophe.text │ │ ├── autolink_email.json │ │ ├── autolink_email.text │ │ ├── autolink_in_code.json │ │ ├── autolink_in_code.text │ │ ├── autolink_url.json │ │ ├── autolink_url.text │ │ ├── broken_brackets.json │ │ ├── broken_brackets.text │ │ ├── broken_link.json │ │ ├── broken_link.text │ │ ├── case_insensitive.json │ │ ├── case_insensitive.text │ │ ├── escaped_broken_link.json │ │ ├── escaped_broken_link.text │ │ ├── implicit.json │ │ ├── implicit.text │ │ ├── in_blockquotes.json │ │ ├── in_blockquotes.text │ │ ├── in_brackets.json │ │ ├── in_brackets.text │ │ ├── inline.json │ │ ├── inline.text │ │ ├── inline_with_newline.json │ │ ├── inline_with_newline.text │ │ ├── inline_with_title.json │ │ ├── inline_with_title.text │ │ ├── missing_references.json │ │ ├── missing_references.text │ │ ├── no_closing.json │ │ ├── no_closing.text │ │ ├── parens_escaped_inline.json │ │ ├── parens_escaped_inline.text │ │ ├── parens_inline.json │ │ ├── parens_inline.text │ │ ├── parens_reference.json │ │ ├── parens_reference.text │ │ ├── ref_reuse.json │ │ ├── ref_reuse.text │ │ ├── ref_with_image_ref.json │ │ ├── ref_with_image_ref.text │ │ ├── reference.json │ │ ├── reference.text │ │ ├── reference_missing.json │ │ ├── reference_missing.text │ │ ├── reference_with_newline.json │ │ ├── reference_with_newline.text │ │ ├── reference_with_newline_and_space.json │ │ ├── reference_with_newline_and_space.text │ │ ├── reference_with_quote.json │ │ ├── reference_with_quote.text │ │ ├── reference_with_space.json │ │ ├── reference_with_space.text │ │ ├── spaces_in_url.json │ │ └── spaces_in_url.text │ ├── lists/ │ │ ├── bullet_types.json │ │ ├── bullet_types.text │ │ ├── hr_abutting.json │ │ ├── hr_abutting.text │ │ ├── hr_inside.json │ │ ├── hr_inside.text │ │ ├── lazy_wrapping.json │ │ ├── lazy_wrapping.text │ │ ├── leading_whitespace.json │ │ ├── leading_whitespace.text │ │ ├── loose.json │ │ ├── loose.text │ │ ├── loose_with_inline.json │ │ ├── loose_with_inline.text │ │ ├── multiline_inline.json │ │ ├── multiline_inline.text │ │ ├── nested.json │ │ ├── nested.text │ │ ├── nested_para.json │ │ ├── nested_para.text │ │ ├── numeric.json │ │ ├── numeric.text │ │ ├── quote_inside.json │ │ ├── quote_inside.text │ │ ├── references.json │ │ ├── references.text │ │ ├── tight.json │ │ └── tight.text │ ├── meta/ │ │ ├── attribute.json │ │ ├── attribute.text │ │ ├── class.json │ │ ├── class.text │ │ ├── code.json │ │ ├── code.text │ │ ├── document.json │ │ ├── document.text │ │ ├── id.json │ │ ├── id.text │ │ ├── inline.json │ │ ├── inline.text │ │ ├── inner_whitespace.json │ │ ├── inner_whitespace.text │ │ ├── leading_whitespace.json │ │ ├── leading_whitespace.text │ │ ├── list.json │ │ ├── list.text │ │ ├── list.todo │ │ ├── multiple_classes.json │ │ ├── multiple_classes.text │ │ ├── quoted.json │ │ └── quoted.text │ └── tables/ │ ├── align.json │ ├── align.text │ ├── compact.json │ ├── compact.text │ ├── inline_formatting.json │ ├── inline_formatting.text │ ├── pipe_escape.json │ ├── pipe_escape.text │ ├── simple_leading.json │ ├── simple_leading.text │ ├── simple_no_leading.json │ ├── simple_no_leading.text │ ├── spaces_tolerance.json │ └── spaces_tolerance.text ├── features.t.js ├── fixtures/ │ ├── Markdown-from-MDTest1.1.mdtest/ │ │ ├── Amps_and_angle_encoding.json │ │ ├── Amps_and_angle_encoding.text │ │ ├── Amps_and_angle_encoding.xhtml │ │ ├── Auto_links.json │ │ ├── Auto_links.text │ │ ├── Auto_links.xhtml │ │ ├── Backslash_escapes.json │ │ ├── Backslash_escapes.text │ │ ├── Backslash_escapes.xhtml │ │ ├── Blockquotes_with_code_blocks.json │ │ ├── Blockquotes_with_code_blocks.text │ │ ├── Blockquotes_with_code_blocks.xhtml │ │ ├── Code_Blocks.json │ │ ├── Code_Blocks.text │ │ ├── Code_Blocks.xhtml │ │ ├── Code_Spans.json │ │ ├── Code_Spans.text │ │ ├── Code_Spans.xhtml │ │ ├── Hard-wrapped_paragraphs_with_list-like_lines.json │ │ ├── Hard-wrapped_paragraphs_with_list-like_lines.text │ │ ├── Hard-wrapped_paragraphs_with_list-like_lines.xhtml │ │ ├── Horizontal_rules.json │ │ ├── Horizontal_rules.text │ │ ├── Horizontal_rules.xhtml │ │ ├── Images.json │ │ ├── Images.text │ │ ├── Images.xhtml │ │ ├── Inline_HTML_(Advanced).json │ │ ├── Inline_HTML_(Advanced).text │ │ ├── Inline_HTML_(Advanced).xhtml │ │ ├── Inline_HTML_(Simple).html │ │ ├── Inline_HTML_(Simple).json │ │ ├── Inline_HTML_(Simple).text │ │ ├── Inline_HTML_comments.html │ │ ├── Inline_HTML_comments.json │ │ ├── Inline_HTML_comments.text │ │ ├── Links_inline_style.json │ │ ├── Links_inline_style.text │ │ ├── Links_inline_style.xhtml │ │ ├── Links_reference_style.json │ │ ├── Links_reference_style.text │ │ ├── Links_reference_style.xhtml │ │ ├── Links_shortcut_references.json │ │ ├── Links_shortcut_references.text │ │ ├── Links_shortcut_references.xhtml │ │ ├── Literal_quotes_in_titles.json │ │ ├── Literal_quotes_in_titles.text │ │ ├── Literal_quotes_in_titles.xhtml │ │ ├── Markdown_Documentation_-_Basics.json │ │ ├── Markdown_Documentation_-_Basics.text │ │ ├── Markdown_Documentation_-_Basics.xhtml │ │ ├── Markdown_Documentation_-_Syntax.json │ │ ├── Markdown_Documentation_-_Syntax.text │ │ ├── Markdown_Documentation_-_Syntax.xhtml │ │ ├── Nested_blockquotes.json │ │ ├── Nested_blockquotes.text │ │ ├── Nested_blockquotes.xhtml │ │ ├── Ordered_and_unordered_lists.json │ │ ├── Ordered_and_unordered_lists.text │ │ ├── Ordered_and_unordered_lists.xhtml │ │ ├── Strong_and_em_together.json │ │ ├── Strong_and_em_together.text │ │ ├── Strong_and_em_together.xhtml │ │ ├── Tabs.json │ │ ├── Tabs.text │ │ ├── Tabs.xhtml │ │ ├── Tidyness.json │ │ ├── Tidyness.text │ │ └── Tidyness.xhtml │ ├── PHP_Markdown-from-MDTest1.1.mdtest/ │ │ ├── Backslash_escapes.json │ │ ├── Backslash_escapes.text │ │ ├── Backslash_escapes.xhtml │ │ ├── Code_Spans.json │ │ ├── Code_Spans.text │ │ ├── Code_Spans.xhtml │ │ ├── Code_block_in_a_list_item.json │ │ ├── Code_block_in_a_list_item.text │ │ ├── Code_block_in_a_list_item.xhtml │ │ ├── Email_auto_links.json │ │ ├── Email_auto_links.text │ │ ├── Email_auto_links.xhtml │ │ ├── Emphasis.json │ │ ├── Emphasis.text │ │ ├── Emphasis.xhtml │ │ ├── Headers.json │ │ ├── Headers.text │ │ ├── Headers.xhtml │ │ ├── Horizontal_Rules.json │ │ ├── Horizontal_Rules.text │ │ ├── Horizontal_Rules.xhtml │ │ ├── Inline_HTML_(Simple).html │ │ ├── Inline_HTML_(Simple).json │ │ ├── Inline_HTML_(Simple).text │ │ ├── Inline_HTML_(Span).json │ │ ├── Inline_HTML_(Span).text │ │ ├── Inline_HTML_(Span).xhtml │ │ ├── Inline_HTML_comments.html │ │ ├── Inline_HTML_comments.json │ │ ├── Inline_HTML_comments.text │ │ ├── Ins_and_del.json │ │ ├── Ins_and_del.text │ │ ├── Ins_and_del.xhtml │ │ ├── Links_inline_style.json │ │ ├── Links_inline_style.text │ │ ├── Links_inline_style.xhtml │ │ ├── MD5_Hashes.json │ │ ├── MD5_Hashes.text │ │ ├── MD5_Hashes.xhtml │ │ ├── Nesting.json │ │ ├── Nesting.text │ │ ├── Nesting.xhtml │ │ ├── PHP-Specific_Bugs.json │ │ ├── PHP-Specific_Bugs.text │ │ ├── PHP-Specific_Bugs.xhtml │ │ ├── Parens_in_URL.json │ │ ├── Parens_in_URL.text │ │ ├── Parens_in_URL.xhtml │ │ ├── Tight_blocks.json │ │ ├── Tight_blocks.text │ │ └── Tight_blocks.xhtml │ ├── README │ ├── Text-Markdown.mdtest/ │ │ ├── CoreDumps5.8.json │ │ ├── CoreDumps5.8.text │ │ ├── CoreDumps5.8.xhtml │ │ ├── Emphasis.json │ │ ├── Emphasis.text │ │ ├── Emphasis.xhtml │ │ ├── HTML-Comment-encoding.json │ │ ├── HTML-Comment-encoding.text │ │ ├── HTML-Comment-encoding.xhtml │ │ ├── HTML5-attributes.html │ │ ├── HTML5-attributes.json │ │ ├── HTML5-attributes.text │ │ ├── Links_brackets.json │ │ ├── Links_brackets.text │ │ ├── Links_brackets.xhtml │ │ ├── Links_multiline_bugs_1.html │ │ ├── Links_multiline_bugs_1.json │ │ ├── Links_multiline_bugs_1.text │ │ ├── Links_multiline_bugs_2.html │ │ ├── Links_multiline_bugs_2.json │ │ ├── Links_multiline_bugs_2.text │ │ ├── Links_reference_style.json │ │ ├── Links_reference_style.text │ │ ├── Links_reference_style.xhtml │ │ ├── Lists-multilevel-md5-edgecase.json │ │ ├── Lists-multilevel-md5-edgecase.text │ │ ├── Lists-multilevel-md5-edgecase.xhtml │ │ ├── PHP-ASP_tags.json │ │ ├── PHP-ASP_tags.text │ │ ├── PHP-ASP_tags.xhtml │ │ ├── Unicode.json │ │ ├── Unicode.text │ │ └── Unicode.xhtml │ ├── docs-maruku-unittest/ │ │ ├── abbreviations.html │ │ ├── abbreviations.json │ │ ├── abbreviations.text │ │ ├── alt.html │ │ ├── alt.json │ │ ├── alt.text │ │ ├── blank.html │ │ ├── blank.json │ │ ├── blank.text │ │ ├── blanks_in_code.html │ │ ├── blanks_in_code.json │ │ ├── blanks_in_code.text │ │ ├── bug_def.html │ │ ├── bug_def.json │ │ ├── bug_def.text │ │ ├── bug_table.html │ │ ├── bug_table.json │ │ ├── bug_table.text │ │ ├── code.html │ │ ├── code.json │ │ ├── code.text │ │ ├── code2.html │ │ ├── code2.json │ │ ├── code2.text │ │ ├── code3.html │ │ ├── code3.json │ │ ├── code3.text │ │ ├── convert.pl │ │ ├── data_loss.html │ │ ├── data_loss.json │ │ ├── data_loss.text │ │ ├── easy.html │ │ ├── easy.json │ │ ├── easy.text │ │ ├── email.html │ │ ├── email.json │ │ ├── email.text │ │ ├── entities.html │ │ ├── entities.json │ │ ├── entities.text │ │ ├── escaping.html │ │ ├── escaping.json │ │ ├── escaping.text │ │ ├── extra_dl.html │ │ ├── extra_dl.json │ │ ├── extra_dl.text │ │ ├── extra_header_id.html │ │ ├── extra_header_id.json │ │ ├── extra_header_id.text │ │ ├── extra_table1.html │ │ ├── extra_table1.json │ │ ├── extra_table1.text │ │ ├── footnotes.html │ │ ├── footnotes.json │ │ ├── footnotes.text │ │ ├── headers.html │ │ ├── headers.json │ │ ├── headers.text │ │ ├── hex_entities.html │ │ ├── hex_entities.json │ │ ├── hex_entities.text │ │ ├── hrule.html │ │ ├── hrule.json │ │ ├── hrule.text │ │ ├── html2.html │ │ ├── html2.json │ │ ├── html2.text │ │ ├── html3.html │ │ ├── html3.json │ │ ├── html3.text │ │ ├── html4.html │ │ ├── html4.json │ │ ├── html4.text │ │ ├── html5.html │ │ ├── html5.json │ │ ├── html5.text │ │ ├── ie.html │ │ ├── ie.json │ │ ├── ie.text │ │ ├── images.html │ │ ├── images.json │ │ ├── images.text │ │ ├── images2.html │ │ ├── images2.json │ │ ├── images2.text │ │ ├── inline_html.html │ │ ├── inline_html.json │ │ ├── inline_html.text │ │ ├── inline_html2.html │ │ ├── inline_html2.json │ │ ├── inline_html2.text │ │ ├── links.html │ │ ├── links.json │ │ ├── links.text │ │ ├── list1.html │ │ ├── list1.json │ │ ├── list1.text │ │ ├── list2.html │ │ ├── list2.json │ │ ├── list2.text │ │ ├── list3.html │ │ ├── list3.json │ │ ├── list3.text │ │ ├── list4.html │ │ ├── list4.json │ │ ├── list4.text │ │ ├── lists.html │ │ ├── lists.json │ │ ├── lists.text │ │ ├── lists11.html │ │ ├── lists11.json │ │ ├── lists11.text │ │ ├── lists6.html │ │ ├── lists6.json │ │ ├── lists6.text │ │ ├── lists7.html │ │ ├── lists7.json │ │ ├── lists7.text │ │ ├── lists7b.html │ │ ├── lists7b.json │ │ ├── lists7b.text │ │ ├── lists8.html │ │ ├── lists8.json │ │ ├── lists8.text │ │ ├── lists9.html │ │ ├── lists9.json │ │ ├── lists9.text │ │ ├── lists_after_paragraph.html │ │ ├── lists_after_paragraph.json │ │ ├── lists_after_paragraph.text │ │ ├── lists_ol.html │ │ ├── lists_ol.json │ │ ├── lists_ol.text │ │ ├── loss.html │ │ ├── loss.json │ │ ├── loss.text │ │ ├── misc_sw.html │ │ ├── misc_sw.json │ │ ├── misc_sw.text │ │ ├── olist.html │ │ ├── olist.json │ │ ├── olist.text │ │ ├── one.html │ │ ├── one.json │ │ ├── one.text │ │ ├── paragraph.html │ │ ├── paragraph.json │ │ ├── paragraph.text │ │ ├── paragraphs.html │ │ ├── paragraphs.json │ │ ├── paragraphs.text │ │ ├── smartypants.html │ │ ├── smartypants.json │ │ ├── smartypants.text │ │ ├── syntax_hl.html │ │ ├── syntax_hl.json │ │ ├── syntax_hl.text │ │ ├── table_attributes.html │ │ ├── table_attributes.json │ │ ├── table_attributes.text │ │ ├── test.html │ │ ├── test.json │ │ ├── test.text │ │ ├── wrapping.html │ │ ├── wrapping.json │ │ ├── wrapping.text │ │ ├── xml.html │ │ ├── xml.json │ │ ├── xml.text │ │ ├── xml2.html │ │ ├── xml2.json │ │ ├── xml2.text │ │ ├── xml3.html │ │ ├── xml3.json │ │ ├── xml3.text │ │ ├── xml_instruction.html │ │ ├── xml_instruction.json │ │ └── xml_instruction.text │ ├── docs-php-markdown/ │ │ ├── Backslash_escapes.html │ │ ├── Backslash_escapes.json │ │ ├── Backslash_escapes.text │ │ ├── Code_Spans.html │ │ ├── Code_Spans.json │ │ ├── Code_Spans.text │ │ ├── Code_block_in_a_list_item.html │ │ ├── Code_block_in_a_list_item.json │ │ ├── Code_block_in_a_list_item.text │ │ ├── Headers.html │ │ ├── Headers.json │ │ ├── Headers.text │ │ ├── Images_(Untitled).html │ │ ├── Images_(Untitled).json │ │ ├── Images_(Untitled).text │ │ ├── Inline_HTML_(Simple).html │ │ ├── Inline_HTML_(Simple).json │ │ ├── Inline_HTML_(Simple).text │ │ ├── Inline_HTML_comments.html │ │ ├── Inline_HTML_comments.json │ │ ├── Inline_HTML_comments.text │ │ ├── PHP-Specific_Bugs.html │ │ ├── PHP-Specific_Bugs.json │ │ ├── PHP-Specific_Bugs.text │ │ ├── Tight_blocks.html │ │ ├── Tight_blocks.json │ │ └── Tight_blocks.text │ ├── docs-php-markdown-extra/ │ │ ├── Abbr.html │ │ ├── Abbr.json │ │ ├── Abbr.text │ │ ├── Definition_Lists.html │ │ ├── Definition_Lists.json │ │ ├── Definition_Lists.text │ │ ├── Emphasis.html │ │ ├── Emphasis.json │ │ ├── Emphasis.text │ │ ├── Footnotes.html │ │ ├── Footnotes.json │ │ ├── Footnotes.text │ │ ├── Inline_HTML_with_Markdown_content.html │ │ ├── Inline_HTML_with_Markdown_content.json │ │ ├── Inline_HTML_with_Markdown_content.text │ │ ├── Tables.html │ │ ├── Tables.json │ │ └── Tables.text │ ├── docs-php-markdown-todo/ │ │ ├── Email_auto_links.html │ │ ├── Email_auto_links.json │ │ ├── Email_auto_links.text │ │ ├── Emphasis.html │ │ ├── Emphasis.json │ │ ├── Emphasis.text │ │ ├── Inline_HTML_(Span).html │ │ ├── Inline_HTML_(Span).json │ │ ├── Inline_HTML_(Span).text │ │ ├── Ins_and_del.json │ │ ├── Ins_and_del.text │ │ ├── Ins_and_del.xhtml │ │ ├── Links_inline_style.html │ │ ├── Links_inline_style.json │ │ ├── Links_inline_style.text │ │ ├── Nesting.html │ │ ├── Nesting.json │ │ ├── Nesting.text │ │ ├── Parens_in_URL.html │ │ ├── Parens_in_URL.json │ │ └── Parens_in_URL.text │ └── docs-pythonmarkdown2-tm-cases-pass/ │ ├── auto_link.html │ ├── auto_link.json │ ├── auto_link.text │ ├── auto_link_safe_mode.html │ ├── auto_link_safe_mode.json │ ├── auto_link_safe_mode.opts │ ├── auto_link_safe_mode.text │ ├── basic_safe_mode.html │ ├── basic_safe_mode.json │ ├── basic_safe_mode.opts │ ├── basic_safe_mode.text │ ├── basic_safe_mode_escape.html │ ├── basic_safe_mode_escape.json │ ├── basic_safe_mode_escape.opts │ ├── basic_safe_mode_escape.text │ ├── blockquote.html │ ├── blockquote.json │ ├── blockquote.text │ ├── blockquote_with_pre.html │ ├── blockquote_with_pre.json │ ├── blockquote_with_pre.text │ ├── code_block_with_tabs.html │ ├── code_block_with_tabs.json │ ├── code_block_with_tabs.text │ ├── code_safe_emphasis.html │ ├── code_safe_emphasis.json │ ├── code_safe_emphasis.opts │ ├── code_safe_emphasis.text │ ├── codeblock.html │ ├── codeblock.json │ ├── codeblock.text │ ├── codespans.html │ ├── codespans.json │ ├── codespans.text │ ├── codespans_safe_mode.html │ ├── codespans_safe_mode.json │ ├── codespans_safe_mode.opts │ ├── codespans_safe_mode.text │ ├── emacs_head_vars.html │ ├── emacs_head_vars.json │ ├── emacs_head_vars.text │ ├── emacs_tail_vars.html │ ├── emacs_tail_vars.json │ ├── emacs_tail_vars.text │ ├── emphasis.html │ ├── emphasis.json │ ├── emphasis.text │ ├── escapes.html │ ├── escapes.json │ ├── escapes.text │ ├── footnotes.html │ ├── footnotes.json │ ├── footnotes.opts │ ├── footnotes.text │ ├── footnotes_letters.html │ ├── footnotes_letters.json │ ├── footnotes_letters.opts │ ├── footnotes_letters.text │ ├── footnotes_markup.html │ ├── footnotes_markup.json │ ├── footnotes_markup.opts │ ├── footnotes_markup.text │ ├── footnotes_safe_mode_escape.html │ ├── footnotes_safe_mode_escape.json │ ├── footnotes_safe_mode_escape.opts │ ├── footnotes_safe_mode_escape.text │ ├── header.html │ ├── header.json │ ├── header.text │ ├── hr.html │ ├── hr.json │ ├── hr.text │ ├── img_in_link.html │ ├── img_in_link.json │ ├── img_in_link.text │ ├── inline_links.html │ ├── inline_links.json │ ├── inline_links.text │ ├── issue2_safe_mode_borks_markup.html │ ├── issue2_safe_mode_borks_markup.json │ ├── issue2_safe_mode_borks_markup.opts │ ├── issue2_safe_mode_borks_markup.text │ ├── link_defn_alt_title_delims.html │ ├── link_defn_alt_title_delims.json │ ├── link_defn_alt_title_delims.text │ ├── link_patterns.html │ ├── link_patterns.json │ ├── link_patterns.opts │ ├── link_patterns.text │ ├── link_patterns_double_hit.html │ ├── link_patterns_double_hit.json │ ├── link_patterns_double_hit.opts │ ├── link_patterns_double_hit.text │ ├── link_patterns_edge_cases.html │ ├── link_patterns_edge_cases.json │ ├── link_patterns_edge_cases.opts │ ├── link_patterns_edge_cases.text │ ├── lists.html │ ├── lists.json │ ├── lists.text │ ├── mismatched_footnotes.html │ ├── mismatched_footnotes.json │ ├── mismatched_footnotes.opts │ ├── mismatched_footnotes.text │ ├── missing_link_defn.html │ ├── missing_link_defn.json │ ├── missing_link_defn.text │ ├── nested_list.html │ ├── nested_list.json │ ├── nested_list.text │ ├── nested_list_safe_mode.html │ ├── nested_list_safe_mode.json │ ├── nested_list_safe_mode.opts │ ├── nested_list_safe_mode.text │ ├── parens_in_url_4.html │ ├── parens_in_url_4.json │ ├── parens_in_url_4.text │ ├── raw_html.html │ ├── raw_html.json │ ├── raw_html.text │ ├── ref_links.html │ ├── ref_links.json │ ├── ref_links.text │ ├── sublist-para.html │ ├── sublist-para.json │ ├── sublist-para.text │ ├── syntax_color.html │ ├── syntax_color.json │ ├── syntax_color.opts │ ├── syntax_color.text │ ├── tricky_anchors.html │ ├── tricky_anchors.json │ ├── tricky_anchors.text │ ├── underline_in_autolink.html │ ├── underline_in_autolink.json │ └── underline_in_autolink.text ├── html_renderer.t.js ├── interface.t.js ├── regressions.t.js └── render_tree.t.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ .*.swp .DS_Store /node_modules/ /npm-debug.log dist lib/markdown.js ================================================ FILE: .travis.yml ================================================ language: node_js node_js: - "0.10" - "0.11" ================================================ FILE: Changes.md ================================================ # Changelog for markdown ## vNEXT - ??? - **Big change**: Drop official support for Node 0.8 - Use JSHint to validate code style and fix numerous warnings it flagged up ([#65]) Thanks [XhmikosR](https://github.com/XhmikosR)! - Fix (yet more! gah) global variable leaks ([#99]) - Fix content tight between two `hr`'s disappearing ([#106]) - Use [Grunt](http://gruntjs.com/) to build tailored versions including allowing customizing of what dialects are included ([#113] - [Robin Ward](https://github.com/eviltrout)) - Add in a bower.json for easier use in non-node environments ([#184]) - Lots of small other fixes ## v0.5.0 - 2013-07-26 There might be other bug fixes then the ones listed - I've been a bit lax at updating the changes file, sorry :( - Fix "undefined" appearing in output for some cases with blockquotes - Fix (multiple) global variable leaks. Ooops - Allow spaces in img/link paths ([#48]) - Handle windows line endings ([#58]) - Fix IE8 issues ([#68], [#86], [#97]) - Fix images inside links mistakenly requiring a title attribute to parse correctly ([#71]) - Add explicit text of the license to the readme ([#74]) - Style tweaks by [XhmikosR](https://github.com/XhmikosR) ([#81], [#82], [#83]) - Build now tested by TravisCI thanks to [sebs](https://github.com/sebs) ([#85]) - Fix "cuddled" header parsing ([#94]) - Add support for tables to Maruku dialect ([#66]) Thanks [redsun82](https://github.com/redsun82)! ## v0.4.0 - 2012-06-09 - Improve link parsing when multiple on a line ([#5]) - `npm test` will now run the entire test suite cleanly (switch tests over to [node-tap](https://github.com/isaacs/node-tap)) ([#21]) - Fix blockquote merging/implicit conversion between string/String ([#24], [#44]) - Allow inline elements to appear inside link text ([#27]) - Fix to correctly render self-closing tags ([#28], [#35], [#40]) - Actually render image references ([#36]) - Make it work in IE7/8 ([#37]) - Improve link parsing when link is inside parenthesis ([#38]) - Fix JSLint warnings ([#42]) - `md2html` can now process stdin ([#43]) - Fix for anchors enclosed by parenthesis ([#46]) [#5]: https://github.com/evilstreak/markdown-js/issues/5 [#21]: https://github.com/evilstreak/markdown-js/issues/21 [#24]: https://github.com/evilstreak/markdown-js/issues/24 [#27]: https://github.com/evilstreak/markdown-js/issues/27 [#28]: https://github.com/evilstreak/markdown-js/issues/28 [#35]: https://github.com/evilstreak/markdown-js/issues/35 [#36]: https://github.com/evilstreak/markdown-js/issues/36 [#37]: https://github.com/evilstreak/markdown-js/issues/37 [#38]: https://github.com/evilstreak/markdown-js/issues/38 [#40]: https://github.com/evilstreak/markdown-js/issues/40 [#42]: https://github.com/evilstreak/markdown-js/issues/42 [#43]: https://github.com/evilstreak/markdown-js/issues/43 [#44]: https://github.com/evilstreak/markdown-js/issues/44 [#46]: https://github.com/evilstreak/markdown-js/issues/46 [#48]: https://github.com/evilstreak/markdown-js/issues/48 [#58]: https://github.com/evilstreak/markdown-js/issues/58 [#65]: https://github.com/evilstreak/markdown-js/issues/65 [#66]: https://github.com/evilstreak/markdown-js/issues/66 [#68]: https://github.com/evilstreak/markdown-js/issues/68 [#71]: https://github.com/evilstreak/markdown-js/issues/71 [#74]: https://github.com/evilstreak/markdown-js/issues/74 [#81]: https://github.com/evilstreak/markdown-js/issues/81 [#82]: https://github.com/evilstreak/markdown-js/issues/82 [#83]: https://github.com/evilstreak/markdown-js/issues/83 [#85]: https://github.com/evilstreak/markdown-js/issues/85 [#86]: https://github.com/evilstreak/markdown-js/issues/86 [#94]: https://github.com/evilstreak/markdown-js/issues/94 [#97]: https://github.com/evilstreak/markdown-js/issues/97 [#99]: https://github.com/evilstreak/markdown-js/issues/99 [#106]: https://github.com/evilstreak/markdown-js/issues/106 [#113]: https://github.com/evilstreak/markdown-js/issues/113 ================================================ FILE: Gruntfile.js ================================================ module.exports = function(grunt) { var pkg = grunt.file.readJSON('package.json'); grunt.initConfig({ pkg: pkg, env: process.env, node_tap: { default_options: { options: { outputType: 'failures', outputTo: 'console' }, files: { 'tests': ['./test/*.t.js'] } } }, jshint: { files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'], options: { "browser": false, "maxerr": 100, "node": true, "camelcase": false, "curly": false, "eqeqeq": true, "eqnull": true, "forin": false, "globals": { "define": true, "print": true, "uneval": true, "window": true }, "immed": true, "indent": 2, "latedef": true, "laxbreak": true, "laxcomma": true, "lastsemic": true, "loopfunc": true, "noarg": true, "newcap": true, "plusplus": false, "quotmark": "true", "regexp": true, "shadow": true, "strict": false, "sub": true, "trailing": true, "undef": true, "unused": false, ignores: ['.git', 'node_modules'] } }, build: { web: { dest: "dist/markdown.js", minimum: ["parser"], removeWith: ['dialects/gruber'], startFile: "inc/header.js", endFile: "inc/footer-web.js" }, node: { dest: "lib/markdown.js", minimum: ["parser"], removeWith: ['dialects/gruber'], startFile: "inc/header.js", endFile: "inc/footer-node.js" } }, uglify: { my_target: { options: { compress: true, mangle: true, preserveComments: "some", report: "min" }, files: { 'dist/markdown.min.js': ['dist/markdown.js'] } } } }); grunt.registerTask('all', ['test', 'build', 'uglify']); grunt.registerTask('default', ['all']); grunt.registerTask('test', 'Runs all tests and linting', ['node_tap', 'jshint']); grunt.loadNpmTasks('grunt-node-tap'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadTasks("inc/tasks"); }; ================================================ FILE: README.md ================================================ [![NPM version](https://badge.fury.io/js/markdown.png)](http://badge.fury.io/js/markdown) [![Build Status](https://secure.travis-ci.org/evilstreak/markdown-js.png)](https://travis-ci.org/evilstreak/markdown-js) [![Dependency Status](https://gemnasium.com/evilstreak/markdown-js.png)](https://gemnasium.com/evilstreak/markdown-js) ## Notice: Unmaintained This repo is no longer maintained, however there are many alternatives: - [Markdown-It](https://github.com/markdown-it/markdown-it) - [Showdown](https://github.com/showdownjs/showdown) - [Marked](https://github.com/markedjs/marked) - and more... # markdown-js Yet another Markdown parser, this time for JavaScript. There's a few options that precede this project but they all treat Markdown to HTML conversion as a single step process. You pass Markdown in and get HTML out, end of story. We had some pretty particular views on how the process should actually look, which include: * Producing well-formed HTML. This means that `em` and `strong` nesting is important, as is the ability to output as both HTML and XHTML * Having an intermediate representation to allow processing of parsed data (we in fact have two, both [JsonML]: a markdown tree and an HTML tree) * Being easily extensible to add new dialects without having to rewrite the entire parsing mechanics * Having a good test suite. The only test suites we could find tested massive blocks of input, and passing depended on outputting the HTML with exactly the same whitespace as the original implementation [JsonML]: http://jsonml.org/ "JSON Markup Language" ## Installation Just the `markdown` library: npm install markdown Optionally, install `md2html` into your path npm install -g markdown ### In the browser If you want to use from the browser go to the [releases] page on GitHub and download the version you want (minified or not). [releases]: https://github.com/evilstreak/markdown-js/releases ## Usage The basic interface is: ```js md_content = "Hello.\n\n* This is markdown.\n* It is fun\n* Love it or leave it." html_content = markdown.toHTML( md_content ); ``` toHTML also accepts a dialect argument: ```js md_content = "Vessel | Captain\n-----------|-------------\nNCC-1701 | James T Kirk\nNCC-1701 A | James T Kirk\nNCC-1701 D | Picard"; html_content = markdown.toHTML( md_content, 'Maruku'); ``` ### Node The simple way to use it with Node is: ```js var markdown = require( "markdown" ).markdown; console.log( markdown.toHTML( "Hello *World*!" ) ); ``` ### ES6 ```js import {markdown} from 'markdown'; console.log( markdown.toHTML( "Hello *World*!" ) ); ``` #### Older versions of node We only officially support node >= 0.10 as the libraries we use for building and testing don't work on older versions of node. That said since this module is so simple and doesn't use any parts of the node API if you use the pre-built version and find a bug let us know and we'll try and fix it. ### Browser It also works in a browser; here is a complete example: ```html
``` ### Command Line Assuming you've installed the `md2html` script (see Installation, above), you can convert Markdown to HTML: ```bash # read from a file md2html /path/to/doc.md > /path/to/doc.html # or from stdin echo 'Hello *World*!' | md2html ``` ### More Options If you want more control check out the documentation in [the .js files under src/][src_folder] which details all the methods and parameters available (including examples!). One day we'll get the docs generated and hosted somewhere for nicer browsing. [src_folder]: https://github.com/evilstreak/markdown-js/blob/master/src Meanwhile, here's an example of using the multi-step processing to make wiki-style linking work by filling in missing link references: ```js var md = require( "markdown" ).markdown, text = "[Markdown] is a simple text-based [markup language]\n" + "created by [John Gruber]\n\n" + "[John Gruber]: http://daringfireball.net"; // parse the markdown into a tree and grab the link references var tree = md.parse( text ), refs = tree[ 1 ].references; // iterate through the tree finding link references ( function find_link_refs( jsonml ) { if ( jsonml[ 0 ] === "link_ref" ) { var ref = jsonml[ 1 ].ref; // if there's no reference, define a wiki link if ( !refs[ ref ] ) { refs[ ref ] = { href: "http://en.wikipedia.org/wiki/" + ref.replace(/\s+/, "_" ) }; } } else if ( Array.isArray( jsonml[ 1 ] ) ) { jsonml[ 1 ].forEach( find_link_refs ); } else if ( Array.isArray( jsonml[ 2 ] ) ) { jsonml[ 2 ].forEach( find_link_refs ); } } )( tree ); // convert the tree into html var html = md.renderJsonML( md.toHTMLTree( tree ) ); console.log( html ); ``` ## Intermediate Representation Internally the process to convert a chunk of Markdown into a chunk of HTML has three steps: 1. Parse the Markdown into a JsonML tree. Any references found in the parsing are stored in the attribute hash of the root node under the key `references`. 2. Convert the Markdown tree into an HTML tree. Rename any nodes that need it (`bulletlist` to `ul` for example) and lookup any references used by links or images. Remove the references attribute once done. 3. Stringify the HTML tree being careful not to wreck whitespace where whitespace is important (surrounding inline elements for example). Each step of this process can be called individually if you need to do some processing or modification of the data at an intermediate stage. For example, you may want to grab a list of all URLs linked to in the document before rendering it to HTML which you could do by recursing through the HTML tree looking for `a` nodes. ## Building and Testing markdown-js We use [Grunt](http://gruntjs.com/) to build and run markdown-js's tests. Make sure you run `npm install` to install the developer dependencies for the project, then you can: $ npm test To run our test suite. If you'd like to build markdown-js, you can run: $ ./node_modules/.bin/grunt all This command will run all the tests, then output a concatenated markdown.js and markdown.min.js in the `dist/` directory for use in a browser application. ## Building a custom markdown-js By default, you will get the [Gruber] and [Maruku] dialects included when you run `grunt all`. However, you can create a custom build using the following syntax if you don't want to include Maruku support. $ ./node_modules/.bin/grunt "custom:-dialects/maruku" [Gruber]: http://daringfireball.net/projects/markdown/syntax [Maruku]: http://maruku.rubyforge.org/maruku.html ## Running Tests To run the tests under Node you will need tap installed (it's listed as a `devDependencies` so `npm install` from the checkout should be enough), then do $ npm test ## Contributing Do the usual GitHub fork and pull request dance. Add yourself to the contributors section of [package.json] too if you want to. [package.json]: https://github.com/evilstreak/markdown-js/blob/master/package.json ## License Released under the MIT license. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: bin/md2html.js ================================================ #!/usr/bin/env node (function () { "use strict"; var fs = require("fs"), markdown = require("markdown").markdown, nopt = require("nopt"), stream, opts, buffer = ""; opts = nopt( { "dialect": [ "Gruber", "Maruku"], "help": Boolean } ); if (opts.help || process.argv.length === 2) { var name = process.argv[1].split("/").pop(); console.warn( require("util").format( "usage: %s [--dialect=DIALECT] FILE\n\nValid dialects are Gruber (the default) or Maruku", name ) ); process.exit(0); } var fullpath = opts.argv.remain[0]; if (fullpath && fullpath !== "-") stream = fs.createReadStream(fullpath); else stream = process.stdin; stream.resume(); stream.setEncoding("utf8"); stream.on("error", function(error) { console.error(error.toString()); process.exit(1); }); stream.on("data", function(data) { buffer += data; }); stream.on("end", function() { var html = markdown.toHTML(buffer, opts.dialect); console.log(html); }); }()); ================================================ FILE: bower.json ================================================ { "name": "markdown", "homepage": "https://github.com/evilstreak/markdown-js", "_source": "git://github.com/evilstreak/markdown-js.git", "_target": "master", "_originalSource": "markdown", "version": "v0.6.0-beta1", "authors": [ "Dominic Baggott (http://evilstreak.co.uk)", "Ash Berlin (http://ashberlin.com)" ], "description": "A sensible Markdown parser for javascript", "main": "./lib/index.js", "keywords": [ "markdown", "text processing", "ast" ], "license": "MIT" } ================================================ FILE: inc/footer-node.js ================================================ expose.Markdown = Markdown; expose.parse = Markdown.parse; expose.toHTML = Markdown.toHTML; expose.toHTMLTree = Markdown.toHTMLTree; expose.renderJsonML = Markdown.renderJsonML; expose.DialectHelpers = DialectHelpers; })(exports); ================================================ FILE: inc/footer-web.js ================================================ expose.Markdown = Markdown; expose.parse = Markdown.parse; expose.toHTML = Markdown.toHTML; expose.toHTMLTree = Markdown.toHTMLTree; expose.renderJsonML = Markdown.renderJsonML; expose.DialectHelpers = DialectHelpers; })(function() { window.markdown = {}; return window.markdown; }()); ================================================ FILE: inc/header.js ================================================ /*! * Markdown * Released under MIT license * Copyright (c) 2009-2010 Dominic Baggott * Copyright (c) 2009-2010 Ash Berlin * Copyright (c) 2011 Christoph Dorn (http://www.christophdorn.com) * Version: @VERSION * Date: @DATE */ (function(expose) { ================================================ FILE: inc/tasks/build_markdown.js ================================================ /** Tasks cribbed from jQuery to handle building custom markdown parsers. */ module.exports = function( grunt ) { "use strict"; var fs = require( "fs" ), srcFolder = __dirname + "/../../src/", rdefineEnd = /\}\);[^}\w]*$/, // This is temporary until the skipSemiColonInsertion option makes it to NPM requirejs = require( "requirejs" ), config = { baseUrl: "src", name: "markdown", // We have multiple minify steps optimize: "none", skipSemiColonInsertion: true, onBuildWrite: convert }; /** * Strip all definitions generated by requirejs * Convert "var" modules to var declarations * "var module" means the module only contains a return statement that should be converted to a var declaration * This is indicated by including the file in any "var" folder * @param {String} name * @param {String} path * @param {String} contents The contents to be written (including their AMD wrappers) */ function convert( name, path, contents ) { // Convert var modules if ( /.\/var\//.test( path ) ) { contents = contents .replace( /define\([\w\W]*?return/, "var " + (/var\/([\w-]+)/.exec(name)[1]) + " =" ) .replace( rdefineEnd, "" ); } else { contents = contents .replace( /^\s*return\s+[^\}]+(\}\);[^\w\}]*)$/m, "$1" ); // Remove define wrappers, closure ends, and empty declarations contents = contents .replace( /define\([^{]*?{/, "" ) .replace( rdefineEnd, "" ); // Remove empty definitions contents = contents .replace( /define\(\[[^\]]+\]\)[\W\n]+$/, "" ); } return contents; } grunt.registerMultiTask( "build", "Concatenate source, remove sub AMD definitions, (include/exclude modules with +/- flags), embed date/version", function() { var flag, index, done = this.async(), flags = this.flags, name = this.data.dest, minimum = this.data.minimum, removeWith = this.data.removeWith, excluded = [], included = [], version = grunt.config( "pkg.version" ), /** * Recursively calls the excluder to remove on all modules in the list * @param {Array} list * @param {String} [prepend] Prepend this to the module name. Indicates we're walking a directory */ excludeList = function( list, prepend ) { if ( list ) { prepend = prepend ? prepend + "/" : ""; list.forEach(function( module ) { // Exclude var modules as well if ( module === "var" ) { excludeList( fs.readdirSync( srcFolder + prepend + module ), prepend + module ); return; } if ( prepend ) { // Skip if this is not a js file and we're walking files in a dir if ( !(module = /([\w-\/]+)\.js$/.exec( module )) ) { return; } // Prepend folder name if passed // Remove .js extension module = prepend + module[1]; } // Avoid infinite recursion if ( excluded.indexOf( module ) === -1 ) { excluder( "-" + module ); } }); } }, /** * Adds the specified module to the excluded or included list, depending on the flag * @param {String} flag A module path relative to the src directory starting with + or - to indicate whether it should included or excluded */ excluder = function( flag ) { var m = /^(\+|\-|)([\w\/-]+)$/.exec( flag ), exclude = m[ 1 ] === "-", module = m[ 2 ]; if ( exclude ) { // Can't exclude certain modules if ( minimum.indexOf( module ) === -1 ) { // Add to excluded if ( excluded.indexOf( module ) === -1 ) { grunt.log.writeln( flag ); excluded.push( module ); // Exclude all files in the folder of the same name // These are the removable dependencies // It's fine if the directory is not there try { excludeList( fs.readdirSync( srcFolder + module ), module ); } catch( e ) { grunt.verbose.writeln( e ); } } // Check removeWith list excludeList( removeWith[ module ] ); } else { grunt.log.error( "Module \"" + module + "\" is a mimimum requirement."); if ( module === "selector" ) { grunt.log.error( "If you meant to replace Sizzle, use -sizzle instead." ); } } } else { grunt.log.writeln( flag ); included.push( module ); } }; // append commit id to version if ( process.env.COMMIT ) { version += " " + process.env.COMMIT; } // figure out which files to exclude based on these rules in this order: // dependency explicit exclude // > explicit exclude // > explicit include // > dependency implicit exclude // > implicit exclude // examples: // * none (implicit exclude) // *:* all (implicit include) // *:*:-css all except css and dependents (explicit > implicit) // *:*:-css:+effects same (excludes effects because explicit include is trumped by explicit exclude of dependency) // *:+effects none except effects and its dependencies (explicit include trumps implicit exclude of dependency) for ( flag in flags ) { if ( flag !== "*" ) { excluder( flag ); } } grunt.verbose.writeflags( excluded, "Excluded" ); grunt.verbose.writeflags( included, "Included" ); // append excluded modules to version if ( excluded.length ) { version += " -" + excluded.join( ",-" ); // set pkg.version to version with excludes, so minified file picks it up grunt.config.set( "pkg.version", version ); grunt.verbose.writeln( "Version changed to " + version ); // Have to use shallow or core will get excluded since it is a dependency config.excludeShallow = excluded; } config.include = included; config.wrap = { startFile: this.data.startFile, endFile: this.data.endFile }; /** * Handle Final output from the optimizer * @param {String} compiled */ config.out = function( compiled ) { compiled = compiled // Remove any lone semi colons .replace(/^;$/gm, '') // Remove extra line breaks .replace(/\n\n+/gm, "\n\n") // Embed Version .replace( /@VERSION/g, version ) // Embed Date // yyyy-mm-ddThh:mmZ .replace( /@DATE/g, ( new Date() ).toISOString().replace( /:\d+\.\d+Z$/, "Z" ) ); // Write concatenated source to file grunt.file.write( name, compiled ); }; // Trace dependencies and concatenate files requirejs.optimize( config, function( response ) { grunt.verbose.writeln( response ); grunt.log.ok( "File '" + name + "' created." ); done(); }, function( err ) { done( err ); }); }); // Special "alias" task to make custom build creation less grawlix-y // Translation example // // grunt custom:+ajax,-dimensions,-effects,-offset // // Becomes: // // grunt build:*:*:+ajax:-dimensions:-effects:-offset grunt.registerTask( "custom", function() { var args = [].slice.call( arguments ), modules = args.length ? args[ 0 ].replace( /,/g, ":" ) : ""; grunt.log.writeln( "Creating custom build...\n" ); grunt.task.run([ "build:*:*:" + modules, 'uglify']); }); }; ================================================ FILE: lib/index.js ================================================ // super simple module for the most common nodejs use case. exports.markdown = require("./markdown"); exports.parse = exports.markdown.toHTML; ================================================ FILE: package.json ================================================ { "name": "markdown", "version": "0.6.0-beta1", "description": "A sensible Markdown parser for javascript", "keywords": [ "markdown", "text processing", "ast" ], "maintainers": [ "Dominic Baggott (http://evilstreak.co.uk)", "Ash Berlin (http://ashberlin.com)" ], "contributors": [ "Dominic Baggott (http://evilstreak.co.uk)", "Ash Berlin (http://ashberlin.com)", "XhmikosR ", "Robin Ward (http://eviltrout.com)" ], "bugs": { "url": "https://github.com/evilstreak/markdown-js/issues" }, "license": "MIT", "repository": { "type": "git", "url": "git://github.com/evilstreak/markdown-js.git" }, "main": "./lib/index.js", "bin": { "md2html": "./bin/md2html.js" }, "files": [ "bin", "lib", "Changes.md", "README.md" ], "dependencies": { "nopt": "~2.1.1" }, "devDependencies": { "amdefine": "~0.0.8", "grunt": "~0.4.1", "grunt-cli": "~0.1.9", "grunt-contrib-jshint": "~0.6.4", "grunt-contrib-uglify": "~0.2.4", "grunt-node-tap": "0.1.46", "requirejs": "~2.1.8", "tap": "~0.3.3" }, "scripts": { "test": "grunt test", "tap": "grunt node_tap", "lint": "grunt jshint", "prepublish": "grunt build" }, "engines": { "node": ">=0.10.0" } } ================================================ FILE: seed.yml ================================================ --- name: markdown-js description: JavaScript implementation of Markdown tags: markdown parser version: 0.1.2 ================================================ FILE: src/core.js ================================================ if (typeof define !== 'function') { var define = require('amdefine')(module) } define([], function() { /** * class Markdown * * Markdown processing in Javascript done right. We have very particular views * on what constitutes 'right' which include: * * - produces well-formed HTML (this means that em and strong nesting is * important) * * - has an intermediate representation to allow processing of parsed data (We * in fact have two, both as [JsonML]: a markdown tree and an HTML tree). * * - is easily extensible to add new dialects without having to rewrite the * entire parsing mechanics * * - has a good test suite * * This implementation fulfills all of these (except that the test suite could * do with expanding to automatically run all the fixtures from other Markdown * implementations.) * * ##### Intermediate Representation * * *TODO* Talk about this :) Its JsonML, but document the node names we use. * * [JsonML]: http://jsonml.org/ "JSON Markup Language" **/ var Markdown = function(dialect) { switch (typeof dialect) { case "undefined": this.dialect = Markdown.dialects.Gruber; break; case "object": this.dialect = dialect; break; default: if ( dialect in Markdown.dialects ) this.dialect = Markdown.dialects[dialect]; else throw new Error("Unknown Markdown dialect '" + String(dialect) + "'"); break; } this.em_state = []; this.strong_state = []; this.debug_indent = ""; }; /** * Markdown.dialects * * Namespace of built-in dialects. **/ Markdown.dialects = {}; return Markdown; }); ================================================ FILE: src/dialects/dialect_helpers.js ================================================ if (typeof define !== 'function') { var define = require('amdefine')(module) } define([], function (w) { var DialectHelpers = {}; DialectHelpers.inline_until_char = function( text, want ) { var consumed = 0, nodes = []; while ( true ) { if ( text.charAt( consumed ) === want ) { // Found the character we were looking for consumed++; return [ consumed, nodes ]; } if ( consumed >= text.length ) { // No closing char found. Abort. return [consumed, null, nodes]; } var res = this.dialect.inline.__oneElement__.call(this, text.substr( consumed ) ); consumed += res[ 0 ]; // Add any returned nodes. nodes.push.apply( nodes, res.slice( 1 ) ); } }; // Helper function to make sub-classing a dialect easier DialectHelpers.subclassDialect = function( d ) { function Block() {} Block.prototype = d.block; function Inline() {} Inline.prototype = d.inline; return { block: new Block(), inline: new Inline() }; }; return DialectHelpers; }); ================================================ FILE: src/dialects/gruber.js ================================================ if (typeof define !== 'function') { var define = require('amdefine')(module) } define(['../markdown_helpers', './dialect_helpers', '../parser'], function (MarkdownHelpers, DialectHelpers, Markdown) { var forEach = MarkdownHelpers.forEach, extract_attr = MarkdownHelpers.extract_attr, mk_block = MarkdownHelpers.mk_block, isEmpty = MarkdownHelpers.isEmpty, inline_until_char = DialectHelpers.inline_until_char; // A robust regexp for matching URLs. Thanks: https://gist.github.com/dperini/729294 var urlRegexp = /(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?/i.source; /** * Gruber dialect * * The default dialect that follows the rules set out by John Gruber's * markdown.pl as closely as possible. Well actually we follow the behaviour of * that script which in some places is not exactly what the syntax web page * says. **/ var Gruber = { block: { atxHeader: function atxHeader( block, next ) { var m = block.match( /^(#{1,6})\s*(.*?)\s*#*\s*(?:\n|$)/ ); if ( !m ) return undefined; var header = [ "header", { level: m[ 1 ].length } ]; Array.prototype.push.apply(header, this.processInline(m[ 2 ])); if ( m[0].length < block.length ) next.unshift( mk_block( block.substr( m[0].length ), block.trailing, block.lineNumber + 2 ) ); return [ header ]; }, setextHeader: function setextHeader( block, next ) { var m = block.match( /^(.*)\n([-=])\2\2+(?:\n|$)/ ); if ( !m ) return undefined; var level = ( m[ 2 ] === "=" ) ? 1 : 2, header = [ "header", { level : level } ].concat( this.processInline(m[ 1 ]) ); if ( m[0].length < block.length ) next.unshift( mk_block( block.substr( m[0].length ), block.trailing, block.lineNumber + 2 ) ); return [ header ]; }, code: function code( block, next ) { // | Foo // |bar // should be a code block followed by a paragraph. Fun // // There might also be adjacent code block to merge. var ret = [], re = /^(?: {0,3}\t| {4})(.*)\n?/; // 4 spaces + content if ( !block.match( re ) ) return undefined; block_search: do { // Now pull out the rest of the lines var b = this.loop_re_over_block( re, block.valueOf(), function( m ) { ret.push( m[1] ); } ); if ( b.length ) { // Case alluded to in first comment. push it back on as a new block next.unshift( mk_block(b, block.trailing) ); break block_search; } else if ( next.length ) { // Check the next block - it might be code too if ( !next[0].match( re ) ) break block_search; // Pull how how many blanks lines follow - minus two to account for .join ret.push ( block.trailing.replace(/[^\n]/g, "").substring(2) ); block = next.shift(); } else { break block_search; } } while ( true ); return [ [ "code_block", ret.join("\n") ] ]; }, horizRule: function horizRule( block, next ) { // this needs to find any hr in the block to handle abutting blocks var m = block.match( /^(?:([\s\S]*?)\n)?[ \t]*([-_*])(?:[ \t]*\2){2,}[ \t]*(?:\n([\s\S]*))?$/ ); if ( !m ) return undefined; var jsonml = [ [ "hr" ] ]; // if there's a leading abutting block, process it if ( m[ 1 ] ) { var contained = mk_block( m[ 1 ], "", block.lineNumber ); jsonml.unshift.apply( jsonml, this.toTree( contained, [] ) ); } // if there's a trailing abutting block, stick it into next if ( m[ 3 ] ) next.unshift( mk_block( m[ 3 ], block.trailing, block.lineNumber + 1 ) ); return jsonml; }, // There are two types of lists. Tight and loose. Tight lists have no whitespace // between the items (and result in text just in the
  • ) and loose lists, // which have an empty line between list items, resulting in (one or more) // paragraphs inside the
  • . // // There are all sorts weird edge cases about the original markdown.pl's // handling of lists: // // * Nested lists are supposed to be indented by four chars per level. But // if they aren't, you can get a nested list by indenting by less than // four so long as the indent doesn't match an indent of an existing list // item in the 'nest stack'. // // * The type of the list (bullet or number) is controlled just by the // first item at the indent. Subsequent changes are ignored unless they // are for nested lists // lists: (function( ) { // Use a closure to hide a few variables. var any_list = "[*+-]|\\d+\\.", bullet_list = /[*+-]/, // Capture leading indent as it matters for determining nested lists. is_list_re = new RegExp( "^( {0,3})(" + any_list + ")[ \t]+" ), indent_re = "(?: {0,3}\\t| {4})"; // TODO: Cache this regexp for certain depths. // Create a regexp suitable for matching an li for a given stack depth function regex_for_depth( depth ) { return new RegExp( // m[1] = indent, m[2] = list_type "(?:^(" + indent_re + "{0," + depth + "} {0,3})(" + any_list + ")\\s+)|" + // m[3] = cont "(^" + indent_re + "{0," + (depth-1) + "}[ ]{0,4})" ); } function expand_tab( input ) { return input.replace( / {0,3}\t/g, " " ); } // Add inline content `inline` to `li`. inline comes from processInline // so is an array of content function add(li, loose, inline, nl) { if ( loose ) { li.push( [ "para" ].concat(inline) ); return; } // Hmmm, should this be any block level element or just paras? var add_to = li[li.length -1] instanceof Array && li[li.length - 1][0] === "para" ? li[li.length -1] : li; // If there is already some content in this list, add the new line in if ( nl && li.length > 1 ) inline.unshift(nl); for ( var i = 0; i < inline.length; i++ ) { var what = inline[i], is_str = typeof what === "string"; if ( is_str && add_to.length > 1 && typeof add_to[add_to.length-1] === "string" ) add_to[ add_to.length-1 ] += what; else add_to.push( what ); } } // contained means have an indent greater than the current one. On // *every* line in the block function get_contained_blocks( depth, blocks ) { var re = new RegExp( "^(" + indent_re + "{" + depth + "}.*?\\n?)*$" ), replace = new RegExp("^" + indent_re + "{" + depth + "}", "gm"), ret = []; while ( blocks.length > 0 ) { if ( re.exec( blocks[0] ) ) { var b = blocks.shift(), // Now remove that indent x = b.replace( replace, ""); ret.push( mk_block( x, b.trailing, b.lineNumber ) ); } else break; } return ret; } // passed to stack.forEach to turn list items up the stack into paras function paragraphify(s, i, stack) { var list = s.list; var last_li = list[list.length-1]; if ( last_li[1] instanceof Array && last_li[1][0] === "para" ) return; if ( i + 1 === stack.length ) { // Last stack frame // Keep the same array, but replace the contents last_li.push( ["para"].concat( last_li.splice(1, last_li.length - 1) ) ); } else { var sublist = last_li.pop(); last_li.push( ["para"].concat( last_li.splice(1, last_li.length - 1) ), sublist ); } } // The matcher function return function( block, next ) { var m = block.match( is_list_re ); if ( !m ) return undefined; function make_list( m ) { var list = bullet_list.exec( m[2] ) ? ["bulletlist"] : ["numberlist"]; stack.push( { list: list, indent: m[1] } ); return list; } var stack = [], // Stack of lists for nesting. list = make_list( m ), last_li, loose = false, ret = [ stack[0].list ], i; // Loop to search over block looking for inner block elements and loose lists loose_search: while ( true ) { // Split into lines preserving new lines at end of line var lines = block.split( /(?=\n)/ ); // We have to grab all lines for a li and call processInline on them // once as there are some inline things that can span lines. var li_accumulate = "", nl = ""; // Loop over the lines in this block looking for tight lists. tight_search: for ( var line_no = 0; line_no < lines.length; line_no++ ) { nl = ""; var l = lines[line_no].replace(/^\n/, function(n) { nl = n; return ""; }); // TODO: really should cache this var line_re = regex_for_depth( stack.length ); m = l.match( line_re ); //print( "line:", uneval(l), "\nline match:", uneval(m) ); // We have a list item if ( m[1] !== undefined ) { // Process the previous list item, if any if ( li_accumulate.length ) { add( last_li, loose, this.processInline( li_accumulate ), nl ); // Loose mode will have been dealt with. Reset it loose = false; li_accumulate = ""; } m[1] = expand_tab( m[1] ); var wanted_depth = Math.floor(m[1].length/4)+1; //print( "want:", wanted_depth, "stack:", stack.length); if ( wanted_depth > stack.length ) { // Deep enough for a nested list outright //print ( "new nested list" ); list = make_list( m ); last_li.push( list ); last_li = list[1] = [ "listitem" ]; } else { // We aren't deep enough to be strictly a new level. This is // where Md.pl goes nuts. If the indent matches a level in the // stack, put it there, else put it one deeper then the // wanted_depth deserves. var found = false; for ( i = 0; i < stack.length; i++ ) { if ( stack[ i ].indent !== m[1] ) continue; list = stack[ i ].list; stack.splice( i+1, stack.length - (i+1) ); found = true; break; } if (!found) { //print("not found. l:", uneval(l)); wanted_depth++; if ( wanted_depth <= stack.length ) { stack.splice(wanted_depth, stack.length - wanted_depth); //print("Desired depth now", wanted_depth, "stack:", stack.length); list = stack[wanted_depth-1].list; //print("list:", uneval(list) ); } else { //print ("made new stack for messy indent"); list = make_list(m); last_li.push(list); } } //print( uneval(list), "last", list === stack[stack.length-1].list ); last_li = [ "listitem" ]; list.push(last_li); } // end depth of shenegains nl = ""; } // Add content if ( l.length > m[0].length ) li_accumulate += nl + l.substr( m[0].length ); } // tight_search if ( li_accumulate.length ) { var contents = this.processBlock(li_accumulate, []), firstBlock = contents[0]; if (firstBlock) { firstBlock.shift(); contents.splice.apply(contents, [0, 1].concat(firstBlock)); add( last_li, loose, contents, nl ); // Let's not creating a trailing \n after content in the li if(last_li[last_li.length-1] === "\n") { last_li.pop(); } // Loose mode will have been dealt with. Reset it loose = false; li_accumulate = ""; } } // Look at the next block - we might have a loose list. Or an extra // paragraph for the current li var contained = get_contained_blocks( stack.length, next ); // Deal with code blocks or properly nested lists if ( contained.length > 0 ) { // Make sure all listitems up the stack are paragraphs forEach( stack, paragraphify, this); last_li.push.apply( last_li, this.toTree( contained, [] ) ); } var next_block = next[0] && next[0].valueOf() || ""; if ( next_block.match(is_list_re) || next_block.match( /^ / ) ) { block = next.shift(); // Check for an HR following a list: features/lists/hr_abutting var hr = this.dialect.block.horizRule.call( this, block, next ); if ( hr ) { ret.push.apply(ret, hr); break; } // Add paragraphs if the indentation level stays the same if (stack[stack.length-1].indent === block.match(/^\s*/)[0]) { forEach( stack, paragraphify, this); } loose = true; continue loose_search; } break; } // loose_search return ret; }; })(), blockquote: function blockquote( block, next ) { // Handle quotes that have spaces before them var m = /(^|\n) +(\>[\s\S]*)/.exec(block); if (m && m[2] && m[2].length) { var blockContents = block.replace(/(^|\n) +\>/, "$1>"); next.unshift(blockContents); return []; } if ( !block.match( /^>/m ) ) return undefined; var jsonml = []; // separate out the leading abutting block, if any. I.e. in this case: // // a // > b // if ( block[ 0 ] !== ">" ) { var lines = block.split( /\n/ ), prev = [], line_no = block.lineNumber; // keep shifting lines until you find a crotchet while ( lines.length && lines[ 0 ][ 0 ] !== ">" ) { prev.push( lines.shift() ); line_no++; } var abutting = mk_block( prev.join( "\n" ), "\n", block.lineNumber ); jsonml.push.apply( jsonml, this.processBlock( abutting, [] ) ); // reassemble new block of just block quotes! block = mk_block( lines.join( "\n" ), block.trailing, line_no ); } // if the next block is also a blockquote merge it in while ( next.length && next[ 0 ][ 0 ] === ">" ) { var b = next.shift(); block = mk_block( block + block.trailing + b, b.trailing, block.lineNumber ); } // Strip off the leading "> " and re-process as a block. var input = block.replace( /^> ?/gm, "" ), old_tree = this.tree, processedBlock = this.toTree( input, [ "blockquote" ] ), attr = extract_attr( processedBlock ); // If any link references were found get rid of them if ( attr && attr.references ) { delete attr.references; // And then remove the attribute object if it's empty if ( isEmpty( attr ) ) processedBlock.splice( 1, 1 ); } jsonml.push( processedBlock ); return jsonml; }, referenceDefn: function referenceDefn( block, next) { var re = /^\s*\[([^\[\]]+)\]:\s*(\S+)(?:\s+(?:(['"])(.*)\3|\((.*?)\)))?\n?/; // interesting matches are [ , ref_id, url, , title, title ] if ( !block.match(re) ) return undefined; var attrs = create_attrs.call( this ); var b = this.loop_re_over_block(re, block, function( m ) { create_reference(attrs, m); } ); if ( b.length ) next.unshift( mk_block( b, block.trailing ) ); return []; }, para: function para( block ) { // everything's a para! return [ ["para"].concat( this.processInline( block ) ) ]; } }, inline: { __oneElement__: function oneElement( text, patterns_or_re, previous_nodes ) { var m, res; patterns_or_re = patterns_or_re || this.dialect.inline.__patterns__; var re = new RegExp( "([\\s\\S]*?)(" + (patterns_or_re.source || patterns_or_re) + ")" ); m = re.exec( text ); if (!m) { // Just boring text return [ text.length, text ]; } else if ( m[1] ) { // Some un-interesting text matched. Return that first return [ m[1].length, m[1] ]; } var res; if ( m[2] in this.dialect.inline ) { res = this.dialect.inline[ m[2] ].call( this, text.substr( m.index ), m, previous_nodes || [] ); } // Default for now to make dev easier. just slurp special and output it. res = res || [ m[2].length, m[2] ]; return res; }, __call__: function inline( text, patterns ) { var out = [], res; function add(x) { //D:self.debug(" adding output", uneval(x)); if ( typeof x === "string" && typeof out[out.length-1] === "string" ) out[ out.length-1 ] += x; else out.push(x); } while ( text.length > 0 ) { res = this.dialect.inline.__oneElement__.call(this, text, patterns, out ); text = text.substr( res.shift() ); forEach(res, add ); } return out; }, // These characters are interesting elsewhere, so have rules for them so that // chunks of plain text blocks don't include them "]": function () {}, "}": function () {}, __escape__ : /^\\[\\`\*_{}<>\[\]()#\+.!\-]/, "\\": function escaped( text ) { // [ length of input processed, node/children to add... ] // Only esacape: \ ` * _ { } [ ] ( ) # * + - . ! if ( this.dialect.inline.__escape__.exec( text ) ) return [ 2, text.charAt( 1 ) ]; else // Not an esacpe return [ 1, "\\" ]; }, "![": function image( text ) { // Without this guard V8 crashes hard on the RegExp if (text.indexOf('(') >= 0 && text.indexOf(')') === -1) { return; } // Unlike images, alt text is plain text only. no other elements are // allowed in there // ![Alt text](/path/to/img.jpg "Optional title") // 1 2 3 4 <--- captures // // First attempt to use a strong URL regexp to catch things like parentheses. If it misses, use the // old one. var m = text.match(new RegExp("^!\\[(.*?)][ \\t]*\\((" + urlRegexp + ")\\)([ \\t])*([\"'].*[\"'])?")) || text.match( /^!\[(.*?)\][ \t]*\([ \t]*([^")]*?)(?:[ \t]+(["'])(.*?)\3)?[ \t]*\)/ ); if ( m ) { if ( m[2] && m[2][0] === "<" && m[2][m[2].length-1] === ">" ) m[2] = m[2].substring( 1, m[2].length - 1 ); m[2] = this.dialect.inline.__call__.call( this, m[2], /\\/ )[0]; var attrs = { alt: m[1], href: m[2] || "" }; if ( m[4] !== undefined) attrs.title = m[4]; return [ m[0].length, [ "img", attrs ] ]; } // ![Alt text][id] m = text.match( /^!\[(.*?)\][ \t]*\[(.*?)\]/ ); if ( m ) { // We can't check if the reference is known here as it likely wont be // found till after. Check it in md tree->hmtl tree conversion return [ m[0].length, [ "img_ref", { alt: m[1], ref: m[2].toLowerCase(), original: m[0] } ] ]; } // Just consume the '![' return [ 2, "![" ]; }, "[": function link( text ) { var open = 1; for (var i=0; i 3) { return [1, "["]; } } var orig = String(text); // Inline content is possible inside `link text` var res = inline_until_char.call( this, text.substr(1), "]" ); // No closing ']' found. Just consume the [ if ( !res[1] ) { return [ res[0] + 1, text.charAt(0) ].concat(res[2]); } // empty link if ( res[0] === 1 ) { return [ 2, "[]" ]; } var consumed = 1 + res[ 0 ], children = res[ 1 ], link, attrs; // At this point the first [...] has been parsed. See what follows to find // out which kind of link we are (reference or direct url) text = text.substr( consumed ); // [link text](/path/to/img.jpg "Optional title") // 1 2 3 <--- captures // This will capture up to the last paren in the block. We then pull // back based on if there a matching ones in the url // ([here](/url/(test)) // The parens have to be balanced var m = text.match( /^\s*\([ \t]*([^"']*)(?:[ \t]+(["'])(.*?)\2)?[ \t]*\)/ ); if ( m ) { var url = m[1].replace(/\s+$/, ''); consumed += m[0].length; if ( url && url[0] === "<" && url[url.length-1] === ">" ) url = url.substring( 1, url.length - 1 ); // If there is a title we don't have to worry about parens in the url if ( !m[3] ) { var open_parens = 1; // One open that isn't in the capture for ( var len = 0; len < url.length; len++ ) { switch ( url[len] ) { case "(": open_parens++; break; case ")": if ( --open_parens === 0) { consumed -= url.length - len; url = url.substring(0, len); } break; } } } // Process escapes only url = this.dialect.inline.__call__.call( this, url, /\\/ )[0]; attrs = { href: url || "" }; if ( m[3] !== undefined) attrs.title = m[3]; link = [ "link", attrs ].concat( children ); return [ consumed, link ]; } m = text.match(new RegExp("^\\((" + urlRegexp + ")\\)")); if (m && m[1]) { consumed += m[0].length; link = ["link", {href: m[1]}].concat(children); return [consumed, link]; } // [Alt text][id] // [Alt text] [id] m = text.match( /^\s*\[(.*?)\]/ ); if ( m ) { consumed += m[ 0 ].length; // [links][] uses links as its reference attrs = { ref: ( m[ 1 ] || String(children) ).toLowerCase(), original: orig.substr( 0, consumed ) }; if (children && children.length > 0) { link = [ "link_ref", attrs ].concat( children ); // We can't check if the reference is known here as it likely wont be // found till after. Check it in md tree->hmtl tree conversion. // Store the original so that conversion can revert if the ref isn't found. return [ consumed, link ]; } } // Another check for references m = orig.match(/^\s*\[(.*?)\]:\s*(\S+)(?:\s+(?:(['"])(.*?)\3|\((.*?)\)))?\n?/); if (m) { var attrs = create_attrs.call(this); create_reference(attrs, m); return [ m[0].length ]; } // [id] // Only if id is plain (no formatting.) if ( children.length === 1 && typeof children[0] === "string" ) { var normalized = children[0].toLowerCase().replace(/\s+/, ' '); attrs = { ref: normalized, original: orig.substr( 0, consumed ) }; link = [ "link_ref", attrs, children[0] ]; return [ consumed, link ]; } // Just consume the "[" return [ 1, "[" ]; }, "<": function autoLink( text ) { var m; if ( ( m = text.match( /^<(?:((https?|ftp|mailto):[^>]+)|(.*?@.*?\.[a-zA-Z]+))>/ ) ) !== null ) { if ( m[3] ) return [ m[0].length, [ "link", { href: "mailto:" + m[3] }, m[3] ] ]; else if ( m[2] === "mailto" ) return [ m[0].length, [ "link", { href: m[1] }, m[1].substr("mailto:".length ) ] ]; else return [ m[0].length, [ "link", { href: m[1] }, m[1] ] ]; } return [ 1, "<" ]; }, "`": function inlineCode( text ) { // Inline code block. as many backticks as you like to start it // Always skip over the opening ticks. var m = text.match( /(`+)(([\s\S]*?)\1)/ ); if ( m && m[2] ) return [ m[1].length + m[2].length, [ "inlinecode", m[3] ] ]; else { // TODO: No matching end code found - warn! return [ 1, "`" ]; } }, " \n": function lineBreak() { return [ 3, [ "linebreak" ] ]; } } }; // Meta Helper/generator method for em and strong handling function strong_em( tag, md ) { var state_slot = tag + "_state", other_slot = tag === "strong" ? "em_state" : "strong_state"; function CloseTag(len) { this.len_after = len; this.name = "close_" + md; } return function ( text ) { if ( this[state_slot][0] === md ) { // Most recent em is of this type //D:this.debug("closing", md); this[state_slot].shift(); // "Consume" everything to go back to the recursion in the else-block below return[ text.length, new CloseTag(text.length-md.length) ]; } else { // Store a clone of the em/strong states var other = this[other_slot].slice(), state = this[state_slot].slice(); this[state_slot].unshift(md); //D:this.debug_indent += " "; // Recurse var res = this.processInline( text.substr( md.length ) ); //D:this.debug_indent = this.debug_indent.substr(2); var last = res[res.length - 1]; //D:this.debug("processInline from", tag + ": ", uneval( res ) ); var check = this[state_slot].shift(); if ( last instanceof CloseTag ) { res.pop(); // We matched! Huzzah. var consumed = text.length - last.len_after; return [ consumed, [ tag ].concat(res) ]; } else { // Restore the state of the other kind. We might have mistakenly closed it. this[other_slot] = other; this[state_slot] = state; // We can't reuse the processed result as it could have wrong parsing contexts in it. return [ md.length, md ]; } } }; // End returned function } // A helper function to create attributes function create_attrs() { if ( !extract_attr( this.tree ) ) { this.tree.splice( 1, 0, {} ); } var attrs = extract_attr( this.tree ); // make a references hash if it doesn't exist if ( attrs.references === undefined ) { attrs.references = {}; } return attrs; } // Create references for attributes function create_reference(attrs, m) { if ( m[2] && m[2][0] === "<" && m[2][m[2].length-1] === ">" ) m[2] = m[2].substring( 1, m[2].length - 1 ); var ref = attrs.references[ m[1].toLowerCase() ] = { href: m[2] }; if ( m[4] !== undefined ) ref.title = m[4]; else if ( m[5] !== undefined ) ref.title = m[5]; } Gruber.inline["**"] = strong_em("strong", "**"); Gruber.inline["__"] = strong_em("strong", "__"); Gruber.inline["*"] = strong_em("em", "*"); Gruber.inline["_"] = strong_em("em", "_"); Markdown.dialects.Gruber = Gruber; Markdown.buildBlockOrder ( Markdown.dialects.Gruber.block ); Markdown.buildInlinePatterns( Markdown.dialects.Gruber.inline ); return Gruber; }); ================================================ FILE: src/dialects/maruku.js ================================================ if (typeof define !== 'function') { var define = require('amdefine')(module) } define(['../markdown_helpers', './dialect_helpers', './gruber', '../parser'], function (MarkdownHelpers, DialectHelpers, Gruber, Markdown) { var Maruku = DialectHelpers.subclassDialect( Gruber ), extract_attr = MarkdownHelpers.extract_attr, forEach = MarkdownHelpers.forEach; Maruku.processMetaHash = function processMetaHash( meta_string ) { var meta = split_meta_hash( meta_string ), attr = {}; for ( var i = 0; i < meta.length; ++i ) { // id: #foo if ( /^#/.test( meta[ i ] ) ) attr.id = meta[ i ].substring( 1 ); // class: .foo else if ( /^\./.test( meta[ i ] ) ) { // if class already exists, append the new one if ( attr["class"] ) attr["class"] = attr["class"] + meta[ i ].replace( /./, " " ); else attr["class"] = meta[ i ].substring( 1 ); } // attribute: foo=bar else if ( /\=/.test( meta[ i ] ) ) { var s = meta[ i ].split( /\=/ ); attr[ s[ 0 ] ] = s[ 1 ]; } } return attr; }; function split_meta_hash( meta_string ) { var meta = meta_string.split( "" ), parts = [ "" ], in_quotes = false; while ( meta.length ) { var letter = meta.shift(); switch ( letter ) { case " " : // if we're in a quoted section, keep it if ( in_quotes ) parts[ parts.length - 1 ] += letter; // otherwise make a new part else parts.push( "" ); break; case "'" : case '"' : // reverse the quotes and move straight on in_quotes = !in_quotes; break; case "\\" : // shift off the next letter to be used straight away. // it was escaped so we'll keep it whatever it is letter = meta.shift(); /* falls through */ default : parts[ parts.length - 1 ] += letter; break; } } return parts; } Maruku.block.document_meta = function document_meta( block ) { // we're only interested in the first block if ( block.lineNumber > 1 ) return undefined; // document_meta blocks consist of one or more lines of `Key: Value\n` if ( ! block.match( /^(?:\w+:.*\n)*\w+:.*$/ ) ) return undefined; // make an attribute node if it doesn't exist if ( !extract_attr( this.tree ) ) this.tree.splice( 1, 0, {} ); var pairs = block.split( /\n/ ); for ( var p in pairs ) { var m = pairs[ p ].match( /(\w+):\s*(.*)$/ ), key = m[ 1 ].toLowerCase(), value = m[ 2 ]; this.tree[ 1 ][ key ] = value; } // document_meta produces no content! return []; }; Maruku.block.block_meta = function block_meta( block ) { // check if the last line of the block is an meta hash var m = block.match( /(^|\n) {0,3}\{:\s*((?:\\\}|[^\}])*)\s*\}$/ ); if ( !m ) return undefined; // process the meta hash var attr = this.dialect.processMetaHash( m[ 2 ] ), hash; // if we matched ^ then we need to apply meta to the previous block if ( m[ 1 ] === "" ) { var node = this.tree[ this.tree.length - 1 ]; hash = extract_attr( node ); // if the node is a string (rather than JsonML), bail if ( typeof node === "string" ) return undefined; // create the attribute hash if it doesn't exist if ( !hash ) { hash = {}; node.splice( 1, 0, hash ); } // add the attributes in for ( var a in attr ) hash[ a ] = attr[ a ]; // return nothing so the meta hash is removed return []; } // pull the meta hash off the block and process what's left var b = block.replace( /\n.*$/, "" ), result = this.processBlock( b, [] ); // get or make the attributes hash hash = extract_attr( result[ 0 ] ); if ( !hash ) { hash = {}; result[ 0 ].splice( 1, 0, hash ); } // attach the attributes to the block for ( var a in attr ) hash[ a ] = attr[ a ]; return result; }; Maruku.block.definition_list = function definition_list( block, next ) { // one or more terms followed by one or more definitions, in a single block var tight = /^((?:[^\s:].*\n)+):\s+([\s\S]+)$/, list = [ "dl" ], i, m; // see if we're dealing with a tight or loose block if ( ( m = block.match( tight ) ) ) { // pull subsequent tight DL blocks out of `next` var blocks = [ block ]; while ( next.length && tight.exec( next[ 0 ] ) ) blocks.push( next.shift() ); for ( var b = 0; b < blocks.length; ++b ) { var m = blocks[ b ].match( tight ), terms = m[ 1 ].replace( /\n$/, "" ).split( /\n/ ), defns = m[ 2 ].split( /\n:\s+/ ); // print( uneval( m ) ); for ( i = 0; i < terms.length; ++i ) list.push( [ "dt", terms[ i ] ] ); for ( i = 0; i < defns.length; ++i ) { // run inline processing over the definition list.push( [ "dd" ].concat( this.processInline( defns[ i ].replace( /(\n)\s+/, "$1" ) ) ) ); } } } else { return undefined; } return [ list ]; }; // splits on unescaped instances of @ch. If @ch is not a character the result // can be unpredictable Maruku.block.table = function table ( block ) { var _split_on_unescaped = function( s, ch ) { ch = ch || '\\s'; if ( ch.match(/^[\\|\[\]{}?*.+^$]$/) ) ch = '\\' + ch; var res = [ ], r = new RegExp('^((?:\\\\.|[^\\\\' + ch + '])*)' + ch + '(.*)'), m; while ( ( m = s.match( r ) ) ) { res.push( m[1] ); s = m[2]; } res.push(s); return res; }; var leading_pipe = /^ {0,3}\|(.+)\n {0,3}\|\s*([\-:]+[\-| :]*)\n((?:\s*\|.*(?:\n|$))*)(?=\n|$)/, // find at least an unescaped pipe in each line no_leading_pipe = /^ {0,3}(\S(?:\\.|[^\\|])*\|.*)\n {0,3}([\-:]+\s*\|[\-| :]*)\n((?:(?:\\.|[^\\|])*\|.*(?:\n|$))*)(?=\n|$)/, i, m; if ( ( m = block.match( leading_pipe ) ) ) { // remove leading pipes in contents // (header and horizontal rule already have the leading pipe left out) m[3] = m[3].replace(/^\s*\|/gm, ''); } else if ( ! ( m = block.match( no_leading_pipe ) ) ) { return undefined; } var table = [ "table", [ "thead", [ "tr" ] ], [ "tbody" ] ]; // remove trailing pipes, then split on pipes // (no escaped pipes are allowed in horizontal rule) m[2] = m[2].replace(/\|\s*$/, '').split('|'); // process alignment var html_attrs = [ ]; forEach (m[2], function (s) { if (s.match(/^\s*-+:\s*$/)) html_attrs.push({align: "right"}); else if (s.match(/^\s*:-+\s*$/)) html_attrs.push({align: "left"}); else if (s.match(/^\s*:-+:\s*$/)) html_attrs.push({align: "center"}); else html_attrs.push({}); }); // now for the header, avoid escaped pipes m[1] = _split_on_unescaped(m[1].replace(/\|\s*$/, ''), '|'); for (i = 0; i < m[1].length; i++) { table[1][1].push(['th', html_attrs[i] || {}].concat( this.processInline(m[1][i].trim()))); } // now for body contents forEach (m[3].replace(/\|\s*$/mg, '').split('\n'), function (row) { var html_row = ['tr']; row = _split_on_unescaped(row, '|'); for (i = 0; i < row.length; i++) html_row.push(['td', html_attrs[i] || {}].concat(this.processInline(row[i].trim()))); table[2].push(html_row); }, this); return [table]; }; Maruku.inline[ "{:" ] = function inline_meta( text, matches, out ) { if ( !out.length ) return [ 2, "{:" ]; // get the preceeding element var before = out[ out.length - 1 ]; if ( typeof before === "string" ) return [ 2, "{:" ]; // match a meta hash var m = text.match( /^\{:\s*((?:\\\}|[^\}])*)\s*\}/ ); // no match, false alarm if ( !m ) return [ 2, "{:" ]; // attach the attributes to the preceeding element var meta = this.dialect.processMetaHash( m[ 1 ] ), attr = extract_attr( before ); if ( !attr ) { attr = {}; before.splice( 1, 0, attr ); } for ( var k in meta ) attr[ k ] = meta[ k ]; // cut out the string and replace it with nothing return [ m[ 0 ].length, "" ]; }; Markdown.dialects.Maruku = Maruku; Markdown.dialects.Maruku.inline.__escape__ = /^\\[\\`\*_{}\[\]()#\+.!\-|:]/; Markdown.buildBlockOrder ( Markdown.dialects.Maruku.block ); Markdown.buildInlinePatterns( Markdown.dialects.Maruku.inline ); return Maruku; }); ================================================ FILE: src/markdown.js ================================================ if (typeof define !== 'function') { var define = require('amdefine')(module) } // Include all our dependencies and return the resulting library. define(['./parser', './markdown_helpers', './render_tree', './dialects/gruber', './dialects/maruku'], function(Markdown) { return Markdown; }); ================================================ FILE: src/markdown_helpers.js ================================================ if (typeof define !== 'function') { var define = require('amdefine')(module) } define([], function (w) { var MarkdownHelpers = {}; // For Spidermonkey based engines function mk_block_toSource() { return "Markdown.mk_block( " + uneval(this.toString()) + ", " + uneval(this.trailing) + ", " + uneval(this.lineNumber) + " )"; } // node function mk_block_inspect() { var util = require("util"); return "Markdown.mk_block( " + util.inspect(this.toString()) + ", " + util.inspect(this.trailing) + ", " + util.inspect(this.lineNumber) + " )"; } MarkdownHelpers.mk_block = function(block, trail, line) { // Be helpful for default case in tests. if ( arguments.length === 1 ) trail = "\n\n"; // We actually need a String object, not a string primitive /* jshint -W053 */ var s = new String(block); s.trailing = trail; // To make it clear its not just a string s.inspect = mk_block_inspect; s.toSource = mk_block_toSource; if ( line !== undefined ) s.lineNumber = line; return s; }; var isArray = MarkdownHelpers.isArray = Array.isArray || function(obj) { return Object.prototype.toString.call(obj) === "[object Array]"; }; // Don't mess with Array.prototype. Its not friendly if ( Array.prototype.forEach ) { MarkdownHelpers.forEach = function forEach( arr, cb, thisp ) { return arr.forEach( cb, thisp ); }; } else { MarkdownHelpers.forEach = function forEach(arr, cb, thisp) { for (var i = 0; i < arr.length; i++) cb.call(thisp || arr, arr[i], i, arr); }; } MarkdownHelpers.isEmpty = function isEmpty( obj ) { for ( var key in obj ) { if ( hasOwnProperty.call( obj, key ) ) return false; } return true; }; MarkdownHelpers.extract_attr = function extract_attr( jsonml ) { return isArray(jsonml) && jsonml.length > 1 && typeof jsonml[ 1 ] === "object" && !( isArray(jsonml[ 1 ]) ) ? jsonml[ 1 ] : undefined; }; return MarkdownHelpers; }); ================================================ FILE: src/parser.js ================================================ if (typeof define !== 'function') { var define = require('amdefine')(module) } define(['./markdown_helpers', './core'], function(MarkdownHelpers, Markdown) { // Imported functions var mk_block = Markdown.mk_block = MarkdownHelpers.mk_block, isArray = MarkdownHelpers.isArray; /** * parse( markdown, [dialect] ) -> JsonML * - markdown (String): markdown string to parse * - dialect (String | Dialect): the dialect to use, defaults to gruber * * Parse `markdown` and return a markdown document as a Markdown.JsonML tree. **/ Markdown.parse = function( source, dialect ) { // dialect will default if undefined var md = new Markdown( dialect ); return md.toTree( source ); }; /** * count_lines( str ) -> count * - str (String): String whose lines we want to count * * Counts the number of linebreaks in `str` **/ function count_lines( str ) { return str.split("\n").length - 1; } // Internal - split source into rough blocks Markdown.prototype.split_blocks = function splitBlocks( input ) { // Normalize linebreaks to \n. input = input.replace(/\r\n?/g, "\n"); // Match until the end of the string, a newline followed by #, or two or more newlines. // [\s\S] matches _anything_ (newline or space) // [^] is equivalent but doesn't work in IEs. var re = /([\s\S]+?)($|\n#|\n(?:\s*\n|$)+)/g, blocks = [], m; var line_no = 1; if ( ( m = /^(\s*\n)/.exec(input) ) !== null ) { // skip (but count) leading blank lines line_no += count_lines( m[0] ); re.lastIndex = m[0].length; } while ( ( m = re.exec(input) ) !== null ) { if (m[2] === "\n#") { m[2] = "\n"; re.lastIndex--; } blocks.push( mk_block( m[1], m[2], line_no ) ); line_no += count_lines( m[0] ); } return blocks; }; /** * Markdown#processBlock( block, next ) -> undefined | [ JsonML, ... ] * - block (String): the block to process * - next (Array): the following blocks * * Process `block` and return an array of JsonML nodes representing `block`. * * It does this by asking each block level function in the dialect to process * the block until one can. Succesful handling is indicated by returning an * array (with zero or more JsonML nodes), failure by a false value. * * Blocks handlers are responsible for calling [[Markdown#processInline]] * themselves as appropriate. * * If the blocks were split incorrectly or adjacent blocks need collapsing you * can adjust `next` in place using shift/splice etc. * * If any of this default behaviour is not right for the dialect, you can * define a `__call__` method on the dialect that will get invoked to handle * the block processing. */ Markdown.prototype.processBlock = function processBlock( block, next ) { var cbs = this.dialect.block, ord = cbs.__order__; if ( "__call__" in cbs ) return cbs.__call__.call(this, block, next); for ( var i = 0; i < ord.length; i++ ) { //D:this.debug( "Testing", ord[i] ); var res = cbs[ ord[i] ].call( this, block, next ); if ( res ) { if ( !isArray(res) || ( res.length > 0 && !( isArray(res[0]) ) && ( typeof res[0] !== "string")) ) { this.debug(ord[i], "didn't return proper JsonML"); } return res; } } // Uhoh! no match! Should we throw an error? return []; }; Markdown.prototype.processInline = function processInline( block ) { return this.dialect.inline.__call__.call( this, String( block ) ); }; /** * Markdown#toTree( source ) -> JsonML * - source (String): markdown source to parse * * Parse `source` into a JsonML tree representing the markdown document. **/ // custom_tree means set this.tree to `custom_tree` and restore old value on return Markdown.prototype.toTree = function toTree( source, custom_root ) { var blocks = source instanceof Array ? source : this.split_blocks( source ); // Make tree a member variable so its easier to mess with in extensions var old_tree = this.tree; try { this.tree = custom_root || this.tree || [ "markdown" ]; blocks_loop: while ( blocks.length ) { var b = this.processBlock( blocks.shift(), blocks ); // Reference blocks and the like won't return any content if ( !b.length ) continue blocks_loop; this.tree.push.apply( this.tree, b ); } return this.tree; } finally { if ( custom_root ) this.tree = old_tree; } }; // Noop by default Markdown.prototype.debug = function () { var args = Array.prototype.slice.call( arguments); args.unshift(this.debug_indent); if ( typeof print !== "undefined" ) print.apply( print, args ); if ( typeof console !== "undefined" && typeof console.log !== "undefined" ) console.log.apply( null, args ); }; Markdown.prototype.loop_re_over_block = function( re, block, cb ) { // Dont use /g regexps with this var m, b = block.valueOf(); while ( b.length && (m = re.exec(b) ) !== null ) { b = b.substr( m[0].length ); cb.call(this, m); } return b; }; // Build default order from insertion order. Markdown.buildBlockOrder = function(d) { var ord = []; for ( var i in d ) { if ( i === "__order__" || i === "__call__" ) continue; ord.push( i ); } d.__order__ = ord; }; // Build patterns for inline matcher Markdown.buildInlinePatterns = function(d) { var patterns = []; for ( var i in d ) { // __foo__ is reserved and not a pattern if ( i.match( /^__.*__$/) ) continue; var l = i.replace( /([\\.*+?^$|()\[\]{}])/g, "\\$1" ) .replace( /\n/, "\\n" ); patterns.push( i.length === 1 ? l : "(?:" + l + ")" ); } patterns = patterns.join("|"); d.__patterns__ = patterns; //print("patterns:", uneval( patterns ) ); var fn = d.__call__; d.__call__ = function(text, pattern) { if ( pattern !== undefined ) return fn.call(this, text, pattern); else return fn.call(this, text, patterns); }; }; return Markdown; }); ================================================ FILE: src/render_tree.js ================================================ if (typeof define !== 'function') { var define = require('amdefine')(module); } define(['./core', './markdown_helpers'], function(Markdown, MarkdownHelpers) { var extract_attr = MarkdownHelpers.extract_attr; /** * renderJsonML( jsonml[, options] ) -> String * - jsonml (Array): JsonML array to render to XML * - options (Object): options * * Converts the given JsonML into well-formed XML. * * The options currently understood are: * * - root (Boolean): wether or not the root node should be included in the * output, or just its children. The default `false` is to not include the * root itself. */ Markdown.renderJsonML = function( jsonml, options ) { options = options || {}; // include the root element in the rendered output? options.root = options.root || false; jsonml = JSON.parse(JSON.stringify(jsonml)); // Clone to prevent mutation of original reference. var content = []; if ( options.root ) { content.push( render_tree( jsonml ) ); } else { jsonml.shift(); // get rid of the tag if ( jsonml.length && typeof jsonml[ 0 ] === "object" && !( jsonml[ 0 ] instanceof Array ) ) jsonml.shift(); // get rid of the attributes while ( jsonml.length ) content.push( render_tree( jsonml.shift() ) ); } return content.join( "\n\n" ); }; /** * toHTMLTree( markdown, [dialect] ) -> JsonML * toHTMLTree( md_tree ) -> JsonML * - markdown (String): markdown string to parse * - dialect (String | Dialect): the dialect to use, defaults to gruber * - md_tree (Markdown.JsonML): parsed markdown tree * * Turn markdown into HTML, represented as a JsonML tree. If a string is given * to this function, it is first parsed into a markdown tree by calling * [[parse]]. **/ Markdown.toHTMLTree = function toHTMLTree( input, dialect , options ) { // convert string input to an MD tree if ( typeof input === "string" ) input = this.parse( input, dialect ); // Now convert the MD tree to an HTML tree // remove references from the tree var attrs = extract_attr( input ), refs = {}; if ( attrs && attrs.references ) refs = attrs.references; var html = convert_tree_to_html( input, refs , options ); merge_text_nodes( html ); return html; }; /** * toHTML( markdown, [dialect] ) -> String * toHTML( md_tree ) -> String * - markdown (String): markdown string to parse * - md_tree (Markdown.JsonML): parsed markdown tree * * Take markdown (either as a string or as a JsonML tree) and run it through * [[toHTMLTree]] then turn it into a well-formated HTML fragment. **/ Markdown.toHTML = function toHTML( source , dialect , options ) { var input = this.toHTMLTree( source , dialect , options ); return this.renderJsonML( input ); }; function escapeHTML( text ) { if (text && text.length > 0) { return text.replace( /&/g, "&" ) .replace( //g, ">" ) .replace( /"/g, """ ) .replace( /'/g, "'" ); } else { return ""; } } function render_tree( jsonml ) { // basic case if ( typeof jsonml === "string" ) return escapeHTML( jsonml ); var tag = jsonml.shift(), attributes = {}, content = []; if ( jsonml.length && typeof jsonml[ 0 ] === "object" && !( jsonml[ 0 ] instanceof Array ) ) attributes = jsonml.shift(); while ( jsonml.length ) content.push( render_tree( jsonml.shift() ) ); var tag_attrs = ""; if (typeof attributes.src !== 'undefined') { tag_attrs += ' src="' + escapeHTML( attributes.src ) + '"'; delete attributes.src; } for ( var a in attributes ) { var escaped = escapeHTML( attributes[ a ]); if (escaped && escaped.length) { tag_attrs += " " + a + '="' + escaped + '"'; } } // be careful about adding whitespace here for inline elements if ( tag === "img" || tag === "br" || tag === "hr" ) return "<"+ tag + tag_attrs + "/>"; else return "<"+ tag + tag_attrs + ">" + content.join( "" ) + ""; } function convert_tree_to_html( tree, references, options ) { var i; options = options || {}; // shallow clone var jsonml = tree.slice( 0 ); if ( typeof options.preprocessTreeNode === "function" ) jsonml = options.preprocessTreeNode(jsonml, references); // Clone attributes if they exist var attrs = extract_attr( jsonml ); if ( attrs ) { jsonml[ 1 ] = {}; for ( i in attrs ) { jsonml[ 1 ][ i ] = attrs[ i ]; } attrs = jsonml[ 1 ]; } // basic case if ( typeof jsonml === "string" ) return jsonml; // convert this node switch ( jsonml[ 0 ] ) { case "header": jsonml[ 0 ] = "h" + jsonml[ 1 ].level; delete jsonml[ 1 ].level; break; case "bulletlist": jsonml[ 0 ] = "ul"; break; case "numberlist": jsonml[ 0 ] = "ol"; break; case "listitem": jsonml[ 0 ] = "li"; break; case "para": jsonml[ 0 ] = "p"; break; case "markdown": jsonml[ 0 ] = "html"; if ( attrs ) delete attrs.references; break; case "code_block": jsonml[ 0 ] = "pre"; i = attrs ? 2 : 1; var code = [ "code" ]; code.push.apply( code, jsonml.splice( i, jsonml.length - i ) ); jsonml[ i ] = code; break; case "inlinecode": jsonml[ 0 ] = "code"; break; case "img": jsonml[ 1 ].src = jsonml[ 1 ].href; delete jsonml[ 1 ].href; break; case "linebreak": jsonml[ 0 ] = "br"; break; case "link": jsonml[ 0 ] = "a"; break; case "link_ref": jsonml[ 0 ] = "a"; // grab this ref and clean up the attribute node var ref = references[ attrs.ref ]; // if the reference exists, make the link if ( ref ) { delete attrs.ref; // add in the href and title, if present attrs.href = ref.href; if ( ref.title ) attrs.title = ref.title; // get rid of the unneeded original text delete attrs.original; } // the reference doesn't exist, so revert to plain text else { return attrs.original; } break; case "img_ref": jsonml[ 0 ] = "img"; // grab this ref and clean up the attribute node var ref = references[ attrs.ref ]; // if the reference exists, make the link if ( ref ) { delete attrs.ref; // add in the href and title, if present attrs.src = ref.href; if ( ref.title ) attrs.title = ref.title; // get rid of the unneeded original text delete attrs.original; } // the reference doesn't exist, so revert to plain text else { return attrs.original; } break; } // convert all the children i = 1; // deal with the attribute node, if it exists if ( attrs ) { // if there are keys, skip over it for ( var key in jsonml[ 1 ] ) { i = 2; break; } // if there aren't, remove it if ( i === 1 ) jsonml.splice( i, 1 ); } for ( ; i < jsonml.length; ++i ) { jsonml[ i ] = convert_tree_to_html( jsonml[ i ], references, options ); } return jsonml; } // merges adjacent text nodes into a single node function merge_text_nodes( jsonml ) { // skip the tag name and attribute hash var i = extract_attr( jsonml ) ? 2 : 1; while ( i < jsonml.length ) { // if it's a string check the next item too if ( typeof jsonml[ i ] === "string" ) { if ( i + 1 < jsonml.length && typeof jsonml[ i + 1 ] === "string" ) { // merge the second string into the first and remove it jsonml[ i ] += jsonml.splice( i + 1, 1 )[ 0 ]; } else { ++i; } } // if it's not a string recurse else { merge_text_nodes( jsonml[ i ] ); ++i; } } } return Markdown; }); ================================================ FILE: test/features/blockquotes/contains_code.json ================================================ ["html", ["blockquote", ["p", "There's a code block in here:" ], ["pre", ["code", "SET foo = TRUE\n\nIF foo GOTO 10" ] ], ["p", "Wasn't that nice?" ] ] ] ================================================ FILE: test/features/blockquotes/contains_code.text ================================================ > There's a code block in here: > > SET foo = TRUE > > IF foo GOTO 10 > > Wasn't that nice? ================================================ FILE: test/features/blockquotes/lazy_wrapping.json ================================================ ["html", ["blockquote", ["p", "If you're too lazy\nto wrap your code nicely" ], ["p", "This will still work" ] ] ] ================================================ FILE: test/features/blockquotes/lazy_wrapping.text ================================================ > If you're too lazy to wrap your code nicely > This will still work ================================================ FILE: test/features/blockquotes/leading_paras.json ================================================ ["html", ["p", "Amy wrote:" ], ["blockquote", ["p", "No wai?" ] ], ["p", "Bob wrote:" ], ["blockquote", ["p", "Ya rly!" ] ] ] ================================================ FILE: test/features/blockquotes/leading_paras.text ================================================ Amy wrote: > No wai? Bob wrote: > Ya rly! ================================================ FILE: test/features/blockquotes/nested.json ================================================ ["html", ["blockquote", ["p", "One" ], ["blockquote", ["p", "Two" ] ], ["p", "Three" ] ] ] ================================================ FILE: test/features/blockquotes/nested.text ================================================ > One > > > Two > > Three ================================================ FILE: test/features/blockquotes/simple.json ================================================ ["html", ["blockquote", ["p", "Blockquote" ] ] ] ================================================ FILE: test/features/blockquotes/simple.text ================================================ > Blockquote ================================================ FILE: test/features/blockquotes/spaceless.json ================================================ ["html", ["blockquote", ["p", "blockquote\nwithout spaces" ] ] ] ================================================ FILE: test/features/blockquotes/spaceless.text ================================================ >blockquote >without spaces ================================================ FILE: test/features/blockquotes/spaces_before.json ================================================ ["html", ["blockquote", ["p", "evil" ] ] ] ================================================ FILE: test/features/blockquotes/spaces_before.text ================================================ > evil ================================================ FILE: test/features/blockquotes/threequotes.json ================================================ [ "html", [ "blockquote", [ "p", "this is" ], [ "p", "three" ], [ "p", "quotes" ] ] ] ================================================ FILE: test/features/blockquotes/threequotes.text ================================================ > this is > three > quotes ================================================ FILE: test/features/code/blank_lines.json ================================================ ["html", ["p", "This block is composed of three lines:" ], ["pre", ["code", "one\n\nthree" ] ], ["p", "This block is composed of 5" ], ["pre", ["code", "one\n\n\nfour" ] ], ["p", "This block is composed of 2" ], ["pre", ["code", "two" ] ] ] ================================================ FILE: test/features/code/blank_lines.text ================================================ This block is composed of three lines: one three This block is composed of 5 one four This block is composed of 2 two ================================================ FILE: test/features/code/block.json ================================================ ["html", ["p", "Here is an example of AppleScript:" ], ["pre", ["code", "tell application \"Foo\"\n beep\nend tell\n\ttab" ] ] ] ================================================ FILE: test/features/code/block.text ================================================ Here is an example of AppleScript: tell application "Foo" beep end tell tab ================================================ FILE: test/features/code/embedded_backtick.json ================================================ ["html", ["p", "This is a ", ["code", "code span with an `embedded` backtick"], "." ] ] ================================================ FILE: test/features/code/embedded_backtick.text ================================================ This is a ``code span with an `embedded` backtick``. ================================================ FILE: test/features/code/horizontal_rules.json ================================================ ["html", ["pre", ["code", "fsfsfsf\n* * *\n\n***\n\n*****\n\n- - -\n\n---------------------------------------" ] ] ] ================================================ FILE: test/features/code/horizontal_rules.text ================================================ fsfsfsf * * * *** ***** - - - --------------------------------------- ================================================ FILE: test/features/code/in_lists.json ================================================ ["html", ["ul", ["li", ["p", "Loose list" ], ["pre", ["code", "some code\n\nmore code" ] ] ] ] ] ================================================ FILE: test/features/code/in_lists.text ================================================ * Loose list some code more code ================================================ FILE: test/features/code/inline.json ================================================ ["html", ["p", ["code", "This" ], " is a code span." ] ] ================================================ FILE: test/features/code/inline.text ================================================ `This` is a code span. ================================================ FILE: test/features/code/inline_multiline.json ================================================ ["html", ["p", "foo ", ["code", "code\ncode" ], " bar" ] ] ================================================ FILE: test/features/code/inline_multiline.text ================================================ foo `code code` bar ================================================ FILE: test/features/code/trailing_para.json ================================================ ["html", ["p", "Paragraph above" ], ["pre", ["code", "Code block" ] ], ["p", "Paragraph below" ] ] ================================================ FILE: test/features/code/trailing_para.text ================================================ Paragraph above Code block Paragraph below ================================================ FILE: test/features/code/with_greater_than.json ================================================ ["html", ["pre", ["code", "> meep"] ] ] ================================================ FILE: test/features/code/with_greater_than.text ================================================ > meep ================================================ FILE: test/features/definition_lists/inline.json ================================================ ["html", ["dl", ["dt", "a term" ], ["dd", ["em", "emphasised" ], " definition." ], ["dt", "another term" ], ["dd", ["strong", "strong" ], " definition." ] ] ] ================================================ FILE: test/features/definition_lists/inline.text ================================================ a term : *emphasised* definition. another term : **strong** definition. ================================================ FILE: test/features/definition_lists/long.json ================================================ ["html", ["dl", ["dt", "first term" ], ["dd", "the quick brown fox jumps\nover the lazy dog" ], ["dt", "second term" ], ["dd", "pack my box with five\ndozen liquor jugs" ] ] ] ================================================ FILE: test/features/definition_lists/long.text ================================================ first term : the quick brown fox jumps over the lazy dog second term : pack my box with five dozen liquor jugs ================================================ FILE: test/features/definition_lists/multiple_definitions.json ================================================ ["html", ["dl", ["dt", "fruit" ], ["dd", "apple" ], ["dd", "banana" ], ["dd", "pear" ], ["dt", "animal" ], ["dd", "cow" ], ["dd", "duck" ], ["dd", "horse" ] ] ] ================================================ FILE: test/features/definition_lists/multiple_definitions.text ================================================ fruit : apple : banana : pear animal : cow : duck : horse ================================================ FILE: test/features/definition_lists/multiple_terms.json ================================================ ["html", ["dl", ["dt", "fruit" ], ["dt", "vegetable" ], ["dd", "tomato" ], ["dt", "animal" ], ["dt", "mineral" ], ["dd", "pet rock" ] ] ] ================================================ FILE: test/features/definition_lists/multiple_terms.text ================================================ fruit vegetable : tomato animal mineral : pet rock ================================================ FILE: test/features/definition_lists/tight.json ================================================ ["html", ["dl", ["dt", "one" ], ["dd", "alpha" ], ["dt", "two" ], ["dd", "beta" ], ["dt", "three" ], ["dd", "gamma" ] ] ] ================================================ FILE: test/features/definition_lists/tight.text ================================================ one : alpha two : beta three : gamma ================================================ FILE: test/features/emphasis/multiple_lines.json ================================================ ["html", ["p", "You can ", ["em", "start emphasis on one line,\nand finish it" ], " on another." ] ] ================================================ FILE: test/features/emphasis/multiple_lines.text ================================================ You can *start emphasis on one line, and finish it* on another. ================================================ FILE: test/features/emphasis/nested.json ================================================ ["html", ["p", "You can ", ["strong", "nest ", ["em", "em" ], " inside strong" ], "." ], ["p", "You can ", ["em", "nest ", ["strong", "strong" ], " inside em" ], "." ] ] ================================================ FILE: test/features/emphasis/nested.text ================================================ You can **nest *em* inside strong**. You can *nest **strong** inside em*. ================================================ FILE: test/features/emphasis/simple.json ================================================ ["html", ["p", "Emphasis can be ", ["em", "weak" ], " or ", ["strong", "strong" ], "." ], ["p", "It can ", ["em", "even" ], " use ", ["strong", "underscores" ], "." ] ] ================================================ FILE: test/features/emphasis/simple.text ================================================ Emphasis can be *weak* or **strong**. It can _even_ use __underscores__. ================================================ FILE: test/features/headers/atx.json ================================================ ["html", ["h1", "One" ], ["h2", "Two" ], ["h3", "Three" ], ["h4", "Four" ], ["h5", "Five" ], ["h6", "Six" ] ] ================================================ FILE: test/features/headers/atx.text ================================================ # One ## Two ### Three #### Four ##### Five ###### Six ================================================ FILE: test/features/headers/atx_closing_hashes.json ================================================ ["html", ["h1", "One" ], ["h2", "Two" ], ["h3", "Three" ] ] ================================================ FILE: test/features/headers/atx_closing_hashes.text ================================================ # One # ## Two ##### ### Three ## ================================================ FILE: test/features/headers/inline.json ================================================ ["html", ["h2", ["strong", "Bold"] ] ] ================================================ FILE: test/features/headers/inline.text ================================================ **Bold** -------- ================================================ FILE: test/features/headers/setext.json ================================================ ["html", ["h1", "One" ], ["h2", "Two" ] ] ================================================ FILE: test/features/headers/setext.text ================================================ One === Two --- ================================================ FILE: test/features/headers/trailing_paras.json ================================================ ["html", ["h1", "Header" ], ["p", "Paragraph" ], ["h2", "Header" ], ["p", "Paragraph" ], ["h3", "Header" ], ["p", "Paragraph" ] ] ================================================ FILE: test/features/headers/trailing_paras.text ================================================ Header ====== Paragraph Header ------ Paragraph ### Header Paragraph ================================================ FILE: test/features/horizontal_rules/abutting_blocks.json ================================================ ["html", ["p", "para" ], ["hr"], ["ul", ["li", "list" ] ], ["hr"], ["ul", ["li", "list before para" ] ], ["p", " para" ], ["hr"], ["blockquote", ["p", "blockquote" ] ] ] ================================================ FILE: test/features/horizontal_rules/abutting_blocks.text ================================================ para *** * list - - - * list before para para - - - > blockquote ================================================ FILE: test/features/horizontal_rules/dashes.json ================================================ ["html", ["hr"] ] ================================================ FILE: test/features/horizontal_rules/dashes.text ================================================ --- ================================================ FILE: test/features/horizontal_rules/front_matter.json ================================================ ["html", ["hr"], ["p", "layout: post\ntitle: A title" ], ["hr"], ["p", "Pack my box with five dozen liquor jugs." ] ] ================================================ FILE: test/features/horizontal_rules/front_matter.text ================================================ --- layout: post title: A title --- Pack my box with five dozen liquor jugs. ================================================ FILE: test/features/horizontal_rules/leading_spaces.json ================================================ ["html", ["hr"] ] ================================================ FILE: test/features/horizontal_rules/leading_spaces.text ================================================ * * * ================================================ FILE: test/features/horizontal_rules/long.json ================================================ ["html", ["hr"] ] ================================================ FILE: test/features/horizontal_rules/long.text ================================================ ********************* ================================================ FILE: test/features/horizontal_rules/long_loose.json ================================================ ["html", ["hr"] ] ================================================ FILE: test/features/horizontal_rules/long_loose.text ================================================ * * * * * * * * * * * ================================================ FILE: test/features/horizontal_rules/loose_dashes.json ================================================ ["html", ["hr"] ] ================================================ FILE: test/features/horizontal_rules/loose_dashes.text ================================================ - - - ================================================ FILE: test/features/horizontal_rules/loose_stars.json ================================================ ["html", ["hr"] ] ================================================ FILE: test/features/horizontal_rules/loose_stars.text ================================================ * * * ================================================ FILE: test/features/horizontal_rules/loose_underscores.json ================================================ ["html", ["hr"] ] ================================================ FILE: test/features/horizontal_rules/loose_underscores.text ================================================ _ _ _ ================================================ FILE: test/features/horizontal_rules/stars.json ================================================ ["html", ["hr"] ] ================================================ FILE: test/features/horizontal_rules/stars.text ================================================ *** ================================================ FILE: test/features/horizontal_rules/underscores.json ================================================ ["html", ["hr"] ] ================================================ FILE: test/features/horizontal_rules/underscores.text ================================================ ___ ================================================ FILE: test/features/images/basic.json ================================================ ["html", ["p", ["img", { "src": "/path/to/img.jpg", "alt": "Alt text" } ] ] ] ================================================ FILE: test/features/images/basic.text ================================================ ![Alt text](/path/to/img.jpg) ================================================ FILE: test/features/images/crotcheted_url.json ================================================ ["html", ["p", ["img", { "src": "/url/", "alt": "alt text" } ] ] ] ================================================ FILE: test/features/images/crotcheted_url.text ================================================ ![alt text]() ================================================ FILE: test/features/images/crotcheted_url_with_title.json ================================================ ["html", ["p", ["img", { "src": "/url/", "alt": "alt text", "title": "with a title" } ] ] ] ================================================ FILE: test/features/images/crotcheted_url_with_title.text ================================================ ![alt text]( "with a title") ================================================ FILE: test/features/images/empty.json ================================================ ["html", ["p", ["img", { "src": "", "alt": "Empty" } ] ] ] ================================================ FILE: test/features/images/empty.text ================================================ ![Empty]() ================================================ FILE: test/features/images/incomplete_image.json ================================================ [ "html", [ "p", "![alert](http://cdn.eviltrout.com/images/trout.png" ] ] ================================================ FILE: test/features/images/incomplete_image.text ================================================ ![alert](http://cdn.eviltrout.com/images/trout.png ================================================ FILE: test/features/images/inside_link.json ================================================ ["html", ["p", ["a", { "href": "https://link-url" }, ["img", { "alt": "alt", "src": "https://img-url" } ] ] ] ] ================================================ FILE: test/features/images/inside_link.text ================================================ [![alt](https://img-url)](https://link-url) ================================================ FILE: test/features/images/ref.json ================================================ ["html", ["p", ["img", { "src": "/path/to/img.jpg", "alt": "Alt text" } ] ] ] ================================================ FILE: test/features/images/ref.text ================================================ ![Alt text] [img] [img]: /path/to/img.jpg ================================================ FILE: test/features/images/spaces_in_href.json ================================================ ["html", ["p", ["img", { "src": "path to img.jpg", "alt": "Alt text" } ] ] ] ================================================ FILE: test/features/images/spaces_in_href.text ================================================ ![Alt text](path to img.jpg) ================================================ FILE: test/features/images/spaces_round_title.json ================================================ ["html", ["p", ["img", { "src": "/url/", "alt": "alt text", "title": "title has spaces afterward" } ] ] ] ================================================ FILE: test/features/images/spaces_round_title.text ================================================ ![alt text](/url/ "title has spaces afterward" ) ================================================ FILE: test/features/images/title.json ================================================ ["html", ["p", ["img", { "src": "/path/to/img.jpg", "alt": "Alt text", "title": "Optional title" } ] ] ] ================================================ FILE: test/features/images/title.text ================================================ ![Alt text](/path/to/img.jpg "Optional title") ================================================ FILE: test/features/linebreaks/simple.json ================================================ ["html", ["p", "The quick brown fox", ["br"], "jumps over the lazy dog." ] ] ================================================ FILE: test/features/linebreaks/simple.text ================================================ The quick brown fox jumps over the lazy dog. ================================================ FILE: test/features/links/apostrophe.json ================================================ ["html", ["p", ["a", { "href" : "http://wiki.postgresql.org/wiki/What's_new_in_PostgreSQL_9.3" }, "Postgres 9.3" ] ] ] ================================================ FILE: test/features/links/apostrophe.text ================================================ [Postgres 9.3](http://wiki.postgresql.org/wiki/What's_new_in_PostgreSQL_9.3) ================================================ FILE: test/features/links/autolink_email.json ================================================ ["html", ["p", "Email addresses written like ", ["a", { "href" : "mailto:bill@microsoft.com" }, "bill@microsoft.com" ], " get autolinkified." ] ] ================================================ FILE: test/features/links/autolink_email.text ================================================ Email addresses written like get autolinkified. ================================================ FILE: test/features/links/autolink_in_code.json ================================================ ["html", ["p", "Autolinks don't happen inside code: ", ["code", "" ] ] ] ================================================ FILE: test/features/links/autolink_in_code.text ================================================ Autolinks don't happen inside code: `` ================================================ FILE: test/features/links/autolink_url.json ================================================ ["html", ["p", "URLs like ", ["a", { "href" : "http://google.com" }, "http://google.com" ], " get autolinkified." ] ] ================================================ FILE: test/features/links/autolink_url.text ================================================ URLs like get autolinkified. ================================================ FILE: test/features/links/broken_brackets.json ================================================ ["html", ["p", "[[][]"] ] ================================================ FILE: test/features/links/broken_brackets.text ================================================ [[][] ================================================ FILE: test/features/links/broken_link.json ================================================ ["html", ["p", "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]"] ] ================================================ FILE: test/features/links/broken_link.text ================================================ [[[[[[[[[[[[[[[[[[[[[[[[[[[[[] ================================================ FILE: test/features/links/case_insensitive.json ================================================ ["html", ["p", "This is ", ["a", { "href" : "http://google.com" }, "google" ], ". ", ["a", { "href" : "http://google.com" }, "Google" ], " and ", ["a", { "href" : "http://google.com" }, "this" ], " are the same thing too" ] ] ================================================ FILE: test/features/links/case_insensitive.text ================================================ This is [google]. [Google] and [this][GoOgLe] are the same thing too [GOOGLE]: http://google.com ================================================ FILE: test/features/links/escaped_broken_link.json ================================================ ["html", ["p", "[][][][][][][][][][][][][][][][][][][][][]"] ] ================================================ FILE: test/features/links/escaped_broken_link.text ================================================ [\][\][\][\][\][\][\][\][\][\][\][\][\][\][\][\][\][\][\][\][\] ================================================ FILE: test/features/links/implicit.json ================================================ ["html", ["p", "These ", ["a", { "href" : "http://links.com" }, "links" ], " use ", ["a", { "href" : "http://implicit.com" }, "implicit" ], " references." ] ] ================================================ FILE: test/features/links/implicit.text ================================================ These [links][] use [implicit] references. [links]: http://links.com [implicit]: http://implicit.com ================================================ FILE: test/features/links/in_blockquotes.json ================================================ ["html", ["blockquote", ["p", "Let's fork this repo!" ], ["p", "[markdown][]" ] ] ] ================================================ FILE: test/features/links/in_blockquotes.text ================================================ > Let's fork this repo! > > [markdown][] > > [markdown]: https://github.com/evilstreak/markdown-js ================================================ FILE: test/features/links/in_brackets.json ================================================ ["html", ["p", "Lorem ipsum (", ["a", {"href": "http://www.lipsum.com/"}, "lorem ipsum"], ") dolar sit amut" ], ["p", "(", ["a", {"href": "/url()((test))"}, "Inline link"], ")" ] ] ================================================ FILE: test/features/links/in_brackets.text ================================================ Lorem ipsum ([lorem ipsum](http://www.lipsum.com/)) dolar sit amut ([Inline link](/url()((test)))) ================================================ FILE: test/features/links/inline.json ================================================ ["html", ["p", "An ", ["a", { "href" : "http://inline.com" }, "inline" ], " link." ] ] ================================================ FILE: test/features/links/inline.text ================================================ An [inline](http://inline.com) link. ================================================ FILE: test/features/links/inline_with_newline.json ================================================ ["html", ["p", "An ", ["a", { "href" : "http://inline.com" }, "inline\nlink" ], " with a newline." ] ] ================================================ FILE: test/features/links/inline_with_newline.text ================================================ An [inline link](http://inline.com) with a newline. ================================================ FILE: test/features/links/inline_with_title.json ================================================ ["html", ["p", "An ", ["a", { "href" : "http://inline.com", "title" : "le title" }, "inline link" ], " with a title." ] ] ================================================ FILE: test/features/links/inline_with_title.text ================================================ An [inline link](http://inline.com "le title") with a title. ================================================ FILE: test/features/links/missing_references.json ================================================ ["html", ["p", "Link with [missing][id] reference" ], ["p", "Link with [empty][] reference" ], ["p", "Link with [inferred] reference" ] ] ================================================ FILE: test/features/links/missing_references.text ================================================ Link with [missing][id] reference Link with [empty][] reference Link with [inferred] reference ================================================ FILE: test/features/links/no_closing.json ================================================ ["html", ["p", "[[1]" ] ] ================================================ FILE: test/features/links/no_closing.text ================================================ [[1] ================================================ FILE: test/features/links/parens_escaped_inline.json ================================================ ["html", ["p", ["a", { "href": "/url(test)", "title": "title" }, "Inline link" ], " with escaped parens." ] ] ================================================ FILE: test/features/links/parens_escaped_inline.text ================================================ [Inline link](/url\(test\) "title") with escaped parens. ================================================ FILE: test/features/links/parens_inline.json ================================================ ["html", ["p", ["a", { "href": "/url(test)", "title": "title" }, "Inline link" ], " with non-escaped parens." ] ] ================================================ FILE: test/features/links/parens_inline.text ================================================ [Inline link](/url(test) "title") with non-escaped parens. ================================================ FILE: test/features/links/parens_reference.json ================================================ ["html", ["p", ["a", { "href": "/url(test)", "title": "title" }, "Reference link" ], " with non-escaped parens." ] ] ================================================ FILE: test/features/links/parens_reference.text ================================================ [Reference link][1] with non-escaped parens. [1]: /url(test) "title" ================================================ FILE: test/features/links/ref_reuse.json ================================================ ["html", ["p", "Two ", ["a", { "href" : "http://google.com" }, "links" ], ", one ", ["a", { "href" : "http://google.com" }, "ref" ] ] ] ================================================ FILE: test/features/links/ref_reuse.text ================================================ Two [links][id], one [ref][id] [id]: http://google.com ================================================ FILE: test/features/links/ref_with_image_ref.json ================================================ ["html", ["p", ["a", {"href": "http://link_url"}, ["img", {"src": "http://image_url", "alt": "alt text"} ] ] ] ] ================================================ FILE: test/features/links/ref_with_image_ref.text ================================================ [![alt text][id_2]][id_1] [id_1]: http://link_url [id_2]: http://image_url ================================================ FILE: test/features/links/reference.json ================================================ ["html", ["p", "A ", ["a", { "href" : "http://reference.com" }, "link using a reference" ], "." ] ] ================================================ FILE: test/features/links/reference.text ================================================ A [link using a reference][1]. [1]: http://reference.com ================================================ FILE: test/features/links/reference_missing.json ================================================ ["html", ["p", ["a", { "href" : "http://example.com" }, "hi" ] ], ["ul", ["li"]] ] ================================================ FILE: test/features/links/reference_missing.text ================================================ [hi][link] - [link]: http://example.com ================================================ FILE: test/features/links/reference_with_newline.json ================================================ ["html", ["p", "This one has a ", ["a", { "href" : "/foo" }, "line\nbreak" ], "." ] ] ================================================ FILE: test/features/links/reference_with_newline.text ================================================ This one has a [line break]. [line break]: /foo ================================================ FILE: test/features/links/reference_with_newline_and_space.json ================================================ ["html", ["p", "This one has a ", ["a", { "href" : "/foo" }, "line \nbreak" ], "." ] ] ================================================ FILE: test/features/links/reference_with_newline_and_space.text ================================================ This one has a [line break]. [line break]: /foo ================================================ FILE: test/features/links/reference_with_quote.json ================================================ ["html", ["p", "Foo ", [ "a", {"href": "/url/", "title": "Title with \"quotes\" inside"}, "bar" ], "." ] ] ================================================ FILE: test/features/links/reference_with_quote.text ================================================ Foo [bar][]. [bar]: /url/ "Title with "quotes" inside" ================================================ FILE: test/features/links/reference_with_space.json ================================================ ["html", ["p", "A ", ["a", { "href" : "http://reference.com" }, "link using a reference" ], " separated by a space." ] ] ================================================ FILE: test/features/links/reference_with_space.text ================================================ A [link using a reference] [1] separated by a space. [1]: http://reference.com ================================================ FILE: test/features/links/spaces_in_url.json ================================================ ["html", ["p", ["a", { "href" : "Link to file/Lorem Ipsum.txt", "title" : "Alt2" }, "link text" ] ] ] ================================================ FILE: test/features/links/spaces_in_url.text ================================================ [link text](Link to file/Lorem Ipsum.txt "Alt2") ================================================ FILE: test/features/lists/bullet_types.json ================================================ ["html", ["p", "Stars" ], ["ul", ["li", "star" ] ], ["p", "Dashes" ], ["ul", ["li", "dash" ] ], ["p", "Pluses" ], ["ul", ["li", "plus" ] ] ] ================================================ FILE: test/features/lists/bullet_types.text ================================================ Stars * star Dashes - dash Pluses + plus ================================================ FILE: test/features/lists/hr_abutting.json ================================================ ["html", ["ul", [ "li", "foo" ], [ "li", "bar" ] ], ["hr"], ["p", "after"] ] ================================================ FILE: test/features/lists/hr_abutting.text ================================================ * foo * bar * * * after ================================================ FILE: test/features/lists/hr_inside.json ================================================ ["html", ["ul", [ "li", ["p", "before"], ["hr"], ["p", "after"] ] ] ] ================================================ FILE: test/features/lists/hr_inside.text ================================================ * before - - - - after ================================================ FILE: test/features/lists/lazy_wrapping.json ================================================ ["html", ["ul", ["li", "If you're too\nlazy to wrap your" ], ["li", "Lists nicely, this\nwill still work" ] ] ] ================================================ FILE: test/features/lists/lazy_wrapping.text ================================================ * If you're too lazy to wrap your * Lists nicely, this will still work ================================================ FILE: test/features/lists/leading_whitespace.json ================================================ ["html", ["ul", ["li", "white" ], ["li", "space" ] ] ] ================================================ FILE: test/features/lists/leading_whitespace.text ================================================ * white * space ================================================ FILE: test/features/lists/loose.json ================================================ ["html", ["ul", ["li", ["p", "the quick brown fox jumps\nover the lazy dog" ] ], ["li", ["p", "pack my box with five\ndozen liquor jugs" ], ["p", "this item has a\nsecond paragraph" ] ], ["li", ["p", "this item has\nonly one paragraph" ] ] ] ] ================================================ FILE: test/features/lists/loose.text ================================================ * the quick brown fox jumps over the lazy dog * pack my box with five dozen liquor jugs this item has a second paragraph * this item has only one paragraph ================================================ FILE: test/features/lists/loose_with_inline.json ================================================ ["html", ["ul", ["li", ["p", "List item ", ["em", "ending" ], "\nwith ", ["em", "emphasis" ], "." ] ], ["li", ["p", "List item\nwith ", ["strong", "strong emphasis" ], "." ] ], ["li", ["p", "List item\nwith ", ["a", { "href" : "http://google.com" }, "a link" ], "." ] ] ] ] ================================================ FILE: test/features/lists/loose_with_inline.text ================================================ * List item _ending_ with _emphasis_. * List item with **strong emphasis**. * List item with [a link](http://google.com). ================================================ FILE: test/features/lists/multiline_inline.json ================================================ ["html", ["ul", ["li", "List items can have ", [ "em", "inline content\nthat spans multiple lines" ], ". Pain" ] ] ] ================================================ FILE: test/features/lists/multiline_inline.text ================================================ * List items can have *inline content that spans multiple lines*. Pain ================================================ FILE: test/features/lists/nested.json ================================================ ["html", ["ol", ["li", "one", ["ul", ["li", "alpha", ["ul", ["li", "almond" ], ["li", "brazil" ] ] ], ["li", "beta", ["ul", ["li", "cashew" ] ] ] ] ], ["li", "two" ], ["li", "three", ["ul", ["li", "gamma" ] ] ] ] ] ================================================ FILE: test/features/lists/nested.text ================================================ 1. one * alpha - almond - brazil * beta - cashew 2. two 3. three * gamma ================================================ FILE: test/features/lists/nested_para.json ================================================ ["html", ["ol", ["li", ["p", "First"] ], ["li", ["p", "Second:"], ["ul", ["li", "Fee"], ["li", "Fie"], ["li", "Foe"] ] ], ["li", ["p", "Third"]] ] ] ================================================ FILE: test/features/lists/nested_para.text ================================================ 1. First 2. Second: * Fee * Fie * Foe 3. Third ================================================ FILE: test/features/lists/numeric.json ================================================ ["html", ["ol", ["li", "one" ], ["li", "two" ], ["li", "three" ] ] ] ================================================ FILE: test/features/lists/numeric.text ================================================ 1. one 2. two 3. three ================================================ FILE: test/features/lists/quote_inside.json ================================================ ["html", ["ol", [ "li", "bar", ["blockquote", ["p", "this should go under #1"]] ] ] ] ================================================ FILE: test/features/lists/quote_inside.text ================================================ 1. bar > this should go under #1 ================================================ FILE: test/features/lists/references.json ================================================ ["html", ["ul", ["li", ["a", {"href": "http://eviltrout.com"}, "Evil Trout"] ] ] ] ================================================ FILE: test/features/lists/references.text ================================================ * [Evil Trout][1] [1]: http://eviltrout.com ================================================ FILE: test/features/lists/tight.json ================================================ ["html", ["ul", ["li", "alpha" ], ["li", "beta" ], ["li", "gamma" ] ] ] ================================================ FILE: test/features/lists/tight.text ================================================ * alpha * beta * gamma ================================================ FILE: test/features/meta/attribute.json ================================================ ["html", ["p", { "foo" : "bar" }, "A paragraph with an\narbitrary attribute." ] ] ================================================ FILE: test/features/meta/attribute.text ================================================ A paragraph with an arbitrary attribute. {: foo=bar} ================================================ FILE: test/features/meta/class.json ================================================ ["html", ["p", { "class" : "para" }, "This is a paragraph\nwith an ID." ] ] ================================================ FILE: test/features/meta/class.text ================================================ This is a paragraph with an ID. {: .para} ================================================ FILE: test/features/meta/code.json ================================================ ["html", ["pre", { "foo" : "bar" }, ["code", "A pre with an\narbitrary attribute." ] ] ] ================================================ FILE: test/features/meta/code.text ================================================ A pre with an arbitrary attribute. {: foo=bar} ================================================ FILE: test/features/meta/document.json ================================================ ["html", { "key" : "value", "anotherkey" : "another value" }, ["p", "A regular paragraph" ] ] ================================================ FILE: test/features/meta/document.text ================================================ Key: value AnotherKey: another value A regular paragraph ================================================ FILE: test/features/meta/id.json ================================================ ["html", ["p", { "id" : "para" }, "This is a paragraph\nwith an ID." ] ] ================================================ FILE: test/features/meta/id.text ================================================ This is a paragraph with an ID. {: #para} ================================================ FILE: test/features/meta/inline.json ================================================ ["html", ["p", "An ", ["em", { "class" : "foo" }, "em" ], " and ", ["strong", { "class" : "bar" }, "strong" ], "\nwith attached attributes." ] ] ================================================ FILE: test/features/meta/inline.text ================================================ An *em*{: .foo} and **strong**{: .bar} with attached attributes. ================================================ FILE: test/features/meta/inner_whitespace.json ================================================ ["html", ["p", { "id" : "none" }, "We can have no whitespace" ], ["p", { "id" : "one" }, "Or a single whitespace" ], ["p", { "id" : "lots" }, "And even lots of whitespace" ] ] ================================================ FILE: test/features/meta/inner_whitespace.text ================================================ We can have no whitespace {:#none} Or a single whitespace {: #one } And even lots of whitespace {: #lots } ================================================ FILE: test/features/meta/leading_whitespace.json ================================================ ["html", ["p", { "id" : "zero" }, "Zero" ], ["p", { "id" : "one" }, "One" ], ["p", { "id" : "two" }, "Two" ], ["p", { "id" : "three" }, "Three" ], ["p", "Four\n {: #four}" ] ] ================================================ FILE: test/features/meta/leading_whitespace.text ================================================ Zero {: #zero} One {: #one} Two {: #two} Three {: #three} Four {: #four} ================================================ FILE: test/features/meta/list.json ================================================ ["html", ["ul", { "id" : "list" }, ["li", "here's a\nloose list" ], ["li", "it might confuse the\nblock_meta routine" ] ] ] ================================================ FILE: test/features/meta/list.text ================================================ * here's a loose list * it might confuse the block_meta routine {: #list} ================================================ FILE: test/features/meta/list.todo ================================================ ================================================ FILE: test/features/meta/multiple_classes.json ================================================ ["html", ["p", { "class" : "foo bar" }, "Here's a paragraph and\nan ", ["em", { "class" : "foo bar" }, "em" ], "\nwith multiple classes" ] ] ================================================ FILE: test/features/meta/multiple_classes.text ================================================ Here's a paragraph and an *em*{: .foo .bar} with multiple classes {: .foo .bar} ================================================ FILE: test/features/meta/quoted.json ================================================ ["html", ["p", { "foo" : "bar baz" }, "A paragraph with a\nquoted attribute." ] ] ================================================ FILE: test/features/meta/quoted.text ================================================ A paragraph with a quoted attribute. {: foo="bar baz"} ================================================ FILE: test/features/tables/align.json ================================================ [ "html", [ "table", [ "thead", [ "tr", [ "th", { "align": "left" }, "#" ], [ "th", { "align": "center" }, "Item" ], [ "th", { "align": "right" }, "Value" ] ] ], [ "tbody", [ "tr", [ "td", { "align": "left" }, "1" ], [ "td", { "align": "center" }, "Computer" ], [ "td", { "align": "right" }, "$1600" ] ], [ "tr", [ "td", { "align": "left" }, "2" ], [ "td", { "align": "center" }, "Phone" ], [ "td", { "align": "right" }, "$12" ] ], [ "tr", [ "td", { "align": "left" }, "3" ], [ "td", { "align": "center" }, "Pipe" ], [ "td", { "align": "right" }, "$1" ] ] ] ] ] ================================================ FILE: test/features/tables/align.text ================================================ | # | Item | Value | | :- | :-------: | -----:| | 1 | Computer | $1600 | | 2 | Phone | $12 | | 3 | Pipe | $1 | ================================================ FILE: test/features/tables/compact.json ================================================ [ "html", [ "table", [ "thead", [ "tr", [ "th", { "align": "left" }, "#" ], [ "th", { "align": "center" }, "Item" ], [ "th", { "align": "right" }, "Value" ] ] ], [ "tbody", [ "tr", [ "td", { "align": "left" }, "1" ], [ "td", { "align": "center" }, "Computer" ], [ "td", { "align": "right" }, "$1600" ] ], [ "tr", [ "td", { "align": "left" }, "2" ], [ "td", { "align": "center" }, "Phone" ], [ "td", { "align": "right" }, "$12" ] ], [ "tr", [ "td", { "align": "left" }, "3" ], [ "td", { "align": "center" }, "Pipe" ], [ "td", { "align": "right" }, "$1" ] ] ] ] ] ================================================ FILE: test/features/tables/compact.text ================================================ #|Item|Value :-|:-:|-: 1|Computer|$1600 2|Phone|$12 3|Pipe|$1 ================================================ FILE: test/features/tables/inline_formatting.json ================================================ [ "html", [ "table", [ "thead", [ "tr", [ "th", "Function name" ], [ "th", "Description" ] ] ], [ "tbody", [ "tr", [ "td", [ "code", "help()" ] ], [ "td", "Display the help window." ] ], [ "tr", [ "td", [ "code", "destroy()" ] ], [ "td", [ "strong", "Destroy your computer!" ] ] ] ] ] ] ================================================ FILE: test/features/tables/inline_formatting.text ================================================ | Function name | Description | | ------------- | ------------------------------ | | `help()` | Display the help window. | | `destroy()` | **Destroy your computer!** | ================================================ FILE: test/features/tables/pipe_escape.json ================================================ [ "html", [ "table", [ "thead", [ "tr", [ "th", "a|b" ], [ "th", "c" ] ] ], [ "tbody", [ "tr", [ "td", "1" ], [ "td", "2|3" ] ], [ "tr", [ "td", "4|5" ], [ "td", "6" ] ] ] ] ] ================================================ FILE: test/features/tables/pipe_escape.text ================================================ | a\|b | c | | -----|------| | 1 | 2\|3 | | 4\|5 | 6 | ================================================ FILE: test/features/tables/simple_leading.json ================================================ [ "html", [ "table", [ "thead", [ "tr", [ "th", "First Header" ], [ "th", "Second Header" ] ] ], [ "tbody", [ "tr", [ "td", "Content 1" ], [ "td", "Content 2" ] ], [ "tr", [ "td", "Content 3" ], [ "td", "Content 4" ] ] ] ] ] ================================================ FILE: test/features/tables/simple_leading.text ================================================ | First Header | Second Header | | ------------- | ------------- | | Content 1 | Content 2 | | Content 3 | Content 4 | ================================================ FILE: test/features/tables/simple_no_leading.json ================================================ [ "html", [ "table", [ "thead", [ "tr", [ "th", "First Header" ], [ "th", "Second Header" ] ] ], [ "tbody", [ "tr", [ "td", "Content 1" ], [ "td", "Content 2" ] ], [ "tr", [ "td", "Content 3" ], [ "td", "Content 4" ] ] ] ] ] ================================================ FILE: test/features/tables/simple_no_leading.text ================================================ First Header | Second Header ------------- | ------------- Content 1 | Content 2 Content 3 | Content 4 ================================================ FILE: test/features/tables/spaces_tolerance.json ================================================ [ "html", [ "p", "This is a table (look out, less than 4 spaces\nbefore headers and rule)." ], [ "table", [ "thead", [ "tr", [ "th", "Header" ], [ "th", "Header" ] ] ], [ "tbody", [ "tr", [ "td", "1" ], [ "td", "2" ] ], [ "tr", [ "td", "3" ], [ "td", "4" ] ] ] ], [ "p", "Yeah, right." ] ] ================================================ FILE: test/features/tables/spaces_tolerance.text ================================================ This is a table (look out, less than 4 spaces before headers and rule). Header | Header -------- | -------- 1 | 2 3 | 4 Yeah, right. ================================================ FILE: test/features.t.js ================================================ var markdown = require("../src/markdown"); function test_dialect( dialect, features ) { var fs = require("fs"), path = require("path"), tap = require("tap"); var slurpFile = function slurpFile( path ) { return fs.readFileSync( path, "utf8" ); }; var isFile = function isFile( f ) { try { return fs.statSync( f ).isFile(); } catch (e) { if ( e.code === "ENOENT" ) return false; throw e; } }; tap.test( dialect, function(tap) { for ( var f in features ) { (function( feature ) { tap.test( feature, function(tap) { var test_path = path.join(__dirname, "features", feature); // grab all the test files in this feature var tests = fs.readdirSync( test_path ); // filter to only the raw files tests = tests.filter( function( x ) {return x.match( /\.text$/ ); } ); // remove the extensions tests = tests.map( function( x ) {return x.replace( /\.text$/, "" ); } ); for ( var t in tests ) { // load the raw text var testName = dialect + "/" + feature + "/" + tests[ t ].substring( tests[ t ].lastIndexOf( "/" ) + 1 ), testFileBase = path.join(test_path, tests[ t ]), text = slurpFile( testFileBase + ".text" ); // load the target output var json = JSON.parse( slurpFile( testFileBase + ".json" ) ); var output = markdown.toHTMLTree( text, dialect ); tap.equivalent( output, json, testName, {todo: isFile( testFileBase + ".todo" )} ); } tap.end(); } ); } )( features[ f ] ); } }); } var dialects = {}; dialects.Gruber = [ "blockquotes", "code", "emphasis", "headers", "horizontal_rules", "images", "linebreaks", "links", "lists" ]; dialects.Maruku = dialects.Gruber.slice( 0 ); dialects.Maruku.push( "meta", "definition_lists", "tables" ); // TODO if dialects/features were passed on the command line, filter to them // if ( args.length ) // features = features.filter( function( x ) args.indexOf( x ) !== -1 ); for ( var d in dialects ) { test_dialect( d, dialects[ d ] ); } ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Amps_and_angle_encoding.json ================================================ ["html", ["p", "AT&T has an ampersand in their name."], ["p", "AT&T is another way to write it."], ["p", "This & that."], ["p", "4 < 5."], ["p", "6 > 5."], ["p", "Here's a ", ["a", { "href": "http://example.com/?foo=1&bar=2" }, "link"], " with an ampersand in the URL."], ["p", "Here's a link with an amersand in the link text: ", ["a", { "href": "http://att.com/", "title": "AT&T" }, "AT&T"], "."], ["p", "Here's an inline ", ["a", { "href": "/script?foo=1&bar=2" }, "link"], "."], ["p", "Here's an inline ", ["a", { "href": "/script?foo=1&bar=2" }, "link"], "."]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Amps_and_angle_encoding.text ================================================ 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" ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Amps_and_angle_encoding.xhtml ================================================

    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.

    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Auto_links.json ================================================ ["html", ["p", "Link: ", ["a", { "href": "http://example.com/" }, "http://example.com/"], "."], ["p", "With an ampersand: ", ["a", { "href": "http://example.com/?foo=1&bar=2" }, "http://example.com/?foo=1&bar=2"]], ["ul", ["li", "In a list?"], ["li", ["a", { "href": "http://example.com/" }, "http://example.com/"]], ["li", "It should."]], ["blockquote", ["p", "Blockquoted: ", ["a", { "href": "http://example.com/" }, "http://example.com/"]]], ["p", "Auto-links should not occur here: ", ["code", ""]], ["pre", ["code", "or here: \u000a"]]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Auto_links.text ================================================ Link: . With an ampersand: * In a list? * * It should. > Blockquoted: Auto-links should not occur here: `` or here: ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Auto_links.xhtml ================================================

    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/>
    
    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Backslash_escapes.json ================================================ ["html", ["p", "These should all get escaped:"], ["p", "Backslash: \\"], ["p", "Backtick: `"], ["p", "Asterisk: *"], ["p", "Underscore: _"], ["p", "Left brace: {"], ["p", "Right brace: }"], ["p", "Left bracket: ["], ["p", "Right bracket: ]"], ["p", "Left paren: ("], ["p", "Right paren: )"], ["p", "Greater-than: >"], ["p", "Hash: #"], ["p", "Period: ."], ["p", "Bang: !"], ["p", "Plus: +"], ["p", "Minus: -"], ["p", "These should not, because they occur within a code block:"], ["pre", ["code", "Backslash: \\\\\u000a\u000aBacktick: \\`\u000a\u000aAsterisk: \\*\u000a\u000aUnderscore: \\_\u000a\u000aLeft brace: \\{\u000a\u000aRight brace: \\}\u000a\u000aLeft bracket: \\[\u000a\u000aRight bracket: \\]\u000a\u000aLeft paren: \\(\u000a\u000aRight paren: \\)\u000a\u000aGreater-than: \\>\u000a\u000aHash: \\#\u000a\u000aPeriod: \\.\u000a\u000aBang: \\!\u000a\u000aPlus: \\+\u000a\u000aMinus: \\-\u000a"]], ["p", "Nor should these, which occur in code spans:"], ["p", "Backslash: ", ["code", "\\\\"]], ["p", "Backtick: ", ["code", "\\`"]], ["p", "Asterisk: ", ["code", "\\*"]], ["p", "Underscore: ", ["code", "\\_"]], ["p", "Left brace: ", ["code", "\\{"]], ["p", "Right brace: ", ["code", "\\}"]], ["p", "Left bracket: ", ["code", "\\["]], ["p", "Right bracket: ", ["code", "\\]"]], ["p", "Left paren: ", ["code", "\\("]], ["p", "Right paren: ", ["code", "\\)"]], ["p", "Greater-than: ", ["code", "\\>"]], ["p", "Hash: ", ["code", "\\#"]], ["p", "Period: ", ["code", "\\."]], ["p", "Bang: ", ["code", "\\!"]], ["p", "Plus: ", ["code", "\\+"]], ["p", "Minus: ", ["code", "\\-"]], ["p", "These should get escaped, even though they're matching pairs for\u000aother Markdown constructs:"], ["p", "*asterisks*"], ["p", "_underscores_"], ["p", "`backticks`"], ["p", "This is a code span with a literal backslash-backtick sequence: ", ["code", "\\`"]], ["p", "This is a tag with unescaped backticks ", ["span", { "attr": "`ticks`" }, "bar"], "."], ["p", "This is a tag with backslashes ", ["span", { "attr": "\\\\backslashes\\\\" }, "bar"], "."]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Backslash_escapes.text ================================================ 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. ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Backslash_escapes.xhtml ================================================

    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.

    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Blockquotes_with_code_blocks.json ================================================ ["html", ["blockquote", ["p", "Example:"], ["pre", ["code", "sub status {\u000a print \"working\";\u000a}\u000a"]], ["p", "Or:"], ["pre", ["code", "sub status {\u000a return \"working\";\u000a}\u000a"]]]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Blockquotes_with_code_blocks.text ================================================ > Example: > > sub status { > print "working"; > } > > Or: > > sub status { > return "working"; > } ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Blockquotes_with_code_blocks.xhtml ================================================

    Example:

    sub status {
        print "working";
    }
    

    Or:

    sub status {
        return "working";
    }
    
    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Code_Blocks.json ================================================ ["html", ["pre", ["code", "code block on the first line\u000a"]], ["p", "Regular text."], ["pre", ["code", "code block indented by spaces\u000a"]], ["p", "Regular text."], ["pre", ["code", "the lines in this block \u000aall contain trailing spaces \u000a"]], ["p", "Regular Text."], ["pre", ["code", "code block on the last line\u000a"]]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Code_Blocks.text ================================================ 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 ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Code_Blocks.xhtml ================================================
    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
    
    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Code_Spans.json ================================================ ["html", ["p", ["code", ""]], ["p", "Fix for backticks within HTML tag: ", ["span", { "attr": "`ticks`" }, "like this"]], ["p", "Here's how you put ", ["code", "`backticks`"], " in a code span."]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Code_Spans.text ================================================ `` Fix for backticks within HTML tag: like this Here's how you put `` `backticks` `` in a code span. ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Code_Spans.xhtml ================================================

    <test a=" content of attribute ">

    Fix for backticks within HTML tag: like this

    Here's how you put `backticks` in a code span.

    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Hard-wrapped_paragraphs_with_list-like_lines.json ================================================ ["html", ["p", "In Markdown 1.0.0 and earlier. Version\u000a8. This line turns into a list item.\u000aBecause a hard-wrapped line in the\u000amiddle of a paragraph looked like a\u000alist item."], ["p", "Here's one with a bullet.\u000a* criminey."]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Hard-wrapped_paragraphs_with_list-like_lines.text ================================================ 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. ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Hard-wrapped_paragraphs_with_list-like_lines.xhtml ================================================

    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.

    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Horizontal_rules.json ================================================ ["html", ["p", "Dashes:"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["pre", ["code", "---\u000a"]], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["pre", ["code", "- - -\u000a"]], ["p", "Asterisks:"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["pre", ["code", "***\u000a"]], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["pre", ["code", "* * *\u000a"]], ["p", "Underscores:"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["pre", ["code", "___\u000a"]], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["pre", ["code", "_ _ _\u000a"]]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Horizontal_rules.text ================================================ Dashes: --- --- --- --- --- - - - - - - - - - - - - - - - Asterisks: *** *** *** *** *** * * * * * * * * * * * * * * * Underscores: ___ ___ ___ ___ ___ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Horizontal_rules.xhtml ================================================

    Dashes:





    ---
    




    - - -
    

    Asterisks:





    ***
    




    * * *
    

    Underscores:





    ___
    




    _ _ _
    
    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Images.json ================================================ ["html", ["p", ["img", { "src": "/path/to/img.jpg", "alt": "Alt text" }]], ["p", ["img", { "src": "/path/to/img.jpg", "alt": "Alt text", "title": "Optional title" }]], ["p", "Inline within a paragraph: ", ["a", { "href": "/url/" }, "alt text"], "."], ["p", ["img", { "src": "/url/", "alt": "alt text", "title": "title preceded by two spaces" }]], ["p", ["img", { "src": "/url/", "alt": "alt text", "title": "title has spaces afterward" }]], ["p", ["img", { "src": "/url/", "alt": "alt text" }]], ["p", ["img", { "src": "/url/", "alt": "alt text", "title": "with a title" }], "."], ["p", ["img", { "alt": "Empty" }]], ["p", ["img", { "src": "http://example.com/(parens).jpg", "alt": "this is a stupid URL" }]], ["p", ["img", { "src": "/url/", "alt": "alt text" }]], ["p", ["img", { "src": "/url/", "alt": "alt text", "title": "Title here" }]]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Images.text ================================================ ![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" ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Images.xhtml ================================================

    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

    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Advanced).json ================================================ ["html", ["p", "Simple block on one line:"], "\u000a\u000a", ["div", "foo"], "\u000a\u000a", ["p", "And nested without indentation:"], "\u000a\u000a", ["div", "\u000a", ["div", "\u000a", ["div", "\u000afoo\u000a"], "\u000a", ["div", { "style": ">" }], "\u000a"], "\u000a", ["div", "bar"], "\u000a"], "\u000a\u000a", ["p", "And with attributes:"], "\u000a\u000a", ["div", "\u000a ", ["div", { "id": "foo" }], "\u000a"], "\u000a\u000a", ["p", "This was broken in 1.0.2b7:"], "\u000a\u000a", ["div", { "class": "inlinepage" }, "\u000a", ["div", { "class": "toggleableend" }, "\u000afoo\u000a"], "\u000a"], "\u000a"] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Advanced).text ================================================ Simple block on one line:
    foo
    And nested without indentation:
    foo
    bar
    And with attributes:
    This was broken in 1.0.2b7:
    foo
    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Advanced).xhtml ================================================

    Simple block on one line:

    foo

    And nested without indentation:

    foo
    bar

    And with attributes:

    This was broken in 1.0.2b7:

    foo
    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).html ================================================

    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:










    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).json ================================================ ["html", ["p", "Here's a simple block:"], "\u000a\u000a", ["div", "\u000a foo\u000a"], "\u000a\u000a", ["p", "This should be a code block, though:"], ["pre", ["code", "
    \u000a foo\u000a
    \u000a"]], ["p", "As should this:"], ["pre", ["code", "
    foo
    \u000a"]], ["p", "Now, nested:"], "\u000a\u000a", ["div", "\u000a ", ["div", "\u000a ", ["div", "\u000a foo\u000a "], "\u000a "], "\u000a"], "\u000a\u000a", ["p", "This should just be an HTML comment:"], "\u000a\u000a", "\u000a\u000a", ["p", "Multiline:"], "\u000a\u000a", "\u000a\u000a", ["p", "Code block:"], ["pre", ["code", "\u000a"]], ["p", "Just plain comment, with trailing spaces on the line:"], "\u000a\u000a", " \u000a\u000a", ["p", "Code:"], ["pre", ["code", "
    \u000a"]], ["p", "Hr's:"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], " \u000a\u000a", ["hr"], " \u000a\u000a", ["hr"], " \u000a\u000a", ["hr", { "class": "foo", "id": "bar" }], "\u000a\u000a", ["hr", { "class": "foo", "id": "bar" }], "\u000a\u000a", ["hr", { "class": "foo", "id": "bar" }], "\u000a"] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).text ================================================ 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:








    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.html ================================================

    Paragraph one.

    Paragraph two.

    The end.

    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.json ================================================ ["html", ["p", "Paragraph one."], "\u000a\u000a", "\u000a\u000a", "\u000a\u000a", ["p", "Paragraph two."], "\u000a\u000a", "\u000a\u000a", ["p", "The end."]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.text ================================================ Paragraph one. Paragraph two. The end. ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Links_inline_style.json ================================================ ["html", ["p", "Just a ", ["a", { "href": "/url/" }, "URL"], "."], ["p", ["a", { "href": "/url/", "title": "title" }, "URL and title"], "."], ["p", ["a", { "href": "/url/", "title": "title preceded by two spaces" }, "URL and title"], "."], ["p", ["a", { "href": "/url/", "title": "title preceded by a tab" }, "URL and title"], "."], ["p", ["a", { "href": "/url/", "title": "title has spaces afterward" }, "URL and title"], "."], ["p", ["a", { "href": "/url/" }, "URL wrapped in angle brackets"], "."], ["p", ["a", { "href": "/url/", "title": "Here's the title" }, "URL w/ angle brackets + title"], "."], ["p", ["a", "Empty"], "."], ["p", ["a", { "href": "http://en.wikipedia.org/wiki/WIMP_(computing)" }, "With parens in the URL"]], ["p", "(With outer parens and ", ["a", { "href": "/foo(bar)" }, "parens in url"], ")"], ["p", ["a", { "href": "/foo(bar)", "title": "and a title" }, "With parens in the URL"]], ["p", "(With outer parens and ", ["a", { "href": "/foo(bar)", "title": "and a title" }, "parens in url"], ")"]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Links_inline_style.text ================================================ 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")) ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Links_inline_style.xhtml ================================================

    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)

    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Links_reference_style.json ================================================ ["html", ["p", "Foo ", ["a", { "href": "/url/", "title": "Title" }, "bar"], "."], ["p", "Foo ", ["a", { "href": "/url/", "title": "Title" }, "bar"], "."], ["p", "Foo ", ["a", { "href": "/url/", "title": "Title" }, "bar"], "."], ["p", "With ", ["a", { "href": "/url/" }, "embedded [brackets]"], "."], ["p", "Indented ", ["a", { "href": "/url" }, "once"], "."], ["p", "Indented ", ["a", { "href": "/url" }, "twice"], "."], ["p", "Indented ", ["a", { "href": "/url" }, "thrice"], "."], ["p", "Indented [four][] times."], ["pre", ["code", "[four]: /url\u000a"]], "\u000a\u000a", ["hr"], "\u000a\u000a", ["p", ["a", { "href": "foo" }, "this"], " should work"], ["p", "So should ", ["a", { "href": "foo" }, "this"], "."], ["p", "And ", ["a", { "href": "foo" }, "this"], "."], ["p", "And ", ["a", { "href": "foo" }, "this"], "."], ["p", "And ", ["a", { "href": "foo" }, "this"], "."], ["p", "But not [that] []."], ["p", "Nor [that][]."], ["p", "Nor [that]."], ["p", "[Something in brackets like ", ["a", { "href": "foo" }, "this"], " should work]"], ["p", "[Same with ", ["a", { "href": "foo" }, "this"], ".]"], ["p", "In this case, ", ["a", { "href": "/somethingelse/" }, "this"], " points to something else."], ["p", "Backslashing should suppress [this] and [this]."], "\u000a\u000a", ["hr"], "\u000a\u000a", ["p", "Here's one where the ", ["a", { "href": "/url/" }, "link\u000abreaks"], " across lines."], ["p", "Here's another where the ", ["a", { "href": "/url/" }, "link \u000abreaks"], " across lines, but with a line-ending space."]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Links_reference_style.text ================================================ 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/ ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Links_reference_style.xhtml ================================================

    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.

    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Links_shortcut_references.json ================================================ ["html", ["p", "This is the ", ["a", { "href": "/simple" }, "simple case"], "."], ["p", "This one has a ", ["a", { "href": "/foo" }, "line\u000abreak"], "."], ["p", "This one has a ", ["a", { "href": "/foo" }, "line \u000abreak"], " with a line-ending space."], ["p", ["a", { "href": "/that" }, "this"], " and the ", ["a", { "href": "/other" }, "other"]]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Links_shortcut_references.text ================================================ 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 ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Links_shortcut_references.xhtml ================================================

    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

    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Literal_quotes_in_titles.json ================================================ ["html", ["p", "Foo ", ["a", { "href": "/url/", "title": "Title with \"quotes\" inside" }, "bar"], "."], ["p", "Foo ", ["a", { "href": "/url/", "title": "Title with \"quotes\" inside" }, "bar"], "."]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Literal_quotes_in_titles.text ================================================ Foo [bar][]. Foo [bar](/url/ "Title with "quotes" inside"). [bar]: /url/ "Title with "quotes" inside" ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Literal_quotes_in_titles.xhtml ================================================

    Foo bar.

    Foo bar.

    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Basics.json ================================================ ["html", ["h1", "Markdown: Basics"], "\u000a\u000a", ["ul", { "id": "ProjectSubmenu" }, ["li", ["a", { "href": "/projects/markdown/", "title": "Markdown Project Page" }, "Main"]], ["li", ["a", { "class": "selected", "title": "Markdown Basics" }, "Basics"]], ["li", ["a", { "href": "/projects/markdown/syntax", "title": "Markdown Syntax Documentation" }, "Syntax"]], ["li", ["a", { "href": "/projects/markdown/license", "title": "Pricing and License Information" }, "License"]], ["li", ["a", { "href": "/projects/markdown/dingus", "title": "Online Markdown Web Form" }, "Dingus"]]], "\u000a\u000a", ["h2", "Getting the Gist of Markdown's Formatting Syntax"], "\u000a\u000a", ["p", "This page offers a brief overview of what it's like to use Markdown.\u000aThe ", ["a", { "href": "/projects/markdown/syntax", "title": "Markdown Syntax" }, "syntax page"], " provides complete, detailed documentation for\u000aevery feature, but Markdown should be very easy to pick up simply by\u000alooking at a few examples of it in action. The examples on this page\u000aare written in a before/after style, showing example syntax and the\u000aHTML output produced by Markdown."], ["p", "It's also helpful to simply try Markdown out; the ", ["a", { "href": "/projects/markdown/dingus", "title": "Markdown Dingus" }, "Dingus"], " is a\u000aweb application that allows you type your own Markdown-formatted text\u000aand translate it to XHTML."], ["p", ["strong", "Note:"], " This document is itself written using Markdown; you\u000acan ", ["a", { "href": "/projects/markdown/basics.text" }, "see the source for it by adding '.text' to the URL"], "."], "\u000a\u000a", ["h2", "Paragraphs, Headers, Blockquotes"], "\u000a\u000a", ["p", "A paragraph is simply one or more consecutive lines of text, separated\u000aby one or more blank lines. (A blank line is any line that looks like a\u000ablank line -- a line containing nothing spaces or tabs is considered\u000ablank.) Normal paragraphs should not be intended with spaces or tabs."], ["p", "Markdown offers two styles of headers: ", ["em", "Setext"], " and ", ["em", "atx"], ".\u000aSetext-style headers for ", ["code", "

    "], " and ", ["code", "

    "], " are created by\u000a\"underlining\" with equal signs (", ["code", "="], ") and hyphens (", ["code", "-"], "), respectively.\u000aTo create an atx-style header, you put 1-6 hash marks (", ["code", "#"], ") at the\u000abeginning of the line -- the number of hashes equals the resulting\u000aHTML header level."], ["p", "Blockquotes are indicated using email-style '", ["code", ">"], "' angle brackets."], ["p", "Markdown:"], ["pre", ["code", "A First Level Header\u000a====================\u000a\u000aA Second Level Header\u000a---------------------\u000a\u000aNow is the time for all good men to come to\u000athe aid of their country. This is just a\u000aregular paragraph.\u000a\u000aThe quick brown fox jumped over the lazy\u000adog's back.\u000a\u000a### Header 3\u000a\u000a> This is a blockquote.\u000a> \u000a> This is the second paragraph in the blockquote.\u000a>\u000a> ## This is an H2 in a blockquote\u000a"]], ["p", "Output:"], ["pre", ["code", "

    A First Level Header

    \u000a\u000a

    A Second Level Header

    \u000a\u000a

    Now is the time for all good men to come to\u000athe aid of their country. This is just a\u000aregular paragraph.

    \u000a\u000a

    The quick brown fox jumped over the lazy\u000adog's back.

    \u000a\u000a

    Header 3

    \u000a\u000a
    \u000a

    This is a blockquote.

    \u000a\u000a

    This is the second paragraph in the blockquote.

    \u000a\u000a

    This is an H2 in a blockquote

    \u000a
    \u000a"]], "\u000a\u000a", ["h3", "Phrase Emphasis"], "\u000a\u000a", ["p", "Markdown uses asterisks and underscores to indicate spans of emphasis."], ["p", "Markdown:"], ["pre", ["code", "Some of these words *are emphasized*.\u000aSome of these words _are emphasized also_.\u000a\u000aUse two asterisks for **strong emphasis**.\u000aOr, if you prefer, __use two underscores instead__.\u000a"]], ["p", "Output:"], ["pre", ["code", "

    Some of these words are emphasized.\u000aSome of these words are emphasized also.

    \u000a\u000a

    Use two asterisks for strong emphasis.\u000aOr, if you prefer, use two underscores instead.

    \u000a"]], "\u000a\u000a", ["h2", "Lists"], "\u000a\u000a", ["p", "Unordered (bulleted) lists use asterisks, pluses, and hyphens (", ["code", "*"], ",\u000a", ["code", "+"], ", and ", ["code", "-"], ") as list markers. These three markers are\u000ainterchangable; this:"], ["pre", ["code", "* Candy.\u000a* Gum.\u000a* Booze.\u000a"]], ["p", "this:"], ["pre", ["code", "+ Candy.\u000a+ Gum.\u000a+ Booze.\u000a"]], ["p", "and this:"], ["pre", ["code", "- Candy.\u000a- Gum.\u000a- Booze.\u000a"]], ["p", "all produce the same output:"], ["pre", ["code", "
      \u000a
    • Candy.
    • \u000a
    • Gum.
    • \u000a
    • Booze.
    • \u000a
    \u000a"]], ["p", "Ordered (numbered) lists use regular numbers, followed by periods, as\u000alist markers:"], ["pre", ["code", "1. Red\u000a2. Green\u000a3. Blue\u000a"]], ["p", "Output:"], ["pre", ["code", "
      \u000a
    1. Red
    2. \u000a
    3. Green
    4. \u000a
    5. Blue
    6. \u000a
    \u000a"]], ["p", "If you put blank lines between items, you'll get ", ["code", "

    "], " tags for the\u000alist item text. You can create multi-paragraph list items by indenting\u000athe paragraphs by 4 spaces or 1 tab:"], ["pre", ["code", "* A list item.\u000a\u000a With multiple paragraphs.\u000a\u000a* Another item in the list.\u000a"]], ["p", "Output:"], ["pre", ["code", "

      \u000a
    • A list item.

      \u000a

      With multiple paragraphs.

    • \u000a
    • Another item in the list.

    • \u000a
    \u000a"]], "\u000a\u000a", ["h3", "Links"], "\u000a\u000a", ["p", "Markdown supports two styles for creating links: ", ["em", "inline"], " and\u000a", ["em", "reference"], ". With both styles, you use square brackets to delimit the\u000atext you want to turn into a link."], ["p", "Inline-style links use parentheses immediately after the link text.\u000aFor example:"], ["pre", ["code", "This is an [example link](http://example.com/).\u000a"]], ["p", "Output:"], ["pre", ["code", "

    This is an \u000aexample link.

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

    This is an \u000aexample link.

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

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

    \u000a"]], ["p", "The title attribute is optional. Link names may contain letters,\u000anumbers and spaces, but are ", ["em", "not"], " case sensitive:"], ["pre", ["code", "I start my morning with a cup of coffee and\u000a[The New York Times][NY Times].\u000a\u000a[ny times]: http://www.nytimes.com/\u000a"]], ["p", "Output:"], ["pre", ["code", "

    I start my morning with a cup of coffee and\u000aThe New York Times.

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

    I strongly recommend against using any\u000a<blink> tags.

    \u000a\u000a

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

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

    For example.

    \u000a
    \u000a"]], ["p", "Output:"], ["pre", ["code", "

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

    \u000a\u000a
    <blockquote>\u000a    <p>For example.</p>\u000a</blockquote>\u000a
    \u000a"]]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Basics.text ================================================ 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. Green
    3. Blue
    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>
        
    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Basics.xhtml ================================================

    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>
    
    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Syntax.json ================================================ ["html", ["h1", "Markdown: Syntax"], "\u000a\u000a", ["ul", { "id": "ProjectSubmenu" }, ["li", ["a", { "href": "/projects/markdown/", "title": "Markdown Project Page" }, "Main"]], ["li", ["a", { "href": "/projects/markdown/basics", "title": "Markdown Basics" }, "Basics"]], ["li", ["a", { "class": "selected", "title": "Markdown Syntax Documentation" }, "Syntax"]], ["li", ["a", { "href": "/projects/markdown/license", "title": "Pricing and License Information" }, "License"]], ["li", ["a", { "href": "/projects/markdown/dingus", "title": "Online Markdown Web Form" }, "Dingus"]]], ["ul", ["li", ["a", { "href": "#overview" }, "Overview"], "\u000a", ["ul", ["li", ["a", { "href": "#philosophy" }, "Philosophy"]], ["li", ["a", { "href": "#html" }, "Inline HTML"]], ["li", ["a", { "href": "#autoescape" }, "Automatic Escaping for Special Characters"]]]], ["li", ["a", { "href": "#block" }, "Block Elements"], "\u000a", ["ul", ["li", ["a", { "href": "#p" }, "Paragraphs and Line Breaks"]], ["li", ["a", { "href": "#header" }, "Headers"]], ["li", ["a", { "href": "#blockquote" }, "Blockquotes"]], ["li", ["a", { "href": "#list" }, "Lists"]], ["li", ["a", { "href": "#precode" }, "Code Blocks"]], ["li", ["a", { "href": "#hr" }, "Horizontal Rules"]]]], ["li", ["a", { "href": "#span" }, "Span Elements"], "\u000a", ["ul", ["li", ["a", { "href": "#link" }, "Links"]], ["li", ["a", { "href": "#em" }, "Emphasis"]], ["li", ["a", { "href": "#code" }, "Code"]], ["li", ["a", { "href": "#img" }, "Images"]]]], ["li", ["a", { "href": "#misc" }, "Miscellaneous"], "\u000a", ["ul", ["li", ["a", { "href": "#backslash" }, "Backslash Escapes"]], ["li", ["a", { "href": "#autolink" }, "Automatic Links"]]]]], ["p", ["strong", "Note:"], " This document is itself written using Markdown; you\u000acan ", ["a", { "href": "/projects/markdown/syntax.text" }, "see the source for it by adding '.text' to the URL"], "."], "\u000a\u000a", ["hr"], "\u000a\u000a", ["h2", { "id": "overview" }, "Overview"], "\u000a\u000a", ["h3", { "id": "philosophy" }, "Philosophy"], "\u000a\u000a", ["p", "Markdown is intended to be as easy-to-read and easy-to-write as is feasible."], ["p", "Readability, however, is emphasized above all else. A Markdown-formatted\u000adocument should be publishable as-is, as plain text, without looking\u000alike it's been marked up with tags or formatting instructions. While\u000aMarkdown's syntax has been influenced by several existing text-to-HTML\u000afilters -- including ", ["a", { "href": "http://docutils.sourceforge.net/mirror/setext.html" }, "Setext"], ", ", ["a", { "href": "http://www.aaronsw.com/2002/atx/" }, "atx"], ", ", ["a", { "href": "http://textism.com/tools/textile/" }, "Textile"], ", ", ["a", { "href": "http://docutils.sourceforge.net/rst.html" }, "reStructuredText"], ",\u000a", ["a", { "href": "http://www.triptico.com/software/grutatxt.html" }, "Grutatext"], ", and ", ["a", { "href": "http://ettext.taint.org/doc/" }, "EtText"], " -- the single biggest source of\u000ainspiration for Markdown's syntax is the format of plain text email."], ["p", "To this end, Markdown's syntax is comprised entirely of punctuation\u000acharacters, which punctuation characters have been carefully chosen so\u000aas to look like what they mean. E.g., asterisks around a word actually\u000alook like *emphasis*. Markdown lists look like, well, lists. Even\u000ablockquotes look like quoted passages of text, assuming you've ever\u000aused email."], "\u000a\u000a", ["h3", { "id": "html" }, "Inline HTML"], "\u000a\u000a", ["p", "Markdown's syntax is intended for one purpose: to be used as a\u000aformat for ", ["em", "writing"], " for the web."], ["p", "Markdown is not a replacement for HTML, or even close to it. Its\u000asyntax is very small, corresponding only to a very small subset of\u000aHTML tags. The idea is ", ["em", "not"], " to create a syntax that makes it easier\u000ato insert HTML tags. In my opinion, HTML tags are already easy to\u000ainsert. The idea for Markdown is to make it easy to read, write, and\u000aedit prose. HTML is a ", ["em", "publishing"], " format; Markdown is a ", ["em", "writing"], "\u000aformat. Thus, Markdown's formatting syntax only addresses issues that\u000acan be conveyed in plain text."], ["p", "For any markup that is not covered by Markdown's syntax, you simply\u000ause HTML itself. There's no need to preface it or delimit it to\u000aindicate that you're switching from Markdown to HTML; you just use\u000athe tags."], ["p", "The only restrictions are that block-level HTML elements -- e.g. ", ["code", "
    "], ",\u000a", ["code", ""], ", ", ["code", "
    "], ", ", ["code", "

    "], ", etc. -- must be separated from surrounding\u000acontent by blank lines, and the start and end tags of the block should\u000anot be indented with tabs or spaces. Markdown is smart enough not\u000ato add extra (unwanted) ", ["code", "

    "], " tags around HTML block-level tags."], ["p", "For example, to add an HTML table to a Markdown article:"], ["pre", ["code", "This is a regular paragraph.\u000a\u000a

    \u000a \u000a \u000a \u000a
    Foo
    \u000a\u000aThis is another regular paragraph.\u000a"]], ["p", "Note that Markdown formatting syntax is not processed within block-level\u000aHTML tags. E.g., you can't use Markdown-style ", ["code", "*emphasis*"], " inside an\u000aHTML block."], ["p", "Span-level HTML tags -- e.g. ", ["code", ""], ", ", ["code", ""], ", or ", ["code", ""], " -- can be\u000aused anywhere in a Markdown paragraph, list item, or header. If you\u000awant, you can even use HTML tags instead of Markdown formatting; e.g. if\u000ayou'd prefer to use HTML ", ["code", ""], " or ", ["code", ""], " tags instead of Markdown's\u000alink or image syntax, go right ahead."], ["p", "Unlike block-level HTML tags, Markdown syntax ", ["em", "is"], " processed within\u000aspan-level tags."], "\u000a\u000a", ["h3", { "id": "autoescape" }, "Automatic Escaping for Special Characters"], "\u000a\u000a", ["p", "In HTML, there are two characters that demand special treatment: ", ["code", "<"], "\u000aand ", ["code", "&"], ". Left angle brackets are used to start tags; ampersands are\u000aused to denote HTML entities. If you want to use them as literal\u000acharacters, you must escape them as entities, e.g. ", ["code", "<"], ", and\u000a", ["code", "&"], "."], ["p", "Ampersands in particular are bedeviling for web writers. If you want to\u000awrite about 'AT&T', you need to write '", ["code", "AT&T"], "'. You even need to\u000aescape ampersands within URLs. Thus, if you want to link to:"], ["pre", ["code", "http://images.google.com/images?num=30&q=larry+bird\u000a"]], ["p", "you need to encode the URL as:"], ["pre", ["code", "http://images.google.com/images?num=30&q=larry+bird\u000a"]], ["p", "in your anchor tag ", ["code", "href"], " attribute. Needless to say, this is easy to\u000aforget, and is probably the single most common source of HTML validation\u000aerrors in otherwise well-marked-up web sites."], ["p", "Markdown allows you to use these characters naturally, taking care of\u000aall the necessary escaping for you. If you use an ampersand as part of\u000aan HTML entity, it remains unchanged; otherwise it will be translated\u000ainto ", ["code", "&"], "."], ["p", "So, if you want to include a copyright symbol in your article, you can write:"], ["pre", ["code", "©\u000a"]], ["p", "and Markdown will leave it alone. But if you write:"], ["pre", ["code", "AT&T\u000a"]], ["p", "Markdown will translate it to:"], ["pre", ["code", "AT&T\u000a"]], ["p", "Similarly, because Markdown supports ", ["a", { "href": "#html" }, "inline HTML"], ", if you use\u000aangle brackets as delimiters for HTML tags, Markdown will treat them as\u000asuch. But if you write:"], ["pre", ["code", "4 < 5\u000a"]], ["p", "Markdown will translate it to:"], ["pre", ["code", "4 < 5\u000a"]], ["p", "However, inside Markdown code spans and blocks, angle brackets and\u000aampersands are ", ["em", "always"], " encoded automatically. This makes it easy to use\u000aMarkdown to write about HTML code. (As opposed to raw HTML, which is a\u000aterrible format for writing about HTML syntax, because every single ", ["code", "<"], "\u000aand ", ["code", "&"], " in your example code needs to be escaped.)"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["h2", { "id": "block" }, "Block Elements"], "\u000a\u000a", ["h3", { "id": "p" }, "Paragraphs and Line Breaks"], "\u000a\u000a", ["p", "A paragraph is simply one or more consecutive lines of text, separated\u000aby one or more blank lines. (A blank line is any line that looks like a\u000ablank line -- a line containing nothing but spaces or tabs is considered\u000ablank.) Normal paragraphs should not be intended with spaces or tabs."], ["p", "The implication of the \"one or more consecutive lines of text\" rule is\u000athat Markdown supports \"hard-wrapped\" text paragraphs. This differs\u000asignificantly from most other text-to-HTML formatters (including Movable\u000aType's \"Convert Line Breaks\" option) which translate every line break\u000acharacter in a paragraph into a ", ["code", "
    "], " tag."], ["p", "When you ", ["em", "do"], " want to insert a ", ["code", "
    "], " break tag using Markdown, you\u000aend a line with two or more spaces, then type return."], ["p", "Yes, this takes a tad more effort to create a ", ["code", "
    "], ", but a simplistic\u000a\"every line break is a ", ["code", "
    "], "\" rule wouldn't work for Markdown.\u000aMarkdown's email-style ", ["a", { "href": "#blockquote" }, "blockquoting"], " and multi-paragraph ", ["a", { "href": "#list" }, "list items"], "\u000awork best -- and look better -- when you format them with hard breaks."], "\u000a\u000a", ["h3", { "id": "header" }, "Headers"], "\u000a\u000a", ["p", "Markdown supports two styles of headers, ", ["a", { "href": "http://docutils.sourceforge.net/mirror/setext.html" }, "Setext"], " and ", ["a", { "href": "http://www.aaronsw.com/2002/atx/" }, "atx"], "."], ["p", "Setext-style headers are \"underlined\" using equal signs (for first-level\u000aheaders) and dashes (for second-level headers). For example:"], ["pre", ["code", "This is an H1\u000a=============\u000a\u000aThis is an H2\u000a-------------\u000a"]], ["p", "Any number of underlining ", ["code", "="], "'s or ", ["code", "-"], "'s will work."], ["p", "Atx-style headers use 1-6 hash characters at the start of the line,\u000acorresponding to header levels 1-6. For example:"], ["pre", ["code", "# This is an H1\u000a\u000a## This is an H2\u000a\u000a###### This is an H6\u000a"]], ["p", "Optionally, you may \"close\" atx-style headers. This is purely\u000acosmetic -- you can use this if you think it looks better. The\u000aclosing hashes don't even need to match the number of hashes\u000aused to open the header. (The number of opening hashes\u000adetermines the header level.) :"], ["pre", ["code", "# This is an H1 #\u000a\u000a## This is an H2 ##\u000a\u000a### This is an H3 ######\u000a"]], "\u000a\u000a", ["h3", { "id": "blockquote" }, "Blockquotes"], "\u000a\u000a", ["p", "Markdown uses email-style ", ["code", ">"], " characters for blockquoting. If you're\u000afamiliar with quoting passages of text in an email message, then you\u000aknow how to create a blockquote in Markdown. It looks best if you hard\u000awrap the text and put a ", ["code", ">"], " before every line:"], ["pre", ["code", "> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,\u000a> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.\u000a> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.\u000a> \u000a> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse\u000a> id sem consectetuer libero luctus adipiscing.\u000a"]], ["p", "Markdown allows you to be lazy and only put the ", ["code", ">"], " before the first\u000aline of a hard-wrapped paragraph:"], ["pre", ["code", "> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,\u000aconsectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.\u000aVestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.\u000a\u000a> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse\u000aid sem consectetuer libero luctus adipiscing.\u000a"]], ["p", "Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by\u000aadding additional levels of ", ["code", ">"], ":"], ["pre", ["code", "> This is the first level of quoting.\u000a>\u000a> > This is nested blockquote.\u000a>\u000a> Back to the first level.\u000a"]], ["p", "Blockquotes can contain other Markdown elements, including headers, lists,\u000aand code blocks:"], ["pre", ["code", "> ## This is a header.\u000a> \u000a> 1. This is the first list item.\u000a> 2. This is the second list item.\u000a> \u000a> Here's some example code:\u000a> \u000a> return shell_exec(\"echo $input | $markdown_script\");\u000a"]], ["p", "Any decent text editor should make email-style quoting easy. For\u000aexample, with BBEdit, you can make a selection and choose Increase\u000aQuote Level from the Text menu."], "\u000a\u000a", ["h3", { "id": "list" }, "Lists"], "\u000a\u000a", ["p", "Markdown supports ordered (numbered) and unordered (bulleted) lists."], ["p", "Unordered lists use asterisks, pluses, and hyphens -- interchangably\u000a-- as list markers:"], ["pre", ["code", "* Red\u000a* Green\u000a* Blue\u000a"]], ["p", "is equivalent to:"], ["pre", ["code", "+ Red\u000a+ Green\u000a+ Blue\u000a"]], ["p", "and:"], ["pre", ["code", "- Red\u000a- Green\u000a- Blue\u000a"]], ["p", "Ordered lists use numbers followed by periods:"], ["pre", ["code", "1. Bird\u000a2. McHale\u000a3. Parish\u000a"]], ["p", "It's important to note that the actual numbers you use to mark the\u000alist have no effect on the HTML output Markdown produces. The HTML\u000aMarkdown produces from the above list is:"], ["pre", ["code", "
      \u000a
    1. Bird
    2. \u000a
    3. McHale
    4. \u000a
    5. Parish
    6. \u000a
    \u000a"]], ["p", "If you instead wrote the list in Markdown like this:"], ["pre", ["code", "1. Bird\u000a1. McHale\u000a1. Parish\u000a"]], ["p", "or even:"], ["pre", ["code", "3. Bird\u000a1. McHale\u000a8. Parish\u000a"]], ["p", "you'd get the exact same HTML output. The point is, if you want to,\u000ayou can use ordinal numbers in your ordered Markdown lists, so that\u000athe numbers in your source match the numbers in your published HTML.\u000aBut if you want to be lazy, you don't have to."], ["p", "If you do use lazy list numbering, however, you should still start the\u000alist with the number 1. At some point in the future, Markdown may support\u000astarting ordered lists at an arbitrary number."], ["p", "List markers typically start at the left margin, but may be indented by\u000aup to three spaces. List markers must be followed by one or more spaces\u000aor a tab."], ["p", "To make lists look nice, you can wrap items with hanging indents:"], ["pre", ["code", "* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\u000a Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,\u000a viverra nec, fringilla in, laoreet vitae, risus.\u000a* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.\u000a Suspendisse id sem consectetuer libero luctus adipiscing.\u000a"]], ["p", "But if you want to be lazy, you don't have to:"], ["pre", ["code", "* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\u000aAliquam hendrerit mi posuere lectus. Vestibulum enim wisi,\u000aviverra nec, fringilla in, laoreet vitae, risus.\u000a* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.\u000aSuspendisse id sem consectetuer libero luctus adipiscing.\u000a"]], ["p", "If list items are separated by blank lines, Markdown will wrap the\u000aitems in ", ["code", "

    "], " tags in the HTML output. For example, this input:"], ["pre", ["code", "* Bird\u000a* Magic\u000a"]], ["p", "will turn into:"], ["pre", ["code", "

      \u000a
    • Bird
    • \u000a
    • Magic
    • \u000a
    \u000a"]], ["p", "But this:"], ["pre", ["code", "* Bird\u000a\u000a* Magic\u000a"]], ["p", "will turn into:"], ["pre", ["code", "
      \u000a
    • Bird

    • \u000a
    • Magic

    • \u000a
    \u000a"]], ["p", "List items may consist of multiple paragraphs. Each subsequent\u000aparagraph in a list item must be intended by either 4 spaces\u000aor one tab:"], ["pre", ["code", "1. This is a list item with two paragraphs. Lorem ipsum dolor\u000a sit amet, consectetuer adipiscing elit. Aliquam hendrerit\u000a mi posuere lectus.\u000a\u000a Vestibulum enim wisi, viverra nec, fringilla in, laoreet\u000a vitae, risus. Donec sit amet nisl. Aliquam semper ipsum\u000a sit amet velit.\u000a\u000a2. Suspendisse id sem consectetuer libero luctus adipiscing.\u000a"]], ["p", "It looks nice if you indent every line of the subsequent\u000aparagraphs, but here again, Markdown will allow you to be\u000alazy:"], ["pre", ["code", "* This is a list item with two paragraphs.\u000a\u000a This is the second paragraph in the list item. You're\u000aonly required to indent the first line. Lorem ipsum dolor\u000asit amet, consectetuer adipiscing elit.\u000a\u000a* Another item in the same list.\u000a"]], ["p", "To put a blockquote within a list item, the blockquote's ", ["code", ">"], "\u000adelimiters need to be indented:"], ["pre", ["code", "* A list item with a blockquote:\u000a\u000a > This is a blockquote\u000a > inside a list item.\u000a"]], ["p", "To put a code block within a list item, the code block needs\u000ato be indented ", ["em", "twice"], " -- 8 spaces or two tabs:"], ["pre", ["code", "* A list item with a code block:\u000a\u000a \u000a"]], ["p", "It's worth noting that it's possible to trigger an ordered list by\u000aaccident, by writing something like this:"], ["pre", ["code", "1986. What a great season.\u000a"]], ["p", "In other words, a ", ["em", "number-period-space"], " sequence at the beginning of a\u000aline. To avoid this, you can backslash-escape the period:"], ["pre", ["code", "1986\\. What a great season.\u000a"]], "\u000a\u000a", ["h3", { "id": "precode" }, "Code Blocks"], "\u000a\u000a", ["p", "Pre-formatted code blocks are used for writing about programming or\u000amarkup source code. Rather than forming normal paragraphs, the lines\u000aof a code block are interpreted literally. Markdown wraps a code block\u000ain both ", ["code", "
    "], " and ", ["code", ""], " tags."],
        ["p", "To produce a code block in Markdown, simply indent every line of the\u000ablock by at least 4 spaces or 1 tab. For example, given this input:"],
        ["pre", ["code", "This is a normal paragraph:\u000a\u000a    This is a code block.\u000a"]],
        ["p", "Markdown will generate:"],
        ["pre", ["code", "

    This is a normal paragraph:

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

    Here is an example of AppleScript:

    \u000a\u000a
    tell application \"Foo\"\u000a    beep\u000aend tell\u000a
    \u000a"]], ["p", "A code block continues until it reaches a line that is not indented\u000a(or the end of the article)."], ["p", "Within a code block, ampersands (", ["code", "&"], ") and angle brackets (", ["code", "<"], " and ", ["code", ">"], ")\u000aare automatically converted into HTML entities. This makes it very\u000aeasy to include example HTML source code using Markdown -- just paste\u000ait and indent it, and Markdown will handle the hassle of encoding the\u000aampersands and angle brackets. For example, this:"], ["pre", ["code", "
    \u000a © 2004 Foo Corporation\u000a
    \u000a"]], ["p", "will turn into:"], ["pre", ["code", "
    <div class=\"footer\">\u000a    &copy; 2004 Foo Corporation\u000a</div>\u000a
    \u000a"]], ["p", "Regular Markdown syntax is not processed within code blocks. E.g.,\u000aasterisks are just literal asterisks within a code block. This means\u000ait's also easy to use Markdown to write about Markdown's own syntax."], "\u000a\u000a", ["h3", { "id": "hr" }, "Horizontal Rules"], "\u000a\u000a", ["p", "You can produce a horizontal rule tag (", ["code", "
    "], ") by placing three or\u000amore hyphens, asterisks, or underscores on a line by themselves. If you\u000awish, you may use spaces between the hyphens or asterisks. Each of the\u000afollowing lines will produce a horizontal rule:"], ["pre", ["code", "* * *\u000a\u000a***\u000a\u000a*****\u000a\u000a- - -\u000a\u000a---------------------------------------\u000a\u000a_ _ _\u000a"]], "\u000a\u000a", ["hr"], "\u000a\u000a", ["h2", { "id": "span" }, "Span Elements"], "\u000a\u000a", ["h3", { "id": "link" }, "Links"], "\u000a\u000a", ["p", "Markdown supports two style of links: ", ["em", "inline"], " and ", ["em", "reference"], "."], ["p", "In both styles, the link text is delimited by [square brackets]."], ["p", "To create an inline link, use a set of regular parentheses immediately\u000aafter the link text's closing square bracket. Inside the parentheses,\u000aput the URL where you want the link to point, along with an ", ["em", "optional"], "\u000atitle for the link, surrounded in quotes. For example:"], ["pre", ["code", "This is [an example](http://example.com/ \"Title\") inline link.\u000a\u000a[This link](http://example.net/) has no title attribute.\u000a"]], ["p", "Will produce:"], ["pre", ["code", "

    This is \u000aan example inline link.

    \u000a\u000a

    This link has no\u000atitle attribute.

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

    I get 10 times more traffic from Google than from\u000aYahoo\u000aor MSN.

    \u000a"]], ["p", "For comparison, here is the same paragraph written using\u000aMarkdown's inline link style:"], ["pre", ["code", "I get 10 times more traffic from [Google](http://google.com/ \"Google\")\u000athan from [Yahoo](http://search.yahoo.com/ \"Yahoo Search\") or\u000a[MSN](http://search.msn.com/ \"MSN Search\").\u000a"]], ["p", "The point of reference-style links is not that they're easier to\u000awrite. The point is that with reference-style links, your document\u000asource is vastly more readable. Compare the above examples: using\u000areference-style links, the paragraph itself is only 81 characters\u000along; with inline-style links, it's 176 characters; and as raw HTML,\u000ait's 234 characters. In the raw HTML, there's more markup than there\u000ais text."], ["p", "With Markdown's reference-style links, a source document much more\u000aclosely resembles the final output, as rendered in a browser. By\u000aallowing you to move the markup-related metadata out of the paragraph,\u000ayou can add links without interrupting the narrative flow of your\u000aprose."], "\u000a\u000a", ["h3", { "id": "em" }, "Emphasis"], "\u000a\u000a", ["p", "Markdown treats asterisks (", ["code", "*"], ") and underscores (", ["code", "_"], ") as indicators of\u000aemphasis. Text wrapped with one ", ["code", "*"], " or ", ["code", "_"], " will be wrapped with an\u000aHTML ", ["code", ""], " tag; double ", ["code", "*"], "'s or ", ["code", "_"], "'s will be wrapped with an HTML\u000a", ["code", ""], " tag. E.g., this input:"], ["pre", ["code", "*single asterisks*\u000a\u000a_single underscores_\u000a\u000a**double asterisks**\u000a\u000a__double underscores__\u000a"]], ["p", "will produce:"], ["pre", ["code", "single asterisks\u000a\u000asingle underscores\u000a\u000adouble asterisks\u000a\u000adouble underscores\u000a"]], ["p", "You can use whichever style you prefer; the lone restriction is that\u000athe same character must be used to open and close an emphasis span."], ["p", "Emphasis can be used in the middle of a word:"], ["pre", ["code", "un*fucking*believable\u000a"]], ["p", "But if you surround an ", ["code", "*"], " or ", ["code", "_"], " with spaces, it'll be treated as a\u000aliteral asterisk or underscore."], ["p", "To produce a literal asterisk or underscore at a position where it\u000awould otherwise be used as an emphasis delimiter, you can backslash\u000aescape it:"], ["pre", ["code", "\\*this text is surrounded by literal asterisks\\*\u000a"]], "\u000a\u000a", ["h3", { "id": "code" }, "Code"], "\u000a\u000a", ["p", "To indicate a span of code, wrap it with backtick quotes (", ["code", "`"], ").\u000aUnlike a pre-formatted code block, a code span indicates code within a\u000anormal paragraph. For example:"], ["pre", ["code", "Use the `printf()` function.\u000a"]], ["p", "will produce:"], ["pre", ["code", "

    Use the printf() function.

    \u000a"]], ["p", "To include a literal backtick character within a code span, you can use\u000amultiple backticks as the opening and closing delimiters:"], ["pre", ["code", "``There is a literal backtick (`) here.``\u000a"]], ["p", "which will produce this:"], ["pre", ["code", "

    There is a literal backtick (`) here.

    \u000a"]], ["p", "The backtick delimiters surrounding a code span may include spaces --\u000aone after the opening, one before the closing. This allows you to place\u000aliteral backtick characters at the beginning or end of a code span:"], ["pre", ["code", "A single backtick in a code span: `` ` ``\u000a\u000aA backtick-delimited string in a code span: `` `foo` ``\u000a"]], ["p", "will produce:"], ["pre", ["code", "

    A single backtick in a code span: `

    \u000a\u000a

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

    \u000a"]], ["p", "With a code span, ampersands and angle brackets are encoded as HTML\u000aentities automatically, which makes it easy to include example HTML\u000atags. Markdown will turn this:"], ["pre", ["code", "Please don't use any `` tags.\u000a"]], ["p", "into:"], ["pre", ["code", "

    Please don't use any <blink> tags.

    \u000a"]], ["p", "You can write this:"], ["pre", ["code", "`—` is the decimal-encoded equivalent of `—`.\u000a"]], ["p", "to produce:"], ["pre", ["code", "

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

    \u000a"]], "\u000a\u000a", ["h3", { "id": "img" }, "Images"], "\u000a\u000a", ["p", "Admittedly, it's fairly difficult to devise a \"natural\" syntax for\u000aplacing images into a plain text document format."], ["p", "Markdown uses an image syntax that is intended to resemble the syntax\u000afor links, allowing for two styles: ", ["em", "inline"], " and ", ["em", "reference"], "."], ["p", "Inline image syntax looks like this:"], ["pre", ["code", "![Alt text](/path/to/img.jpg)\u000a\u000a![Alt text](/path/to/img.jpg \"Optional title\")\u000a"]], ["p", "That is:"], ["ul", ["li", "An exclamation mark: ", ["code", "!"], ";"], ["li", "followed by a set of square brackets, containing the ", ["code", "alt"], "\u000aattribute text for the image;"], ["li", "followed by a set of parentheses, containing the URL or path to\u000athe image, and an optional ", ["code", "title"], " attribute enclosed in double\u000aor single quotes."]], ["p", "Reference-style image syntax looks like this:"], ["pre", ["code", "![Alt text][id]\u000a"]], ["p", "Where \"id\" is the name of a defined image reference. Image references\u000aare defined using syntax identical to link references:"], ["pre", ["code", "[id]: url/to/image \"Optional title attribute\"\u000a"]], ["p", "As of this writing, Markdown has no syntax for specifying the\u000adimensions of an image; if this is important to you, you can simply\u000ause regular HTML ", ["code", ""], " tags."], "\u000a\u000a", ["hr"], "\u000a\u000a", ["h2", { "id": "misc" }, "Miscellaneous"], "\u000a\u000a", ["h3", { "id": "autolink" }, "Automatic Links"], "\u000a\u000a", ["p", "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:"], ["pre", ["code", "\u000a"]], ["p", "Markdown will turn this into:"], ["pre", ["code", "http://example.com/\u000a"]], ["p", "Automatic links for email addresses work similarly, except that\u000aMarkdown will also perform a bit of randomized decimal and hex\u000aentity-encoding to help obscure your address from address-harvesting\u000aspambots. For example, Markdown will turn this:"], ["pre", ["code", "\u000a"]], ["p", "into something like this:"], ["pre", ["code", "address@exa\u000ample.com\u000a"]], ["p", "which will render in a browser as a clickable link to \"address@example.com\"."], ["p", "(This sort of entity-encoding trick will indeed fool many, if not\u000amost, address-harvesting bots, but it definitely won't fool all of\u000athem. It's better than nothing, but an address published in this way\u000awill probably eventually start receiving spam.)"], "\u000a\u000a", ["h3", { "id": "backslash" }, "Backslash Escapes"], "\u000a\u000a", ["p", "Markdown allows you to use backslash escapes to generate literal\u000acharacters which would otherwise have special meaning in Markdown's\u000aformatting syntax. For example, if you wanted to surround a word with\u000aliteral asterisks (instead of an HTML ", ["code", ""], " tag), you can backslashes\u000abefore the asterisks, like this:"], ["pre", ["code", "\\*literal asterisks\\*\u000a"]], ["p", "Markdown provides backslash escapes for the following characters:"], ["pre", ["code", "\\ backslash\u000a` backtick\u000a* asterisk\u000a_ underscore\u000a{} curly braces\u000a[] square brackets\u000a() parentheses\u000a# hash mark\u000a+ plus sign\u000a- minus sign (hyphen)\u000a. dot\u000a! exclamation mark\u000a"]]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Syntax.text ================================================ 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. McHale
    3. Parish
    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 ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Markdown_Documentation_-_Syntax.xhtml ================================================

    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
    
    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Nested_blockquotes.json ================================================ ["html", ["blockquote", ["p", "foo"], ["blockquote", ["p", "bar"]], ["p", "foo"]]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Nested_blockquotes.text ================================================ > foo > > > bar > > foo ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Nested_blockquotes.xhtml ================================================

    foo

    bar

    foo

    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Ordered_and_unordered_lists.json ================================================ ["html", ["h2", "Unordered"], "\u000a\u000a", ["p", "Asterisks tight:"], ["ul", ["li", "asterisk 1"], ["li", "asterisk 2"], ["li", "asterisk 3"]], ["p", "Asterisks loose:"], ["ul", ["li", ["p", "asterisk 1"]], ["li", ["p", "asterisk 2"]], ["li", ["p", "asterisk 3"]]], "\u000a\u000a", ["hr"], "\u000a\u000a", ["p", "Pluses tight:"], ["ul", ["li", "Plus 1"], ["li", "Plus 2"], ["li", "Plus 3"]], ["p", "Pluses loose:"], ["ul", ["li", ["p", "Plus 1"]], ["li", ["p", "Plus 2"]], ["li", ["p", "Plus 3"]]], "\u000a\u000a", ["hr"], "\u000a\u000a", ["p", "Minuses tight:"], ["ul", ["li", "Minus 1"], ["li", "Minus 2"], ["li", "Minus 3"]], ["p", "Minuses loose:"], ["ul", ["li", ["p", "Minus 1"]], ["li", ["p", "Minus 2"]], ["li", ["p", "Minus 3"]]], "\u000a\u000a", ["h2", "Ordered"], "\u000a\u000a", ["p", "Tight:"], ["ol", ["li", "First"], ["li", "Second"], ["li", "Third"]], ["p", "and:"], ["ol", ["li", "One"], ["li", "Two"], ["li", "Three"]], ["p", "Loose using tabs:"], ["ol", ["li", ["p", "First"]], ["li", ["p", "Second"]], ["li", ["p", "Third"]]], ["p", "and using spaces:"], ["ol", ["li", ["p", "One"]], ["li", ["p", "Two"]], ["li", ["p", "Three"]]], ["p", "Multiple paragraphs:"], ["ol", ["li", ["p", "Item 1, graf one."], ["p", "Item 2. graf two. The quick brown fox jumped over the lazy dog's\u000aback."]], ["li", ["p", "Item 2."]], ["li", ["p", "Item 3."]]], "\u000a\u000a", ["h2", "Nested"], "\u000a\u000a", ["ul", ["li", "Tab\u000a", ["ul", ["li", "Tab\u000a", ["ul", ["li", "Tab"]]]]]], ["p", "Here's another:"], ["ol", ["li", "First"], ["li", "Second:\u000a", ["ul", ["li", "Fee"], ["li", "Fie"], ["li", "Foe"]]], ["li", "Third"]], ["p", "Same thing but with paragraphs:"], ["ol", ["li", ["p", "First"]], ["li", ["p", "Second:"], ["ul", ["li", "Fee"], ["li", "Fie"], ["li", "Foe"]]], ["li", ["p", "Third"]]], ["p", "This was an error in Markdown 1.0.1:"], ["ul", ["li", ["p", "this"], ["ul", ["li", "sub"]], ["p", "that"]]]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Ordered_and_unordered_lists.text ================================================ ## 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 ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Ordered_and_unordered_lists.xhtml ================================================

    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

    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Strong_and_em_together.json ================================================ ["html", ["p", ["strong", ["em", "This is strong and em."]]], ["p", "So is ", ["strong", ["em", "this"]], " word."], ["p", ["strong", ["em", "This is strong and em."]]], ["p", "So is ", ["strong", ["em", "this"]], " word."]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Strong_and_em_together.text ================================================ ***This is strong and em.*** So is ***this*** word. ___This is strong and em.___ So is ___this___ word. ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Strong_and_em_together.xhtml ================================================

    This is strong and em.

    So is this word.

    This is strong and em.

    So is this word.

    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Tabs.json ================================================ ["html", ["ul", ["li", ["p", "this is a list item\u000aindented with tabs"]], ["li", ["p", "this is a list item\u000aindented with spaces"]]], ["p", "Code:"], ["pre", ["code", "this code block is indented by one tab\u000a"]], ["p", "And:"], ["pre", ["code", " this code block is indented by two tabs\u000a"]], ["p", "And:"], ["pre", ["code", "+ this is an example list item\u000a indented with tabs\u000a\u000a+ this is an example list item\u000a indented with spaces\u000a"]]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Tabs.text ================================================ + 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 ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Tabs.xhtml ================================================
    • 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
    
    ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Tidyness.json ================================================ ["html", ["blockquote", ["p", "A list within a blockquote:"], ["ul", ["li", "asterisk 1"], ["li", "asterisk 2"], ["li", "asterisk 3"]]]] ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Tidyness.text ================================================ > A list within a blockquote: > > * asterisk 1 > * asterisk 2 > * asterisk 3 ================================================ FILE: test/fixtures/Markdown-from-MDTest1.1.mdtest/Tidyness.xhtml ================================================

    A list within a blockquote:

    • asterisk 1
    • asterisk 2
    • asterisk 3
    ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Backslash_escapes.json ================================================ ["html", ["p", "Tricky combinaisons:"], ["p", "backslash with \\-- two dashes"], ["p", "backslash with \\> greater than"], ["p", "\\[test](not a link)"], ["p", "\\*no emphasis*"]] ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Backslash_escapes.text ================================================ Tricky combinaisons: backslash with \\-- two dashes backslash with \\> greater than \\\[test](not a link) \\\*no emphasis* ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Backslash_escapes.xhtml ================================================

    Tricky combinaisons:

    backslash with \-- two dashes

    backslash with \> greater than

    \[test](not a link)

    \*no emphasis*

    ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Code_Spans.json ================================================ ["html", ["p", "From ", ["code", ""], "\u000aon two lines."], ["p", "From ", ["code", ""], "\u000aon three lines."]] ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Code_Spans.text ================================================ From `` on two lines. From `` on three lines. ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Code_Spans.xhtml ================================================

    From <!-- to --> on two lines.

    From <!-- to --> on three lines.

    ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Code_block_in_a_list_item.json ================================================ ["html", ["ul", ["li", ["p", "List Item:"], ["pre", ["code", "code block\u000a\u000awith a blank line\u000a"]], ["p", "within a list item."]]]] ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Code_block_in_a_list_item.text ================================================ * List Item: code block with a blank line within a list item. ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Code_block_in_a_list_item.xhtml ================================================
    • List Item:

      code block
      
      with a blank line
      

      within a list item.

    ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Email_auto_links.json ================================================ ["html", ["p", ["a", { "href": "mailto:michel.fortin@michelf.com" }, "michel.fortin@michelf.com"]], ["p", "International domain names: ", ["a", { "href": "mailto:help@tūdaliņ.lv" }, "help@tūdaliņ.lv"]]] ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Email_auto_links.text ================================================ International domain names: ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Email_auto_links.xhtml ================================================

    michel.fortin@michelf.com

    International domain names: help@tūdaliņ.lv

    ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Emphasis.json ================================================ ["html", ["p", "Combined emphasis:"], ["ol", ["li", ["strong", ["em", "test test"]]], ["li", ["strong", ["em", "test test"]]], ["li", ["em", "test ", ["strong", "test"]]], ["li", ["strong", "test ", ["em", "test"]]], ["li", ["strong", ["em", "test"], " test"]], ["li", ["em", ["strong", "test"], " test"]], ["li", ["strong", ["em", "test"], " test"]], ["li", ["strong", "test ", ["em", "test"]]], ["li", ["em", "test ", ["strong", "test"]]], ["li", ["em", "test ", ["strong", "test"]]], ["li", ["strong", "test ", ["em", "test"]]], ["li", ["strong", ["em", "test"], " test"]], ["li", ["em", ["strong", "test"], " test"]], ["li", ["strong", ["em", "test"], " test"]], ["li", ["strong", "test ", ["em", "test"]]], ["li", ["em", "test ", ["strong", "test"]]]], ["p", "Incorrect nesting:"], ["ol", ["li", "*test ", ["strong", "test* test"]], ["li", "_test ", ["strong", "test_ test"]], ["li", "**test ", ["em", "test"], "* test*"], ["li", "__test ", ["em", "test"], "_ test_"], ["li", ["em", "test *test"], " test*"], ["li", ["em", "test _test"], " test_"], ["li", ["strong", "test ", ["strong", "test"], " test"]], ["li", ["strong", "test ", ["strong", "test"], " test"]]], ["p", "No emphasis:"], ["ol", ["li", "test* test *test"], ["li", "test** test **test"], ["li", "test_ test _test"], ["li", "test__ test __test"]], ["p", "Middle-word emphasis (asterisks):"], ["ol", ["li", ["em", "a"], "b"], ["li", "a", ["em", "b"]], ["li", "a", ["em", "b"], "c"], ["li", ["strong", "a"], "b"], ["li", "a", ["strong", "b"]], ["li", "a", ["strong", "b"], "c"]], ["p", "Middle-word emphasis (underscore):"], ["ol", ["li", ["em", "a"], "b"], ["li", "a", ["em", "b"]], ["li", "a", ["em", "b"], "c"], ["li", ["strong", "a"], "b"], ["li", "a", ["strong", "b"]], ["li", "a", ["strong", "b"], "c"]], ["p", "my", ["em", "precious"], "file.txt"], "\u000a\u000a", ["h2", "Tricky Cases"], "\u000a\u000a", ["p", "E**. ", ["strong", "Test"], " TestTestTest"], ["p", "E**. ", ["strong", "Test"], " Test Test Test"]] ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Emphasis.text ================================================ 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 ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Emphasis.xhtml ================================================

    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. ab
    2. ab
    3. abc
    4. ab
    5. ab
    6. abc

    Middle-word emphasis (underscore):

    1. ab
    2. ab
    3. abc
    4. ab
    5. ab
    6. abc

    mypreciousfile.txt

    Tricky Cases

    E**. Test TestTestTest

    E**. Test Test Test Test

    ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Headers.json ================================================ ["html", ["h1", "Header"], "\u000a\u000a", ["h2", "Header"], "\u000a\u000a", ["h3", "Header"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["h1", "Header"], "\u000a\u000a", ["p", "Paragraph"], "\u000a\u000a", ["h2", "Header"], "\u000a\u000a", ["p", "Paragraph"], "\u000a\u000a", ["h3", "Header"], "\u000a\u000a", ["p", "Paragraph"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["p", "Paragraph"], "\u000a\u000a", ["h1", "Header"], "\u000a\u000a", ["p", "Paragraph"], ["p", "Paragraph"], "\u000a\u000a", ["h2", "Header"], "\u000a\u000a", ["p", "Paragraph"], ["p", "Paragraph"], "\u000a\u000a", ["h3", "Header"], "\u000a\u000a", ["p", "Paragraph"]] ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Headers.text ================================================ Header ====== Header ------ ### Header - - - Header ====== Paragraph Header ------ Paragraph ### Header Paragraph - - - Paragraph Header ====== Paragraph Paragraph Header ------ Paragraph Paragraph ### Header Paragraph ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Headers.xhtml ================================================

    Header

    Header

    Header


    Header

    Paragraph

    Header

    Paragraph

    Header

    Paragraph


    Paragraph

    Header

    Paragraph

    Paragraph

    Header

    Paragraph

    Paragraph

    Header

    Paragraph

    ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Horizontal_Rules.json ================================================ ["html", ["p", "Horizontal rules:"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["p", "Not horizontal rules (testing for a bug in 1.0.1j):"], ["p", "+++"], ["p", ",,,"], ["p", "==="], ["p", "???"], ["p", "AAA"], ["p", "jjj"], ["p", "j j j"], ["p", "n n n"]] ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Horizontal_Rules.text ================================================ Horizontal rules: - - - * * * *** --- ___ Not horizontal rules (testing for a bug in 1.0.1j): +++ ,,, === ??? AAA jjj j j j n n n ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Horizontal_Rules.xhtml ================================================

    Horizontal rules:






    Not horizontal rules (testing for a bug in 1.0.1j):

    +++

    ,,,

    ===

    ???

    AAA

    jjj

    j j j

    n n n

    ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).html ================================================

    With some attributes:

    foo
    foo

    Hr's:


    ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).json ================================================ ["html", ["p", "With some attributes:"], "\u000a\u000a", ["div", { "id": "test" }, "\u000a foo\u000a"], "\u000a\u000a", ["div", { "id": "test", "class": "nono" }, "\u000a foo\u000a"], "\u000a\u000a", ["p", "Hr's:"], "\u000a\u000a", ["hr", { "class": "foo", "id": "bar" }]] ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Simple).text ================================================ With some attributes:
    foo
    foo
    Hr's:
    ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Span).json ================================================ ["html", ["p", ["abbr", { "title": "` **Attribute Content Is Not A Code Span** `" }, "ACINACS"]], ["p", ["abbr", { "title": "`first backtick!" }, "SB"], " \u000a", ["abbr", { "title": "`second backtick!" }, "SB"]]] ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Span).text ================================================ ACINACS SB SB ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_(Span).xhtml ================================================

    ACINACS

    SB SB

    ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.html ================================================

    Paragraph one.

    Paragraph two.

    The end.

    ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.json ================================================ ["html", ["p", "Paragraph one."], "\u000a\u000a", "\u000a\u000a", ["p", "Paragraph two."], "\u000a\u000a", "\u000a\u000a", ["p", "The end."]] ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Inline_HTML_comments.text ================================================ Paragraph one. Paragraph two. The end. ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Ins_and_del.json ================================================ ["html", ["p", "Here is a block tag ins:"], "\u000a\u000a", ["ins", ["p", "Some text"]], "\u000a\u000a", ["p", ["ins", "And here it is inside a paragraph."]], ["p", "And here it is ", ["ins", "in the middle of"], " a paragraph."], "\u000a\u000a", ["del", ["p", "Some text"]], "\u000a\u000a", ["p", ["del", "And here is ins as a paragraph."]], ["p", "And here it is ", ["del", "in the middle of"], " a paragraph."]] ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Ins_and_del.text ================================================ 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. ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Ins_and_del.xhtml ================================================

    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.

    ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Links_inline_style.json ================================================ ["html", ["p", ["a", { "href": "?}]*+|&)" }, "silly URL w/ angle brackets"], "."]] ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Links_inline_style.text ================================================ [silly URL w/ angle brackets](). ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Links_inline_style.xhtml ================================================

    silly URL w/ angle brackets.

    ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/MD5_Hashes.json ================================================ ["html", ["h1", "Character Escapes"], "\u000a\u000a", ["p", "The MD5 value for ", ["code", "+"], " is \"26b17225b626fb9238849fd60eabdf60\"."], "\u000a\u000a", ["h1", "HTML Blocks"], "\u000a\u000a", ["p", "test"], ["p", "The MD5 value for ", ["code", "

    test

    "], " is:"], ["p", "6205333b793f34273d75379350b36826"]] ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/MD5_Hashes.text ================================================ # Character Escapes The MD5 value for `+` is "26b17225b626fb9238849fd60eabdf60". # HTML Blocks

    test

    The MD5 value for `

    test

    ` is: 6205333b793f34273d75379350b36826 ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/MD5_Hashes.xhtml ================================================

    Character Escapes

    The MD5 value for + is "26b17225b626fb9238849fd60eabdf60".

    HTML Blocks

    test

    The MD5 value for <p>test</p> is:

    6205333b793f34273d75379350b36826

    ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Nesting.json ================================================ ["html", ["p", "Valid nesting:"], ["p", ["strong", ["a", { "href": "url" }, "Link"]]], ["p", ["a", { "href": "url" }, ["strong", "Link"]]], ["p", ["strong", ["a", { "href": "url" }, ["strong", "Link"]]]], ["p", "Invalid nesting:"], ["p", ["a", { "href": "url" }, "[Link](url)"]]] ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Nesting.text ================================================ Valid nesting: **[Link](url)** [**Link**](url) **[**Link**](url)** Invalid nesting: [[Link](url)](url) ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Nesting.xhtml ================================================

    Valid nesting:

    Link

    Link

    Link

    Invalid nesting:

    [Link](url)

    ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/PHP-Specific_Bugs.json ================================================ ["html", ["p", "This tests for a bug where quotes escaped by PHP when using \u000a", ["code", "preg_replace"], " with the ", ["code", "/e"], " modifier must be correctly unescaped\u000a(hence the ", ["code", "_UnslashQuotes"], " function found only in PHP Markdown)."], ["p", "Headers below should appear exactly as they are typed (no backslash\u000aadded or removed)."], "\u000a\u000a", ["h1", "Header \"quoted\\\" again \\\"\""], "\u000a\u000a", ["h2", "Header \"quoted\\\" again \\\"\""], "\u000a\u000a", ["h3", "Header \"quoted\\\" again \\\"\""], "\u000a\u000a", ["p", "Test with tabs for ", ["code", "_Detab"], ":"], ["pre", ["code", "Code 'block' with some \"tabs\" and \"quotes\"\u000a"]]] ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/PHP-Specific_Bugs.text ================================================ 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" ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/PHP-Specific_Bugs.xhtml ================================================

    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"
    
    ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Parens_in_URL.json ================================================ ["html", ["p", ["a", { "href": "/url(test)", "title": "title" }, "Inline link 1 with parens"], "."], ["p", ["a", { "href": "/url(test)", "title": "title" }, "Inline link 2 with parens"], "."], ["p", ["a", { "href": "/url(test)", "title": "title" }, "Inline link 3 with non-escaped parens"], "."], ["p", ["a", { "href": "/url(test)", "title": "title" }, "Inline link 4 with non-escaped parens"], "."], ["p", ["a", { "href": "/url(test)", "title": "title" }, "Reference link 1 with parens"], "."], ["p", ["a", { "href": "/url(test)", "title": "title" }, "Reference link 2 with parens"], "."]] ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Parens_in_URL.text ================================================ [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" ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Parens_in_URL.xhtml ================================================

    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.

    ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Tight_blocks.json ================================================ ["html", ["p", "Paragraph and no space:\u000a* ciao"], ["p", "Paragraph and 1 space:\u000a * ciao"], ["p", "Paragraph and 3 spaces:\u000a * ciao"], ["p", "Paragraph and 4 spaces:\u000a * ciao"], ["p", "Paragraph before header:"], "\u000a\u000a", ["h1", "Header"], "\u000a\u000a", ["p", "Paragraph before blockquote:"], ["blockquote", ["p", "Some quote."]]] ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Tight_blocks.text ================================================ 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. ================================================ FILE: test/fixtures/PHP_Markdown-from-MDTest1.1.mdtest/Tight_blocks.xhtml ================================================

    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.

    ================================================ FILE: test/fixtures/README ================================================ All of these tests (so far) were copied from: github.com/bobtfish/text-markdown/t @ 29ffc3 which is licensed as follows: Copyright (c) 2004, John Gruber All rights reserved. MultiMarkdown changes Copyright (c) 2005-2006 Fletcher T. Penney All rights reserved. Text::MultiMarkdown changes Copyright (c) 2006-2009 Darren Kulp and Tomas Doran 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 "Markdown" 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 copyright holders and contributors "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 the copyright owner or contributors 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. ================================================ FILE: test/fixtures/Text-Markdown.mdtest/CoreDumps5.8.json ================================================ ["html", ["ul", ["li", "Unordered\u000a", ["ol", ["li", "Ordered"]]]], ["p", "Text"], ["ul", ["li", "Unordered\u000a", ["ol", ["li", "Ordered"]]]]] ================================================ FILE: test/fixtures/Text-Markdown.mdtest/CoreDumps5.8.text ================================================ * Unordered 1. Ordered Text * Unordered 1. Ordered ================================================ FILE: test/fixtures/Text-Markdown.mdtest/CoreDumps5.8.xhtml ================================================
    • Unordered
      1. Ordered

    Text

    • Unordered
      1. Ordered
    ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Emphasis.json ================================================ ["html", ["p", ["em", "M*A*S*H"], " here I am going with original Markdown.."], ["p", "foo_bar_bas I am going with PHP Markdown Extra here (by default, there is an option for original style behavior - see\u000adocs).."]] ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Emphasis.text ================================================ _M*A*S*H_ here I am going with original Markdown.. foo_bar_bas I am going with PHP Markdown Extra here (by default, there is an option for original style behavior - see docs).. ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Emphasis.xhtml ================================================

    M*A*S*H here I am going with original Markdown..

    foo_bar_bas I am going with PHP Markdown Extra here (by default, there is an option for original style behavior - see docs)..

    ================================================ FILE: test/fixtures/Text-Markdown.mdtest/HTML-Comment-encoding.json ================================================ ["html", ["p", "A markdown paragraph with a comment that ", ["em", "will"], " be processed by original Markdown. However MultiMarkdown and Pandoc do not convert the & sigil in the comment.. "], ["p", "A paragraph "], ["p"]] ================================================ FILE: test/fixtures/Text-Markdown.mdtest/HTML-Comment-encoding.text ================================================ A markdown paragraph with a comment that *will* be processed by original Markdown. However MultiMarkdown and Pandoc do not convert the & sigil in the comment.. A paragraph

    ================================================ FILE: test/fixtures/Text-Markdown.mdtest/HTML-Comment-encoding.xhtml ================================================

    A markdown paragraph with a comment that will be processed by original Markdown. However MultiMarkdown and Pandoc do not convert the & sigil in the comment..

    A paragraph

    ================================================ FILE: test/fixtures/Text-Markdown.mdtest/HTML5-attributes.html ================================================

    foo

    this is a paragraph

    an h2

    normal

    ================================================ FILE: test/fixtures/Text-Markdown.mdtest/HTML5-attributes.json ================================================ ["html", ["h1", { "class": "foo" }, "foo"], "\u000a\u000a", ["p", { "class": "bar" }, "\u000athis is a paragraph\u000a"], "\u000a\u000a", ["h2", { "class": "bar" }, "\u000aan h2\u000a"], "\u000a\u000a", ["p", "normal"]] ================================================ FILE: test/fixtures/Text-Markdown.mdtest/HTML5-attributes.text ================================================

    foo

    this is a paragraph

    an h2

    normal ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Links_brackets.json ================================================ ["html", ["p", ["a", { "href": "http://en.wikipedia.org/wiki/ZIP_(file_format)", "title": "ZIP (file format) - Wikipedia, the free encyclopedia" }, "ZIP archives"]]] ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Links_brackets.text ================================================ [ZIP archives](http://en.wikipedia.org/wiki/ZIP_(file_format) "ZIP (file format) - Wikipedia, the free encyclopedia") ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Links_brackets.xhtml ================================================

    ZIP archives

    ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Links_multiline_bugs_1.html ================================================

    http://bugs.debian.org/459885

    link text

    ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Links_multiline_bugs_1.json ================================================ ["html", ["p", ["a", { "href": "http://bugs.debian.org/459885" }, "http://bugs.debian.org/459885"]], ["p", ["a", { "href": "/someurl/" }, "link \u000atext"]]] ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Links_multiline_bugs_1.text ================================================ [link text] [link id] [link id]: /someurl/ ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Links_multiline_bugs_2.html ================================================

    http://bugs.debian.org/459885

    Bla, bla, bla, bla, bla, bla, bla, bla, bla, bla bla. This is my
    University
    .

    ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Links_multiline_bugs_2.json ================================================ ["html", ["p", ["a", { "href": "http://bugs.debian.org/459885" }, "http://bugs.debian.org/459885"]], ["p", "Bla, bla, bla, bla, bla, bla, bla, bla, bla, bla bla. This is ", ["a", { "href": "http://www.ua.es" }, "my ", ["br"], "\u000aUniversity"], "."]] ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Links_multiline_bugs_2.text ================================================ Bla, bla, bla, bla, bla, bla, bla, bla, bla, bla bla. This is [my University][]. [my university]: http://www.ua.es ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Links_reference_style.json ================================================ ["html", ["p", "Foo ", ["a", { "href": "/url/", "title": "Title" }, "bar"], "."], ["p", "Foo ", ["a", { "href": "/url/", "title": "Title" }, "bar"], "."], ["p", "Foo ", ["a", { "href": "/url/", "title": "Title" }, "bar"], "."], ["p", "With ", ["a", { "href": "/url/" }, "embedded [brackets]"], "."], ["p", "Indented ", ["a", { "href": "/url" }, "once"], "."], ["p", "Indented ", ["a", { "href": "/url" }, "twice"], "."], ["p", "Indented ", ["a", { "href": "/url" }, "thrice"], "."], ["p", "Indented [four][] times."], ["pre", ["code", "[four]: /url\u000a"]], "\u000a\u000a", ["hr"], "\u000a\u000a", ["p", ["a", { "href": "foo" }, "this"], " should work"], ["p", "So should ", ["a", { "href": "foo" }, "this"], "."], ["p", "And ", ["a", { "href": "foo" }, "this"], "."], ["p", "And ", ["a", { "href": "foo" }, "this"], "."], ["p", "And ", ["a", { "href": "foo" }, "this"], "."], ["p", "But not [that] []."], ["p", "Nor [that][]."], ["p", "Nor [that]."], ["p", "[Something in brackets like ", ["a", { "href": "foo" }, "this"], " should work]"], ["p", "[Same with ", ["a", { "href": "foo" }, "this"], ".]"], ["p", "In this case, ", ["a", { "href": "/somethingelse/" }, "this"], " points to something else."], ["p", "Backslashing should suppress [this] and [this]."], "\u000a\u000a", ["hr"], "\u000a\u000a", ["p", "Here's one where the ", ["a", { "href": "/url/" }, "link\u000abreaks"], " across lines."], ["p", "Here's another where the ", ["a", { "href": "/url/" }, "link \u000abreaks"], " across lines, but with a line-ending space."], ["p", "More multi line edge cases. First a broken link id"], ["p", ["a", { "href": "/someurl/" }, "link \u000atext"]], ["p", "Then a line with 2 chars of trailing whitespace and a line break ", ["a", { "href": "http://www.ua.es" }, "my ", ["br"], "\u000aUniversity"], "."], ["p", "The a shortcut reference link with 2 chars of trailing whitespace and a line break ", ["a", { "href": "http://www.ua.es" }, "my ", ["br"], "\u000aUniversity"], "."]] ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Links_reference_style.text ================================================ 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/ More multi line edge cases. First a broken link id [link text] [link id] [link id]: /someurl/ Then a line with 2 chars of trailing whitespace and a line break [my University][]. The a shortcut reference link with 2 chars of trailing whitespace and a line break [my University]. [my university]: http://www.ua.es ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Links_reference_style.xhtml ================================================

    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.

    More multi line edge cases. First a broken link id

    link text

    Then a line with 2 chars of trailing whitespace and a line break my
    University
    .

    The a shortcut reference link with 2 chars of trailing whitespace and a line break my
    University
    .

    ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Lists-multilevel-md5-edgecase.json ================================================ ["html", ["h1", "text1"], "\u000a\u000a", ["ul", ["li", ["p", "text2"], ["ul", ["li", "text3"]], ["p", "text4"]]], "\u000a\u000a", ["h2", "text5"], "\u000a\u000a", ["ul", ["li", ["p", "text6"], ["ul", ["li", "text7"]], ["p", "text8"]]], "\u000a\u000a", ["h2", "text9"], "\u000a\u000a", ["ul", ["li", ["p", "text10"], ["ul", ["li", "text11"]], ["p", "text12"], ["p", "text13"]]]] ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Lists-multilevel-md5-edgecase.text ================================================ # text1 * text2 * text3 text4 ## text5 * text6 * text7 text8 ## text9 * text10 * text11 text12 text13 ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Lists-multilevel-md5-edgecase.xhtml ================================================

    text1

    • text2

      • text3

      text4

    text5

    • text6

      • text7

      text8

    text9

    • text10

      • text11

      text12

      text13

    ================================================ FILE: test/fixtures/Text-Markdown.mdtest/PHP-ASP_tags.json ================================================ ["html", ["p", "I am going with the same as Markdown.pl 1.0.2b8 here. ", ["em", "However"], " I reserve the right to also leave Template toolkit alone at a later date if I need to.."], "\u000a\u000a", ["foo", { "ok": "ok", "_": "_" }, "\u000a\u000a", "\u000a\u000a", ["p", "[% template_toolkit %]"]]] ================================================ FILE: test/fixtures/Text-Markdown.mdtest/PHP-ASP_tags.text ================================================ I am going with the same as Markdown.pl 1.0.2b8 here. *However* I reserve the right to also leave Template toolkit alone at a later date if I need to.. <%foo ok %> [% template_toolkit %] ================================================ FILE: test/fixtures/Text-Markdown.mdtest/PHP-ASP_tags.xhtml ================================================

    I am going with the same as Markdown.pl 1.0.2b8 here. However I reserve the right to also leave Template toolkit alone at a later date if I need to..

    <%foo ok %>

    [% template_toolkit %]

    ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Unicode.json ================================================ ["html", ["blockquote", ["p", "Fo—o"]], ["p", "μορεοϋερ"], ["blockquote", ["p", "ßåř"]]] ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Unicode.text ================================================ > Fo—o μορεοϋερ > ßåř ================================================ FILE: test/fixtures/Text-Markdown.mdtest/Unicode.xhtml ================================================

    Fo—o

    μορεοϋερ

    ßåř

    ================================================ FILE: test/fixtures/docs-maruku-unittest/abbreviations.html ================================================

    The HTML specification is maintained by the W3C.

    Operation Tigra Genesis is going well.

    ================================================ FILE: test/fixtures/docs-maruku-unittest/abbreviations.json ================================================ ["html", ["p", "The ", ["abbr", { "title": "Hyper Text Markup Language" }, "HTML"], " specification is maintained by the ", ["abbr", { "title": "World Wide Web Consortium" }, "W3C"], "."], ["p", "Operation ", ["abbr", "Tigra Genesis"], " is going well."]] ================================================ FILE: test/fixtures/docs-maruku-unittest/abbreviations.text ================================================ The HTML specification is maintained by the W3C. *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium Operation Tigra Genesis is going well. *[Tigra Genesis]: ================================================ FILE: test/fixtures/docs-maruku-unittest/alt.html ================================================

    bar

    ================================================ FILE: test/fixtures/docs-maruku-unittest/alt.json ================================================ ["html", ["p", ["img", { "src": "/foo.jpg", "alt": "bar" }]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/alt.text ================================================ ![bar](/foo.jpg) ================================================ FILE: test/fixtures/docs-maruku-unittest/blank.html ================================================

    Linea 1

    Linea 2

    ================================================ FILE: test/fixtures/docs-maruku-unittest/blank.json ================================================ ["html", ["p", "Linea 1"], ["p", "Linea 2"]] ================================================ FILE: test/fixtures/docs-maruku-unittest/blank.text ================================================ Linea 1 Linea 2 ================================================ FILE: test/fixtures/docs-maruku-unittest/blanks_in_code.html ================================================

    This block is composed of three lines:

    one
    
    three

    This block is composed of 5

    one
    
    
    four

    This block is composed of 2

    two
    ================================================ FILE: test/fixtures/docs-maruku-unittest/blanks_in_code.json ================================================ ["html", ["p", "This block is composed of three lines:"], ["pre", ["code", "one\u000a\u000athree"]], ["p", "This block is composed of 5"], ["pre", ["code", "one\u000a\u000a\u000afour"]], ["p", "This block is composed of 2"], ["pre", ["code", "two"]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/blanks_in_code.text ================================================ This block is composed of three lines: one three This block is composed of 5 one four This block is composed of 2 two ================================================ FILE: test/fixtures/docs-maruku-unittest/bug_def.html ================================================

    test:

    ================================================ FILE: test/fixtures/docs-maruku-unittest/bug_def.json ================================================ ["html", ["p", ["span", "test"], ":"]] ================================================ FILE: test/fixtures/docs-maruku-unittest/bug_def.text ================================================ [test][]: ================================================ FILE: test/fixtures/docs-maruku-unittest/bug_table.html ================================================

    hello

    hh
    c1c2
    ================================================ FILE: test/fixtures/docs-maruku-unittest/bug_table.json ================================================ ["html", ["p", { "class": "class1", "style": "color:red" }, "hello"], "\u000a", ["table", { "class": "class1", "summary": "Table summary", "style": "color:red" }, ["thead", ["tr", ["th", "h"], ["th", "h"]]], ["tbody", ["tr", ["th", { "scope": "row", "style": "text-align: left;" }, " c1"], ["td", { "style": "text-align: left;" }, "c2"]]]], "\u000a"] ================================================ FILE: test/fixtures/docs-maruku-unittest/bug_table.text ================================================ hello {: summary="Table summary" .class1 style="color:red"} h | h ----------|-- {:t} c1 | c2 {: summary="Table summary" .class1 style="color:red"} {:t: scope="row"} ================================================ FILE: test/fixtures/docs-maruku-unittest/code.html ================================================

    Here is an example of AppleScript:

    tell application "Foo"
        beep
    end tell
    	tab
    ================================================ FILE: test/fixtures/docs-maruku-unittest/code.json ================================================ ["html", ["p", "Here is an example of AppleScript:"], ["pre", ["code", "tell application \"Foo\"\u000a beep\u000aend tell\u000a\u0009tab"]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/code.text ================================================ Here is an example of AppleScript: tell application "Foo" beep end tell tab ================================================ FILE: test/fixtures/docs-maruku-unittest/code2.html ================================================

    Code

    Ciao
    ================================================ FILE: test/fixtures/docs-maruku-unittest/code2.json ================================================ ["html", ["blockquote", ["p", "Code"], ["pre", ["code", "Ciao"]]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/code2.text ================================================ > Code > > Ciao ================================================ FILE: test/fixtures/docs-maruku-unittest/code3.html ================================================

    This is code (4 spaces):

    Code

    This is not code

    Code

    This is code (1 tab):

    Code

    This is not code

    Code
    ================================================ FILE: test/fixtures/docs-maruku-unittest/code3.json ================================================ ["html", ["p", "This is code (4 spaces):"], ["pre", ["code", "Code"]], ["p", "This is not code"], ["pre", ["code", "Code"]], ["p", "This is code (1 tab):"], ["pre", ["code", "Code"]], ["p", "This is not code"], ["pre", ["code", "Code"]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/code3.text ================================================ This is code (4 spaces): Code This is not code Code This is code (1 tab): Code This is not code Code ================================================ FILE: test/fixtures/docs-maruku-unittest/convert.pl ================================================ use strict; use warnings; open(LS, "ls -1 *.md|") or die; my @list = ; close(LS); foreach (@list) { chomp; s/\.md$//; my ($markdown, $html) = convert_to_perl_test("$_.md"); open(MD, ">$_.text") or die; print MD $markdown; close(MD); open(MD, ">$_.html") or die; print MD $html; close(MD); } sub convert_to_perl_test { my ($file) = @_; my $FH; open($FH, '<', $file) or die("Cannot open $file"); my ($markdown, $html); my @lines = <$FH>; close($FH); my $mode = 0; foreach my $l (@lines) { if ($l =~ /^\*\*\*/) { $mode = 0; if ($l =~ /Markdown input/i) { $mode = 1; } if ($l =~ /Output of to_html/) { $mode = 2; } } elsif ($mode > 0) { if (1 == $mode) { $markdown .= $l; } else { $html .= $l; } } } return ($markdown, $html); } ================================================ FILE: test/fixtures/docs-maruku-unittest/data_loss.html ================================================
    1. abcd efgh ijkl
    ================================================ FILE: test/fixtures/docs-maruku-unittest/data_loss.json ================================================ ["html", ["ol", ["li", "abcd efgh ijkl"]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/data_loss.text ================================================ 1. abcd efgh ijkl ================================================ FILE: test/fixtures/docs-maruku-unittest/easy.html ================================================

    Hello! how are you?

    ================================================ FILE: test/fixtures/docs-maruku-unittest/easy.json ================================================ ["html", ["p", ["em", "Hello!"], " how are ", ["strong", "you"], "?"]] ================================================ FILE: test/fixtures/docs-maruku-unittest/easy.text ================================================ *Hello!* how are **you**? ================================================ FILE: test/fixtures/docs-maruku-unittest/email.html ================================================

    This is an email address: andrea@invalid.it

    ================================================ FILE: test/fixtures/docs-maruku-unittest/email.json ================================================ ["html", ["p", "This is an email address: ", ["a", { "href": "mailto:andrea@invalid.it" }, "andrea@invalid.it"]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/email.text ================================================ This is an email address: ================================================ FILE: test/fixtures/docs-maruku-unittest/entities.html ================================================

    Maruku translates HTML entities to the equivalent in LaTeX:

    EntityResult
    &copy;©
    &pound;£
    a&nbsp;ba b
    &lambda;λ
    &mdash;

    Entity-substitution does not happen in code blocks or inline code.

    The following should not be translated:

    &copy;

    It should read just like this: &copy;.

    ================================================ FILE: test/fixtures/docs-maruku-unittest/entities.json ================================================ ["html", ["p", "Maruku translates HTML entities to the equivalent in LaTeX:"], "\u000a", ["table", ["thead", ["tr", ["th", "Entity"], ["th", "Result"]]], ["tbody", ["tr", ["td", { "style": "text-align: left;" }, ["code", "©"]], ["td", { "style": "text-align: left;" }, "©"]], ["tr", ["td", { "style": "text-align: left;" }, ["code", "£"]], ["td", { "style": "text-align: left;" }, "£"]], ["tr", ["td", { "style": "text-align: left;" }, ["code", "a b"]], ["td", { "style": "text-align: left;" }, "a b"]], ["tr", ["td", { "style": "text-align: left;" }, ["code", "λ"]], ["td", { "style": "text-align: left;" }, "λ"]], ["tr", ["td", { "style": "text-align: left;" }, ["code", "—"]], ["td", { "style": "text-align: left;" }, "—"]]]], "\u000a", ["p", "Entity-substitution does not happen in code blocks or inline code."], ["p", "The following should not be translated:"], ["pre", ["code", "©"]], ["p", "It should read just like this: ", ["code", "©"], "."]] ================================================ FILE: test/fixtures/docs-maruku-unittest/entities.text ================================================ Maruku translates HTML entities to the equivalent in LaTeX: Entity | Result ------------|---------- `©` | © `£` | £ `a b` | a b `λ` | λ `—` | — Entity-substitution does not happen in code blocks or inline code. The following should not be translated: © It should read just like this: `©`. ================================================ FILE: test/fixtures/docs-maruku-unittest/escaping.html ================================================

    Hello: ! ! ` { } [ ] ( ) # . ! * * *

    Ora, emphasis, bold, * <- due asterischi-> * , un underscore-> _ , emphasis, incrediblee!

    This is Code with a special: -> ` <-(after)

    Start of paragraph

    End of paragraph

    ================================================ FILE: test/fixtures/docs-maruku-unittest/escaping.json ================================================ ["html", ["p", "Hello: ! ! ` { } [ ] ( ) # . ! * * *"], ["p", "Ora, ", ["em", "emphasis"], ", ", ["strong", "bold"], ", * <- due asterischi-> * , un underscore-> _ , ", ["em", "emphasis"], ", incre", ["em", "dible"], "e!"], ["p", "This is ", ["code", "Code with a special: -> ` <-"], "(after)"], ["p", ["code", "Start "], " of paragraph"], ["p", "End of ", ["code", "paragraph "]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/escaping.text ================================================ Hello: ! \! \` \{ \} \[ \] \( \) \# \. \! * \* * Ora, *emphasis*, **bold**, * <- due asterischi-> * , un underscore-> _ , _emphasis_, incre*dible*e! This is ``Code with a special: -> ` <- ``(after) `Start ` of paragraph End of `paragraph ` ================================================ FILE: test/fixtures/docs-maruku-unittest/extra_dl.html ================================================
    Apple
    Pomaceous fruit of plants of the genus Malus in the family Rosaceae.
    Orange
    The fruit of an evergreen tree of the genus Citrus.
    ================================================ FILE: test/fixtures/docs-maruku-unittest/extra_dl.json ================================================ ["html", ["dl", ["dt", "Apple"], ["dd", "Pomaceous fruit of plants of the genus Malus in the family Rosaceae."], ["dt", "Orange"], ["dd", "The fruit of an evergreen tree of the genus Citrus."]], "\u000a"] ================================================ FILE: test/fixtures/docs-maruku-unittest/extra_dl.text ================================================ CSS: style.css Apple : Pomaceous fruit of plants of the genus Malus in the family Rosaceae. Orange : The fruit of an evergreen tree of the genus Citrus. ================================================ FILE: test/fixtures/docs-maruku-unittest/extra_header_id.html ================================================

    Header 1

    Header 2

    Header 3

    Then you can create links to different parts of the same document like this:

    Link back to header 1, Link back to header 2, Link back to header 3

    ================================================ FILE: test/fixtures/docs-maruku-unittest/extra_header_id.json ================================================ ["html", ["h1", { "id": "header1" }, "Header 1"], "\u000a\u000a", ["h2", { "id": "header2" }, "Header 2"], "\u000a\u000a", ["h3", { "id": "header3" }, "Header 3"], "\u000a\u000a", ["p", "Then you can create links to different parts of the same document like this:"], ["p", ["a", { "href": "#header1" }, "Link back to header 1"], ", ", ["a", { "href": "#header2" }, "Link back to header 2"], ", ", ["a", { "href": "#header3" }, "Link back to header 3"]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/extra_header_id.text ================================================ Header 1 {#header1} ======== Header 2 {#header2} -------- ### Header 3 ### {#header3} Then you can create links to different parts of the same document like this: [Link back to header 1](#header1), [Link back to header 2](#header2), [Link back to header 3](#header3) ================================================ FILE: test/fixtures/docs-maruku-unittest/extra_table1.html ================================================
    First HeaderSecond Header
    Content CellContent Cell
    Content CellContent Cell
    ================================================ FILE: test/fixtures/docs-maruku-unittest/extra_table1.json ================================================ ["html", ["table", ["thead", ["tr", ["th", "First Header"], ["th", "Second Header"]]], ["tbody", ["tr", ["td", { "style": "text-align: left;" }, "Content Cell"], ["td", { "style": "text-align: left;" }, "Content Cell"]], ["tr", ["td", { "style": "text-align: left;" }, "Content Cell"], ["td", { "style": "text-align: left;" }, "Content Cell"]]]], "\u000a"] ================================================ FILE: test/fixtures/docs-maruku-unittest/extra_table1.text ================================================ CSS: style.css First Header | Second Header ------------- | ------------- Content Cell | Content Cell Content Cell | Content Cell ================================================ FILE: test/fixtures/docs-maruku-unittest/footnotes.html ================================================

    That’s some text with a footnote 1 and another 2 and another 3.

    This is not a footnote.


    1. And that’s the footnote. This is second sentence (same paragraph).

    2. This is the very long one.

      That’s the second paragraph.

    3. And that’s the footnote.

      That’s the second paragraph of the footnote.

    ================================================ FILE: test/fixtures/docs-maruku-unittest/footnotes.json ================================================ ["html", ["p", "That’s some text with a footnote ", ["sup", { "id": "fnref:1" }, ["a", { "href": "#fn:1", "rel": "footnote" }, "1"]], " and another ", ["sup", { "id": "fnref:2" }, ["a", { "href": "#fn:2", "rel": "footnote" }, "2"]], " and another ", ["sup", { "id": "fnref:3" }, ["a", { "href": "#fn:3", "rel": "footnote" }, "3"]], "."], ["p", "This is not a footnote."], "\u000a", ["div", { "class": "footnotes" }, ["hr"], ["ol", ["li", { "id": "fn:1" }, ["p", "And that’s the footnote. This is second sentence (same paragraph)."], "\u000a", ["a", { "href": "#fnref:1", "rev": "footnote" }, "↩"]], ["li", { "id": "fn:2" }, ["p", "This is the very long one."], ["p", "That’s the second paragraph."], "\u000a", ["a", { "href": "#fnref:2", "rev": "footnote" }, "↩"]], ["li", { "id": "fn:3" }, ["p", "And that’s the footnote."], ["p", "That’s the second paragraph of the footnote."], "\u000a", ["a", { "href": "#fnref:3", "rev": "footnote" }, "↩"]]]], "\u000a"] ================================================ FILE: test/fixtures/docs-maruku-unittest/footnotes.text ================================================ That's some text with a footnote [^b] and another [^c] and another [^a]. [^a]: And that's the footnote. That's the second paragraph of the footnote. [^b]: And that's the footnote. This is second sentence (same paragraph). [^c]: This is the very long one. That's the second paragraph. This is not a footnote. ================================================ FILE: test/fixtures/docs-maruku-unittest/headers.html ================================================

    A title with emphasis

    A title with emphasis

    A title with emphasis

    ================================================ FILE: test/fixtures/docs-maruku-unittest/headers.json ================================================ ["html", ["h1", { "id": "a_title_with_emphasis" }, "A title with ", ["em", "emphasis"]], "\u000a\u000a", ["h2", { "id": "a_title_with_emphasis" }, "A title with ", ["em", "emphasis"]], "\u000a\u000a", ["h4", { "id": "a_title_with_emphasis" }, "A title with ", ["em", "emphasis"]], "\u000a"] ================================================ FILE: test/fixtures/docs-maruku-unittest/headers.text ================================================ A title with *emphasis* ======================= A title with *emphasis* ----------------------- #### A title with *emphasis* #### ================================================ FILE: test/fixtures/docs-maruku-unittest/hex_entities.html ================================================

    Examples of numeric character references include © or © for the copyright symbol, Α or Α for the Greek capital letter alpha, and ا or ا for the Arabic letter alef.

    ================================================ FILE: test/fixtures/docs-maruku-unittest/hex_entities.json ================================================ ["html", ["p", "Examples of numeric character references include © or © for the copyright symbol, Α or Α for the Greek capital letter alpha, and ا or ا for the Arabic letter alef."]] ================================================ FILE: test/fixtures/docs-maruku-unittest/hex_entities.text ================================================ Examples of numeric character references include © or © for the copyright symbol, Α or Α for the Greek capital letter alpha, and ا or ا for the Arabic letter alef. ================================================ FILE: test/fixtures/docs-maruku-unittest/hrule.html ================================================




    ================================================ FILE: test/fixtures/docs-maruku-unittest/hrule.json ================================================ ["html", ["hr"], ["hr"], ["hr"], ["hr"], ["hr"], "\u000a"] ================================================ FILE: test/fixtures/docs-maruku-unittest/hrule.text ================================================ * * * ================================================ FILE: test/fixtures/docs-maruku-unittest/html2.html ================================================

    One

    123

    ================================================ FILE: test/fixtures/docs-maruku-unittest/html2.json ================================================ ["html", ["p", "One ", ["div"], "123"], "\u000a", ["div"], "\u000a"] ================================================ FILE: test/fixtures/docs-maruku-unittest/html2.text ================================================ One
    123
    123 ================================================ FILE: test/fixtures/docs-maruku-unittest/html3.html ================================================

    taking part in some arcane conspirations which involve coffee, robots, sushi,

    ================================================ FILE: test/fixtures/docs-maruku-unittest/html3.json ================================================ ["html", ["p", "taking part in ", ["a", { "href": "http://sied.dis.uniroma1.it/" }, "some arcane conspirations"], " which involve ", ["b", { "href": "http://www.flickr.com/photos/censi/70893277/" }, "coffee"], ", ", ["a", { "href": "http://flickr.com/photos/censi/42775664/in/set-936677/" }, "robots"], ", ", ["a", { "href": "http://www.flickr.com/photos/censi/42775888/in/set-936677/" }, "sushi"], ","]] ================================================ FILE: test/fixtures/docs-maruku-unittest/html3.text ================================================ taking part in some arcane conspirations which involve coffee, robots, sushi, ================================================ FILE: test/fixtures/docs-maruku-unittest/html4.html ================================================
    ================================================ FILE: test/fixtures/docs-maruku-unittest/html4.json ================================================ ["html", ["div", { "class": "frame" }, "\u000a\u0009", ["a", { "href": "http://www.flickr.com/photos/censi/54757256/", "class": "photo" }, ["img", { "src": "http://static.flickr.com/27/54757256_1a2c1d2a95_m.jpg", "moz-do-not-send": "true" }]], "\u000a"], "\u000a"] ================================================ FILE: test/fixtures/docs-maruku-unittest/html4.text ================================================
    ================================================ FILE: test/fixtures/docs-maruku-unittest/html5.html ================================================
    Aperitif
    ================================================ FILE: test/fixtures/docs-maruku-unittest/html5.json ================================================ ["html", ["div", { "class": "frame" }, "\u000a ", ["a", { "href": "http://www.flickr.com/photos/censi/88561568/", "class": "photo" }, ["img", { "src": "http://static.flickr.com/28/88561568_ab84d28245_m.jpg", "height": "180", "moz-do-not-send": "true", "alt": "Aperitif", "width": "240" }]], "\u000a "], "\u000a"] ================================================ FILE: test/fixtures/docs-maruku-unittest/html5.text ================================================
    Aperitif
    ================================================ FILE: test/fixtures/docs-maruku-unittest/ie.html ================================================

    <p>here's an apostrophe & a quote "</p>

    <p>here's an apostrophe & a quote "</p>
    <p>here's an apostrophe & a quote "</p>
    <p>here's an apostrophe & a quote "</p>
    <p>here's an apostrophe & a quote "</p>
    ================================================ FILE: test/fixtures/docs-maruku-unittest/ie.json ================================================ ["html", ["p", ["code", "

    here's an apostrophe & a quote \"

    "]], ["pre", ["code", "

    here's an apostrophe & a quote \"

    "]], ["pre", { "lang": "xml" }, ["code", { "class": "xml", "lang": "xml" }, "

    here's an apostrophe & a quote \"

    "]], ["pre", ["code", { "class": "not_supported", "lang": "not_supported" }, "

    here's an apostrophe & a quote \"

    "]], ["pre", ["code", { "class": "xml", "lang": "xml" }, ["span", { "class": "punct" }, "<"], ["span", { "class": "tag" }, "p"], ["span", { "class": "punct" }, ">"], "here's an apostrophe & a quote \"", ["span", { "class": "punct" }, ""]]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/ie.text ================================================ `

    here's an apostrophe & a quote "

    `

    here's an apostrophe & a quote "

    {:}

    here's an apostrophe & a quote "

    {:lang=xml}

    here's an apostrophe & a quote "

    {:html_use_syntax=true lang=not_supported}

    here's an apostrophe & a quote "

    {:html_use_syntax=true lang=xml} ================================================ FILE: test/fixtures/docs-maruku-unittest/images.html ================================================

    This page does not uilizes Cascading Style Sheets

    Please mouseover to see the title: Cascading Style Sheets

    Please mouseover to see the title: Cascading Style Sheets

    I’ll say it one more time: this page does not use Cascading Style Sheets

    This is double size: Cascading Style Sheets

    ================================================ FILE: test/fixtures/docs-maruku-unittest/images.json ================================================ ["html", ["p", "This page does not uilizes ", ["img", { "src": "http://jigsaw.w3.org/css-validator/images/vcss", "alt": "Cascading Style Sheets" }]], ["p", "Please mouseover to see the title: ", ["img", { "src": "http://jigsaw.w3.org/css-validator/images/vcss", "alt": "Cascading Style Sheets" }]], ["p", "Please mouseover to see the title: ", ["img", { "src": "http://jigsaw.w3.org/css-validator/images/vcss", "alt": "Cascading Style Sheets" }]], ["p", "I’ll say it one more time: this page does not use ", ["img", { "src": "http://jigsaw.w3.org/css-validator/images/vcss", "alt": "Cascading Style Sheets" }]], ["p", "This is double size: ", ["img", { "src": "http://jigsaw.w3.org/css-validator/images/vcss", "alt": "Cascading Style Sheets" }]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/images.text ================================================ This page does not uilizes ![Cascading Style Sheets](http://jigsaw.w3.org/css-validator/images/vcss) Please mouseover to see the title: ![Cascading Style Sheets](http://jigsaw.w3.org/css-validator/images/vcss "Title ok!") Please mouseover to see the title: ![Cascading Style Sheets](http://jigsaw.w3.org/css-validator/images/vcss 'Title ok!') I'll say it one more time: this page does not use ![Cascading Style Sheets] [css] This is double size: ![Cascading Style Sheets] [css2] [css]: http://jigsaw.w3.org/css-validator/images/vcss "Optional title attribute" [css2]: http://jigsaw.w3.org/css-validator/images/vcss "Optional title attribute" class=external style="border:0;width:188px;height:131px" ================================================ FILE: test/fixtures/docs-maruku-unittest/images2.html ================================================

    This is an image.

    This is an image.

    ================================================ FILE: test/fixtures/docs-maruku-unittest/images2.json ================================================ ["html", ["p", "This is an ", ["img", { "src": "image.jpg", "alt": "image" }], "."], ["p", "This is an ", ["img", { "src": "image.jpg", "alt": "image" }], "."]] ================================================ FILE: test/fixtures/docs-maruku-unittest/images2.text ================================================ This is an ![image][]. This is an ![image]. [image]: image.jpg ================================================ FILE: test/fixtures/docs-maruku-unittest/inline_html.html ================================================

    Input:

    <em>Emphasis</em>

    Result: Emphasis

    Input:

    <img src="http://jigsaw.w3.org/css-validator/images/vcss"/>

    Result on span:

    Result alone:

    Without closing:

    This is

    true

    markdown text (paragraph)

    This is

    true

    markdown text (no paragraph)

    This is

    true

    markdown text (block paragraph)

    This is

    true

    markdown text. (no par)

    This is

    true

    markdown text. (par)

    The following is invalid HTML, and will generate an error:

    HTML parse error: 
    <table>
    <td markdown="1">This is *true* markdown text. (no par)</td>
    <td markdown="block">This is *true* markdown text. (par)</td>
    </tr>
    HTML parse error: 
    </table>
    ================================================ FILE: test/fixtures/docs-maruku-unittest/inline_html.json ================================================ ["html", ["p", "Input:"], ["pre", ["code", "Emphasis"]], ["p", "Result: ", ["em", "Emphasis"]], ["p", "Input:"], ["pre", ["code", ""]], ["p", "Result on span: ", ["img", { "src": "http://jigsaw.w3.org/css-validator/images/vcss" }]], ["p", "Result alone:"], "\u000a", ["img", { "src": "http://jigsaw.w3.org/css-validator/images/vcss" }], "\u000a", ["p", "Without closing:"], "\u000a", ["img", { "src": "http://jigsaw.w3.org/css-validator/images/vcss" }], ["div", ["p", ["p", "This is"], "\u000a", ["em", ["p", "true"]], "\u000a", ["p", "markdown text (paragraph)"]], ["p", ["p", ["p", "This is"], "\u000a", ["em", ["p", "true"]], "\u000a", ["p", "markdown text (no paragraph)"]]], ["p", ["p", ["p", "This is"], "\u000a", ["em", ["p", "true"]], "\u000a", ["p", "markdown text (block paragraph)"]]]], ["table", ["tr", ["td", ["p", "This is"], "\u000a", ["em", ["p", "true"]], "\u000a", ["p", "markdown text. (no par)"]], ["td", ["p", "This is"], "\u000a", ["em", ["p", "true"]], "\u000a", ["p", "markdown text. (par)"]]]], "\u000a", ["p", "The following is invalid HTML, and will generate an error:"], ["pre", { "class": "markdown-html-error", "style": "border: solid 3px red; background-color: pink" }, "HTML parse error: \u000a\u000a\u000a\u000a"], ["pre", { "class": "markdown-html-error", "style": "border: solid 3px red; background-color: pink" }, "HTML parse error: \u000a
    This is *true* markdown text. (no par)This is *true* markdown text. (par)
    "]] ================================================ FILE: test/fixtures/docs-maruku-unittest/inline_html.text ================================================ CSS: style.css Input: Emphasis Result: Emphasis Input: Result on span: Result alone: Without closing:
    This is *true* markdown text (paragraph)

    This is *true* markdown text (no paragraph)

    This is *true* markdown text (block paragraph)

    This is *true* markdown text. (no par) This is *true* markdown text. (par)
    The following is invalid HTML, and will generate an error:
    This is *true* markdown text. (no par) This is *true* markdown text. (par)
    ================================================ FILE: test/fixtures/docs-maruku-unittest/inline_html2.html ================================================

    Test bold

    Test bold

    ================================================ FILE: test/fixtures/docs-maruku-unittest/inline_html2.json ================================================ ["html", ["div", ["p", "Test ", ["strong", "bold"]]], ["p", "Test ", ["strong", "bold"]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/inline_html2.text ================================================
    Test **bold**

    Test **bold**

    ================================================ FILE: test/fixtures/docs-maruku-unittest/links.html ================================================

    Search on Google

    Search on Google

    Search on Google

    Search on Google

    Search on Google images

    Inline: Google images

    Inline with title: Google images

    Inline with title: Google images

    Search on http://www.gogole.com or http://Here.com or ask bill@google.com or you might ask bill@google.com.

    If all else fails, ask Google

    ================================================ FILE: test/fixtures/docs-maruku-unittest/links.json ================================================ ["html", ["p", "Search on ", ["a", { "href": "http://www.google.com" }, "Google"]], ["p", "Search on ", ["a", { "href": "http://www.google.com" }, "Google"]], ["p", "Search on ", ["a", { "href": "http://www.google.com" }, "Google"]], ["p", "Search on ", ["a", { "href": "http://www.google.com" }, "Google"]], ["p", "Search on ", ["a", { "href": "http://images.google.com", "title": "Google images" }, "Google images"]], ["p", "Inline: ", ["a", { "href": "http://google.com" }, "Google images"]], ["p", "Inline with title: ", ["a", { "href": "http://google.com", "title": "Title" }, "Google images"]], ["p", "Inline with title: ", ["a", { "href": "http://google.com", "title": "Title" }, "Google images"]], ["p", "Search on ", ["a", { "href": "http://www.gogole.com" }, "http://www.gogole.com"], " or ", ["a", { "href": "http://Here.com" }, "http://Here.com"], " or ask ", ["a", { "href": "mailto:bill@google.com" }, "bill@google.com"], " or you might ask bill@google.com."], ["p", "If all else fails, ask ", ["a", { "href": "http://www.google.com" }, "Google"]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/links.text ================================================ Search on [Google][] Search on [Google] [] Search on [Google] [google] Search on [Google] [Google] Search on [Google images][] Inline: [Google images](http://google.com) Inline with title: [Google images](http://google.com "Title") Inline with title: [Google images]( http://google.com "Title" ) Search on or or ask or you might ask bill@google.com. If all else fails, ask [Google](http://www.google.com) [google]: http://www.google.com [google2]: http://www.google.com 'Single quotes' [google3]: http://www.google.com "Double quotes" [google4]: http://www.google.com (Parenthesis) [Google Search]: http://www.google.com "Google search" [Google Images]: http://images.google.com (Google images) ================================================ FILE: test/fixtures/docs-maruku-unittest/list1.html ================================================
    • A list item with a blockquote:

      This is a blockquote inside a list item.

    ================================================ FILE: test/fixtures/docs-maruku-unittest/list1.json ================================================ ["html", ["ul", ["li", ["p", "A list item with a blockquote:"], ["blockquote", ["p", "This is a blockquote inside a list item."]]]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/list1.text ================================================ * A list item with a blockquote: > This is a blockquote > inside a list item. ================================================ FILE: test/fixtures/docs-maruku-unittest/list2.html ================================================
    • 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.

    • other

    ================================================ FILE: test/fixtures/docs-maruku-unittest/list2.json ================================================ ["html", ["ul", ["li", ["p", "This is a list item with two paragraphs."], ["p", "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."]], ["li", ["p", "other"]]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/list2.text ================================================ * 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. * other ================================================ FILE: test/fixtures/docs-maruku-unittest/list3.html ================================================
    • A list item with a blockquote:

      This is a blockquote inside a list item.

    • A list item with a code block:

      <code goes here>
    ================================================ FILE: test/fixtures/docs-maruku-unittest/list3.json ================================================ ["html", ["ul", ["li", ["p", "A list item with a blockquote:"], ["blockquote", ["p", "This is a blockquote inside a list item."]]], ["li", ["p", "A list item with a code block:"], ["pre", ["code", ""]]]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/list3.text ================================================ * A list item with a blockquote: > This is a blockquote > inside a list item. * A list item with a code block: ================================================ FILE: test/fixtures/docs-maruku-unittest/list4.html ================================================

    This is a list:

    • one
    • two

    This is not a list: * one ciao

    This is a list:

    1. one
    2. two

    This is not a list: 1987. one ciao

    ================================================ FILE: test/fixtures/docs-maruku-unittest/list4.json ================================================ ["html", ["p", "This is a list:"], ["ul", ["li", "one"], ["li", "two"]], ["p", "This is not a list: * one ciao"], ["p", "This is a list:"], ["ol", ["li", "one"], ["li", "two"]], ["p", "This is not a list: 1987. one ciao"]] ================================================ FILE: test/fixtures/docs-maruku-unittest/list4.text ================================================ This is a list: * one * two This is not a list: * one ciao This is a list: 1. one 1. two This is not a list: 1987. one ciao ================================================ FILE: test/fixtures/docs-maruku-unittest/lists.html ================================================
    • 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.
    • Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
    • Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
    • Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.

    Ancora

    • This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.

      ATTENZIONE!

    • Suspendisse id sem consectetuer libero luctus adipiscing.

    Ancora

    • 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.

    ================================================ FILE: test/fixtures/docs-maruku-unittest/lists.json ================================================ ["html", ["ul", ["li", "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus."], ["li", "Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing."], ["li", "Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing."], ["li", "Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing."], ["li", "Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing."]], ["p", "Ancora"], ["ul", ["li", ["p", "This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus."], ["p", "ATTENZIONE!"]], ["li", ["p", "Suspendisse id sem consectetuer libero luctus adipiscing."]]], ["p", "Ancora"], ["ul", ["li", ["p", "This is a list item with two paragraphs."], ["p", "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."]], ["li", ["p", "Another item in the same list."]]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/lists.text ================================================ * 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. * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. Ancora * This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. ATTENZIONE! * Suspendisse id sem consectetuer libero luctus adipiscing. Ancora * 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. ================================================ FILE: test/fixtures/docs-maruku-unittest/lists11.html ================================================

    - ένα

    ================================================ FILE: test/fixtures/docs-maruku-unittest/lists11.json ================================================ ["html", ["p", "- ένα"]] ================================================ FILE: test/fixtures/docs-maruku-unittest/lists11.text ================================================ - ένα ================================================ FILE: test/fixtures/docs-maruku-unittest/lists6.html ================================================ ================================================ FILE: test/fixtures/docs-maruku-unittest/lists6.json ================================================ ["html"] ================================================ FILE: test/fixtures/docs-maruku-unittest/lists6.text ================================================ ================================================ FILE: test/fixtures/docs-maruku-unittest/lists7.html ================================================

    Ciao

    • Tab * Tab * Tab

    Ciao

    • Tab * Tab * Tab
    ================================================ FILE: test/fixtures/docs-maruku-unittest/lists7.json ================================================ ["html", ["p", "Ciao"], ["ul", ["li", "Tab * Tab * Tab"]], ["p", "Ciao"], ["ul", ["li", "Tab * Tab * Tab"]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/lists7.text ================================================ Ciao * Tab * Tab * Tab ================================================ FILE: test/fixtures/docs-maruku-unittest/lists7b.html ================================================
    • a
      • a1
      • a2
    • b

    -----| WARNING | -----
    • a

      • a1
      • a2
    • b

    ================================================ FILE: test/fixtures/docs-maruku-unittest/lists7b.json ================================================ ["html", ["ul", ["li", "\u000aa\u000a\u000a", ["ul", ["li", "a1"], ["li", "a2"]]], ["li", ["p", "b"]]], "\u000a-----| WARNING | -----\u000a", ["ul", ["li", ["p", "a"], ["ul", ["li", "a1"], ["li", "a2"]]], ["li", ["p", "b"]]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/lists7b.text ================================================ * a * a1 * a2 * b ================================================ FILE: test/fixtures/docs-maruku-unittest/lists8.html ================================================

    Here is a paragraph.

    • Item 1
    • Item 2
    • Item 3
    -----| WARNING | -----

    Here is a paragraph.

    * Item 1 * Item 2 * Item 3

    ================================================ FILE: test/fixtures/docs-maruku-unittest/lists8.json ================================================ ["html", ["p", "Here is a paragraph."], ["ul", ["li", "Item 1"], ["li", "Item 2"], ["li", "Item 3"]], "\u000a-----| WARNING | -----\u000a", ["p", "Here is a paragraph."], ["p", "* Item 1 * Item 2 * Item 3"]] ================================================ FILE: test/fixtures/docs-maruku-unittest/lists8.text ================================================ Here is a paragraph. * Item 1 * Item 2 * Item 3 ================================================ FILE: test/fixtures/docs-maruku-unittest/lists9.html ================================================
    • Due

      1. tre
      2. tre
      3. tre
    • Due

    ================================================ FILE: test/fixtures/docs-maruku-unittest/lists9.json ================================================ ["html", ["ul", ["li", ["p", "Due"], ["ol", ["li", "tre"], ["li", "tre"], ["li", "tre"]]], ["li", ["p", "Due"]]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/lists9.text ================================================ - Due 1. tre 1. tre 1. tre - Due ================================================ FILE: test/fixtures/docs-maruku-unittest/lists_after_paragraph.html ================================================

    Paragraph, list with no space: * ciao

    Paragraph, list with 1 space: * ciao

    Paragraph, list with 3 space: * ciao

    Paragraph, list with 4 spaces: * ciao

    Paragraph, list with 1 tab: * ciao

    Paragraph (1 space after), list with no space: * ciao

    Paragraph (2 spaces after), list with no space:
    * ciao

    Paragraph (3 spaces after), list with no space:
    * ciao

    Paragraph with block quote:

    Quoted

    Paragraph with header:

    Paragraph with header on two lines:

    Paragraph with html after

    Paragraph with html after, indented: Emphasis

    Paragraph with html after, indented: Emphasis tralla Emph

    Paragraph with html after, indented: Emphasis *tralla* Emph

    ================================================ FILE: test/fixtures/docs-maruku-unittest/lists_after_paragraph.json ================================================ ["html", ["p", "Paragraph, list with no space: * ciao"], ["p", "Paragraph, list with 1 space: * ciao"], ["p", "Paragraph, list with 3 space: * ciao"], ["p", "Paragraph, list with 4 spaces: * ciao"], ["p", "Paragraph, list with 1 tab: * ciao"], ["p", "Paragraph (1 space after), list with no space: * ciao"], ["p", "Paragraph (2 spaces after), list with no space:", ["br"], "* ciao"], ["p", "Paragraph (3 spaces after), list with no space: ", ["br"], "* ciao"], ["p", "Paragraph with block quote:"], ["blockquote", ["p", "Quoted"]], ["p", "Paragraph with header:"], "\u000a\u000a", ["h3", { "id": "header" }, "header"], "\u000a\u000a", ["p", "Paragraph with header on two lines:"], "\u000a\u000a", ["h2", { "id": "header" }, "header"], "\u000a\u000a", ["p", "Paragraph with html after ", ["div"]], ["p", "Paragraph with html after, indented: ", ["em", "Emphasis"]], ["p", "Paragraph with html after, indented: ", ["em", "Emphasis"], " ", ["em", "tralla"], " ", ["em", "Emph"]], ["p", "Paragraph with html after, indented: ", ["em", "Emphasis *tralla* Emph"]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/lists_after_paragraph.text ================================================ Paragraph, list with no space: * ciao Paragraph, list with 1 space: * ciao Paragraph, list with 3 space: * ciao Paragraph, list with 4 spaces: * ciao Paragraph, list with 1 tab: * ciao Paragraph (1 space after), list with no space: * ciao Paragraph (2 spaces after), list with no space: * ciao Paragraph (3 spaces after), list with no space: * ciao Paragraph with block quote: > Quoted Paragraph with header: ### header ### Paragraph with header on two lines: header ------ Paragraph with html after
    Paragraph with html after, indented: Emphasis Paragraph with html after, indented: Emphasis *tralla* Emph Paragraph with html after, indented: Emphasis *tralla* Emph ================================================ FILE: test/fixtures/docs-maruku-unittest/lists_ol.html ================================================
    1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
    2. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
    3. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
    4. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
    5. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.

    Ancora

    1. This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.

      ATTENZIONE!

      • Uno

      • Due

        1. tre
        2. tre
        3. tre
      • Due

    2. Suspendisse id sem consectetuer libero luctus adipiscing.

    Ancora

    • 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.

    ================================================ FILE: test/fixtures/docs-maruku-unittest/lists_ol.json ================================================ ["html", ["ol", ["li", "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus."], ["li", "Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing."], ["li", "Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing."], ["li", "Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing."], ["li", "Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing."]], ["p", "Ancora"], ["ol", ["li", ["p", "This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus."], ["p", "ATTENZIONE!"], ["ul", ["li", ["p", "Uno"]], ["li", ["p", "Due"], ["ol", ["li", "tre"], ["li", "tre"], ["li", "tre"]]], ["li", ["p", "Due"]]]], ["li", ["p", "Suspendisse id sem consectetuer libero luctus adipiscing."]]], ["p", "Ancora"], ["ul", ["li", ["p", "This is a list item with two paragraphs."], ["p", "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."]], ["li", ["p", "Another item in the same list."]]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/lists_ol.text ================================================ 1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. 2. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. 3. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. 3. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. 4. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. Ancora 1. This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. ATTENZIONE! - Uno - Due 1. tre 1. tre 1. tre - Due 2. Suspendisse id sem consectetuer libero luctus adipiscing. Ancora * 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. ================================================ FILE: test/fixtures/docs-maruku-unittest/loss.html ================================================
    ================================================ FILE: test/fixtures/docs-maruku-unittest/loss.json ================================================ ["html", ["br"], "\u000a"] ================================================ FILE: test/fixtures/docs-maruku-unittest/loss.text ================================================
    123 ================================================ FILE: test/fixtures/docs-maruku-unittest/misc_sw.html ================================================

    General

    • Operating System : Mac OS X: heaven, after the purgatory of Linux and the hell of Windows.
    • Browser: Firefox. On a Mac, Camino.
    • Email: GMail, “search, don’t sort” really works.
    • Text Editor: TextMate, you have to buy it, but it’s worth every penny. There are rumours that it’s been converting (recovering) Emacs users (addicts). Unfortunately, it’s Mac only. An alternative is jedit (GPL, Java).

    Development

    • Build system: cmake, throw the autotools away.

    • Source code control system: ditch CVS for subversion.

    • Project management: Trac tracks everything.

    • Scripting language: Ruby is Japanese pragmatism (and has a poignant guide). Python, you say? Python is too academic and snob:

      $ python       
      Python 2.4.1 (\#1, Jun  4 2005, 00:54:33) 
      Type "help", "copyright", "credits" or "license" for more information.
      >>> exit
      'Use Ctrl-D (i.e. EOF) to exit.'
      >>> quit
      'Use Ctrl-D (i.e. EOF) to exit.'
    • Java IDE: JBuilder is great software and has a free version (IMHO better than Eclipse). Java is not a pain anymore since it gained generics and got opensourced.

    • Mark-up language: HTML is so 2001, why don’t you take at look at Markdown? Look at the source of this page.

    • C++ libraries: * QT for GUIs. * GSL for math. * Magick++ for manipulating images. * Cairo for creating PDFs. * Boost for just about everything else.

    Research

    • Writing papers: LaTeX
    • Writing papers & enjoying the process: LyX
    • Handsome figures in your papers: xfig or, better, jfig.
    • The occasional presentation with many graphical content: OpenOffice Impress (using the OOOlatex plugin); the alternative is PowerPoint with the TexPoint plugin.
    • Managing BibTeX: jabref: multi-platform, for all your bibtex needs.
    • IEEExplore and BibTeX: convert citations using BibConverter.

    Cool websites

    ================================================ FILE: test/fixtures/docs-maruku-unittest/misc_sw.json ================================================ ["html", ["h3", { "id": "general" }, "General"], "\u000a\u000a", ["ul", ["li", ["em", "Operating System"], " : ", ["a", { "href": "http://www.apple.com/getamac/" }, "Mac OS X"], ": heaven, after the purgatory of Linux and the hell of Windows."], ["li", ["em", "Browser"], ": ", ["a", { "href": "http://getfirefox.com/" }, "Firefox"], ". On a Mac, ", ["a", { "href": "http://www.caminobrowser.org/" }, "Camino"], "."], ["li", ["em", "Email"], ": ", ["a", { "href": "http://gmail.com/" }, "GMail"], ", “search, don’t sort” really works."], ["li", ["em", "Text Editor"], ": ", ["a", { "href": "http://www.apple.com/getamac/" }, "TextMate"], ", you have to buy it, but it’s worth every penny. There are rumours that it’s been converting (recovering) Emacs users (addicts). Unfortunately, it’s Mac only. An alternative is ", ["a", { "href": "http://www.jedit.org/" }, "jedit"], " (GPL, Java)."]], "\u000a\u000a", ["h3", { "id": "development" }, "Development"], "\u000a\u000a", ["ul", ["li", ["p", ["em", "Build system"], ": ", ["a", { "href": "http://www.cmake.org/" }, "cmake"], ", throw the ", ["a", { "href": "http://sources.redhat.com/autobook/" }, "autotools"], " away."]], ["li", ["p", ["em", "Source code control system"], ": ditch CVS for ", ["a", { "href": "http://subversion.tigris.org" }, "subversion"], "."]], ["li", ["p", ["em", "Project management"], ": ", ["a", { "href": "http://trac.edgewall.org/" }, "Trac"], " tracks everything."]], ["li", ["p", ["em", "Scripting language"], ": ", ["a", { "href": "http://www.ruby-lang.org/" }, "Ruby"], " is Japanese pragmatism (and has a ", ["a", { "href": "http://poignantguide.net/ruby/" }, "poignant"], " guide). Python, you say? Python is too academic and snob:"], ["pre", ["code", "$ python \u000aPython 2.4.1 (\\#1, Jun 4 2005, 00:54:33) \u000aType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\u000a>>> exit\u000a'Use Ctrl-D (i.e. EOF) to exit.'\u000a>>> quit\u000a'Use Ctrl-D (i.e. EOF) to exit.'"]]], ["li", ["p", ["em", "Java IDE"], ": ", ["a", { "href": "http://www.borland.com/us/products/jbuilder/index.html" }, "JBuilder"], " is great software and has a free version (IMHO better than Eclipse). Java is not a pain anymore since it gained ", ["a", { "href": "http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html" }, "generics"], " and got opensourced."]], ["li", ["p", ["em", "Mark-up language"], ": HTML is so 2001, why don’t you take at look at ", ["a", { "href": "http://en.wikipedia.org/wiki/Markdown" }, "Markdown"], "? ", ["a", { "href": "data/misc_markdown.png" }, "Look at the source of this page"], "."]], ["li", ["p", ["em", "C++ libraries"], ": * ", ["a", { "href": "http://www.trolltech.no/" }, "QT"], " for GUIs. * ", ["a", { "href": "http://www.gnu.org/software/gsl/" }, "GSL"], " for math. * ", ["a", { "href": "http://www.imagemagick.org/Magick++/" }, "Magick++"], " for manipulating images. * ", ["a", { "href": "http://cairographics.org/" }, "Cairo"], " for creating PDFs. * ", ["a", { "href": "http://www.boost.org/" }, "Boost"], " for just about everything else."]]], "\u000a\u000a", ["h3", { "id": "research" }, "Research"], "\u000a\u000a", ["ul", ["li", ["em", "Writing papers"], ": ", ["a", { "href": "http://en.wikipedia.org/wiki/LaTeX" }, "LaTeX"]], ["li", ["em", "Writing papers & enjoying the process"], ": ", ["a", { "href": "http://www.lyx.org" }, "LyX"]], ["li", ["em", "Handsome figures in your papers"], ": ", ["a", { "href": "http://www.xfig.org/" }, "xfig"], " or, better, ", ["a", { "href": "http://tams-www.informatik.uni-hamburg.de/applets/jfig/" }, "jfig"], "."], ["li", ["em", "The occasional presentation with many graphical content"], ": ", ["a", { "href": "http://www.openoffice.org/product/impress.html" }, "OpenOffice Impress"], " (using the ", ["a", { "href": "http://ooolatex.sourceforge.net/" }, "OOOlatex plugin"], "); the alternative is PowerPoint with the ", ["a", { "href": "http://texpoint.necula.org/" }, "TexPoint"], " plugin."], ["li", ["em", "Managing BibTeX"], ": ", ["a", { "href": "http://jabref.sourceforge.net/" }, "jabref"], ": multi-platform, for all your bibtex needs."], ["li", ["em", "IEEExplore and BibTeX"], ": convert citations using ", ["a", { "href": "http://www.bibconverter.net/ieeexplore/" }, "BibConverter"], "."]], "\u000a\u000a", ["h3", { "id": "cool_websites" }, "Cool websites"], "\u000a\u000a", ["ul", ["li", ["em", "Best site in the wwworld"], ": ", ["a", { "href": "http://en.wikipedia.org/" }, "Wikipedia"]], ["li", ["a", { "href": "http://www.mutopiaproject.org/" }, "Mutopia"], " for sheet music; ", ["a", { "href": "http://www.gutenberg.org/" }, "the Gutenberg Project"], " for books; ", ["a", { "href": "http://www.liberliber.it/" }, "LiberLiber"], " for books in italian."], ["li", ["em", "Blogs"], ": ", ["a", { "href": "http://bloglines.com/" }, "Bloglines"]], ["li", ["em", "Sharing photos"], ": ", ["a", { "href": "http://www.flickr.com/" }, "flickr"], " exposes an API you can use."]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/misc_sw.text ================================================ Subject: Software not painful to use Subject_short: painless software Topic: /misc/coolsw Archive: no Date: Nov 20 2006 Order: -9.5 inMenu: true ### General ### * *Operating System* : [Mac OS X][switch]: heaven, after the purgatory of Linux and the hell of Windows. * *Browser*: [Firefox][firefox]. On a Mac, [Camino][camino]. * *Email*: [GMail][gmail], "search, don't sort" really works. * *Text Editor*: [TextMate][textmate], you have to buy it, but it's worth every penny. There are rumours that it's been converting (recovering) Emacs users (addicts). Unfortunately, it's Mac only. An alternative is [jedit][jedit] (GPL, Java). ### Development ### * *Build system*: [cmake][cmake], throw the [autotools][autotools] away. * *Source code control system*: ditch CVS for [subversion][subversion]. * *Project management*: [Trac][trac] tracks everything. * *Scripting language*: [Ruby][ruby] is Japanese pragmatism (and has a [poignant][poignant] guide). Python, you say? Python is too academic and snob: $ python Python 2.4.1 (\#1, Jun 4 2005, 00:54:33) Type "help", "copyright", "credits" or "license" for more information. >>> exit 'Use Ctrl-D (i.e. EOF) to exit.' >>> quit 'Use Ctrl-D (i.e. EOF) to exit.' * *Java IDE*: [JBuilder][jbuilder] is great software and has a free version (IMHO better than Eclipse). Java is not a pain anymore since it gained [generics][java-generics] and got opensourced. * *Mark-up language*: HTML is so 2001, why don't you take at look at [Markdown][markdown]? [Look at the source of this page](data/misc_markdown.png). * *C++ libraries*: * [QT][qt] for GUIs. * [GSL][gsl] for math. * [Magick++][magick] for manipulating images. * [Cairo][cairo] for creating PDFs. * [Boost][boost] for just about everything else. ### Research ### * *Writing papers*: [LaTeX][latex] * *Writing papers & enjoying the process*: [LyX][lyx] * *Handsome figures in your papers*: [xfig][xfig] or, better, [jfig][jfig]. * *The occasional presentation with many graphical content*: [OpenOffice Impress][impress] (using the [OOOlatex plugin][ooolatex]); the alternative is PowerPoint with the [TexPoint][texpoint] plugin. * *Managing BibTeX*: [jabref][jabref]: multi-platform, for all your bibtex needs. * *IEEExplore and BibTeX*: convert citations using [BibConverter][bibconverter]. ### Cool websites ### * *Best site in the wwworld*: [Wikipedia][wikipedia] * [Mutopia][mutopia] for sheet music; [the Gutenberg Project][gutenberg] for books; [LiberLiber][liberliber] for books in italian. * *Blogs*: [Bloglines][bloglines] * *Sharing photos*: [flickr][flickr] exposes an API you can use. [firefox]: http://getfirefox.com/ [gmail]: http://gmail.com/ [bloglines]: http://bloglines.com/ [wikipedia]: http://en.wikipedia.org/ [ruby]: http://www.ruby-lang.org/ [poignant]: http://poignantguide.net/ruby/ [webgen]: http://webgen.rubyforge.org/ [markdown]: http://daringfireball.net/projects/markdown/ [latex]: http://en.wikipedia.org/wiki/LaTeX [lyx]: http://www.lyx.org [impress]: http://www.openoffice.org/product/impress.html [ooolatex]: http://ooolatex.sourceforge.net/ [texpoint]: http://texpoint.necula.org/ [jabref]: http://jabref.sourceforge.net/ [camino]: http://www.caminobrowser.org/ [switch]: http://www.apple.com/getamac/ [textmate]: http://www.apple.com/getamac/ [cmake]: http://www.cmake.org/ [xfig]: http://www.xfig.org/ [jfig]: http://tams-www.informatik.uni-hamburg.de/applets/jfig/ [subversion]: http://subversion.tigris.org [jbuilder]: http://www.borland.com/us/products/jbuilder/index.html [flickr]: http://www.flickr.com/ [myflickr]: http://www.flickr.com/photos/censi [bibconverter]: http://www.bibconverter.net/ieeexplore/ [autotools]: http://sources.redhat.com/autobook/ [jedit]: http://www.jedit.org/ [qt]: http://www.trolltech.no/ [gsl]: http://www.gnu.org/software/gsl/ [magick]: http://www.imagemagick.org/Magick++/ [cairo]: http://cairographics.org/ [boost]: http://www.boost.org/ [markdown]: http://en.wikipedia.org/wiki/Markdown [trac]: http://trac.edgewall.org/ [mutopia]: http://www.mutopiaproject.org/ [liberliber]: http://www.liberliber.it/ [gutenberg]: http://www.gutenberg.org/ [java-generics]: http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html ================================================ FILE: test/fixtures/docs-maruku-unittest/olist.html ================================================

    This is a list:

    1. one
    2. two
    3. three
    ================================================ FILE: test/fixtures/docs-maruku-unittest/olist.json ================================================ ["html", ["p", "This is a list:"], ["ol", ["li", "one"], ["li", "two"], ["li", "three"]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/olist.text ================================================ This is a list: 2. one 2. two 3. three ================================================ FILE: test/fixtures/docs-maruku-unittest/one.html ================================================

    One line

    ================================================ FILE: test/fixtures/docs-maruku-unittest/one.json ================================================ ["html", ["p", "One line"]] ================================================ FILE: test/fixtures/docs-maruku-unittest/one.text ================================================ One line ================================================ FILE: test/fixtures/docs-maruku-unittest/paragraph.html ================================================

    Paragraph

    ================================================ FILE: test/fixtures/docs-maruku-unittest/paragraph.json ================================================ ["html", ["p", "Paragraph"]] ================================================ FILE: test/fixtures/docs-maruku-unittest/paragraph.text ================================================ Paragraph ================================================ FILE: test/fixtures/docs-maruku-unittest/paragraphs.html ================================================

    Paragraph 1

    Paragraph 2

    Paragraph 3 Paragraph 4 Paragraph Br->
    Paragraph 5

    ================================================ FILE: test/fixtures/docs-maruku-unittest/paragraphs.json ================================================ ["html", ["p", "Paragraph 1"], ["p", "Paragraph 2"], ["p", "Paragraph 3 Paragraph 4 Paragraph Br->", ["br"], "Paragraph 5"]] ================================================ FILE: test/fixtures/docs-maruku-unittest/paragraphs.text ================================================ Paragraph 1 Paragraph 2 Paragraph 3 Paragraph 4 Paragraph Br-> Paragraph 5 ================================================ FILE: test/fixtures/docs-maruku-unittest/smartypants.html ================================================
    'Twas a "test" to 'remember' in the '90s.

    ‘Twas a “test” to ‘remember’ in the ’90s.

    It was --- in a sense --- really... interesting.

    It was — in a sense — really… interesting.

    I -- too -- met << some curly quotes >> there or <<here>>No space.

    I – too – met « some curly quotes » there or «here»No space.

    She was 6\"12\'.

    She was 6"12'.

    ================================================ FILE: test/fixtures/docs-maruku-unittest/smartypants.json ================================================ ["html", ["pre", ["code", "'Twas a \"test\" to 'remember' in the '90s."]], ["p", "‘Twas a “test” to ‘remember’ in the ’90s."], ["pre", ["code", "It was --- in a sense --- really... interesting."]], ["p", "It was — in a sense — really… interesting."], ["pre", ["code", "I -- too -- met << some curly quotes >> there or <>No space."]], ["p", "I – too – met « some curly quotes » there or «here»No space."], ["pre", ["code", "She was 6\\\"12\\'."]], ["blockquote", ["p", "She was 6\"12'."]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/smartypants.text ================================================ 'Twas a "test" to 'remember' in the '90s. 'Twas a "test" to 'remember' in the '90s. It was --- in a sense --- really... interesting. It was --- in a sense --- really... interesting. I -- too -- met << some curly quotes >> there or <>No space. I -- too -- met << some curly quotes >> there or <>No space. She was 6\"12\'. > She was 6\"12\'. ================================================ FILE: test/fixtures/docs-maruku-unittest/syntax_hl.html ================================================

    This is ruby code:

    require 'maruku'
    
    puts Maruku.new($stdin).to_html

    This is ruby code:

    require 'maruku'
    puts Maruku.new($stdin).to_html
    ================================================ FILE: test/fixtures/docs-maruku-unittest/syntax_hl.json ================================================ ["html", ["p", "This is ruby code:"], ["pre", ["code", "require 'maruku'\u000a\u000aputs Maruku.new($stdin).to_html"]], ["p", "This is ruby code:"], ["pre", ["code", { "class": "ruby", "lang": "ruby" }, ["span", { "class": "ident" }, "require"], " ", ["span", { "class": "punct" }, "'"], ["span", { "class": "string" }, "maruku"], ["span", { "class": "punct" }, "'"]]], ["pre", ["code", "puts Maruku.new($stdin).to_html"]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/syntax_hl.text ================================================ This is ruby code: require 'maruku' puts Maruku.new($stdin).to_html This is ruby code: require 'maruku' {: lang=ruby html_use_syntax} puts Maruku.new($stdin).to_html ================================================ FILE: test/fixtures/docs-maruku-unittest/table_attributes.html ================================================
    hh
    c1c2
    ================================================ FILE: test/fixtures/docs-maruku-unittest/table_attributes.json ================================================ ["html", ["table", { "cellspacing": "2em", "class": "class1", "border": "3", "rules": "cols", "frame": "lhs", "summary": "Table summary", "cellpadding": "4px", "width": "50%", "style": "color:red" }, ["thead", ["tr", ["th", "h"], ["th", "h"]]], ["tbody", ["tr", ["th", { "scope": "row", "style": "text-align: left;" }, " c1"], ["td", { "style": "text-align: left;" }, "c2"]]]], "\u000a"] ================================================ FILE: test/fixtures/docs-maruku-unittest/table_attributes.text ================================================ h | h ----------|-- {:t} c1 | c2 {: summary="Table summary" .class1 style="color:red" border=3 width="50%" frame=lhs rules=cols cellspacing=2em cellpadding=4px} {:t: scope="row"} ================================================ FILE: test/fixtures/docs-maruku-unittest/test.html ================================================
           $ python       
    ================================================ FILE: test/fixtures/docs-maruku-unittest/test.json ================================================ ["html", ["pre", ["code", " $ python "]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/test.text ================================================ $ python ================================================ FILE: test/fixtures/docs-maruku-unittest/wrapping.html ================================================

    Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Break:
    Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet.

    • Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet Lorem ipsum Break:
      Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet
    • Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet
    ================================================ FILE: test/fixtures/docs-maruku-unittest/wrapping.json ================================================ ["html", ["p", "Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Break:", ["br"], "Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet."], ["ul", ["li", "Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet Lorem ipsum Break:", ["br"], "Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet"], ["li", "Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet"]]] ================================================ FILE: test/fixtures/docs-maruku-unittest/wrapping.text ================================================ Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Break: Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. * Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet Lorem ipsum Break: Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet * Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet ================================================ FILE: test/fixtures/docs-maruku-unittest/xml.html ================================================ ================================================ FILE: test/fixtures/docs-maruku-unittest/xml.json ================================================ ["html", ["svg:svg"], ["svg:svg", { "height": "400px", "width": "600px" }, "\u000a ", ["svg:g", { "id": "group" }, "\u000a\u0009", ["svg:circle", { "cy": "3cm", "id": "circ1", "r": "1cm", "cx": "3cm", "style": "fill:red;" }], "\u000a\u0009", ["svg:circle", { "cy": "3cm", "id": "circ2", "r": "1cm", "cx": "7cm", "style": "fill:red;" }], "\u000a "], "\u000a"], "\u000a"] ================================================ FILE: test/fixtures/docs-maruku-unittest/xml.text ================================================ ================================================ FILE: test/fixtures/docs-maruku-unittest/xml2.html ================================================ ================================================ FILE: test/fixtures/docs-maruku-unittest/xml2.json ================================================ ["html", "\u000a"] ================================================ FILE: test/fixtures/docs-maruku-unittest/xml2.text ================================================ ================================================ FILE: test/fixtures/docs-maruku-unittest/xml3.html ================================================ Blah
    em
    ================================================ FILE: test/fixtures/docs-maruku-unittest/xml3.json ================================================ ["html", ["table", "Blah", ["thead", ["td", ["em", "em"]]]], "\u000a"] ================================================ FILE: test/fixtures/docs-maruku-unittest/xml3.text ================================================ Blah
    *em*
    ================================================ FILE: test/fixtures/docs-maruku-unittest/xml_instruction.html ================================================

    Targets

    Inside: last

    ================================================ FILE: test/fixtures/docs-maruku-unittest/xml_instruction.json ================================================ ["html", "\u000a", ["p", "Targets ", " ", " "], ["p", "Inside: ", " last"]] ================================================ FILE: test/fixtures/docs-maruku-unittest/xml_instruction.text ================================================ Targets Inside: last ================================================ FILE: test/fixtures/docs-php-markdown/Backslash_escapes.html ================================================

    Tricky combinaisons:

    backslash with \-- two dashes

    backslash with \> greater than

    \[test](not a link)

    \*no emphasis*

    ================================================ FILE: test/fixtures/docs-php-markdown/Backslash_escapes.json ================================================ ["html", ["p", "Tricky combinaisons:"], ["p", "backslash with \\-- two dashes"], ["p", "backslash with \\> greater than"], ["p", "\\[test](not a link)"], ["p", "\\*no emphasis*"]] ================================================ FILE: test/fixtures/docs-php-markdown/Backslash_escapes.text ================================================ Tricky combinaisons: backslash with \\-- two dashes backslash with \\> greater than \\\[test](not a link) \\\*no emphasis* ================================================ FILE: test/fixtures/docs-php-markdown/Code_Spans.html ================================================

    From <!-- to --> on two lines.

    From <!-- to --> on three lines.

    ================================================ FILE: test/fixtures/docs-php-markdown/Code_Spans.json ================================================ ["html", ["p", "From ", ["code", ""], "\u000aon two lines."], ["p", "From ", ["code", ""], "\u000aon three lines."]] ================================================ FILE: test/fixtures/docs-php-markdown/Code_Spans.text ================================================ From `` on two lines. From `` on three lines. ================================================ FILE: test/fixtures/docs-php-markdown/Code_block_in_a_list_item.html ================================================
    • List Item:

      code block
      
      
      with a blank line
      

      within a list item.

    ================================================ FILE: test/fixtures/docs-php-markdown/Code_block_in_a_list_item.json ================================================ ["html", ["ul", ["li", ["p", "List Item:"], ["pre", ["code", "code block\u000a\u000a\u000awith a blank line\u000a"]], ["p", "within a list item."]]]] ================================================ FILE: test/fixtures/docs-php-markdown/Code_block_in_a_list_item.text ================================================ * List Item: code block with a blank line within a list item. ================================================ FILE: test/fixtures/docs-php-markdown/Headers.html ================================================

    Header

    Header

    Header


    Header

    Paragraph

    Header

    Paragraph

    Header

    Paragraph


    Paragraph

    Header

    Paragraph

    Paragraph

    Header

    Paragraph

    Paragraph

    Header

    Paragraph

    ================================================ FILE: test/fixtures/docs-php-markdown/Headers.json ================================================ ["html", ["h1", "Header"], "\u000a\u000a", ["h2", "Header"], "\u000a\u000a", ["h3", "Header"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["h1", "Header"], "\u000a\u000a", ["p", "Paragraph"], "\u000a\u000a", ["h2", "Header"], "\u000a\u000a", ["p", "Paragraph"], "\u000a\u000a", ["h3", "Header"], "\u000a\u000a", ["p", "Paragraph"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["p", "Paragraph"], "\u000a\u000a", ["h1", "Header"], "\u000a\u000a", ["p", "Paragraph"], ["p", "Paragraph"], "\u000a\u000a", ["h2", "Header"], "\u000a\u000a", ["p", "Paragraph"], ["p", "Paragraph"], "\u000a\u000a", ["h3", "Header"], "\u000a\u000a", ["p", "Paragraph"]] ================================================ FILE: test/fixtures/docs-php-markdown/Headers.text ================================================ Header ====== Header ------ ### Header - - - Header ====== Paragraph Header ------ Paragraph ### Header Paragraph - - - Paragraph Header ====== Paragraph Paragraph Header ------ Paragraph Paragraph ### Header Paragraph ================================================ FILE: test/fixtures/docs-php-markdown/Images_(Untitled).html ================================================

    alt text

    alt text

    alt text

    ================================================ FILE: test/fixtures/docs-php-markdown/Images_(Untitled).json ================================================ ["html", ["p", ["img", { "src": "/url/", "alt": "alt text" }]], ["p", ["img", { "src": "/url/", "alt": "alt text" }]], ["p", ["img", { "src": "/url/", "alt": "alt text" }]]] ================================================ FILE: test/fixtures/docs-php-markdown/Images_(Untitled).text ================================================ ![alt text](/url/) ![alt text]() ![alt text][foo] [foo]: /url/ ================================================ FILE: test/fixtures/docs-php-markdown/Inline_HTML_(Simple).html ================================================

    With some attributes:

    foo
    foo

    Hr's:


    ================================================ FILE: test/fixtures/docs-php-markdown/Inline_HTML_(Simple).json ================================================ ["html", ["p", "With some attributes:"], "\u000a\u000a", ["div", { "id": "test" }, "\u000a foo\u000a"], "\u000a\u000a", ["div", { "id": "test", "class": "nono" }, "\u000a foo\u000a"], "\u000a\u000a", ["p", "Hr's:"], "\u000a\u000a", ["hr", { "class": "foo", "id": "bar" }]] ================================================ FILE: test/fixtures/docs-php-markdown/Inline_HTML_(Simple).text ================================================ With some attributes:
    foo
    foo
    Hr's:
    ================================================ FILE: test/fixtures/docs-php-markdown/Inline_HTML_comments.html ================================================

    Paragraph one.

    Paragraph two.

    The end.

    ================================================ FILE: test/fixtures/docs-php-markdown/Inline_HTML_comments.json ================================================ ["html", ["p", "Paragraph one."], "\u000a\u000a", "\u000a\u000a", ["p", "Paragraph two."], "\u000a\u000a", "\u000a\u000a", ["p", "The end."]] ================================================ FILE: test/fixtures/docs-php-markdown/Inline_HTML_comments.text ================================================ Paragraph one. Paragraph two. The end. ================================================ FILE: test/fixtures/docs-php-markdown/PHP-Specific_Bugs.html ================================================

    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"
    
    ================================================ FILE: test/fixtures/docs-php-markdown/PHP-Specific_Bugs.json ================================================ ["html", ["p", "This tests for a bug where quotes escaped by PHP when using \u000a", ["code", "preg_replace"], " with the ", ["code", "/e"], " modifier must be correctly unescaped\u000a(hence the ", ["code", "_UnslashQuotes"], " function found only in PHP Markdown)."], ["p", "Headers below should appear exactly as they are typed (no backslash\u000aadded or removed)."], "\u000a\u000a", ["h1", "Header \"quoted\\\" again \\\"\""], "\u000a\u000a", ["h2", "Header \"quoted\\\" again \\\"\""], "\u000a\u000a", ["h3", "Header \"quoted\\\" again \\\"\""], "\u000a\u000a", ["p", "Test with tabs for ", ["code", "_Detab"], ":"], ["pre", ["code", "Code 'block' with some \"tabs\" and \"quotes\"\u000a"]]] ================================================ FILE: test/fixtures/docs-php-markdown/PHP-Specific_Bugs.text ================================================ 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" ================================================ FILE: test/fixtures/docs-php-markdown/Tight_blocks.html ================================================

    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.

    ================================================ FILE: test/fixtures/docs-php-markdown/Tight_blocks.json ================================================ ["html", ["p", "Paragraph and no space:\u000a* ciao"], ["p", "Paragraph and 1 space:\u000a * ciao"], ["p", "Paragraph and 3 spaces:\u000a * ciao"], ["p", "Paragraph and 4 spaces:\u000a * ciao"], ["p", "Paragraph before header:"], "\u000a\u000a", ["h1", "Header"], "\u000a\u000a", ["p", "Paragraph before blockquote:"], ["blockquote", ["p", "Some quote."]]] ================================================ FILE: test/fixtures/docs-php-markdown/Tight_blocks.text ================================================ 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. ================================================ FILE: test/fixtures/docs-php-markdown-extra/Abbr.html ================================================

    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.

    ================================================ FILE: test/fixtures/docs-php-markdown-extra/Abbr.json ================================================ ["html", ["p", "Some text about ", ["abbr", { "title": "Hyper Text Markup Language" }, "HTML"], ", ", ["abbr", { "title": "Standard Generalized Markup Language" }, "SGML"], " and ", ["abbr", { "title": "Hyper Text Markup Language version 4" }, "HTML4"], "."], ["p", "Let's talk about the ", ["abbr", { "title": "United States of America" }, "U.S.A."], ", (", ["abbr", { "title": "États-Unis d'Amérique" }, "É.U."], " or ", ["abbr", { "title": "États-Unis d'Amérique" }, "É.-U. d'A."], " in French)."], ["p", "And here we have a ", ["abbr", { "title": "Compact Disk" }, "CD"], ", some CDs, and some other ", ["abbr", { "title": "Compact Disk" }, "CD"], "'s."], ["p", "Let's transfert documents through ", ["abbr", { "title": "Transmission Control Protocol" }, "TCP"], "/", ["abbr", { "title": "Internet Protocol" }, "IP"], ", using ", ["abbr", { "title": "Transmission Control Protocol" }, "TCP"], " packets."], "\u000a\u000a", ["hr"], "\u000a\u000a", ["p", "Bienvenue sur ", ["a", { "href": "http://www.bidulecms.com", "title": "Bidule CMS" }, ["abbr", { "title": "Content Management System" }, "CMS"]], "."]] ================================================ FILE: test/fixtures/docs-php-markdown-extra/Abbr.text ================================================ 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 ================================================ FILE: test/fixtures/docs-php-markdown-extra/Definition_Lists.html ================================================

    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)
    ================================================ FILE: test/fixtures/docs-php-markdown-extra/Definition_Lists.json ================================================ ["html", ["p", "A simple definition list:"], "\u000a\u000a", ["dl", ["dt", "Term 1"], ["dd", "Definition 1"], ["dt", "Term 2"], ["dd", "Definition 2"]], "\u000a\u000a", ["p", "With multiple terms:"], "\u000a\u000a", ["dl", ["dt", "Term 1"], ["dt", "Term 2"], ["dd", "Definition 1"], ["dt", "Term 3"], ["dt", "Term 4"], ["dd", "Definition 2"]], "\u000a\u000a", ["p", "With multiple definitions:"], "\u000a\u000a", ["dl", ["dt", "Term 1"], ["dd", "Definition 1"], ["dd", "Definition 2"], ["dt", "Term 2"], ["dd", "Definition 3"], ["dd", "Definition 4"]], "\u000a\u000a", ["p", "With multiple lines per definition:"], "\u000a\u000a", ["dl", ["dt", "Term 1"], ["dd", "Definition 1 line 1 ...\u000aDefinition 1 line 2"], ["dd", "Definition 2 line 1 ...\u000aDefinition 2 line 2"], ["dt", "Term 2"], ["dd", "Definition 3 line 2 ...\u000aDefinition 3 line 2"], ["dd", "Definition 4 line 2 ...\u000aDefinition 4 line 2"]], "\u000a\u000a", ["p", "With paragraphs:"], "\u000a\u000a", ["dl", ["dt", "Term 1"], ["dd", ["p", "Definition 1 (paragraph)"]], ["dt", "Term 2"], ["dd", ["p", "Definition 2 (paragraph)"]]], "\u000a\u000a", ["p", "With multiple paragraphs:"], "\u000a\u000a", ["dl", ["dt", "Term 1"], ["dd", ["p", "Definition 1 paragraph 1 line 1 ...\u000aDefinition 1 paragraph 1 line 2"], ["p", "Definition 1 paragraph 2 line 1 ...\u000aDefinition 1 paragraph 2 line 2"]], ["dt", "Term 2"], ["dd", ["p", "Definition 1 paragraph 1 line 1 ...\u000aDefinition 1 paragraph 1 line 2 (lazy)"], ["p", "Definition 1 paragraph 2 line 1 ...\u000aDefinition 1 paragraph 2 line 2 (lazy)"]]], "\u000a\u000a", ["hr"], "\u000a\u000a", ["p", "A mix:"], "\u000a\u000a", ["dl", ["dt", "Term 1"], ["dt", "Term 2"], ["dd", ["p", "Definition 1 paragraph 1 line 1 ...\u000aDefinition 1 paragraph 1 line 2 (lazy)"], ["p", "Definition 1 paragraph 2 line 1 ...\u000aDefinition 1 paragraph 2 line 2"]], ["dd", ["p", "Definition 2 paragraph 1 line 1 ...\u000aDefinition 2 paragraph 1 line 2 (lazy)"]], ["dt", "Term 3"], ["dd", "Definition 3 (no paragraph)"], ["dd", "Definition 4 (no paragraph)"], ["dd", "Definition 5 line 1 ...\u000aDefinition 5 line 2 (no paragraph)"], ["dd", ["p", "Definition 6 paragraph 1 line 1 ...\u000aDefinition 6 paragraph 1 line 2"]], ["dd", "Definition 7 (no paragraph)"], ["dd", ["p", "Definition 8 paragraph 1 line 1 (forced paragraph) ...\u000aDefinition 8 paragraph 1 line 2"], ["p", "Definition 8 paragraph 2 line 1"]], ["dt", "Term 4"], ["dd", ["p", "Definition 9 paragraph 1 line 1 (forced paragraph) ...\u000aDefinition 9 paragraph 1 line 2"], ["p", "Definition 9 paragraph 2 line 1"]], ["dd", "Definition 10 (no paragraph)"]], "\u000a"] ================================================ FILE: test/fixtures/docs-php-markdown-extra/Definition_Lists.text ================================================ 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) ================================================ FILE: test/fixtures/docs-php-markdown-extra/Emphasis.html ================================================

    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. ab
    2. ab
    3. abc
    4. ab
    5. ab
    6. abc

    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

    ================================================ FILE: test/fixtures/docs-php-markdown-extra/Emphasis.json ================================================ ["html", ["p", "Combined emphasis:"], ["ol", ["li", ["strong", ["em", "test test"]]], ["li", ["strong", ["em", "test test"]]], ["li", ["em", "test ", ["strong", "test"]]], ["li", ["strong", "test ", ["em", "test"]]], ["li", ["strong", ["em", "test"], " test"]], ["li", ["em", ["strong", "test"], " test"]], ["li", ["strong", ["em", "test"], " test"]], ["li", ["strong", "test ", ["em", "test"]]], ["li", ["em", "test ", ["strong", "test"]]], ["li", ["em", "test ", ["strong", "test"]]], ["li", ["strong", "test ", ["em", "test"]]], ["li", ["strong", ["em", "test"], " test"]], ["li", ["em", ["strong", "test"], " test"]], ["li", ["strong", ["em", "test"], " test"]], ["li", ["strong", "test ", ["em", "test"]]], ["li", ["em", "test ", ["strong", "test"]]]], ["p", "Incorrect nesting:"], ["ol", ["li", "*test ", ["strong", "test* test"]], ["li", "_test ", ["strong", "test_ test"]], ["li", "**test ", ["em", "test"], "* test*"], ["li", "__test ", ["em", "test"], "_ test_"], ["li", ["em", "test *test"], " test*"], ["li", ["em", "test _test"], " test_"], ["li", ["strong", "test ", ["strong", "test"], " test"]], ["li", ["strong", "test ", ["strong", "test"], " test"]]], ["p", "No emphasis:"], ["ol", ["li", "test* test *test"], ["li", "test** test **test"], ["li", "test_ test _test"], ["li", "test__ test __test"]], ["p", "Middle-word emphasis (asterisks):"], ["ol", ["li", ["em", "a"], "b"], ["li", "a", ["em", "b"]], ["li", "a", ["em", "b"], "c"], ["li", ["strong", "a"], "b"], ["li", "a", ["strong", "b"]], ["li", "a", ["strong", "b"], "c"]], ["p", "Middle-word emphasis (underscore):"], ["ol", ["li", "_a_b"], ["li", "a_b_"], ["li", "a_b_c"], ["li", "__a__b"], ["li", "a__b__"], ["li", "a__b__c"]], ["p", "my_precious_file.txt"], "\u000a\u000a", ["h2", "Tricky Cases"], "\u000a\u000a", ["p", "E**. ", ["strong", "Test"], " TestTestTest"], ["p", "E**. ", ["strong", "Test"], " Test Test Test"]] ================================================ FILE: test/fixtures/docs-php-markdown-extra/Emphasis.text ================================================ 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 ================================================ FILE: test/fixtures/docs-php-markdown-extra/Footnotes.html ================================================

    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.


    1. This is the first note. 

    2. This is the second note. 

    3. This is the third note, defined out of order. 

    4. This is the fourth note. 

    5. Content for fifth footnote. 

    6. Content for sixth footnote spaning on three lines, with some span-level markup like emphasis, a link

    7. Footnote beginning on the line next to the marker. 

    8. Paragraph.

      • List item

      Blockquote

      Code block
      

    9. This footnote attemps to refer to another footnote. This should be impossible.[^impossible] 

    ================================================ FILE: test/fixtures/docs-php-markdown-extra/Footnotes.json ================================================ ["html", ["p", "This is the first paragraph.", ["sup", { "id": "fnref:first" }, ["a", { "href": "#fn:first", "rel": "footnote" }, "1"]]], ["ul", ["li", "List item one.", ["sup", { "id": "fnref:second" }, ["a", { "href": "#fn:second", "rel": "footnote" }, "2"]]], ["li", "List item two.", ["sup", { "id": "fnref:third" }, ["a", { "href": "#fn:third", "rel": "footnote" }, "3"]]]], "\u000a\u000a", ["h1", "Header", ["sup", { "id": "fnref:fourth" }, ["a", { "href": "#fn:fourth", "rel": "footnote" }, "4"]]], "\u000a\u000a", ["p", "Some paragraph with a footnote", ["sup", { "id": "fnref:1" }, ["a", { "href": "#fn:1", "rel": "footnote" }, "5"]], ", and another", ["sup", { "id": "fnref:2" }, ["a", { "href": "#fn:2", "rel": "footnote" }, "6"]], "."], ["p", "Another paragraph with a named footnote", ["sup", { "id": "fnref:fn-name" }, ["a", { "href": "#fn:fn-name", "rel": "footnote" }, "7"]], "."], ["p", "This paragraph should not have a footnote marker since \u000athe footnote is undefined.[^3]"], ["p", "This paragraph should not have a footnote marker since \u000athe footnote has already been used before.[^1]"], ["p", "This paragraph links to a footnote with plenty of \u000ablock-level content.", ["sup", { "id": "fnref:block" }, ["a", { "href": "#fn:block", "rel": "footnote" }, "8"]]], ["p", "This paragraph host the footnote reference within a \u000afootnote test", ["sup", { "id": "fnref:reference" }, ["a", { "href": "#fn:reference", "rel": "footnote" }, "9"]], "."], "\u000a\u000a", ["div", { "class": "footnotes" }, "\u000a", ["hr"], "\u000a", ["ol", ["li", { "id": "fn:first" }, ["p", "This is the first note. ", ["a", { "href": "#fnref:first", "rev": "footnote" }, "↩"]]], ["li", { "id": "fn:second" }, ["p", "This is the second note. ", ["a", { "href": "#fnref:second", "rev": "footnote" }, "↩"]]], ["li", { "id": "fn:third" }, ["p", "This is the third note, defined out of order. ", ["a", { "href": "#fnref:third", "rev": "footnote" }, "↩"]]], ["li", { "id": "fn:fourth" }, ["p", "This is the fourth note. ", ["a", { "href": "#fnref:fourth", "rev": "footnote" }, "↩"]]], ["li", { "id": "fn:1" }, ["p", "Content for fifth footnote. ", ["a", { "href": "#fnref:1", "rev": "footnote" }, "↩"]]], ["li", { "id": "fn:2" }, ["p", "Content for sixth footnote spaning on \u000athree lines, with some span-level markup like\u000a", ["em", "emphasis"], ", a ", ["a", { "href": "http://www.michelf.com/" }, "link"], ". ", ["a", { "href": "#fnref:2", "rev": "footnote" }, "↩"]]], ["li", { "id": "fn:fn-name" }, ["p", "Footnote beginning on the line next to the marker. ", ["a", { "href": "#fnref:fn-name", "rev": "footnote" }, "↩"]]], ["li", { "id": "fn:block" }, ["p", "Paragraph."], ["ul", ["li", "List item"]], ["blockquote", ["p", "Blockquote"]], ["pre", ["code", "Code block\u000a"]], ["p", ["a", { "href": "#fnref:block", "rev": "footnote" }, "↩"]]], ["li", { "id": "fn:reference" }, ["p", "This footnote attemps to refer to another footnote. This \u000ashould be impossible.[^impossible] ", ["a", { "href": "#fnref:reference", "rev": "footnote" }, "↩"]]]]], "\u000a"] ================================================ FILE: test/fixtures/docs-php-markdown-extra/Footnotes.text ================================================ 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 attemps to refer to another footnote. This should be impossible.[^impossible] [^impossible]: This footnote should not appear, as it is refered from another footnote, which is not allowed. ================================================ FILE: test/fixtures/docs-php-markdown-extra/Inline_HTML_with_Markdown_content.html ================================================

    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!
    ================================================ FILE: test/fixtures/docs-php-markdown-extra/Inline_HTML_with_Markdown_content.json ================================================ ["html", ["h1", "Markdown inside code blocks"], "\u000a\u000a", ["div", ["p", "foo"]], "\u000a\u000a", ["div", ["p", "foo"]], "\u000a\u000a", ["div", ["p", "foo"]], "\u000a\u000a", ["table", ["tr", ["td", "test ", ["em", "emphasis"], " (span)"]]], "\u000a\u000a", ["table", ["tr", ["td", "test ", ["em", "emphasis"], " (span)"]]], "\u000a\u000a", ["table", ["tr", ["td", ["p", "test ", ["em", "emphasis"], " (block)"]]]], "\u000a\u000a", ["h2", "More complicated"], "\u000a\u000a", ["table", ["tr", ["td", "\u000a* this is ", ["em", "not"], " a list item"]], ["tr", ["td", "\u000a* this is ", ["em", "not"], " a list item"]], ["tr", ["td", ["ul", ["li", "this ", ["em", "is"], " a list item"]]]]], "\u000a\u000a", ["h2", "With indent"], "\u000a\u000a", ["div", "\u000a ", ["div", ["p", "This text is no code block: if it was, the \u000aclosing ", ["code", "
    "], " would be too and the HTML block \u000awould be invalid."], ["p", "Markdown content in HTML blocks is assumed to be \u000aindented the same as the block opening tag."], ["p", ["strong", "This should be the third paragraph after the header."]]], "\u000a"], "\u000a\u000a", ["h2", "Code block with rogue ", ["code", "
    "], "s in Markdown code span and block"], "\u000a\u000a", ["div", "\u000a ", ["div", ["p", "This is a code block however:"], ["pre", ["code", "
    \u000a"]], ["p", "Funny isn't it? Here is a code span: ", ["code", "
    "], "."]], "\u000a"], "\u000a\u000a", ["div", "\u000a ", ["div", ["ul", ["li", "List item, not a code block"]], ["p", "Some text"], ["pre", ["code", "This is a code block.\u000a"]]], "\u000a"], "\u000a\u000a", ["h2", "No code block in markdown span mode"], "\u000a\u000a", ["p", "\u000a This is not a code block since Markdown parse paragraph \u000a content as span. Code spans like ", ["code", "

    "], " are allowed though.\u000a"], ["p", ["em", "Hello"], " ", ["em", "world"]], "\u000a\u000a", ["h2", "Preserving attributes and tags on more than one line:"], "\u000a\u000a", ["p", { "class": "test", "id": "12" }, "\u000aSome ", ["em", "span"], " content.\u000a"], "\u000a\u000a", ["h2", "Header confusion bug"], "\u000a\u000a", ["table", { "class": "canvas" }, ["tr", ["td", { "id": "main" }, "Hello World!\u000a============\u000a\u000aHello World!"]]]] ================================================ FILE: test/fixtures/docs-php-markdown-extra/Inline_HTML_with_Markdown_content.text ================================================ # 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!
    ================================================ FILE: test/fixtures/docs-php-markdown-extra/Tables.html ================================================

    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
    ================================================ FILE: test/fixtures/docs-php-markdown-extra/Tables.json ================================================ ["html", ["h1", "Simple tables"], "\u000a\u000a", ["table", ["thead", ["tr", ["th", "Header 1"], ["th", "Header 2"]]], ["tbody", ["tr", ["td", "Cell 1"], ["td", "Cell 2"]], ["tr", ["td", "Cell 3"], ["td", "Cell 4"]]]], "\u000a\u000a", ["p", "With leading pipes:"], "\u000a\u000a", ["table", ["thead", ["tr", ["th", "Header 1"], ["th", "Header 2"]]], ["tbody", ["tr", ["td", "Cell 1"], ["td", "Cell 2"]], ["tr", ["td", "Cell 3"], ["td", "Cell 4"]]]], "\u000a\u000a", ["p", "With tailing pipes:"], "\u000a\u000a", ["table", ["thead", ["tr", ["th", "Header 1"], ["th", "Header 2"]]], ["tbody", ["tr", ["td", "Cell 1"], ["td", "Cell 2"]], ["tr", ["td", "Cell 3"], ["td", "Cell 4"]]]], "\u000a\u000a", ["p", "With leading and tailing pipes:"], "\u000a\u000a", ["table", ["thead", ["tr", ["th", "Header 1"], ["th", "Header 2"]]], ["tbody", ["tr", ["td", "Cell 1"], ["td", "Cell 2"]], ["tr", ["td", "Cell 3"], ["td", "Cell 4"]]]], "\u000a\u000a", ["hr"], "\u000a\u000a", ["h1", "One-column one-row table"], "\u000a\u000a", ["p", "With leading pipes:"], "\u000a\u000a", ["table", ["thead", ["tr", ["th", "Header"]]], ["tbody", ["tr", ["td", "Cell"]]]], "\u000a\u000a", ["p", "With tailing pipes:"], "\u000a\u000a", ["table", ["thead", ["tr", ["th", "Header"]]], ["tbody", ["tr", ["td", "Cell"]]]], "\u000a\u000a", ["p", "With leading and tailing pipes:"], "\u000a\u000a", ["table", ["thead", ["tr", ["th", "Header"]]], ["tbody", ["tr", ["td", "Cell"]]]], "\u000a\u000a", ["hr"], "\u000a\u000a", ["p", "Table alignement:"], "\u000a\u000a", ["table", ["thead", ["tr", ["th", "Default"], ["th", { "align": "left" }, "Right"], ["th", { "align": "center" }, "Center"], ["th", { "align": "right" }, "Left"]]], ["tbody", ["tr", ["td", "Long Cell"], ["td", { "align": "left" }, "Long Cell"], ["td", { "align": "center" }, "Long Cell"], ["td", { "align": "right" }, "Long Cell"]], ["tr", ["td", "Cell"], ["td", { "align": "left" }, "Cell"], ["td", { "align": "center" }, "Cell"], ["td", { "align": "right" }, "Cell"]]]], "\u000a\u000a", ["p", "Table alignement (alternate spacing):"], "\u000a\u000a", ["table", ["thead", ["tr", ["th", "Default"], ["th", { "align": "left" }, "Right"], ["th", { "align": "center" }, "Center"], ["th", { "align": "right" }, "Left"]]], ["tbody", ["tr", ["td", "Long Cell"], ["td", { "align": "left" }, "Long Cell"], ["td", { "align": "center" }, "Long Cell"], ["td", { "align": "right" }, "Long Cell"]], ["tr", ["td", "Cell"], ["td", { "align": "left" }, "Cell"], ["td", { "align": "center" }, "Cell"], ["td", { "align": "right" }, "Cell"]]]], "\u000a\u000a", ["hr"], "\u000a\u000a", ["h1", "Empty cells"], "\u000a\u000a", ["table", ["thead", ["tr", ["th", "Header 1"], ["th", "Header 2"]]], ["tbody", ["tr", ["td", "A"], ["td", "B"]], ["tr", ["td", "C"], ["td"]]]], "\u000a\u000a", ["table", ["thead", ["tr", ["th", "Header 1"], ["th", "Header 2"]]], ["tbody", ["tr", ["td", "A"], ["td", "B"]], ["tr", ["td"], ["td", "D"]]]], "\u000a\u000a", ["hr"], "\u000a\u000a", ["h1", "Missing tailing pipe"], "\u000a\u000a", ["table", ["thead", ["tr", ["th", "Header 1"], ["th", "Header 2"]]], ["tbody", ["tr", ["td", "Cell"], ["td", "Cell"]], ["tr", ["td", "Cell"], ["td", "Cell"]]]], "\u000a\u000a", ["table", ["thead", ["tr", ["th", "Header 1"], ["th", "Header 2"]]], ["tbody", ["tr", ["td", "Cell"], ["td", "Cell"]], ["tr", ["td", "Cell"], ["td", "Cell"]]]], "\u000a\u000a", ["table", ["thead", ["tr", ["th", "Header 1"], ["th", "Header 2"]]], ["tbody", ["tr", ["td", "Cell"], ["td", "Cell"]], ["tr", ["td", "Cell"], ["td", "Cell"]]]], "\u000a\u000a", ["table", ["thead", ["tr", ["th", "Header 1"], ["th", "Header 2"]]], ["tbody", ["tr", ["td", "Cell"], ["td", "Cell"]], ["tr", ["td", "Cell"], ["td", "Cell"]]]]] ================================================ FILE: test/fixtures/docs-php-markdown-extra/Tables.text ================================================ # 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 ================================================ FILE: test/fixtures/docs-php-markdown-todo/Email_auto_links.html ================================================

    michel.fortin@michelf.com

    International domain names: help@tūdaliņ.lv

    ================================================ FILE: test/fixtures/docs-php-markdown-todo/Email_auto_links.json ================================================ ["html", ["p", ["a", { "href": "mailto:michel.fortin@michelf.com" }, "michel.fortin@michelf.com"]], ["p", "International domain names: ", ["a", { "href": "mailto:help@tūdaliņ.lv" }, "help@tūdaliņ.lv"]]] ================================================ FILE: test/fixtures/docs-php-markdown-todo/Email_auto_links.text ================================================ International domain names: ================================================ FILE: test/fixtures/docs-php-markdown-todo/Emphasis.html ================================================

    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. ab
    2. ab
    3. abc
    4. ab
    5. ab
    6. abc

    Middle-word emphasis (underscore):

    1. ab
    2. ab
    3. abc
    4. ab
    5. ab
    6. abc

    mypreciousfile.txt

    Tricky Cases

    E**. Test TestTestTest

    E**. Test Test Test Test

    ================================================ FILE: test/fixtures/docs-php-markdown-todo/Emphasis.json ================================================ ["html", ["p", "Combined emphasis:"], ["ol", ["li", ["strong", ["em", "test test"]]], ["li", ["strong", ["em", "test test"]]], ["li", ["em", "test ", ["strong", "test"]]], ["li", ["strong", "test ", ["em", "test"]]], ["li", ["strong", ["em", "test"], " test"]], ["li", ["em", ["strong", "test"], " test"]], ["li", ["strong", ["em", "test"], " test"]], ["li", ["strong", "test ", ["em", "test"]]], ["li", ["em", "test ", ["strong", "test"]]], ["li", ["em", "test ", ["strong", "test"]]], ["li", ["strong", "test ", ["em", "test"]]], ["li", ["strong", ["em", "test"], " test"]], ["li", ["em", ["strong", "test"], " test"]], ["li", ["strong", ["em", "test"], " test"]], ["li", ["strong", "test ", ["em", "test"]]], ["li", ["em", "test ", ["strong", "test"]]]], ["p", "Incorrect nesting:"], ["ol", ["li", "*test ", ["strong", "test* test"]], ["li", "_test ", ["strong", "test_ test"]], ["li", "**test ", ["em", "test"], "* test*"], ["li", "__test ", ["em", "test"], "_ test_"], ["li", ["em", "test *test"], " test*"], ["li", ["em", "test _test"], " test_"], ["li", ["strong", "test ", ["strong", "test"], " test"]], ["li", ["strong", "test ", ["strong", "test"], " test"]]], ["p", "No emphasis:"], ["ol", ["li", "test* test *test"], ["li", "test** test **test"], ["li", "test_ test _test"], ["li", "test__ test __test"]], ["p", "Middle-word emphasis (asterisks):"], ["ol", ["li", ["em", "a"], "b"], ["li", "a", ["em", "b"]], ["li", "a", ["em", "b"], "c"], ["li", ["strong", "a"], "b"], ["li", "a", ["strong", "b"]], ["li", "a", ["strong", "b"], "c"]], ["p", "Middle-word emphasis (underscore):"], ["ol", ["li", ["em", "a"], "b"], ["li", "a", ["em", "b"]], ["li", "a", ["em", "b"], "c"], ["li", ["strong", "a"], "b"], ["li", "a", ["strong", "b"]], ["li", "a", ["strong", "b"], "c"]], ["p", "my", ["em", "precious"], "file.txt"], "\u000a\u000a", ["h2", "Tricky Cases"], "\u000a\u000a", ["p", "E**. ", ["strong", "Test"], " TestTestTest"], ["p", "E**. ", ["strong", "Test"], " Test Test Test"]] ================================================ FILE: test/fixtures/docs-php-markdown-todo/Emphasis.text ================================================ 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 ================================================ FILE: test/fixtures/docs-php-markdown-todo/Inline_HTML_(Span).html ================================================

    ACINACS

    SB SB

    ================================================ FILE: test/fixtures/docs-php-markdown-todo/Inline_HTML_(Span).json ================================================ ["html", ["p", ["abbr", { "title": "` **Attribute Content Is Not A Code Span** `" }, "ACINACS"]], ["p", ["abbr", { "title": "`first backtick!" }, "SB"], " \u000a", ["abbr", { "title": "`second backtick!" }, "SB"]]] ================================================ FILE: test/fixtures/docs-php-markdown-todo/Inline_HTML_(Span).text ================================================ ACINACS SB SB ================================================ FILE: test/fixtures/docs-php-markdown-todo/Ins_and_del.json ================================================ ["html", ["p", "Here is a block tag ins:"], "\u000a\u000a", ["ins", ["p", "Some text"]], "\u000a\u000a", ["p", ["ins", "And here it is inside a paragraph."]], ["p", "And here it is ", ["ins", "in the middle of"], " a paragraph."], "\u000a\u000a", ["del", ["p", "Some text"]], "\u000a\u000a", ["p", ["del", "And here is ins as a paragraph."]], ["p", "And here it is ", ["del", "in the middle of"], " a paragraph."]] ================================================ FILE: test/fixtures/docs-php-markdown-todo/Ins_and_del.text ================================================ 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. ================================================ FILE: test/fixtures/docs-php-markdown-todo/Ins_and_del.xhtml ================================================

    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.

    ================================================ FILE: test/fixtures/docs-php-markdown-todo/Links_inline_style.html ================================================

    silly URL w/ angle brackets.

    ================================================ FILE: test/fixtures/docs-php-markdown-todo/Links_inline_style.json ================================================ ["html", ["p", ["a", { "href": "?}]*+|&)" }, "silly URL w/ angle brackets"], "."]] ================================================ FILE: test/fixtures/docs-php-markdown-todo/Links_inline_style.text ================================================ [silly URL w/ angle brackets](). ================================================ FILE: test/fixtures/docs-php-markdown-todo/Nesting.html ================================================

    Valid nesting:

    Link

    Link

    Link

    Invalid nesting:

    [Link](url)

    ================================================ FILE: test/fixtures/docs-php-markdown-todo/Nesting.json ================================================ ["html", ["p", "Valid nesting:"], ["p", ["strong", ["a", { "href": "url" }, "Link"]]], ["p", ["a", { "href": "url" }, ["strong", "Link"]]], ["p", ["strong", ["a", { "href": "url" }, ["strong", "Link"]]]], ["p", "Invalid nesting:"], ["p", ["a", { "href": "url" }, "[Link](url)"]]] ================================================ FILE: test/fixtures/docs-php-markdown-todo/Nesting.text ================================================ Valid nesting: **[Link](url)** [**Link**](url) **[**Link**](url)** Invalid nesting: [[Link](url)](url) ================================================ FILE: test/fixtures/docs-php-markdown-todo/Parens_in_URL.html ================================================

    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.

    ================================================ FILE: test/fixtures/docs-php-markdown-todo/Parens_in_URL.json ================================================ ["html", ["p", ["a", { "href": "/url(test)", "title": "title" }, "Inline link 1 with parens"], "."], ["p", ["a", { "href": "/url(test)", "title": "title" }, "Inline link 2 with parens"], "."], ["p", ["a", { "href": "/url(test)", "title": "title" }, "Inline link 3 with non-escaped parens"], "."], ["p", ["a", { "href": "/url(test)", "title": "title" }, "Inline link 4 with non-escaped parens"], "."], ["p", ["a", { "href": "/url(test)", "title": "title" }, "Reference link 1 with parens"], "."], ["p", ["a", { "href": "/url(test)", "title": "title" }, "Reference link 2 with parens"], "."]] ================================================ FILE: test/fixtures/docs-php-markdown-todo/Parens_in_URL.text ================================================ [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" ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/auto_link.html ================================================

    I can has autolink? http://icanhascheeseburger.com

    Ask garfield: garfield@example.com

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/auto_link.json ================================================ ["html", ["p", "I can has autolink? ", ["a", { "href": "http://icanhascheeseburger.com" }, "http://icanhascheeseburger.com"]], ["p", "Ask garfield: ", ["a", { "href": "mailto:garfield@example.com" }, "garfield@example.com"]]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/auto_link.text ================================================ I can has autolink? Ask garfield: ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/auto_link_safe_mode.html ================================================

    I can has autolink? http://icanhascheeseburger.com

    Ask garfield: garfield@example.com

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/auto_link_safe_mode.json ================================================ ["html", ["p", "I can has autolink? ", ["a", { "href": "http://icanhascheeseburger.com" }, "http://icanhascheeseburger.com"]], ["p", "Ask garfield: ", ["a", { "href": "mailto:garfield@example.com" }, "garfield@example.com"]]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/auto_link_safe_mode.opts ================================================ {'safe_mode': True} ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/auto_link_safe_mode.text ================================================ I can has autolink? Ask garfield: ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode.html ================================================

    blah [HTML_REMOVED] blah

    [HTML_REMOVED]yowzer![HTML_REMOVED]

    blah

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode.json ================================================ ["html", ["p", "blah [HTML_REMOVED] blah"], ["p", "[HTML_REMOVED]yowzer![HTML_REMOVED]"], ["p", "blah"]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode.opts ================================================ # Use the old (for-compat-only) way of specifying "replace" safe mode. {"safe_mode": True} ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode.text ================================================ blah blah
    yowzer!
    blah ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode_escape.html ================================================

    blah <img src="dangerous"> blah

    <div>yowzer!</div>

    blah

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode_escape.json ================================================ ["html", ["p", "blah blah"], ["p", "
    yowzer!
    "], ["p", "blah"]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode_escape.opts ================================================ {"safe_mode": "escape"} ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/basic_safe_mode_escape.text ================================================ blah blah
    yowzer!
    blah ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/blockquote.html ================================================

    [Trent wrote]

    no way

    [Jeff wrote]

    way

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/blockquote.json ================================================ ["html", ["p", "[Trent wrote]"], ["blockquote", ["p", "no way"]], ["p", "[Jeff wrote]"], ["blockquote", ["p", "way"]]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/blockquote.text ================================================ [Trent wrote] > no way [Jeff wrote] > way ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/blockquote_with_pre.html ================================================

    Markdown indents blockquotes a couple of spaces necessitating some tweaks for pre-blocks in that blockquote:

    here is a check
    for that
    
    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/blockquote_with_pre.json ================================================ ["html", ["blockquote", ["p", "Markdown indents blockquotes a couple of spaces\u000a necessitating some tweaks for pre-blocks in that\u000a blockquote:"], ["pre", ["code", "here is a check\u000afor that\u000a"]]]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/blockquote_with_pre.text ================================================ > Markdown indents blockquotes a couple of spaces > necessitating some tweaks for pre-blocks in that > blockquote: > > here is a check > for that ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/code_block_with_tabs.html ================================================

    Test with tabs for _Detab:

    Code    'block' with    some    "tabs"  and "quotes"
    
    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/code_block_with_tabs.json ================================================ ["html", ["p", "Test with tabs for ", ["code", "_Detab"], ":"], ["pre", ["code", "Code 'block' with some \"tabs\" and \"quotes\"\u000a"]]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/code_block_with_tabs.text ================================================ Test with tabs for `_Detab`: Code 'block' with some "tabs" and "quotes" ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/code_safe_emphasis.html ================================================

    This is italic and this is bold. This is NOT _italic_ and this is __bold__ because --code-safe is turned on.

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/code_safe_emphasis.json ================================================ ["html", ["p", "This is ", ["em", "italic"], " and this is ", ["strong", "bold"], ".\u000aThis is NOT _italic_ and this is __bold__ because --code-safe is turned on."]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/code_safe_emphasis.opts ================================================ {"extras": ["code-friendly"]} ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/code_safe_emphasis.text ================================================ This is *italic* and this is **bold**. This is NOT _italic_ and this is __bold__ because --code-safe is turned on. ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/codeblock.html ================================================
    some code
    

    some 'splaining

    some more code
    2 > 1
    
    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/codeblock.json ================================================ ["html", ["pre", ["code", "some code\u000a"]], ["p", "some 'splaining"], ["pre", ["code", "some more code\u000a2 > 1\u000a"]]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/codeblock.text ================================================ some code some 'splaining some more code 2 > 1 ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/codespans.html ================================================

    This is a code span. And This is one with an `embedded backtick`.

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/codespans.json ================================================ ["html", ["p", ["code", "This"], " is a code span.\u000aAnd ", ["code", "This is one with an `embedded backtick`"], "."]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/codespans.text ================================================ `This` is a code span. And ``This is one with an `embedded backtick` ``. ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/codespans_safe_mode.html ================================================

    This is a code span. And This is one with an `embedded backtick`.

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/codespans_safe_mode.json ================================================ ["html", ["p", ["code", "This"], " is a code span.\u000aAnd ", ["code", "This is one with an `embedded backtick`"], "."]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/codespans_safe_mode.opts ================================================ {'safe_mode': True} ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/codespans_safe_mode.text ================================================ `This` is a code span. And ``This is one with an `embedded backtick` ``. ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/emacs_head_vars.html ================================================

    This sentence talks about the Python __init__ method, which I'd rather not be interpreted as Markdown's strong.

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/emacs_head_vars.json ================================================ ["html", "\u000a\u000a", ["p", "This sentence talks about the Python __init__ method, which I'd rather not be\u000ainterpreted as Markdown's strong."]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/emacs_head_vars.text ================================================ This sentence talks about the Python __init__ method, which I'd rather not be interpreted as Markdown's strong. ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/emacs_tail_vars.html ================================================

    This sentence talks about the Python __init__ method, which I'd rather not be interpreted as Markdown's strong.

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/emacs_tail_vars.json ================================================ ["html", ["p", "This sentence talks about the Python __init__ method, which I'd rather not be\u000ainterpreted as Markdown's strong."], "\u000a\u000a", "\u000a"] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/emacs_tail_vars.text ================================================ This sentence talks about the Python __init__ method, which I'd rather not be interpreted as Markdown's strong. ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/emphasis.html ================================================

    This is italic and this is bold. This is also italic and this is bold.

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/emphasis.json ================================================ ["html", ["p", "This is ", ["em", "italic"], " and this is ", ["strong", "bold"], ".\u000aThis is also ", ["em", "italic"], " and this is ", ["strong", "bold"], "."]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/emphasis.text ================================================ This is *italic* and this is **bold**. This is also _italic_ and this is __bold__. ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/escapes.html ================================================

    **don't shout**

    *don't emphasize*

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/escapes.json ================================================ ["html", ["p", "**don't shout**"], ["p", "*don't emphasize*"]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/escapes.text ================================================ \*\*don't shout\*\* \*don't emphasize\* ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/footnotes.html ================================================

    This is a para with a footnote.1

    This is another para with a footnote2 in it. Actually it has two3 of them. No, three4.


    1. Here is the body of the first footnote. 

    2. And of the second footnote.

      This one has multiple paragraphs. 

    3. Here is a footnote body that starts on next line. 

    4. quickie "that looks like a link ref if not careful" 

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/footnotes.json ================================================ ["html", ["p", "This is a para with a footnote.", ["sup", { "class": "footnote-ref", "id": "fnref-1" }, ["a", { "href": "#fn-1" }, "1"]]], ["p", "This is another para with a footnote", ["sup", { "class": "footnote-ref", "id": "fnref-2" }, ["a", { "href": "#fn-2" }, "2"]], " in it. Actually it has two", ["sup", { "class": "footnote-ref", "id": "fnref-3" }, ["a", { "href": "#fn-3" }, "3"]], " of\u000athem. No, three", ["sup", { "class": "footnote-ref", "id": "fnref-4" }, ["a", { "href": "#fn-4" }, "4"]], "."], "\u000a\u000a", ["div", { "class": "footnotes" }, "\u000a", ["hr"], "\u000a", ["ol", ["li", { "id": "fn-1" }, ["p", "Here is the body of the first footnote.", ["a", { "href": "#fnref-1", "class": "footnoteBackLink", "title": "Jump back to footnote 1 in the text." }, "↩"]]], ["li", { "id": "fn-2" }, ["p", "And of the second footnote."], ["p", "This one has multiple paragraphs.", ["a", { "href": "#fnref-2", "class": "footnoteBackLink", "title": "Jump back to footnote 2 in the text." }, "↩"]]], ["li", { "id": "fn-3" }, ["p", "Here is a footnote body that starts on next line.", ["a", { "href": "#fnref-3", "class": "footnoteBackLink", "title": "Jump back to footnote 3 in the text." }, "↩"]]], ["li", { "id": "fn-4" }, ["p", "quickie \"that looks like a link ref if not careful\"", ["a", { "href": "#fnref-4", "class": "footnoteBackLink", "title": "Jump back to footnote 4 in the text." }, "↩"]]]]], "\u000a"] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/footnotes.opts ================================================ {"extras": ["footnotes"]} ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/footnotes.text ================================================ This is a para with a footnote.[^1] This is another para with a footnote[^2] in it. Actually it has two[^3] of them. No, three[^4]. [^1]: Here is the body of the first footnote. [^2]: And of the second footnote. This one has multiple paragraphs. [^3]: Here is a footnote body that starts on next line. [^4]: quickie "that looks like a link ref if not careful" ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/footnotes_letters.html ================================================

    This is a para with a footnote.1

    This is another para with a footnote2 in it. Actually it has two3 of them.


    1. Here is the body of the first footnote. 

    2. And of the second footnote.

      This one has multiple paragraphs. 

    3. Here is a footnote body that starts on next line. 

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/footnotes_letters.json ================================================ ["html", ["p", "This is a para with a footnote.", ["sup", { "class": "footnote-ref", "id": "fnref-foo" }, ["a", { "href": "#fn-foo" }, "1"]]], ["p", "This is another para with a footnote", ["sup", { "class": "footnote-ref", "id": "fnref-hyphen-ated" }, ["a", { "href": "#fn-hyphen-ated" }, "2"]], " in it. Actually it has two", ["sup", { "class": "footnote-ref", "id": "fnref-Capital" }, ["a", { "href": "#fn-Capital" }, "3"]], " of\u000athem."], "\u000a\u000a", ["div", { "class": "footnotes" }, "\u000a", ["hr"], "\u000a", ["ol", ["li", { "id": "fn-foo" }, ["p", "Here is the body of the first footnote.", ["a", { "href": "#fnref-foo", "class": "footnoteBackLink", "title": "Jump back to footnote 1 in the text." }, "↩"]]], ["li", { "id": "fn-hyphen-ated" }, ["p", "And of the second footnote."], ["p", "This one has multiple paragraphs.", ["a", { "href": "#fnref-hyphen-ated", "class": "footnoteBackLink", "title": "Jump back to footnote 2 in the text." }, "↩"]]], ["li", { "id": "fn-Capital" }, ["p", "Here is a footnote body that starts on next line.", ["a", { "href": "#fnref-Capital", "class": "footnoteBackLink", "title": "Jump back to footnote 3 in the text." }, "↩"]]]]], "\u000a"] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/footnotes_letters.opts ================================================ {"extras": ["footnotes"]} ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/footnotes_letters.text ================================================ This is a para with a footnote.[^foo] This is another para with a footnote[^hyphen-ated] in it. Actually it has two[^Capital] of them. [^foo]: Here is the body of the first footnote. [^hyphen-ated]: And of the second footnote. This one has multiple paragraphs. [^Capital]: Here is a footnote body that starts on next line. ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/footnotes_markup.html ================================================

    This is a para with a footnote.1

    This is another para with a footnote.2


    1. And the body of the footnote has markup. For example, a link to digg. And some code:

      print "Hello, World!"
      

    2. This body has markup too, but doesn't end with a code block. 

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/footnotes_markup.json ================================================ ["html", ["p", "This is a para with a footnote.", ["sup", { "class": "footnote-ref", "id": "fnref-1" }, ["a", { "href": "#fn-1" }, "1"]]], ["p", "This is another para with a footnote.", ["sup", { "class": "footnote-ref", "id": "fnref-2" }, ["a", { "href": "#fn-2" }, "2"]]], "\u000a\u000a", ["div", { "class": "footnotes" }, "\u000a", ["hr"], "\u000a", ["ol", ["li", { "id": "fn-1" }, ["p", "And the ", ["strong", "body"], " of the footnote has ", ["code", "markup"], ". For example,\u000aa ", ["a", { "href": "http://digg.com" }, "link to digg"], ". And some code:"], ["pre", ["code", "print \"Hello, World!\"\u000a"]], ["p", ["a", { "href": "#fnref-1", "class": "footnoteBackLink", "title": "Jump back to footnote 1 in the text." }, "↩"]]], ["li", { "id": "fn-2" }, ["p", "This body has markup too, ", ["em", "but"], " doesn't end with a code block.", ["a", { "href": "#fnref-2", "class": "footnoteBackLink", "title": "Jump back to footnote 2 in the text." }, "↩"]]]]], "\u000a"] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/footnotes_markup.opts ================================================ {"extras": ["footnotes"]} ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/footnotes_markup.text ================================================ This is a para with a footnote.[^1] This is another para with a footnote.[^2] [^1]: And the **body** of the footnote has `markup`. For example, a [link to digg](http://digg.com). And some code: print "Hello, World!" [^2]: This body has markup too, *but* doesn't end with a code block. ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/footnotes_safe_mode_escape.html ================================================

    This is a para with a footnote.1


    1. Here is the <em>body</em> of <span class="yo">the</span> footnote.

      <div class="blah">And here is the second para of the footnote.</div> 

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/footnotes_safe_mode_escape.json ================================================ ["html", ["p", "This is a para with a footnote.", ["sup", { "class": "footnote-ref", "id": "fnref-1" }, ["a", { "href": "#fn-1" }, "1"]]], "\u000a\u000a", ["div", { "class": "footnotes" }, "\u000a", ["hr"], "\u000a", ["ol", ["li", { "id": "fn-1" }, ["p", "Here is the body of the footnote."], ["p", "
    And here is the second para of the footnote.
    ", ["a", { "href": "#fnref-1", "class": "footnoteBackLink", "title": "Jump back to footnote 1 in the text." }, "↩"]]]]], "\u000a"] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/footnotes_safe_mode_escape.opts ================================================ {"safe_mode": "escape", "extras": ["footnotes"]} ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/footnotes_safe_mode_escape.text ================================================ This is a para with a footnote.[^1] [^1]: Here is the body of the footnote.
    And here is the second para of the footnote.
    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/header.html ================================================

    an h1

    an h2

    another h1

    another h2

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/header.json ================================================ ["html", ["h1", "an h1"], "\u000a\u000a", ["h2", "an h2"], "\u000a\u000a", ["h1", "another h1"], "\u000a\u000a", ["h2", "another h2"], "\u000a"] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/header.text ================================================ # an h1 ## an h2 another h1 ========== another h2 ---------- ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/hr.html ================================================

    Dashes:





    ---
    
    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/hr.json ================================================ ["html", ["p", "Dashes:"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["hr"], "\u000a\u000a", ["pre", ["code", "---\u000a"]]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/hr.text ================================================ Dashes: --- --- --- --- --- ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/img_in_link.html ================================================

    This example from http://orestis.gr/en/blog/2007/05/28/python-markdown-problems/:

    the google logo

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/img_in_link.json ================================================ ["html", ["p", "This example from\u000a", ["a", { "href": "http://orestis.gr/en/blog/2007/05/28/python-markdown-problems/" }, "http://orestis.gr/en/blog/2007/05/28/python-markdown-problems/"], ":"], ["p", ["a", { "href": "http://www.google.com/", "title": "click to visit Google.com" }, ["img", { "src": "http://www.google.com/images/logo.gif", "alt": "the google logo" }]]]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/img_in_link.text ================================================ This example from : [![the google logo][logo]][google] [logo]: http://www.google.com/images/logo.gif [google]: http://www.google.com/ "click to visit Google.com" ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/inline_links.html ================================================

    an inline link

    a link "with" title

    an inline image link

    an image "with" title

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/inline_links.json ================================================ ["html", ["p", "an inline ", ["a", { "href": "/url/" }, "link"]], ["p", "a ", ["a", { "href": "/url/", "title": "title" }, "link \"with\" title"]], ["p", "an inline ", ["img", { "src": "/url/", "alt": "image link" }]], ["p", "an ", ["img", { "src": "/url/", "alt": "image \"with\" title", "title": "title" }]]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/inline_links.text ================================================ an inline [link](/url/) a [link "with" title](/url/ "title") an inline ![image link](/url/) an ![image "with" title](/url/ "title") ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/issue2_safe_mode_borks_markup.html ================================================

    Heading 2

    blah [HTML_REMOVED]alert('this should be removed')[HTML_REMOVED] blah

    [HTML_REMOVED]alert('as should this')[HTML_REMOVED]

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/issue2_safe_mode_borks_markup.json ================================================ ["html", ["h2", "Heading 2"], "\u000a\u000a", ["p", "blah [HTML_REMOVED]alert('this should be removed')[HTML_REMOVED] ", ["strong", "blah"]], ["p", "[HTML_REMOVED]alert('as should this')[HTML_REMOVED]"]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/issue2_safe_mode_borks_markup.opts ================================================ {"safe_mode": "replace"} ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/issue2_safe_mode_borks_markup.text ================================================ ## Heading 2 blah **blah** ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/link_defn_alt_title_delims.html ================================================

    Alternative delimiters for link definitions are allowed -- as of Markdown 1.0.2, I think. Hence, this link and this link work too.

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/link_defn_alt_title_delims.json ================================================ ["html", ["p", "Alternative delimiters for ", ["a", { "href": "http://daringfireball.net/projects/markdown/syntax#link", "title": "link syntax" }, "link definitions"], " are allowed -- as of\u000aMarkdown 1.0.2, I think. Hence, ", ["a", { "href": "http://daringfireball.net/projects/markdown/syntax#link", "title": "link syntax" }, "this link"], " and ", ["a", { "href": "http://daringfireball.net/projects/markdown/syntax#link", "title": "link syntax" }, "this link"], " work\u000atoo."]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/link_defn_alt_title_delims.text ================================================ Alternative delimiters for [link definitions][link1] are allowed -- as of Markdown 1.0.2, I think. Hence, [this link][link2] and [this link][link3] work too. [link1]: http://daringfireball.net/projects/markdown/syntax#link "link syntax" [link2]: http://daringfireball.net/projects/markdown/syntax#link 'link syntax' [link3]: http://daringfireball.net/projects/markdown/syntax#link (link syntax) ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/link_patterns.html ================================================

    Recipe 123 and Komodo bug 234 are related.

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/link_patterns.json ================================================ ["html", ["p", ["a", { "href": "http://code.activestate.com/recipes/123/" }, "Recipe 123"], " and ", ["a", { "href": "http://bugs.activestate.com/show_bug.cgi?id=234" }, "Komodo bug 234"], " are related."]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/link_patterns.opts ================================================ {"extras": ["link-patterns"], "link_patterns": [ (re.compile("recipe\s+(\d+)", re.I), r"http://code.activestate.com/recipes/\1/"), (re.compile("(?:komodo\s+)?bug\s+(\d+)", re.I), r"http://bugs.activestate.com/show_bug.cgi?id=\1"), ], } ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/link_patterns.text ================================================ Recipe 123 and Komodo bug 234 are related. ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/link_patterns_double_hit.html ================================================

    There once was a Mozilla bug 123 and a Komodo bug 123.

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/link_patterns_double_hit.json ================================================ ["html", ["p", "There once was a ", ["a", { "href": "http://bugzilla.mozilla.org/show_bug.cgi?id=123" }, "Mozilla bug 123"], " and a ", ["a", { "href": "http://bugs.activestate.com/show_bug.cgi?id=123" }, "Komodo bug 123"], "."]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/link_patterns_double_hit.opts ================================================ {"extras": ["link-patterns"], "link_patterns": [ (re.compile(r'mozilla\s+bug\s+(\d+)', re.I), r'http://bugzilla.mozilla.org/show_bug.cgi?id=\1'), (re.compile("(?:komodo\s+)?bug\s+(\d+)", re.I), r"http://bugs.activestate.com/show_bug.cgi?id=\1"), ], } ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/link_patterns_double_hit.text ================================================ There once was a Mozilla bug 123 and a Komodo bug 123. ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/link_patterns_edge_cases.html ================================================

    Blah 123 becomes a line with two underscores.

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/link_patterns_edge_cases.json ================================================ ["html", ["p", ["a", { "href": "http://foo.com/blah_blah_blah/123" }, "Blah 123"], " becomes a line with two underscores."]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/link_patterns_edge_cases.opts ================================================ {"extras": ["link-patterns"], "link_patterns": [ (re.compile("Blah\s+(\d+)", re.I), r"http://foo.com/blah_blah_blah/\1"), ], } ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/link_patterns_edge_cases.text ================================================ Blah 123 becomes a line with two underscores. ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/lists.html ================================================

    count:

    • one
    • two
    • three

    count in spanish:

    1. uno
    2. dos
    3. tres
    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/lists.json ================================================ ["html", ["p", "count:"], ["ul", ["li", "one"], ["li", "two"], ["li", "three"]], ["p", "count in spanish:"], ["ol", ["li", "uno"], ["li", "dos"], ["li", "tres"]]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/lists.text ================================================ count: * one * two * three count in spanish: 1. uno 2. dos 3. tres ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/mismatched_footnotes.html ================================================

    This is sentence has a footnote foo1 and whamo[^whamo].

    This is another para with a numbered footnote2.


    1. Here is the body of the footnote foo. 

    2. Here is the body of the footnote 6. 

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/mismatched_footnotes.json ================================================ ["html", ["p", "This is sentence has a footnote foo", ["sup", { "class": "footnote-ref", "id": "fnref-foo" }, ["a", { "href": "#fn-foo" }, "1"]], " and whamo[^whamo]."], ["p", "This is another para with a numbered footnote", ["sup", { "class": "footnote-ref", "id": "fnref-6" }, ["a", { "href": "#fn-6" }, "2"]], "."], "\u000a\u000a", ["div", { "class": "footnotes" }, "\u000a", ["hr"], "\u000a", ["ol", ["li", { "id": "fn-foo" }, ["p", "Here is the body of the footnote foo.", ["a", { "href": "#fnref-foo", "class": "footnoteBackLink", "title": "Jump back to footnote 1 in the text." }, "↩"]]], ["li", { "id": "fn-6" }, ["p", "Here is the body of the footnote 6.", ["a", { "href": "#fnref-6", "class": "footnoteBackLink", "title": "Jump back to footnote 2 in the text." }, "↩"]]]]], "\u000a"] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/mismatched_footnotes.opts ================================================ {"extras": ["footnotes"]} ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/mismatched_footnotes.text ================================================ This is sentence has a footnote foo[^foo] and whamo[^whamo]. This is another para with a numbered footnote[^6]. [^foo]: Here is the body of the footnote foo. [^bar]: Here is the body of the footnote bar. [^6]: Here is the body of the footnote 6. ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/missing_link_defn.html ================================================

    This is a [missing link][missing] and a used link.

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/missing_link_defn.json ================================================ ["html", ["p", "This is a [missing link][missing] and a ", ["a", { "href": "http://foo.com" }, "used link"], "."]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/missing_link_defn.text ================================================ This is a [missing link][missing] and a [used link][used]. [used]: http://foo.com [unused]: http://foo.com ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/nested_list.html ================================================

    shopping list:

    • veggies
      • carrots
      • lettuce
    • fruits
      • oranges
      • apples
      • peaches
    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/nested_list.json ================================================ ["html", ["p", "shopping list:"], ["ul", ["li", "veggies\u000a", ["ul", ["li", "carrots"], ["li", "lettuce"]]], ["li", "fruits\u000a", ["ul", ["li", "oranges"], ["li", "apples"], ["li", ["em", "peaches"]]]]]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/nested_list.text ================================================ shopping list: - veggies + carrots + lettuce - fruits + oranges + apples + *peaches* ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/nested_list_safe_mode.html ================================================

    shopping list:

    • veggies
      • carrots
      • lettuce
    • fruits
      • oranges
      • apples
      • peaches
    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/nested_list_safe_mode.json ================================================ ["html", ["p", "shopping list:"], ["ul", ["li", "veggies\u000a", ["ul", ["li", "carrots"], ["li", "lettuce"]]], ["li", "fruits\u000a", ["ul", ["li", "oranges"], ["li", "apples"], ["li", ["em", "peaches"]]]]]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/nested_list_safe_mode.opts ================================================ {'safe_mode': True} ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/nested_list_safe_mode.text ================================================ shopping list: - veggies + carrots + lettuce - fruits + oranges + apples + *peaches* ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/parens_in_url_4.html ================================================

    Inline link 4 with non-escaped parens.

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/parens_in_url_4.json ================================================ ["html", ["p", ["a", { "href": "/url(test)", "title": "title" }, "Inline link 4 with non-escaped parens"], "."]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/parens_in_url_4.text ================================================ [Inline link 4 with non-escaped parens]( "title"). ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/raw_html.html ================================================

    Hi, there. blah

    **ack**
    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/raw_html.json ================================================ ["html", ["p", "Hi, ", ["span", { "foo": "*bar*" }, ["em", "there"]], ". ", " blah"], "\u000a\u000a", ["div", "\u000a **ack**\u000a"], "\u000a"] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/raw_html.text ================================================ Hi, *there*. blah
    **ack**
    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/ref_links.html ================================================

    Google is fast star.

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/ref_links.json ================================================ ["html", ["p", ["a", { "href": "http://www.google.com/" }, "Google"], " is fast ", ["img", { "src": "/img/star.png", "alt": "star" }], "."]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/ref_links.text ================================================ [Google][] is fast ![star][]. [google]: http://www.google.com/ [star]: /img/star.png ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/sublist-para.html ================================================

    Some quick thoughts from a coder's perspective:

    • The source will be available in a Mercurial ...

    • Komodo is a Mozilla-based application...

      • Get a slightly tweaked mozilla build (C++, JavaScript, XUL).
      • Get a slightly tweaks Python build (C).
      • Add a bunch of core logic (Python)...
      • Add Komodo chrome (XUL, JavaScript, CSS, DTDs).

      What this means is that work on and add significant functionality...

    • Komodo uses the same extension mechanisms as Firefox...

    • Komodo builds and runs on Windows, Linux and ...

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/sublist-para.json ================================================ ["html", ["p", "Some quick thoughts from a coder's perspective:"], ["ul", ["li", ["p", "The source will be available in a Mercurial ..."]], ["li", ["p", "Komodo is a Mozilla-based application..."], ["ul", ["li", "Get a slightly tweaked mozilla build (C++, JavaScript, XUL)."], ["li", "Get a slightly tweaks Python build (C)."], ["li", "Add a bunch of core logic (Python)..."], ["li", "Add Komodo chrome (XUL, JavaScript, CSS, DTDs)."]], ["p", ["p", "What this means is that work on and add significant functionality..."]]], ["li", ["p", "Komodo uses the same extension mechanisms as Firefox..."]], ["li", ["p", "Komodo builds and runs on Windows, Linux and ..."]]]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/sublist-para.text ================================================ Some quick thoughts from a coder's perspective: - The source will be available in a Mercurial ... - Komodo is a Mozilla-based application... - Get a slightly tweaked mozilla build (C++, JavaScript, XUL). - Get a slightly tweaks Python build (C). - Add a bunch of core logic (Python)... - Add Komodo chrome (XUL, JavaScript, CSS, DTDs). What this means is that work on and add significant functionality... - Komodo uses the same extension mechanisms as Firefox... - Komodo builds and runs on Windows, Linux and ... ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/syntax_color.html ================================================

    Here is some sample code:

    import sys
    def main(argv=sys.argv):
        logging.basicConfig()
        log.info('hi')
    

    and:

    use 'zlib'
    sub main(argv)
        puts 'hi'
    end
    
    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/syntax_color.json ================================================ ["html", ["p", "Here is some sample code:"], "\u000a\u000a", ["div", { "class": "codehilite" }, ["pre", ["code", ["span", { "class": "k" }, "import"], " ", ["span", { "class": "nn" }, "sys"], "\u000a", ["span", { "class": "k" }, "def"], " ", ["span", { "class": "nf" }, "main"], ["span", { "class": "p" }, "("], ["span", { "class": "n" }, "argv"], ["span", { "class": "o" }, "="], ["span", { "class": "n" }, "sys"], ["span", { "class": "o" }, "."], ["span", { "class": "n" }, "argv"], ["span", { "class": "p" }, "):"], "\u000a ", ["span", { "class": "n" }, "logging"], ["span", { "class": "o" }, "."], ["span", { "class": "n" }, "basicConfig"], ["span", { "class": "p" }, "()"], "\u000a ", ["span", { "class": "n" }, "log"], ["span", { "class": "o" }, "."], ["span", { "class": "n" }, "info"], ["span", { "class": "p" }, "("], ["span", { "class": "s" }, "'hi'"], ["span", { "class": "p" }, ")"], "\u000a"]]], "\u000a\u000a", ["p", "and:"], "\u000a\u000a", ["div", { "class": "codehilite" }, ["pre", ["code", ["span", { "class": "n" }, "use"], " ", ["span", { "class": "s1" }, "'zlib'"], "\u000a", ["span", { "class": "nb" }, "sub"], " ", ["span", { "class": "n" }, "main"], ["span", { "class": "p" }, "("], ["span", { "class": "n" }, "argv"], ["span", { "class": "p" }, ")"], "\u000a ", ["span", { "class": "nb" }, "puts"], " ", ["span", { "class": "s1" }, "'hi'"], "\u000a", ["span", { "class": "k" }, "end"], "\u000a"]]], "\u000a"] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/syntax_color.opts ================================================ {"extras": ["code-color"]} ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/syntax_color.text ================================================ Here is some sample code: :::python import sys def main(argv=sys.argv): logging.basicConfig() log.info('hi') and: :::ruby use 'zlib' sub main(argv) puts 'hi' end ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/tricky_anchors.html ================================================

    with [brackets][] in text

    with [[brackets][]] in text

    full link [like](/this/) in text

    full link to img like is ok

    [only open bracket(/in/) text

    only close bracket text](/url/)

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/tricky_anchors.json ================================================ ["html", ["p", ["a", { "href": "/url/" }, "with [brackets][] in text"]], ["p", ["a", { "href": "/url/", "title": "a title" }, "with [[brackets][]] in text"]], ["p", ["a", { "href": "/url/" }, "full link [like](/this/) in text"]], ["p", ["a", { "href": "/url/" }, "full link to img ", ["img", { "src": "/this/", "alt": "like" }], " is ok"]], ["p", "[only open ", ["a", { "href": "/url/", "title": "a title" }, "bracket(/in/) text"]], ["p", ["a", { "href": "/in/" }, "only close bracket"], " text](/url/)"]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/tricky_anchors.text ================================================ [with [brackets][] in text](/url/) [with [[brackets][]] in text](/url/ "a title") [full link [like](/this/) in text](/url/) [full link to img ![like](/this/) is ok](/url/) [only open [bracket(/in/) text](/url/ 'a title') [only close bracket](/in/) text](/url/) ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/underline_in_autolink.html ================================================

    Eric wrote up a (long) intro to writing UDL definitions a while back on his blog: http://blogs.activestate.com/ericp/2007/01/kid_adding_a_ne.html

    ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/underline_in_autolink.json ================================================ ["html", ["p", "Eric wrote up a (long) intro to writing UDL definitions a while back on\u000ahis blog: ", ["a", { "href": "http://blogs.activestate.com/ericp/2007/01/kid_adding_a_ne.html" }, "http://blogs.activestate.com/ericp/2007/01/kid_adding_a_ne.html"]]] ================================================ FILE: test/fixtures/docs-pythonmarkdown2-tm-cases-pass/underline_in_autolink.text ================================================ Eric wrote up a (long) intro to writing UDL definitions a while back on his blog: ================================================ FILE: test/html_renderer.t.js ================================================ var markdown = require("../src/markdown"), tap = require("tap"); tap.test("src attribute order", function(t) { var tree = markdown.toHTML("![photo](/images/photo.jpg)"); t.equivalent( tree, '

    photo

    ' ); t.end(); }); ================================================ FILE: test/interface.t.js ================================================ var markdown = require("../src/markdown"), test = require("tap").test; function clone_array( input ) { // Helper method. Since the objects are plain round trip through JSON to get // a clone return JSON.parse( JSON.stringify( input ) ); } test("arguments untouched", function(t) { var input = "A [link][id] by id.\n\n[id]: http://google.com", tree = markdown.parse( input ), clone = clone_array( tree ), output = markdown.toHTML( tree ); t.equivalent( tree, clone, "tree isn't modified" ); // We had a problem where we would accidentally remove the references // property from the root. We want to check the output is the same when // called twice. t.equivalent( markdown.toHTML( tree ), output, "output is consistent" ); t.end(); }); ================================================ FILE: test/regressions.t.js ================================================ var Markdown = require("../src/markdown"), tap = require("tap"), mk_block = Markdown.mk_block; /* * This file contains tests that check various regressions on the individual * parsers, rather than the parser as a whole. */ function test(name, cb) { tap.test( name, function(t) { cb(t, new Markdown() ); t.end(); }); } test("split_block", function(t, md) { t.equivalent( md.split_blocks( "# h1 #\n\npara1\npara1L2\n \n\n\n\npara2\n" ), [mk_block( "# h1 #", "\n\n", 1 ), mk_block( "para1\npara1L2", "\n \n\n\n\n", 3 ), mk_block( "para2", "\n", 9 ) ], "split_block should record trailing newlines"); t.equivalent( md.split_blocks( "\n\n# heading #\n\npara\n" ), [mk_block( "# heading #", "\n\n", 3 ), mk_block( "para", "\n", 5 ) ], "split_block should ignore leading newlines"); }); test("headers", function(t, md) { t.equivalent( md.dialect.block.setextHeader.call( md, "h1\n===\n\n", [] ), [ [ "header", { level: 1 }, "h1" ] ], "Atx and Setext style H1s should produce the same output" ); t.equivalent( md.dialect.block.atxHeader.call( md, "# h1\n\n"), [ [ "header", { level: 1 }, "h1" ] ], "Closing # optional on atxHeader"); t.equivalent( md.dialect.block.atxHeader.call( md, "## h2\n\n", [] ), [["header", {level: 2}, "h2"]], "Atx h2 has right level"); t.equivalent( md.dialect.block.setextHeader.call( md, "h2\n---\n\n", [] ), [["header", {level: 2}, "h2"]], "Atx and Setext style H2s should produce the same output" ); }); test("code", function(t, md) { var code = md.dialect.block.code, next = [ mk_block("next") ]; t.equivalent( code.call( md, mk_block(" foo\n bar"), next ), [["code_block", "foo\nbar" ]], "Code block correct"); t.equivalent( next, [mk_block("next")], "next untouched when its not code"); next = []; t.equivalent( code.call( md, mk_block(" foo\n bar"), next ), [["code_block", "foo" ]], "Code block correct for abutting para"); t.equivalent( next, [mk_block(" bar")], "paragraph put back into next block"); t.equivalent( code.call( md, mk_block(" foo"), [mk_block(" bar") ] ), [["code_block", "foo\n\nbar" ]], "adjacent code blocks "); t.equivalent( code.call( md, mk_block(" foo","\n \n \n"), [mk_block(" bar") ] ), [["code_block", "foo\n\n\nbar" ]], "adjacent code blocks preserve correct number of empty lines"); }); test( "bulletlist", function(t, md) { var bl = function() { return md.dialect.block.lists.apply(md, arguments); }; t.equivalent( bl( mk_block("* foo\n* bar"), [] ), [ [ "bulletlist", [ "listitem", "foo" ], [ "listitem", "bar" ] ] ], "single line bullets"); t.equivalent( bl( mk_block("* [text](url)" ), [] ), [ [ "bulletlist", [ "listitem", [ "link", { href: "url" }, "text" ] ] ] ], "link in bullet"); t.equivalent( bl( mk_block("* foo\nbaz\n* bar\nbaz"), [] ), [ [ "bulletlist", [ "listitem", "foo\nbaz" ], [ "listitem", "bar\nbaz" ] ] ], "multiline lazy bullets"); t.equivalent( bl( mk_block("* foo\n baz\n* bar\n baz"), [] ), [ [ "bulletlist", [ "listitem", "foo\nbaz" ], [ "listitem", "bar\nbaz" ] ] ], "multiline tidy bullets"); t.equivalent( bl( mk_block("* foo\n baz"), [] ), [ [ "bulletlist", [ "listitem", "foo\n baz" ] ] ], "only trim 4 spaces from the start of the line"); /* Test wrong: should end up with 3 nested lists here t.equivalent( bl( mk_block(" * one\n * two\n * three" ), [] ), [ [ "bulletlist", [ "listitem", "one" ], [ "listitem", "two" ], [ "listitem", "three" ] ] ], "bullets can be indented up to three spaces"); */ t.equivalent( bl( mk_block(" * one"), [ mk_block(" two") ] ), [ [ "bulletlist", [ "listitem", [ "para", "one" ], [ "para", "two" ] ] ] ], "loose bullet lists can have multiple paragraphs"); /* Case: no space after bullet - not a list | *↵ |foo */ t.equivalent( bl( mk_block(" *\nfoo") ), undefined, "Space required after bullet to trigger list"); /* Case: note the space after the bullet | *␣ |foo |bar */ t.equivalent( bl( mk_block(" * \nfoo\nbar"), [ ] ), [ [ "bulletlist", [ "listitem", "foo\nbar" ] ] ], "space+continuation lines", {todo: true} ); /* Case I: | * foo | * bar | * baz */ t.equivalent( bl( mk_block(" * foo\n" + " * bar\n" + " * baz"), [] ), [ [ "bulletlist", [ "listitem", "foo", [ "bulletlist", [ "listitem", "bar", [ "bulletlist", [ "listitem", "baz" ] ] ] ] ] ] ], "Interesting indented lists I"); /* Case II: | * foo | * bar | * baz */ t.equivalent( bl( mk_block(" * foo\n * bar\n * baz"), [] ), [ [ "bulletlist", [ "listitem", "foo", [ "bulletlist", [ "listitem", "bar" ] ] ], [ "listitem", "baz" ] ] ], "Interesting indented lists II"); /* Case III: | * foo | * bar |* baz | * fnord */ t.equivalent( bl( mk_block(" * foo\n * bar\n* baz\n * fnord"), [] ), [ [ "bulletlist", [ "listitem", "foo", [ "bulletlist", [ "listitem", "bar" ], [ "listitem", "baz" ], [ "listitem", "fnord" ] ] ] ] ], "Interesting indented lists III"); /* Case IV: | * foo | | 1. bar */ t.equivalent( bl( mk_block(" * foo"), [ mk_block(" 1. bar\n") ] ), [ [ "bulletlist", ["listitem", ["para", "foo"] ], ["listitem", ["para", "bar"] ] ] ], "Different lists at same indent IV"); /* Case V: | * foo | * bar | * baz */ t.equivalent( bl( mk_block(" * foo\n * bar\n * baz"), [] ), [ [ "bulletlist", [ "listitem", "foo", [ "bulletlist", ["listitem", "bar"], ["listitem", "baz"] ] ] ] ], "Indenting Case V"); /* Case VI: deep nesting |* one | * two | * three | * four */ t.equivalent( bl( mk_block("* one\n * two\n * three\n * four"), [] ), [ [ "bulletlist", [ "listitem", "one", [ "bulletlist", [ "listitem", "two", [ "bulletlist", [ "listitem", "three", [ "bulletlist", [ "listitem", "four" ] ] ] ] ] ] ] ] ], "deep nested lists VI"); /* Case VII: This one is just fruity! | * foo | * bar | * baz |* HATE | * flibble | * quxx | * nest? | * where | * am | * i? */ t.equivalent( bl( mk_block(" * foo\n" + " * bar\n" + " * baz\n" + "* HATE\n" + " * flibble\n" + " * quxx\n" + " * nest?\n" + " * where\n" + " * am\n" + " * i?"), [] ), [ [ "bulletlist", [ "listitem", "foo", [ "bulletlist", ["listitem", "bar"], ["listitem", "baz"], ["listitem", "HATE"], ["listitem", "flibble"] ] ], [ "listitem", "quxx", [ "bulletlist", [ "listitem", "nest?", [ "bulletlist", ["listitem", "where"], ["listitem", "am"], ["listitem", "i?"] ] ] ] ] ] ], "Indenting Case VII"); /* Case VIII: Deep nesting + code block | * one | * two | * three | * four | | foo */ t.equivalent( bl( mk_block(" * one\n" + " 1. two\n" + " * three\n" + " * four", "\n\n"), [ mk_block(" foo") ] ), [ [ "bulletlist", [ "listitem", ["para", "one"], [ "numberlist", [ "listitem", ["para", "two"], [ "bulletlist", [ "listitem", [ "para", "three\n * four"], ["code_block", "foo"] ] ] ] ] ] ] ], "Case VIII: Deep nesting and code block"); }); test( "horizRule", function(t, md) { var hr = md.dialect.block.horizRule, strs = ["---", "_ __", "** ** **", "--- "]; strs.forEach( function(s) { t.equivalent( hr.call( md, mk_block(s), [] ), [ [ "hr" ] ], "simple hr from " + require("util").inspect(s)); }); }); test( "blockquote", function(t, md) { var bq = md.dialect.block.blockquote; t.equivalent( bq.call( md, mk_block("> foo\n> bar"), [] ), [ ["blockquote", ["para", "foo\nbar"] ] ], "simple blockquote"); // Note: this tests horizRule as well through block processing. t.equivalent( bq.call( md, mk_block("> foo\n> bar\n>\n>- - - "), [] ), [ ["blockquote", ["para", "foo\nbar"], ["hr"] ] ], "blockquote with interesting content"); t.equivalent( bq.call( md, mk_block( 'p\n> a', '\n\n', 1 ), [ mk_block( '> b', '\n', 4) ] ), [ [ 'para', 'p' ], [ 'blockquote', [ 'para', 'a' ], [ 'para', 'b' ] ] ], "blockquote with abutting paragraph"); }); test( "referenceDefn", function(t, md) { var rd = md.dialect.block.referenceDefn; [ '[id]: http://example.com/ "Optional Title Here"', "[id]: http://example.com/ 'Optional Title Here'", '[id]: http://example.com/ (Optional Title Here)' ].forEach( function(s) { md.tree = ["markdown"]; t.equivalent(rd.call( md, mk_block(s) ), [], "ref processed"); t.equivalent(md.tree[ 1 ].references, { "id": { href: "http://example.com/", title: "Optional Title Here" } }, "reference extracted"); }); // Check a para abbuting a ref works right md.tree = ["markdown"]; var next = []; t.equivalent(rd.call( md, mk_block("[id]: example.com\npara"), next ), [], "ref processed"); t.equivalent(md.tree[ 1 ].references, { "id": { href: "example.com" } }, "reference extracted"); t.equivalent(next, [ mk_block("para") ], "paragraph put back into blocks"); // Check empty tags and non-tags are ignored md.tree = ["markdown"]; t.type(rd.call( md, mk_block("[]: http://example.com"), []), "undefined", "no empty ref name"); t.type(rd.call( md, mk_block("[b]label[/b]: description"), []), "undefined", "no brackets in ref name"); }); test( "inline_br", function(t, md) { t.equivalent( md.processInline("foo \n\\[bar"), [ "foo", ["linebreak"], "[bar" ], "linebreak+escape"); }); test( "inline_escape", function(t, md) { t.equivalent( md.processInline("\\bar"), [ "\\bar" ], "invalid escape" ); t.equivalent( md.processInline("\\>"), [ ">" ], "escapes >" ); t.equivalent( md.processInline("\\*foo*"), [ "*foo*" ], "escaped em" ); }); test( "inline_code", function(t, md) { t.equivalent( md.processInline("`bar`"), [ ["inlinecode", "bar" ] ], "code I" ); t.equivalent( md.processInline("``b`ar``"), [ ["inlinecode", "b`ar" ] ], "code II" ); t.equivalent( md.processInline("```bar``` baz"), [ ["inlinecode", "bar" ], " baz" ], "code III" ); }); test( "inline_strong_em", function(t, md) { // Yay for horrible edge cases >_< t.equivalent( md.processInline("foo *abc* bar"), [ "foo ", ["em", "abc" ], " bar" ], "strong/em I" ); t.equivalent( md.processInline("*abc `code`"), [ "*abc ", ["inlinecode", "code" ] ], "strong/em II" ); t.equivalent( md.processInline("*abc**def* after"), [ ["em", "abc**def" ], " after" ], "strong/em III" ); t.equivalent( md.processInline("*em **strong * wtf**"), [ ["em", "em **strong " ], " wtf**" ], "strong/em IV" ); t.equivalent( md.processInline("*foo _b*a*r baz"), [ [ "em", "foo _b" ], "a*r baz" ], "strong/em V" ); }); test( "inline_img", function(t, md) { t.equivalent( md.processInline( "![alt] (url)" ), [ [ "img", { href: "url", alt: "alt" } ] ], "inline img I" ); t.equivalent( md.processInline( "![alt](url 'title')" ), [ [ "img", { href: "url", alt: "alt", title: "title" } ] ], "inline img II" ); t.equivalent( md.processInline( "![alt] (url 'tit'le') after')" ), [ [ "img", { href: "url", alt: "alt", title: "tit'le" } ], " after')" ], "inline img III" ); t.equivalent( md.processInline( "![alt] (url \"title\")" ), [ [ "img", { href: "url", alt: "alt", title: "title" } ] ], "inline img IV" ); t.equivalent( md.processInline( '![Alt text](/path/to/img\\\\.jpg "Optional title")' ), [ [ "img", { href: "/path/to/img\\.jpg", alt: "Alt text", title: "Optional title" } ] ], "inline img IV" ); t.equivalent( md.processInline( "![alt][id]" ), [ [ "img_ref", { ref: "id", alt: "alt", original: "![alt][id]" } ] ], "ref img I" ); t.equivalent( md.processInline( "![alt] [id]" ), [ [ "img_ref", { ref: "id", alt: "alt", original: "![alt] [id]" } ] ], "ref img II" ); t.equivalent( md.processInline( "![contains parens](http://example.com/(parens).jpg)" ), [ ["img", { href: "http://example.com/(parens).jpg", alt: "contains parens"} ] ], "images with parentheses in the URL" ); }); test( "inline_link", function(t, md) { t.equivalent( md.processInline( "[text] (url)" ), [ [ "link", { href: "url" }, "text" ] ], "inline link I" ); t.equivalent( md.processInline( "[text](url 'title')" ), [ [ "link", { href: "url", title: "title" }, "text" ] ], "inline link II" ); t.equivalent( md.processInline( "[text](url 'title')" ), [ [ "link", { href: "url", title: "title" }, "text" ] ], "inline link II" ); t.equivalent( md.processInline( "[text](url\t\t'title')" ), [ [ "link", { href: "url", title: "title" }, "text" ] ], "inline link II" ); t.equivalent( md.processInline( "[text](url 'tit'le') after')" ), [ [ "link", { href: "url", title: "tit'le" }, "text" ], " after')" ], "inline link III" ); t.equivalent( md.processInline( "[text](url \"title\")" ), [ [ "link", { href: "url", title: "title" }, "text" ] ], "inline link IV" ); t.equivalent( md.processInline( "[text][id]" ), [ [ "link_ref", { ref: "id", original: "[text][id]" }, "text" ] ], "ref link I" ); t.equivalent( md.processInline( "[text] [id]" ), [ [ "link_ref", { ref: "id", original: "[text] [id]" }, "text" ] ], "ref link II" ); /* jshint indent: false */ t.equivalent( md.processInline( "[to put it another way][SECTION 1] or even [link this](#SECTION-1)" ), [ [ "link_ref", { ref: "section 1", original: "[to put it another way][SECTION 1]" }, "to put it another way" ], " or even ", [ "link", { href: "#SECTION-1" }, "link this" ] ], "ref link II" ); /* jshint indent: 2 */ t.equivalent( md.processInline( "[]: text" ), [ "[]: text" ], "no empty links" ); }); test( "inline_autolink", function(t, md) { t.equivalent( md.processInline( "" ), [ [ "link", { href: "http://foo.com" }, "http://foo.com" ] ], "autolink I" ); t.equivalent( md.processInline( "" ), [ [ "link", { href: "mailto:foo@bar.com" }, "foo@bar.com" ] ], "autolink II" ); t.equivalent( md.processInline( "" ), [ [ "link", { href: "mailto:foo@bar.com" }, "foo@bar.com" ] ], "autolink III" ); }); test( "line_endings", function(t, md) { // try to generate this tree with all types of line ending var tree = [ "markdown", [ "para", "Foo" ], [ "para", "Bar" ] ]; t.equivalent( md.toTree( "Foo\n\nBar", [ "markdown" ] ), tree, "Unix line endings" ); t.equivalent( md.toTree( "Foo\r\n\r\nBar", [ "markdown" ] ), tree, "Windows line endings" ); t.equivalent( md.toTree( "Foo\r\rBar", [ "markdown" ] ), tree, "Mac line endings" ); t.equivalent( md.toTree( "Foo\r\n\nBar", [ "markdown" ] ), tree, "Mixed line endings" ); }); test( "header_in_paragraph", function(t, md){ var tree = [ "markdown", [ "para", "Foo" ], [ "header", { level: 1 }, "Title" ], [ "para", "Bar" ] ]; t.equivalent( md.toTree("Foo\n#Title\nBar", [ "markdown" ]), tree, "Header in praragraph" ); t.equivalent( md.toTree("Foo\n\n#Title\n\nBar", [ "markdown" ]), tree, "Header in praragraph" ); }); ================================================ FILE: test/render_tree.t.js ================================================ var markdown = require("../src/markdown"), tap = require("tap"); function clone_array( input ) { // Helper method. Since the objects are plain round trip through JSON to get // a clone return JSON.parse( JSON.stringify( input ) ); } tap.test("undefined attribute", function(t) { var tree = markdown.renderJsonML( ['html', ['p', {style: undefined }, 'hello'] ] ); t.equivalent( tree, '

    hello

    ' ); t.end(); }); tap.test("escaped attribute", function(t) { var tree = markdown.renderJsonML( ['html', ['p', {style: "color: blue" }, 'hello'] ] ); t.equivalent( tree, '

    hello

    ' ); t.end(); }); tap.test("intermediate trees left alone", function(t) { var markdownTree = [ [ "bulletlist", [ "listitem", "foo\nbaz" ], [ "listitem", "bar\nbaz" ] ] ]; var cloneMarkdownTree = clone_array( markdownTree ); markdown.toHTMLTree( markdownTree ); t.equivalent( markdownTree, cloneMarkdownTree, 'toHTMLTree should not mutate its argument' ); var htmlTree = ['html', ['p', {style: "color: blue" }, 'hello'] ]; var cloneHtmlTree = clone_array( htmlTree ); markdown.renderJsonML( htmlTree ); t.equivalent( htmlTree, cloneHtmlTree, 'renderJsonML should not mutate its argument' ); t.end(); });