### Example of Ordered List Item with Specific Indentation Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Demonstrates an ordered list item starting with '1.' and a specific indentation (N=2). The output shows the resulting HTML structure with an ordered list and its content. ```example 1. A paragraph with two lines. indented code > A block quote. . ``` ```html
  1. A paragraph with two lines.

    indented code
    

    A block quote.

``` -------------------------------- ### Emphasis and Strong Emphasis Examples Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Examples demonstrating standard emphasis, strong emphasis, and nested structures. ```markdown foo***bar***baz ``` ```markdown foo******bar*********baz ``` ```markdown *foo **bar *baz* bim** bop* ``` ```markdown *foo [*bar*](/url)* ``` ```markdown ** is not an empty emphasis ``` ```markdown **** is not an empty strong emphasis ``` -------------------------------- ### Ordered List Start Number Constraints Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Examples of valid and invalid start numbers for ordered lists, noting the nine-digit limit and handling of leading zeros. ```markdown 123456789. ok ``` ```markdown 1234567890. not ok ``` ```markdown 0. ok ``` ```markdown 003. ok ``` ```markdown -1. not ok ``` -------------------------------- ### Markdown.pl list continuation example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Example demonstrating how Markdown.pl parses indented continuation paragraphs. ```markdown - one two ``` ```html ``` -------------------------------- ### Markdown Input Example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt This is an example of Markdown input used to demonstrate the parsing process. ```markdown > Lorem ipsum dolor sit amet. > - Qui *quodsi iracundia* > - aliquando id ``` -------------------------------- ### Inline Link Examples Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Demonstrates basic inline link syntax with and without titles. ```markdown [link](/uri "title") .

link

``` ```markdown [link](/uri) .

link

``` ```markdown [link]() .

link

``` ```markdown [link](<>) .

link

``` -------------------------------- ### GitHub Flavored Markdown Alerts Example Source: https://github.com/commonmark/commonmark-java/blob/main/README.md This example demonstrates the syntax for GitHub-style alerts (callouts/admonitions) using blockquotes with a special prefix like '[!NOTE]'. ```markdown > [!NOTE] > The text of the note. ``` -------------------------------- ### Basic HTML Block Example (Type 6) Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Illustrates a basic HTML block of type 6, starting with an opening tag like . The content inside is treated as raw HTML. ```markdown
hi
okay. .
hi

okay.

``` -------------------------------- ### Ordered List Item with Valid Start Number Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Ordered list start numbers must be nine digits or less. This example shows a valid start number. ```markdown 123456789. ok ``` -------------------------------- ### List Item Indentation Example 1 Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Shows how content 'two' is not indented under the list item when there is no extra space after the list marker and the content starts on a new line. ```example - one two . ``` ```html

two

