### HTML for Numbered Example Source: https://github.com/commonmark/commonmark-spec/wiki/Proposed-Extensions-to-CommonMark Mark a specific example with a paragraph element, assigning a class 'example' and an ID for referencing. ```html5

example

``` -------------------------------- ### CommonMark Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt This is the equivalent CommonMark syntax for the AsciiDoc example, demonstrating its readability. ```markdown 1. List item one. List item one continued with a second paragraph followed by an Indented block. $ ls *.sh $ mv *.sh ~\/tmp List item continued with a third paragraph. 2. List item two continued with an open block. This paragraph is part of the preceding list item. 1. This list is nested and does not require explicit item continuation. This paragraph is part of the preceding list item. 2. List item b. This paragraph belongs to item two of the outer list. ``` -------------------------------- ### Delimiter Runs: Both Left and Right-Flanking Examples Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Examples of delimiter runs that are both left-flanking and right-flanking. ```text abc***def "abc"_"def" ``` -------------------------------- ### Markdown Example: List Item with Blank Line Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Example of a list item starting with a blank line that contains spaces. ```markdown Add example for list item starting with a blank line with spaces (Robin Stocker). ``` -------------------------------- ### Anonymous and Named Numbered Examples Syntax Source: https://github.com/commonmark/commonmark-spec/wiki/Deployed-Extensions Syntax for creating anonymous and named numbered examples, useful for linguistic articles or documents requiring sequential referencing. References are made using the '@' symbol. ```CommonMark (@) anonymous numbered example ``` ```CommonMark (@id) named numbered example ``` -------------------------------- ### Delimiter Runs: Neither Left nor Right-Flanking Examples Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Examples of delimiter runs that are neither left-flanking nor right-flanking. ```text abc *** def a _ b ``` -------------------------------- ### Delimiter Runs: Left-Flanking Examples Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Examples of delimiter runs that are left-flanking but not right-flanking. ```text ***abc _abc **"abc" _"abc" ``` -------------------------------- ### Delimiter Runs: Right-Flanking Examples Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Examples of delimiter runs that are right-flanking but not left-flanking. ```text abc*** abc_ "abc"** "abc"_ ``` -------------------------------- ### Explicit Numbered List Syntax Source: https://github.com/commonmark/commonmark-spec/wiki/Deployed-Extensions Demonstrates explicit numbering in enumerated lists using dots and parentheses, with examples for starting values and fixed values. ```markdown 2. two 4. three ____ 2) two 4) four ``` -------------------------------- ### AsciiDoc Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt This is an example of AsciiDoc syntax for a list with nested elements and indented blocks. ```asciidoc 1. List item one. + List item one continued with a second paragraph followed by an Indented block. + ................. $ ls *.sh $ mv *.sh ~\/tmp ................. + List item continued with a third paragraph. 2. List item two continued with an open block. + -- This paragraph is part of the preceding list item. a. This list is nested and does not require explicit item continuation. + This paragraph is part of the preceding list item. b. List item b. This paragraph belongs to item two of the outer list. -- ``` -------------------------------- ### Settings Extension Example Source: https://github.com/commonmark/commonmark-spec/wiki/Generic-Directive-Extension-List Illustrates the 'settings' extension, which allows for configuring extensions. The available settings depend on the specific extension being configured. ```markdown extensionName.settings: () {available settings Dependent on extension} ``` -------------------------------- ### Markdown Example: Unicode Whitespace Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Examples and test cases to ensure correct handling of Unicode whitespace distinctions. ```markdown Add examples for Unicode whitespace (Timothy Gu). In light of commonmark/commonmark.js#107, add a few examples/test cases to make sure the distinction between Unicode whitespace and regular whitespace is kept. ``` -------------------------------- ### URI Autolink Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates a basic URI autolink. Ensure the URI is enclosed in angle brackets. ```markdown .

http://foo.bar.baz

``` -------------------------------- ### Parentheses in Link URLs Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Example demonstrating support for unlimited balanced parentheses within link URLs. ```markdown [link](http://example.com/path(with(nested)parentheses)) ``` -------------------------------- ### HTML Block Type 6 Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Illustrates basic HTML blocks of type 6, which start with specific tags like and end at a blank line. Shows verbatim text within the block. ```markdown
hi
okay. .
hi

okay.

``` -------------------------------- ### CommonMark Spec Example Syntax Source: https://github.com/commonmark/commonmark-spec/blob/master/README.md The shorthand format used for embedding code examples within the CommonMark specification's Markdown source file. ```markdown ```````````````````````````````` example Markdown source . expected HTML output ```````````````````````````````` ``` -------------------------------- ### Markdown Example: ATX Header with Tab Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Example of an ATX header with a tab character after the hash, which was previously removed. ```markdown Removed example of ATX header with tab after `#`. ``` -------------------------------- ### HTML Block with Div Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Shows an HTML block starting with a
tag. The content inside is treated as raw HTML until a blank line terminates the block. ```markdown
*hello* .
*hello* ``` -------------------------------- ### Help Extension Example Source: https://github.com/commonmark/commonmark-spec/wiki/Generic-Directive-Extension-List Shows the syntax for the 'help' extension, which is used to display documentation for a specific extension. The argument field can optionally include a 'shortVersion' flag. ```markdown extensionName.help: () {shortVersion=True/False} ``` -------------------------------- ### Changing Ordered List Delimiters Starts New List Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Illustrates that changing the ordered list delimiter (e.g., from '.' to ')') starts a new ordered list, with the 'start' attribute reflecting the new list's initial number. ```markdown 1. foo 2. bar 3) baz ``` ```html
  1. foo
  2. bar
  1. baz
``` -------------------------------- ### HTML Block Parsing - Basic Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates a standard HTML block that is typically parsed correctly by CommonMark. ```markdown
Hi
.
Hi
``` -------------------------------- ### HTML Block with Non-standard Tag Start Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates an HTML block where the opening tag is not standard but starts like one. Content is rendered as raw HTML. ```html
(foo)

``` ```markdown **Gomphocarpus (*Gomphocarpus physocarpus*, syn. *Asclepias physocarpa*)** .

Gomphocarpus (Gomphocarpus physocarpus, syn. Asclepias physocarpa)

``` ```markdown **foo "*bar*" foo** .

foo "bar" foo

``` -------------------------------- ### Link Destination Starting with '<' Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Demonstrates the disallowed case of a link destination starting with '<' unless it's within '<..>'. ```markdown [foo]: (baz) [foo] ``` -------------------------------- ### Reference Link Spacing Fix Example Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Illustrates a fix for inadvertent capture in reference links by disallowing spaces between the link text and the link label. The example shows the problematic spacing that is now disallowed. ```text [foo] [bar] [foo]: /u1 [bar]: /u2 ``` -------------------------------- ### HTML Block: Basic Table Example Source: https://github.com/commonmark/commonmark-spec/blob/master/alternative-html-blocks.txt Demonstrates a simple HTML table as a block. This is parsed as raw HTML. ```html
hi
``` -------------------------------- ### URI Scheme Validation Example Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Demonstrates the updated validation rule for URI schemes, which now requires schemes to be between 2-32 characters long, starting with an ASCII letter, and containing only letters, digits, and the symbols `-`, `+`, `.`. This change was discussed at http://talk.commonmark.org/t/555. ```text URI schemes must be more than one character. ``` -------------------------------- ### Multiple Link Reference Definitions Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt This example demonstrates multiple definitions for the same link reference. It questions which definition takes precedence when multiple are provided. ```markdown [foo]: /url1 [foo]: /url2 [foo][] ``` -------------------------------- ### HTML Block Start Condition Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Clarifies that script, pre, and style close tags can begin an HTML block. ```markdown
``` -------------------------------- ### Subscript Syntax Examples Source: https://github.com/commonmark/commonmark-spec/wiki/Deployed-Extensions Illustrates various methods for creating subscript text using tilde or underscore characters. Parentheses can group subscript content, and double tildes are also shown. ```markdown ~subscript~ ``` ```markdown ~~subscript~~ ``` ```markdown ~(subscript) ~s ``` ```markdown _(subscript) _s ``` -------------------------------- ### Setext Heading Level 1 and 2 Examples Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates basic Setext headings using '=' for level 1 and '-' for level 2. The content is parsed as inline. ```markdown Foo *bar* ========= Foo *bar* --------- ``` -------------------------------- ### ATX Heading - Not a heading (leading '#') Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Lines starting with '#' followed immediately by a non-space character are not parsed as headings. ```markdown foo # bar ``` -------------------------------- ### Code Span with Mixed Delimiters Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Example of using backticks with spaces around them, demonstrating delimiter matching. ```markdown ` foo `` bar ` ``` -------------------------------- ### Valid ordered list start number (9 digits or less) Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Ordered list start numbers must not exceed nine digits. ```markdown 123456789. ok ``` -------------------------------- ### Underline Syntax Example Source: https://github.com/commonmark/commonmark-spec/wiki/Deployed-Extensions Demonstrates the use of underscores for italic, bold, bold italic, and underlined text. Four underscores are used for underlining. ```markdown _italic_ __bold__ ___bold italic___ ____underlined____ ``` -------------------------------- ### Empty List Item Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt This example presents a list with an empty list item. It questions whether list items can be empty. ```markdown * a * * b ``` -------------------------------- ### Markdown to Block Structure Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates how four lines of Markdown are parsed into a block structure, including block quotes, lists, and paragraphs. Observe the creation and closure of blocks as each line is processed. ```markdown > Lorem ipsum dolor sit amet. > - Qui *quodsi iracundia* > - aliquando id ``` -------------------------------- ### Markdown Example: Strong/Emph Parsing Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Demonstrates changes in strong and emphasis parsing, particularly concerning internal delimiters and delimiter run lengths. ```markdown **foo*bar*** ``` -------------------------------- ### List starting with an empty item Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Shows a list that begins with an empty list item. ```commonmark * ``` ```html
``` -------------------------------- ### Markdown Emphasis and Strong Emphasis Examples Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates various combinations of asterisks and underscores for strong emphasis and emphasis, including nested cases. ```markdown ***strong emph*** ***strong** in emph* ***emph* in strong** **in strong *emph*** *in emph **strong*** ``` -------------------------------- ### Table of Contents (TOC) Directive Example Source: https://github.com/commonmark/commonmark-spec/wiki/Generic-Directive-Extension-List Provides an example of the 'TOC' extension for generating a table of contents. The content field can be used for the TOC title, and key-value pairs are not specified for this extension. ```markdown TOC: Title of TOC, could default to "Table of contents" () ``` -------------------------------- ### Setext Header After Reference Link Definition Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Example showing a setext-style header following a reference link definition. ```markdown [id]: some label Header ====== ``` -------------------------------- ### Email Autolink Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates a standard email autolink. The email address is converted to a 'mailto:' link. ```markdown .