``` -------------------------------- ### Nested Task Lists Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Example showing how task lists can be nested within each other. ```markdown - [x] foo - [ ] bar - [x] baz - [ ] bim . ``` -------------------------------- ### AsciiDoc List Example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt A sample of AsciiDoc syntax demonstrating list items, indentation, and block content. ```text 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. -- ``` -------------------------------- ### HTML Output for Blockquote Example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Displays the HTML output for the blockquote example, showing 'two' as a continuation paragraph within the list item inside the blockquote. ```html
``` -------------------------------- ### Empty List Item at Start of List Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Demonstrates a list that begins with an empty list item. ```commonmark * ``` ```html ``` -------------------------------- ### GitHub Flavored Markdown Tables Example Source: https://github.com/commonmark/commonmark-java/blob/main/README.md This is an example of Markdown syntax for tables, which is enabled by the TablesExtension. It uses pipes to define columns and rows. ```markdown | Header 1 | Header 2 | | -------- | -------- | | Cell 1 | Cell 2 | ``` -------------------------------- ### Compare AsciiDoc and Markdown syntax Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Examples demonstrating the difference in list nesting and block formatting between AsciiDoc and Markdown. ```text 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. -- ``` ```text 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. ``` -------------------------------- ### HTML Output for Two-Space Indentation Example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Shows the HTML output for the two-space indentation example, where 'two' is treated as a continuation paragraph within the same list item. ```html ``` -------------------------------- ### Nested list structure example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Example of a list structure parsed as a single nested list. ```html ``` -------------------------------- ### Links with Fragment Identifiers and Queries Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Provides examples of links containing fragment identifiers and query parameters. ```markdown [link](#fragment) [link](https://example.com#fragment) [link](https://example.com?foo=3#frag) ``` -------------------------------- ### Example of Basic List Item with Indented Code and Block Quote Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Illustrates a basic ordered list item where subsequent lines are indented. Shows how indented code and block quotes are parsed within the list item. ```example A paragraph with two lines. indented code > A block quote. . ``` ```html

A paragraph with two lines.

indented code

A block quote.

``` -------------------------------- ### Basic Fenced Code Block Examples Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Demonstrates the use of backticks and tildes to create code blocks. ```markdown ``` < > ``` ``` ```markdown ~~~ < > ~~~ ``` -------------------------------- ### URI Autolink Example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Demonstrates a basic URI autolink. Ensure the URI is enclosed in angle brackets. ```CommonMark .

http://foo.bar.baz

``` -------------------------------- ### HTML Output for Four-Space Rule Example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Shows the HTML output generated by the four-space rule for the preceding Markdown example, highlighting the separation into multiple lists. ```html

bar

``` -------------------------------- ### YAML Front Matter Example Source: https://github.com/commonmark/commonmark-java/blob/main/README.md Demonstrates the structure of a YAML front matter block for metadata. This extension supports a subset of YAML syntax. ```markdown --- key: value list: - value 1 - value 2 literal: | this is literal value. literal values 2 --- document start here ``` -------------------------------- ### Blockquote list continuation example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Example of a list item within a blockquote parsed by Markdown.pl. ```markdown > - one > > two ``` ```html
``` -------------------------------- ### Indentation Rules for List Items Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Examples showing how block indentation affects list item formation. ```markdown foo bar ``` ```markdown - foo bar ``` ```markdown - foo bar ``` -------------------------------- ### Delimiter Handling Rules Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Examples demonstrating how excess delimiter characters are handled when they do not match evenly. ```markdown foo *** ``` ```markdown foo *\** ``` ```markdown foo *_* ``` ```markdown foo ***** ``` ```markdown foo **\*** ``` ```markdown foo **_** ``` ```markdown **foo* ``` ```markdown *foo** ``` ```markdown ***foo** ``` ```markdown ****foo* ``` ```markdown **foo*** ``` ```markdown *foo**** ``` -------------------------------- ### List Item Indentation Example 2 Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Demonstrates how 'two' is indented under the list item when there is one space after the list marker and 'two' is on a new line, resulting in a paragraph within the list item. ```example - one two . ``` ```html ``` -------------------------------- ### Empty Ordered List Item Example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Illustrates an empty ordered list item, showing its HTML representation. ```commonmark 1. foo 2. 3. bar ``` ```html
  1. foo
  2. bar
``` -------------------------------- ### Lazy Continuation Lines Example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Shows how lazy continuation lines, where indentation is partially removed, are handled in CommonMark. ```commonmark 1. A paragraph with two lines. indented code > A block quote. ``` ```html
  1. A paragraph with two lines.

    indented code
    

    A block quote.

``` -------------------------------- ### Marker-relative indentation example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Example of a list item with a subparagraph using marker-relative indentation. ```markdown 10. foo bar ``` -------------------------------- ### Strong Emphasis Rules Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Examples demonstrating rules for strong emphasis using double asterisks or double underscores. ```markdown **foo bar** .

foo bar

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

** foo bar**

``` ```markdown a**"foo"** .

a**"foo"**

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

foobar

``` ```markdown __foo bar__ .

foo bar

``` ```markdown __ foo bar__ .

__ foo bar__

``` ```markdown __ foo bar__ .

__ foo bar__

``` ```markdown a__"foo"__ .

a__"foo"__

``` ```markdown foo__bar__ .

foo__bar__

``` ```markdown 5__6__78 .

5__6__78

``` ```markdown пристаням__стремятся__ .

пристаням__стремятся__

``` ```markdown __foo, __bar__, baz__ .

foo, bar, baz

``` -------------------------------- ### Both Left and Right-Flanking Delimiter Runs Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Examples of delimiter runs that are both left and right-flanking. ```markdown abc***def "abc"_"def" ``` -------------------------------- ### Four-space rule list example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Example of a list structure that the four-space rule parses as two separate lists. ```markdown - foo bar - baz ``` ```html

bar

``` -------------------------------- ### Heading Anchor Example Source: https://github.com/commonmark/commonmark-java/blob/main/README.md This example shows how a Markdown heading '# Heading' is rendered with an auto-generated 'id' attribute, resulting in '

Heading

'. ```markdown # Heading ``` -------------------------------- ### List Item Indentation Example 4 Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Shows that with sufficient spaces after the list marker and indentation, subsequent content is parsed as a paragraph within the list item. ```example - one two . ``` ```html ``` -------------------------------- ### List Item Indentation and Parsing Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Examples demonstrating how list items are parsed based on indentation levels and how they interact with code blocks. ```markdown - foo notcode - foo code ``` ```markdown - a - b - c - d - e - f - g ``` ```markdown 1. a 2. b 3. c ``` ```markdown - a - b - c - d - e ``` ```markdown 1. a 2. b 3. c ``` -------------------------------- ### Empty list items Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Examples of empty bullet and ordered list items. ```markdown - foo - - bar . ``` ```markdown - foo - - bar . ``` ```markdown 1. foo 2. 3. bar . ``` ```markdown * . ``` -------------------------------- ### HTML Table Structure Example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt An example of an HTML table structure that may be interpreted as an indented code block if not handled correctly. ```html
Hi
``` ```html
<td>
  Hi
</td>
``` -------------------------------- ### Configure Parser and HtmlRenderer with Extensions Source: https://github.com/commonmark/commonmark-java/blob/main/README.md Configure the Parser and HtmlRenderer builders to use extensions by creating a list of Extension objects. This example shows how to add the TablesExtension. ```java import org.commonmark.ext.gfm.tables.TablesExtension; List extensions = List.of(TablesExtension.create()); Parser parser = Parser.builder() .extensions(extensions) .build(); HtmlRenderer renderer = HtmlRenderer.builder() .extensions(extensions) .build(); ``` -------------------------------- ### Empty List Items Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Presents an example of Markdown with an empty list item, questioning whether this is permissible. ```markdown * a * * b ``` -------------------------------- ### Markdown List Example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt The equivalent list structure represented in Markdown syntax. ```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. ``` -------------------------------- ### Reference Link Example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt A basic reference link using a label that matches a definition elsewhere in the document. ```markdown [foo][bar] [bar]: /url "title" .

foo

``` -------------------------------- ### Loose and Tight List Rules Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Examples illustrating how blank lines and block-level elements determine if a list is loose or tight. ```markdown - a - b - c . ``` ```markdown * a * * c . ``` ```markdown - a - b c - d . ``` ```markdown - a - b [ref]: /url - d . ``` ```markdown - a - ``` b ``` - c . ``` ```markdown - a - b c - d . ``` ```markdown * a > b > * c . ``` ```markdown - a > b ``` c ``` - d . ``` ```markdown - a . ``` ```markdown - a - b . ``` ```markdown 1. ``` foo ``` bar .
  1. foo
    

    bar

``` ```markdown * foo * bar baz . ``` ```markdown - a - b - c - d - e - f . ``` -------------------------------- ### Empty Bullet List Item Example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Demonstrates an empty bullet list item within a list, showing its representation in HTML. ```commonmark - foo - - bar ``` ```html ``` -------------------------------- ### Simple Code Span Example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Demonstrates a basic code span with single backticks. No special normalization is applied. ```markdown `foo` ``` -------------------------------- ### Markdown List Pattern Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Example of existing Markdown list indentation patterns. ```markdown 1. foo indented code ``` -------------------------------- ### Emphasis and Strong Emphasis Precedence Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt An example used to explore the precedence rules between emphasis and strong emphasis markers in Markdown. ```markdown *foo *bar* baz* ``` -------------------------------- ### List Item Starting with Blank Line Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Illustrates a list item that begins with a blank line, resulting in an empty list item in the HTML output. ```commonmark - foo ``` ```html

foo

``` -------------------------------- ### Emphasis Delimiter Matching and Whitespace Constraints Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Examples demonstrating how mismatched delimiters or surrounding whitespace prevent emphasis. ```markdown _foo* .

_foo*

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

*foo bar *

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

*foo bar *

``` ```markdown *(*foo) .

*(*foo)

``` ```markdown *(*foo*)* .

(foo)

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

foobar

``` -------------------------------- ### Setext Heading Level 1 and 2 Examples Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Demonstrates the creation of level 1 and level 2 Setext headings using '=' and '-' characters respectively for the underline. The content is parsed as CommonMark inline content. ```markdown Foo *bar* ========= Foo *bar* --------- ``` ```html

Foo bar

Foo bar

``` -------------------------------- ### Basic Block Quote Example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Demonstrates a standard block quote with a heading and paragraphs. Requires a '>' character followed by a space at the beginning of each line. ```markdown > # Foo > bar > baz ``` ```html

Foo

bar baz

``` -------------------------------- ### Email Autolink Example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Demonstrates a standard email autolink. The parser automatically prepends 'mailto:' to the email address. ```CommonMark .

foo@bar.example.com

``` -------------------------------- ### Ordered List Item with Invalid Start Number Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Ordered list start numbers exceeding nine digits are not rendered as lists. This example shows an invalid start number. ```markdown 1234567890. not ok ``` -------------------------------- ### Render AST to Markdown Source: https://github.com/commonmark/commonmark-java/blob/main/README.md Renders a CommonMark AST structure to a Markdown string. This example demonstrates creating a heading node and rendering it. ```java import org.commonmark.node.*; import org.commonmark.renderer.markdown.MarkdownRenderer; // Build document var heading = new Heading(); heading.setLevel(2); heading.appendChild(new Text("My heading")); var document = new Document(); document.appendChild(heading); // Render to Markdown var renderer = MarkdownRenderer.builder().build(); renderer.render(document); // "## My heading\n" ``` -------------------------------- ### Parsing Processing Instructions Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Demonstrates parsing of PHP-style processing instructions. ```text foo . ``` -------------------------------- ### Strong Emphasis Rules Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Examples showing strong emphasis with nested elements and multi-line content. ```markdown **foo [bar](/url)** ``` ```markdown **foo bar** ``` ```markdown __foo _bar_ baz__ ``` ```markdown __foo __bar__ baz__ ``` ```markdown ____foo__ bar__ ``` ```markdown **foo **bar**** ``` ```markdown **foo *bar* baz** ``` ```markdown **foo*bar*baz** ``` ```markdown ***foo* bar** ``` ```markdown **foo *bar*** ``` ```markdown **foo *bar **baz** bim* bop** ``` ```markdown **foo [*bar*](/url)** ``` ```markdown __ is not an empty emphasis ``` ```markdown ____ is not an empty strong emphasis ``` -------------------------------- ### Underscore Emphasis Rules Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Examples showing specific constraints for underscore-based emphasis, including intraword restrictions. ```markdown _foo bar _ .

_foo bar _

``` ```markdown _(_foo) .

_(_foo)

``` ```markdown _(_foo_)_ .

(foo)

``` ```markdown _foo_bar .

_foo_bar

``` ```markdown _пристаням_стремятся .

_пристаням_стремятся

``` ```markdown _foo_bar_baz_ .

foo_bar_baz

``` ```markdown _(bar)_. .

(bar).

``` -------------------------------- ### Links with Titles in Different Quote Styles Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Provides examples of links with titles enclosed in double quotes, single quotes, and parentheses. ```markdown [link](/url "title") [link](/url 'title') [link](/url (title)) ``` -------------------------------- ### Loose and Tight List Definitions Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Examples showing how blank lines and block-level elements determine whether a list is considered loose or tight. ```markdown - a - b - c ``` ```markdown * a * * c ``` ```markdown - a - b c - d ``` ```markdown - a - b [ref]: /url - d ``` ```markdown - a - ``` b ``` - c ``` ```markdown - a - b c - d ``` ```markdown * a > b > * c ``` ```markdown - a > b ``` c ``` - d ``` ```markdown - a ``` ```markdown - a - b ``` ```markdown 1. ``` foo ``` bar ``` ```markdown * foo * bar baz ``` ```markdown - a - b - c - d - e - f ``` -------------------------------- ### CommonMark Footnotes Example Source: https://github.com/commonmark/commonmark-java/blob/main/README.md This Markdown syntax shows how to create footnotes. Main text is followed by a reference like '[^1]', and the footnote content is defined later with '[^1]: Additional text in a footnote'. ```markdown Main text[^1] [^1]: Additional text in a footnote ``` -------------------------------- ### Basic Type 6 HTML Blocks Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Examples of standard HTML block usage with table and div tags. ```markdown
hi
okay. .
hi

okay.

``` ```markdown
*hello* .
*hello* ``` -------------------------------- ### URI Autolink with Made-up Scheme Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt An example of an autolink using a scheme that is not officially recognized but follows the defined syntax. ```CommonMark .

made-up-scheme://foo,bar

``` -------------------------------- ### Prepare Changelog Source: https://github.com/commonmark/commonmark-java/wiki/Releasing Use this command to generate a list of commits since the last release for the changelog. ```bash git log --first-parent commonmark-parent-0.xx.0.. ``` -------------------------------- ### Emphasis Delimiter Flanking Rules Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Examples showing how delimiter flanking and surrounding characters affect emphasis parsing. ```markdown aa_"bb"_cc .

aa_"bb"_cc

``` ```markdown foo-_(bar)_ .

foo-(bar)

``` -------------------------------- ### Indentation and List Item Content Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Examples showing how the amount of indentation after a list marker dictates whether subsequent lines are included in the list item. ```markdown - one two .
  • one

two

``` ```markdown - one two .
  • one

    two

``` ```markdown - one two .
  • one
 two
``` ```markdown - one two .
  • one

    two

``` -------------------------------- ### Configure Standard GFM Alerts Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-ext-gfm-alerts/README.md Initialize the parser and renderer with the standard Alerts extension. ```java var extension = AlertsExtension.create(); var parser = Parser.builder().extensions(List.of(extension)).build(); var renderer = HtmlRenderer.builder().extensions(List.of(extension)).build(); ``` -------------------------------- ### HTML Block Parsing Example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Demonstrates how HTML blocks are parsed, especially when nested HTML might otherwise be recognized. The parser state is not affected by HTML within an HTML block. ```markdown
**Hello**,

_world_.
.
**Hello**,

world.

``` -------------------------------- ### Ordered List Item with Negative Start Number Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Negative start numbers are not valid for ordered lists and are rendered as plain text. ```markdown -1. not ok ``` -------------------------------- ### Indented Ordered List Markers Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Shows an example of indented ordered list markers, questioning whether they are permissible and if they can be right-aligned. ```markdown 8. item 1 9. item 2 10. item 2a ``` -------------------------------- ### Customize HTML Rendering with NodeRendererFactory Source: https://github.com/commonmark/commonmark-java/blob/main/README.md Take complete control over HTML rendering by providing a `NodeRendererFactory`. This example demonstrates how to change the rendering of indented code blocks to only use a `pre` tag instead of `pre` and `code`. ```java Parser parser = Parser.builder().build(); HtmlRenderer renderer = HtmlRenderer.builder() .nodeRendererFactory(new HtmlNodeRendererFactory() { public NodeRenderer create(HtmlNodeRendererContext context) { return new IndentedCodeBlockNodeRenderer(context); } }) .build(); Node document = parser.parse("Example:\n\n code"); renderer.render(document); // "

Example:

\n
code\n
\n" class IndentedCodeBlockNodeRenderer implements NodeRenderer { private final HtmlWriter html; IndentedCodeBlockNodeRenderer(HtmlNodeRendererContext context) { this.html = context.getWriter(); } @Override public Set> getNodeTypes() { // Return the node types we want to use this renderer for. return Set.of(IndentedCodeBlock.class); } @Override public void render(Node node) { // We only handle one type as per getNodeTypes, so we can just cast it here. IndentedCodeBlock codeBlock = (IndentedCodeBlock) node; html.line(); html.tag("pre"); html.text(codeBlock.getLiteral()); html.tag("/pre"); html.line(); } } ``` -------------------------------- ### Markdown to HTML Conversion Example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Illustrates how Markdown with list indicators and code spans is parsed into HTML. Block structure takes precedence over inline code. ```markdown - `one - two` ``` ```html
  • `one
  • two`
``` -------------------------------- ### List Item Indentation Example 3 Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Illustrates that when there are multiple spaces after the list marker and content is indented, it may be treated as code if the indentation is not sufficient for a paragraph. ```example - one two . ``` ```html
  • one
 two
``` -------------------------------- ### List Item Wrapping in Paragraph Tags Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Presents examples of Markdown lists that raise questions about when list items should be wrapped in

tags, and whether lists can be partially 'loose' or 'tight'. ```markdown 1. one 2. two 3. three ``` ```markdown 1. one - a - b 2. two ``` -------------------------------- ### List Items Including Section Headings Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Shows a Markdown example where a list item contains a section heading, questioning its validity based on different implementation behaviors. ```markdown - # Heading ``` -------------------------------- ### Invalid List Item Markers Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Shows examples where text following a list marker is not indented by at least one space, resulting in the text being parsed as paragraphs rather than list items. ```example -one 2.two . ``` ```html

-one

2.two

``` -------------------------------- ### Parsing Simple Open Tags Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Demonstrates basic open tag parsing in CommonMark. ```text .

``` -------------------------------- ### List Item with Multiple Blank Lines Between Blocks Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Demonstrates that a list item can contain blocks separated by more than one blank line, showing 'foo' and 'bar' as separate paragraphs within the same list item. ```example - foo bar . ``` ```html
  • foo

    bar

``` -------------------------------- ### Right-Flanking Delimiter Runs Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Examples of delimiter runs that are right-flanking but not left-flanking. ```markdown abc*** abc_ "abc"** "abc"_ ``` -------------------------------- ### Left-Flanking Delimiter Runs Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Examples of delimiter runs that are left-flanking but not right-flanking. ```markdown ***abc _abc **"abc" _"abc" ``` -------------------------------- ### Non-Flanking Delimiter Runs Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Examples of delimiter runs that are neither left nor right-flanking. ```markdown abc *** def a _ b ``` -------------------------------- ### Link Destination Space Handling Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Shows how spaces in link destinations are handled when using pointy brackets. ```markdown [link](/my uri) .

[link](/my uri)

``` ```markdown [link]() .

link

``` -------------------------------- ### Bump Project Version Source: https://github.com/commonmark/commonmark-java/wiki/Releasing Execute this command when performing a minor version update to set the new snapshot version. ```bash mvn versions:set -DnewVersion=0.yy.0-SNAPSHOT ``` -------------------------------- ### Task List Items Syntax Source: https://github.com/commonmark/commonmark-java/blob/main/README.md Illustrates the syntax for creating task list items, indicated by `[ ]` for incomplete tasks and `[x]` for completed tasks. Requires `TaskListItemsExtension`. ```markdown - [ ] task #1 - [x] task #2 ``` -------------------------------- ### Basic Code Span Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt A simple example of a code span using single backticks. ```markdown `foo` .

foo

``` -------------------------------- ### Bullet List Delimiter Change Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Changing the bullet character starts a new list block. ```markdown - foo - bar + baz .
  • foo
  • bar
  • baz
``` -------------------------------- ### Inline HTML Tag Handling Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Shows that end tags can appear on the same line as start tags. ```markdown *foo* .

foo

``` -------------------------------- ### List as First Block in List Item Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Demonstrates nesting a list as the initial content within another list item. ```markdown - - foo ``` ```html
    • foo
``` -------------------------------- ### Ordered List Delimiter Change Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Changing the ordered list delimiter starts a new list block. ```markdown 1. foo 2. bar 3) baz .
  1. foo
  2. bar
  1. baz