foo@bar.example.com

``` -------------------------------- ### List Item Paragraph Wrapping (Example 1) Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt This example questions the rules for wrapping list items in paragraph tags. It presents a scenario with a single-item list followed by a multi-item list, raising questions about consistency. ```markdown 1. one 2. two 3. three ``` -------------------------------- ### Markdown Example: Setext Headers vs Lists Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Illustrates an ambiguity between setext headers and lists, particularly when empty list items are involved. ```markdown foo - ``` -------------------------------- ### List Interrupting Paragraph - Markdown Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Provides a markdown example where a list is intended to interrupt a paragraph, highlighting natural list usage. ```markdown I need to buy - new shoes - a coat - a plane ticket ``` -------------------------------- ### Indentation from List Marker Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt This markdown example illustrates a proposed rule where indentation is relative to the list marker, allowing 'bar' to be considered a subparagraph of 'foo' even with less indentation. ```markdown 10. foo bar ``` -------------------------------- ### Ordered list start number with leading zeros Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Leading zeros in ordered list start numbers are permitted and correctly interpreted. ```markdown 0. ok ``` ```markdown 003. ok ``` -------------------------------- ### Nested Emphasis with Underscores Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Provides an example of nested emphasis using underscores, showing correct rendering. ```markdown _(__foo__)_ .

(foo)

``` -------------------------------- ### Invalid ordered list start number (10 digits) Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Ordered list start numbers exceeding nine digits are not parsed as lists. ```markdown 1234567890. not ok ``` -------------------------------- ### List Item Paragraph Wrapping (Example 2) Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt This example further explores list item paragraph wrapping, showing a nested list structure within a list item. It questions whether such mixed structures are handled consistently. ```markdown 1. one - a - b 2. two ``` -------------------------------- ### Link Destination with Spaces in Brackets Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Example illustrating that spaces are allowed inside link destinations enclosed in pointy brackets. ```markdown [foo]: ``` -------------------------------- ### List items with blank lines Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates list items that start with a blank line, including nested code blocks and lists. ```commonmark - foo - ``` bar ``` - baz ``` ```html
  • foo
  • bar
    
  • baz
    
``` -------------------------------- ### Basic Block Quote Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates a standard block quote with a heading and paragraphs. Requires a block quote marker (>) followed by a space at the beginning of each line. ```markdown > # Foo > bar > baz ``` ```html

Foo

bar baz

``` -------------------------------- ### Ordered List Item with Start Number Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Shows an ordered list item where the marker '1.' and indentation determine the structure. The start number is derived from the marker, and subsequent content is indented accordingly. ```markdown 1. A paragraph with two lines. indented code > A block quote. ``` -------------------------------- ### Critic Markup Editorial Syntax Examples Source: https://github.com/commonmark/commonmark-spec/wiki/Deployed-Extensions Demonstrates Critic Markup syntax for tracking changes, including removed, added, and highlighted content using curly braces and double-character affixes. ```markdown {-- removed content --} ``` ```markdown {~~removed content~>ins~~} ``` ```markdown {++ added content ++} ``` ```markdown {== highlighted ==} ``` -------------------------------- ### Document Tree Structure Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Illustrates the hierarchical structure of a CommonMark document tree, showing nested blocks and indicating open blocks. ```tree -> document -> block_quote paragraph "Lorem ipsum dolor\nsit amet." -> list (type=bullet tight=true bullet_char=-) list_item paragraph "Qui *quodsi iracundia*" -> list_item -> paragraph "aliquando id" ``` -------------------------------- ### Markdown Example: Nested Lists Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Test case for nested lists with an indent greater than 4 spaces. ```markdown Add test case for nested lists with an indent > 4 (Alexandre Mutel). ``` -------------------------------- ### Code Span with URL-like Syntax Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Example of a code span containing syntax that resembles a URL. ```markdown `` ``` -------------------------------- ### ATX Heading Syntax Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates basic ATX heading syntax with varying numbers of '#' characters. ```markdown ###### foo ``` -------------------------------- ### URI Autolink with Made-up Scheme Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt An example of an autolink with a scheme that is syntactically valid but not registered. ```markdown .

made-up-scheme://foo,bar

``` -------------------------------- ### Update Site Source: https://github.com/commonmark/commonmark-spec/blob/master/RELEASE_CHECKLIST.md Navigate to the commonmark-spec-web directory and run make, followed by make upload, to update the project website. ```shell cd ../../commonmark-spec-web make make upload ``` -------------------------------- ### Emphasis and Strong Emphasis Precedence Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt This example probes the precedence rules for emphasis and strong emphasis markers. It asks how a string with nested emphasis markers should be parsed. ```markdown *foo *bar* baz* ``` -------------------------------- ### ASCII Art Directive Example Source: https://github.com/commonmark/commonmark-spec/wiki/Generic-Directive-Extension-List Demonstrates the 'asciiArt' extension for rendering ASCII art. Key-value pairs can specify the rendering format and dimensions. The block content is the ASCII art itself. ```markdown asciiArt: () {renderAs='vector/bitmap/ASCII' width="width of image" height="height of image"} Block: ASCII art ``` -------------------------------- ### Markdown Example: Bold Italics Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Illustrates parsing differences for bold and italic markdown with varying asterisk counts. ```markdown ***hi*** ``` ```markdown ***hi**** ``` -------------------------------- ### HTML for Pro-Con List Source: https://github.com/commonmark/commonmark-spec/wiki/Proposed-Extensions-to-CommonMark Create a feature or changelog list using an unordered list with 'pro' and 'con' classes for list items. ```html5
  • pro
  • con
``` -------------------------------- ### List item starting with a blank line Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Illustrates a list item that begins with a blank line, where the following content is not part of the list item. ```commonmark - foo ``` ```html

foo