``` -------------------------------- ### URI Autolink with Relative Path Components Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Demonstrates an autolink that includes relative path components like '..'. ```CommonMark .

https://../

``` -------------------------------- ### Basic Fenced Code Block with Tildes Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Demonstrates a simple fenced code block using tildes. The content is treated as literal text. ```markdown ~~~ < > ~~~ ``` -------------------------------- ### PHP Processing Instruction Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Demonstrates a type 3 processing instruction block. ```markdown '; ?> okay . '; ?>

okay

``` -------------------------------- ### Thematic Break Examples Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Demonstrates how different Markdown syntaxes are interpreted as thematic breaks (horizontal rules). ```markdown --- --- ``` ```markdown - foo ----- ``` ```markdown foo --- ``` ```markdown > foo ----- ``` -------------------------------- ### Parsing Closing Tags Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Demonstrates standard closing tag parsing. ```text .

``` -------------------------------- ### Paragraph Interruption Constraint Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Lists starting with numbers other than 1 do not interrupt paragraphs to prevent accidental list creation. ```markdown The number of windows in my house is 14. The number of doors is 6. .

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

``` ```markdown The number of windows in my house is 1. The number of doors is 6. .

The number of windows in my house is

  1. The number of doors is 6.
``` -------------------------------- ### Link Destination Special Character Handling Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Examples of handling parentheses and escaped characters within link destinations. ```markdown [a]() .

a

``` ```markdown [link]() .

[link](<foo>)

``` ```markdown [a]( [a](c) .

[a](<b)c [a](<b)c> [a](c)

``` -------------------------------- ### Emphasis with URLs Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Demonstrates how emphasis delimiters are handled within URLs. ```Markdown **a .

**ahttp://foo.bar/?q=**

``` ```Markdown __a .

__ahttp://foo.bar/?q=__

``` -------------------------------- ### Task List Rendering Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Basic task list items rendered as HTML checkbox inputs. ```markdown - [ ] foo - [x] bar .
  • foo
  • bar
``` -------------------------------- ### Run Lint Check on Windows Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-android-test/README.md Execute the Gradle wrapper to perform lint checks on the commonmark-java Android module using Windows command prompt. Ensure your environment is set up with the Android SDK. ```bat .\gradlew :app:lint ``` -------------------------------- ### Basic List Item Structure Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Demonstrates how a list item wraps content including paragraphs, indented code, and blockquotes. ```markdown A paragraph with two lines. indented code > A block quote. .

A paragraph with two lines.

indented code

A block quote.

``` ```markdown 1. A paragraph with two lines. indented code > A block quote. .
  1. A paragraph with two lines.

    indented code
    

    A block quote.

``` -------------------------------- ### Invalid Autolink without Scheme Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt A string within angle brackets that does not start with a valid URI scheme is not parsed as an autolink. ```CommonMark .

<foo.bar.baz>

``` -------------------------------- ### Render TIP Alert in CommonMark Java Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-ext-gfm-alerts/src/test/resources/alerts-spec.txt Shows the Markdown and HTML for a TIP alert. Use this for providing helpful suggestions or advice. ```markdown > [!TIP] > This is a tip . ``` ```html

Tip

This is a tip

``` -------------------------------- ### HTML Table Structure Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Shows how to structure HTML tables with blank lines for proper parsing. ```markdown
Hi
.
Hi
``` -------------------------------- ### Interrupting Paragraphs with Block Quotes Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Illustrates how a block quote can start immediately following a paragraph without requiring a blank line. ```markdown foo > bar .

foo

bar

``` -------------------------------- ### Parse and Render Markdown to HTML Source: https://github.com/commonmark/commonmark-java/blob/main/README.md Parses a Markdown string into an AST and then renders it to HTML using default options. Ensure the commonmark, parser, and renderer libraries are imported. ```java import org.commonmark.node.*; import org.commonmark.parser.Parser; import org.commonmark.renderer.html.HtmlRenderer; var parser = Parser.builder().build(); var document = parser.parse("This is *Markdown*"); var renderer = HtmlRenderer.builder().build(); renderer.render(document); // "

This is Markdown

\n" ``` -------------------------------- ### Plain textual content parsing Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Examples of how plain text, including special characters and non-ASCII characters, are parsed into paragraph elements. ```markdown hello $.;'there .

hello $.;'there

``` ```markdown Foo χρῆν .

Foo χρῆν

``` -------------------------------- ### Parse and Render Markdown to HTML Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark/src/main/javadoc/overview.html Initializes a parser and renderer to convert a Markdown string into an HTML-formatted string. ```java import org.commonmark.node.*; import org.commonmark.parser.Parser; import org.commonmark.renderer.html.HtmlRenderer; Parser parser = Parser.builder().build(); Node document = parser.parse("This is *Sparta*"); HtmlRenderer renderer = HtmlRenderer.builder().escapeHtml(true).build(); renderer.render(document); // "

This is Sparta

\n" ``` -------------------------------- ### Indented Block Quote Example Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Illustrates block quotes where the '>' marker is indented by 1-3 spaces. This indentation is preserved and does not affect parsing. ```markdown > # Foo > bar > baz ``` ```html

Foo

bar baz

``` -------------------------------- ### Basic Indented Code Block Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt A simple example of an indented code block, which requires four spaces of indentation per line. ```markdown a simple indented code block ``` -------------------------------- ### Nested List with Blank Lines Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Demonstrates complex nesting and blank line handling within list items. ```markdown - foo - bar - baz bim .
  • foo
    • bar
      • baz

        bim

``` -------------------------------- ### Plain URI Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt A URI not enclosed in angle brackets is rendered as plain text. ```CommonMark https://example.com .

https://example.com

``` -------------------------------- ### Ordered List Item with Leading Zeros Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Start numbers in ordered lists can begin with zeros. The parser correctly interprets the numerical value. ```markdown 0. ok ``` ```markdown 003. ok ``` -------------------------------- ### Run Lint Check on Mac/Linux Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-android-test/README.md Execute the Gradle wrapper to perform lint checks on the commonmark-java Android module. Ensure your environment is set up with the Android SDK. ```shell ./gradlew :app:lint ``` -------------------------------- ### HTML Block with Div Tag Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Shows an HTML block starting with a
tag. The content within the div is treated as raw HTML. ```markdown
*hello* .
*hello* ``` -------------------------------- ### Using Info Strings Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt Info strings after the opening fence define the language, typically resulting in a language-specific class in HTML. ```markdown ```ruby def foo(x) return 3 end ``` ``` ```markdown ~~~~ ruby startline=3 $%@#$ def foo(x) return 3 end ~~~~~~~ ``` ```markdown ````; ```` ``` -------------------------------- ### Basic www Autolink Recognition Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt Demonstrates automatic insertion of the http scheme for www-prefixed domains. ```text www.commonmark.org .

www.commonmark.org

``` -------------------------------- ### Indented Content Not Forming List Item Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt This example shows content with indentation that does not form a list item due to specific parsing rules. ```markdown - foo bar ```