``` -------------------------------- ### Inline and Block Directive Syntax Examples Source: https://github.com/commonmark/commonmark-spec/wiki/Generic-Directive-Extension-List Illustrates the proposed syntax for both inline and block-level generic directive extensions. Inline extensions are shown with a name, empty brackets, and parentheses, while block extensions include a name, argument field, content block, and optional ID/class/key-value attributes. ```markdown !extensionName[](){} ``` ```markdown extensionNames: argumentField ::: ...BlockContent... ::: { #id .class key1=value key2=value } ``` -------------------------------- ### Reference Link with Empty Destination Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Example of a reference link with an empty destination specified within angle brackets. ```markdown [foo]: <> ``` -------------------------------- ### Emphasis and Strong Emphasis - Mixed Delimiters Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates how mixed delimiters for emphasis and strong emphasis are handled, showing cases where delimiters are not evenly matched. ```markdown **foo*** .

foo*

``` ```markdown *foo**** .

foo***

``` ```markdown ***foo*** .

foo

``` ```markdown _____foo_____ .

foo

``` -------------------------------- ### HTML Block: Generic Tag Example Source: https://github.com/commonmark/commonmark-spec/blob/master/alternative-html-blocks.txt Demonstrates that non-HTML-specific tags like 'a' are treated as HTML blocks if they follow the block rules. ```html foo ``` -------------------------------- ### Example of List Item Content Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates how indented content, including paragraphs, code blocks, and block quotes, becomes part of a list item. The indentation of subsequent lines is crucial for them to be included. ```markdown A paragraph with two lines. indented code > A block quote. ``` -------------------------------- ### Inline Structure Parsing Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Represents the abstract syntax tree after inline elements have been parsed. Shows how line endings become softbreaks and emphasis is recognized. ```tree document block_quote paragraph str "Lorem ipsum dolor" softbreak str "sit amet." list (type=bullet tight=true bullet_char=-) list_item paragraph str "Qui " emph str "quodsi iracundia" list_item paragraph str "aliquando id" ``` -------------------------------- ### Basic Unordered List Rendering Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates the rendering of a simple unordered list with basic list items. ```markdown - foo code . ``` -------------------------------- ### List as First Block in a List Item Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Example of a list item where the first element is another list. This requires proper indentation of the nested list. ```markdown - - foo ``` -------------------------------- ### Image Directive Example Source: https://github.com/commonmark/commonmark-spec/wiki/Generic-Directive-Extension-List Demonstrates the 'image' extension for embedding images. It uses the content field for alt text and the argument field for the image URL, with optional key-value pairs for width and height. ```markdown image: image alt text (image url) {width="width of image" height="height of image"} ``` -------------------------------- ### HTML Tag vs. Code Span Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Contrasts with the previous example, showing an actual HTML tag that is not delimited by backticks. ```html ` ``` -------------------------------- ### Invalid ordered list start number (negative) Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Negative numbers are not valid start numbers for ordered lists. ```markdown -1. not ok ``` -------------------------------- ### Four-Space Rule Example (Alternative Parsing) Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt This HTML output represents an alternative, more intuitive parsing of the same markdown, where subsequent paragraphs and sublists are correctly nested within the list item. ```html
  • foo

    bar

    • baz
``` -------------------------------- ### HTML for Definition List Source: https://github.com/commonmark/commonmark-spec/wiki/Proposed-Extensions-to-CommonMark Structure definition lists using dl, dt for terms, and dd for definitions. This example shows a basic term-definition pair. ```html5
term
definition
``` -------------------------------- ### New Spec Test Format Example Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Illustrates the updated format for CommonMark specification tests, moving from a simple three-line structure to a fenced code block format. This change allows `spec.txt` to be a valid CommonMark file. ```CommonMark ```````````````````````````````` example markdown . html ```````````````````````````````` ``` -------------------------------- ### Markdown Highlighting with .gitattributes Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Configuration to ensure changelog.txt is correctly highlighted as Markdown. ```gitattributes *.txt text=auto eol=lf ``` -------------------------------- ### HTML Block: Custom Tag Example Source: https://github.com/commonmark/commonmark-spec/blob/master/alternative-html-blocks.txt Shows that custom tags like '' are also parsed as HTML blocks when they appear on their own lines. ```html bar ``` -------------------------------- ### Partial Tag HTML Block Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Illustrates an HTML block where the opening tag is split across lines, with whitespace separating parts. The block is correctly parsed. ```markdown
.
``` -------------------------------- ### Superscript Syntax Examples Source: https://github.com/commonmark/commonmark-spec/wiki/Deployed-Extensions Shows different ways to denote superscript text using caret characters. Single or double carets can be used as affixes, and parentheses can group longer superscript content. ```markdown ^superscript^ ``` ```markdown ^^superscript^^ ``` ```markdown ^(superscript) ^s ``` -------------------------------- ### Mixed List Markers Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt This example shows a list where markers change from numbers to bullets. It questions whether this should be parsed as one list or two. ```markdown 1. fee 2. fie - foe - fum ``` -------------------------------- ### HTML Block Parsing Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates how HTML blocks are parsed, especially when containing nested elements like
. The parser state is not affected by HTML within an HTML block.

```markdown
**Hello**,

_world_.
. table>
**Hello**,

world.

``` -------------------------------- ### Wiki Link Directive Example Source: https://github.com/commonmark/commonmark-spec/wiki/Generic-Directive-Extension-List Illustrates the 'wiki' extension for looking up wiki pages. The content field specifies the wiki page name, and the argument field can provide an optional direct link. ```markdown wiki: wiki page name (optional direct link) {} ``` -------------------------------- ### Escaped Backslash in Link Label Example Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt An example demonstrating the correct handling of an escaped backslash at the end of a link label, as specified in issue #325. ```text [link \[label\]] ``` -------------------------------- ### HTML Block with Standard Inline Tag Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates an HTML block starting with a standard inline-level tag. Markdown within the block is converted to HTML. ```html
*bar* ``` -------------------------------- ### Markdown.pl Two-Space Indentation with Blockquote HTML Output Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt This HTML output demonstrates the parsing of the blockquote example by Markdown.pl, maintaining the list item structure even with varying indentation. ```html
  • one

    two

``` -------------------------------- ### Basic HTML Tags Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates the parsing of simple HTML open tags and custom tags. ```CommonMark .

``` -------------------------------- ### Numbered List as First Block in a List Item Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates a list item starting with a nested numbered list. The indentation must be correct for the nested list to be recognized. ```markdown 1. - 2. foo ``` -------------------------------- ### ATX Header Space Requirement Example Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Clarifies that a space or end-of-line (EOL) is required after the opening '#' characters in ATX headers. Other whitespace characters are not sufficient, as indicated by the added test case. ```text # header ``` -------------------------------- ### Changing List Delimiters Starts New List Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates how changing the list marker (bullet or ordered delimiter) initiates a new list, even if the preceding list is not closed. ```markdown - foo - bar + baz ``` ```html
  • foo
  • bar
  • baz
``` -------------------------------- ### Shortcut Image with Formatted Label Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates shortcut image syntax with a label containing inline formatting. ```markdown ![*foo* bar] [*foo* bar]: /url "title" ``` -------------------------------- ### Indentation for Code Blocks Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt This example shows a paragraph followed by what might be an indented code block. The original spec is unclear on whether a blank line is required before such blocks. ```markdown paragraph code? ``` -------------------------------- ### Markdown.pl Two-Space Indentation Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt This markdown illustrates the behavior of Markdown.pl, where less indentation than the list marker is allowed for continuation paragraphs, leading to unintuitive list item parsing. ```markdown - one two ``` -------------------------------- ### Interrupted HTML Blocks Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Presents two HTML blocks separated by a Markdown paragraph. This shows how Markdown content can appear between distinct HTML blocks. ```markdown
*Markdown*
.

Markdown

``` -------------------------------- ### Simplified Editorial Markup Examples Source: https://github.com/commonmark/commonmark-spec/wiki/Deployed-Extensions Shows simplified editorial markup syntax without curly braces, using double characters for removed, added, highlighted, and changed content. ```markdown ~~removed content~~ ``` ```markdown --removed content-- ``` ```markdown ++added content++ ``` ```markdown ==highlighted== ``` ```markdown ???highlighted??? ``` -------------------------------- ### Block Quote Followed by Paragraph (Continuation) Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt If the line following a block quote starts with a greater-than sign and a space, it's considered a continuation of the block quote. Otherwise, it starts a new paragraph. ```markdown > bar > baz ``` -------------------------------- ### Block-Level and Inline-Level Structure Precedence Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt This example investigates the precedence between block-level and inline-level structures. It questions how a list item containing a code span with hyphens should be parsed. ```markdown - `a long code span can contain a hyphen like this - and it can screw things up` ``` -------------------------------- ### Markdown Example: Code Span Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt An illustrative case for code spans within markdown. ```markdown Add another illustrative case for code spans (#463). ``` -------------------------------- ### Figure Directive Example Source: https://github.com/commonmark/commonmark-spec/wiki/Generic-Directive-Extension-List Shows the 'fig' extension for creating a figure instance. The content field specifies the figure name, and key-value pairs can define the figure type. The block content represents the figure's content. ```markdown fig: name of figure {} type="numeric/letter/figname" Block Directive Content : Content of figure ``` -------------------------------- ### List Item Code Block Empty Line Example Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt A new test case added to address list item code blocks that contain an empty line. This ensures correct parsing and rendering of such structures. ```text ``` -------------------------------- ### Empty bullet list item Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt An example of an empty bullet list item within a list. ```commonmark - foo - - bar ``` ```html
  • foo
  • bar
``` -------------------------------- ### Markdown Example: Blockquote with Tab Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt A fixed spec test for blockquotes containing a tab character. ```markdown Fixed spec test for tabs. In the blockquote with a tab following ``` -------------------------------- ### Space Before Reference Link Title Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Example highlighting the necessity of a space before the title in a reference link. ```markdown [foo][bar] [bar]: url "title" ``` -------------------------------- ### HTML Comments Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Illustrates the parsing of HTML comments, including those with hyphens and specific starting sequences. ```CommonMark foo .

foo

``` ```CommonMark foo foo --> foo foo --> .

foo foo -->

foo foo -->

``` -------------------------------- ### Custom HTML Tag Names Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates the use of custom tag names in HTML. ```CommonMark Foo .

Foo

``` -------------------------------- ### Reference to Figure Directive Example Source: https://github.com/commonmark/commonmark-spec/wiki/Generic-Directive-Extension-List Illustrates the 'ref' extension for linking to a figure created with the 'fig' directive. The argument field specifies the figure name, and an optional key-value pair can override the reference type. ```markdown ref: (figname) {type="override numeric/letter/figname"} ``` -------------------------------- ### Empty ordered list item Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt An example of an empty ordered list item within an ordered list. ```commonmark 1. foo 2. 3. bar ``` ```html
  1. foo
  2. bar
``` -------------------------------- ### Running CommonMark Spec Tests Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Use this command to run conformance tests against a Markdown program using the spec file. ```shell python test/spec_tests.py --spec spec.txt --program PROGRAM ``` -------------------------------- ### Unescaped Parenthesis in Link Title Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Example showing that unescaped parentheses are disallowed within the title of a link. ```markdown [foo](bar "baz (title)") ``` -------------------------------- ### Basic Paragraphs Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates the parsing of simple paragraphs separated by blank lines. ```markdown aaa bbb ``` ```html

aaa

bbb

``` -------------------------------- ### HTML for Frontmatter Section Source: https://github.com/commonmark/commonmark-spec/wiki/Proposed-Extensions-to-CommonMark Employ a section element with a 'frontmatter' class for introductory content preceding the main body. ```html5
``` -------------------------------- ### Illegal HTML Tag Names Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Shows examples of tag names that are not parsed as HTML and are treated as literal text. ```CommonMark <33> <__> .

<33> <__>

``` -------------------------------- ### Consecutive Emphasis Sections Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Shows an example where two consecutive emphasis sections are not formed due to delimiter rules. ```markdown *foo**bar* .

foo**bar

``` -------------------------------- ### Link Syntax Sugar: Shortcut Reference Links Source: https://github.com/commonmark/commonmark-spec/wiki/Proposed-Extensions-to-CommonMark Creates an HTML anchor link with an explicit href attribute. ```html
Reference ``` -------------------------------- ### Link Reference Definition and Usage Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates how a link reference definition is parsed and then used within the document. ```markdown [foo]: /url bar === [foo] . ``` ```html

bar

foo

``` -------------------------------- ### Run CommonMark Spec Tests Source: https://github.com/commonmark/commonmark-spec/blob/master/README.md Execute conformance tests against the CommonMark specification using a provided program. ```bash python3 test/spec_tests.py --program $PROG ``` -------------------------------- ### HTML Block with Closing Tag Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt An HTML block starting with a closing tag. Content is rendered as raw HTML. ```html *bar* ``` -------------------------------- ### Inline Code with Attributes Source: https://github.com/commonmark/commonmark-spec/wiki/Consistent-Attribute-Recommendation-List Demonstrates applying attributes to inline code. This can be used to specify the language for short code snippets within text. ```CommonMark ` print("hellowworld") `{.python} ``` -------------------------------- ### Link Containing Another Link (Not Allowed) Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Links cannot contain other links, even if nested. This example shows the incorrect rendering. ```markdown [foo [bar](/uri)][ref] [ref]: /uri ``` -------------------------------- ### Case-Insensitive Label Matching Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Link reference labels are matched case-insensitively. This example shows matching between uppercase and mixed-case labels. ```markdown [FOO]: /url [Foo] . ``` ```markdown [ΑΓΩ]: /φου [αγω] . ``` -------------------------------- ### Markdown Example: HTML Block End Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Demonstrates an HTML block ending on the last line of its container, as per issue #103. ```markdown Allow HTML blocks to end on the last line of their container (Colin O'Dell, #103). ``` -------------------------------- ### Shortcut Image Syntax Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Uses shortcut reference-style syntax for images, similar to collapsed but without the empty brackets. ```markdown ![foo] [foo]: /url "title" ``` -------------------------------- ### Emphasis and Strong Emphasis - Underscore Delimiters Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Illustrates the behavior of emphasis and strong emphasis when using underscore delimiters, particularly with uneven matching and nesting. ```markdown foo ___ .

foo ___

``` ```markdown foo _\__ .

foo _

``` ```markdown foo _*_ .

foo *

``` ```markdown foo _____ .

foo _____

``` ```markdown foo __\___ .

foo _

``` ```markdown foo __*__ .

foo *

``` ```markdown __foo_ .

_foo

``` ```markdown _foo__ .

foo_

``` ```markdown ___foo__ .

_foo

``` ```markdown ____foo_ .

___foo

``` ```markdown __foo___ .

foo_

``` ```markdown _foo____ .

foo___

``` ```markdown __foo__ .

foo

``` ```markdown __ .

__

``` -------------------------------- ### HTML Block with Incomplete Tag Syntax Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt An HTML block starting with a tag that has incomplete syntax. Content is treated as raw HTML. ```html
question?
answer! ``` -------------------------------- ### HTML Block Starting with Closing Tag Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates an HTML block that begins with a closing tag, such as
. This is followed by Markdown content. ```markdown
*foo* .
*foo* ``` -------------------------------- ### Parse Reference Link with Defined Label Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates parsing a reference-style link where the label is defined. The first link uses the defined label '[bar]'. ```markdown [foo][bar][baz] [baz]: /url1 [bar]: /url2 . ``` ```html

foobaz

``` -------------------------------- ### List with Code Span Precedence - HTML Output Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt The HTML rendering of the CommonMark example, illustrating the precedence of block elements over inline elements. ```html ``` -------------------------------- ### Interior Delimiter Runs Source: https://github.com/commonmark/commonmark-spec/blob/master/changelog.txt Illustrates matching interior delimiter runs where lengths are multiples of three, improving handling of complex emphasis. ```markdown a***b***c ``` -------------------------------- ### Simple ATX Headings Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt ATX headings are created using 1 to 6 '#' characters at the beginning of a line, followed by a space. An optional closing sequence of '#' characters can be added. ```markdown # foo ## foo ### foo #### foo ##### foo ``` -------------------------------- ### URI Autolink with Custom Scheme Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Illustrates an autolink using a custom URI scheme like 'irc'. ```markdown .

irc://foo.bar:2233/baz

``` -------------------------------- ### Update Dingus Source: https://github.com/commonmark/commonmark-spec/blob/master/RELEASE_CHECKLIST.md Navigate to the dingus directory and run make to update the dingus tool. ```shell cd ../commonmark.js cd dingus make ``` -------------------------------- ### Unintended List Capture with '1.' Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Highlights a case where a list starting with '1.' might be unintentionally captured, even if it's part of a sentence. ```markdown The number of windows in my house is 1. The number of doors is 6. ``` ```html

The number of windows in my house is

  1. The number of doors is 6.
``` -------------------------------- ### Multi-line Setext Heading Content Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Shows a Setext heading where the content spans multiple lines. The underline must align with the start of the content. ```markdown Foo *bar baz* ==== ``` -------------------------------- ### Link Reference Definition with Title Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Shows how link reference definitions with titles are parsed and rendered. ```markdown [foo]: /foo-url "foo" [bar]: /bar-url "bar" [baz]: /baz-url [foo], [bar], [baz] ``` ```html

foo, bar, baz

``` -------------------------------- ### Multi-line Setext Heading Interpretation Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt CommonMark allows multi-line text for setext headings. This example shows the preferred interpretation where 'bar' becomes a heading. ```markdown Foo bar --- baz ``` -------------------------------- ### Link Syntax Sugar: Implicit Shortcut Links Source: https://github.com/commonmark/commonmark-spec/wiki/Proposed-Extensions-to-CommonMark Creates an HTML anchor link that implicitly refers to a heading ID. ```html Heading ``` -------------------------------- ### Indented Ordered List Markers Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt This example demonstrates right-aligned and indented ordered list markers. It questions whether list markers can be indented and if they can be right-aligned. ```markdown 8. item 1 9. item 2 10. item 2a ``` -------------------------------- ### URI Autolink with Relative Path Component Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates a URI autolink that includes a relative path component like '../'. ```markdown .

https://../

``` -------------------------------- ### Basic Emphasis and Strong Emphasis Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates basic nesting of emphasis within strong emphasis. ```CommonMark *foo **bar*** ``` ```HTML

foo bar

``` -------------------------------- ### Spoiler Directive Example Source: https://github.com/commonmark/commonmark-spec/wiki/Generic-Directive-Extension-List Demonstrates the 'spoiler' extension for hiding content. The content field is used for the spoiler text, and no arguments or key-value pairs are specified. ```markdown spoiler: Spoiler Text () ``` -------------------------------- ### Preventing Spurious List Capture with Non-1 Number Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Shows that only lists starting with '1' can interrupt paragraphs; other numbers will be treated as part of the preceding paragraph. ```markdown The number of windows in my house is 14. The number of doors is 6. ``` ```html

The number of windows in my house is 14. The number of doors is 6.

``` -------------------------------- ### Tight List with Code Block Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates a tight list where blank lines within a code block inside a list item do not make the list loose. ```markdown - a - ``` b ``` - c . ``` -------------------------------- ### Emphasis and Strong Emphasis - Nested Delimiters Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Shows how nested emphasis and strong emphasis are handled, requiring different delimiters for direct nesting of the same type. ```markdown **foo** .

foo

``` ```markdown *_foo_* .

foo

``` ```markdown _*foo*_ .

foo

``` ```markdown ****foo**** .

foo

``` ```markdown ____foo____ .

foo

``` ```markdown ******foo****** .

foo

``` -------------------------------- ### List item indentation with blank line Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Shows that the number of spaces after a list marker does not affect indentation when the list item starts with a blank line. ```commonmark - foo ``` ```html
  • foo
``` -------------------------------- ### HTML Block with Partial Tag Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Illustrates an HTML block starting with an incomplete tag. The parser includes content until a blank line or end of document. ```html
document ``` -------------------------------- ### Nested List Interrupting Paragraph - Markdown Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates a nested list structure within a paragraph context, emphasizing the principle of uniformity in Markdown parsing. ```markdown * I need to buy - new shoes - a coat - a plane ticket ``` -------------------------------- ### Fenced Code Block Info String with Backticks Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Info strings in backtick-delimited code blocks cannot contain backticks. This example shows how such an info string is handled. ```markdown foo ``` -------------------------------- ### Indented Paragraph Continuation in List Item Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Demonstrates how a list item starting with more than three spaces of indentation is treated as a paragraph continuation, not a new list item. ```markdown - a - b - c - d - e . ``` -------------------------------- ### Markdown.pl Two-Space Indentation with Blockquote Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt This markdown example shows the Markdown.pl behavior with a blockquote, where 'two' is still parsed as part of the list item despite indentation differences. ```markdown > - one > > two ``` -------------------------------- ### Indented Block Quote Example Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Illustrates that block quote markers (>) can be preceded by up to three spaces of indentation. Four spaces will cause the content to be treated as a code block. ```markdown > # Foo > bar > baz ``` ```html

Foo

bar baz

``` -------------------------------- ### ATX Heading - Closing sequence preceded by space Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt The closing '#' sequence must be preceded by a space or tab. ```markdown # foo# ``` -------------------------------- ### Fenced Code Block with Internal Spaces in Fence Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt Code fences cannot contain internal spaces or tabs. This example shows how a space within the fence is treated as content. ```markdown ``` ``` aaa ``` ```html

aaa

``` -------------------------------- ### ATX Heading - Closing '#' sequence Source: https://github.com/commonmark/commonmark-spec/blob/master/spec.txt A closing sequence of '#' characters is optional and need not match the opening sequence in length. Spaces or tabs are allowed after the closing sequence. ```markdown ## foo ## ### bar ### ``` ```markdown # foo ################################## ##### foo ## ``` ```markdown ### foo ### ```