### Markdown Example Source: https://github.com/mity/md4c/blob/master/test/spec.txt This code block demonstrates the equivalent Markdown syntax for the AsciiDoc example, emphasizing 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. ``` -------------------------------- ### Install md2html Executable and Man Page Source: https://github.com/mity/md4c/blob/master/md2html/CMakeLists.txt Installs the md2html executable to the binary directory and its man page to the man page directory. ```cmake install( TARGETS md2html RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) install(FILES "md2html.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") ``` -------------------------------- ### Nested Emphasis and Strong Emphasis Examples Source: https://github.com/mity/md4c/blob/master/test/spec.txt Provides examples of nested emphasis and strong emphasis, including combinations of `_` and `*` delimiters. These cases illustrate complex inline formatting rules. ```markdown _foo __bar__ baz_ .

foo bar baz

``` ```markdown _foo _bar_ baz_ .

foo bar baz

``` ```markdown __foo_ bar_ .

foo bar

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

foo bar

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

foo bar baz

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

foobarbaz

``` -------------------------------- ### AsciiDoc Example Source: https://github.com/mity/md4c/blob/master/test/spec.txt This code block shows an example of AsciiDoc syntax for lists 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. -- ``` -------------------------------- ### Markdown.pl Blockquote Indentation Example (HTML Output) Source: https://github.com/mity/md4c/blob/master/test/spec.txt Shows the HTML output for the Markdown.pl blockquote indentation example, with 'two' as a continuation paragraph. ```html
``` -------------------------------- ### Markdown.pl Two-Space Indentation Example (HTML Output) Source: https://github.com/mity/md4c/blob/master/test/spec.txt Shows the HTML output for the Markdown.pl two-space indentation example, where 'two' is treated as a continuation paragraph. ```html ``` -------------------------------- ### URI Autolink Example Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates a basic URI autolink. Ensure the URI is enclosed in angle brackets. ```markdown ``` ```html

http://foo.bar.baz

``` -------------------------------- ### Markdown List Starting with Empty Item Source: https://github.com/mity/md4c/blob/master/test/spec.txt Example of a Markdown list that begins with an empty list item. ```markdown * ``` ```html ``` -------------------------------- ### Permissive WWW Autolinks Example Source: https://github.com/mity/md4c/blob/master/test/spec-permissive-autolinks.txt Recognizes URLs starting with 'www.' without an explicit scheme, similar to permissive URL autolinks. The output links are prefixed with 'http://'. ```markdown www.google.com/search?q=Markdown ``` ```html

www.google.com/search?q=Markdown

``` ```markdown --fpermissive-www-autolinks ``` -------------------------------- ### Emphasis and Strong Emphasis Precedence Source: https://github.com/mity/md4c/blob/master/test/spec.txt Shows an example that questions the precedence rules for emphasis and strong emphasis markers. ```markdown *foo *bar* baz* ``` -------------------------------- ### Changing Ordered List Delimiter Starts New List Source: https://github.com/mity/md4c/blob/master/test/spec.txt Illustrates how changing the ordered list delimiter ('.' or ')') starts a new ordered list. Displays the corresponding HTML output. ```markdown 1. foo 2. bar 3) baz ``` ```html
  1. foo
  2. bar
  1. baz
``` -------------------------------- ### Basic Block Quote Example Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates a standard block quote with a heading and paragraphs. The output shows the parsed HTML. ```markdown > # Foo > bar > baz ``` ```html

Foo

bar baz

``` -------------------------------- ### Delimiter Run Examples: Left-flanking Source: https://github.com/mity/md4c/blob/master/test/spec.txt Examples of delimiter runs that are left-flanking but not right-flanking, crucial for determining emphasis in Markdown. ```text ***abc _abc **"abc" _"abc" ``` -------------------------------- ### Four-Space Rule Example (HTML Output) Source: https://github.com/mity/md4c/blob/master/test/spec.txt Shows the HTML output generated by a parser adhering to the four-space rule for the preceding Markdown example. ```html

bar

``` -------------------------------- ### HTML Comments Source: https://github.com/mity/md4c/blob/master/test/spec.txt Shows examples of valid HTML comments, including those with hyphens and specific starting sequences. ```html foo .

foo

``` ```html foo foo --> foo foo --> .

foo foo -->

foo foo -->

``` -------------------------------- ### Non-entities and Invalid References Example Source: https://github.com/mity/md4c/blob/master/test/spec.txt Displays examples of strings that are not recognized as valid entity or numeric character references, and how they are rendered literally. ```html   &x; &#; &#x; � &#abcdef0; &ThisIsNotDefined; &hi?; . ``` ```html

&nbsp &x; &#; &#x; � &#abcdef0; &ThisIsNotDefined; &hi?;

``` -------------------------------- ### Markdown Link Label Hash Collision Example Source: https://github.com/mity/md4c/blob/master/test/coverage.txt This example demonstrates a markdown input with multiple link labels that normalize to the same FNV1a hash. This is used to test complex code paths in the parser. ```markdown [foo]: /foo [qnptgbh]: /qnptgbh [abgbrwcv]: /abgbrwcv [abgbrwcv]: /abgbrwcv2 [abgbrwcv]: /abgbrwcv3 [abgbrwcv]: /abgbrwcv4 [alqadfgn]: /alqadfgn [foo] [qnptgbh] [abgbrwcv] [alqadfgn] [axgydtdu] . ``` ```html

foo qnptgbh abgbrwcv alqadfgn [axgydtdu]

``` -------------------------------- ### Empty List Item Source: https://github.com/mity/md4c/blob/master/test/spec.txt Shows an example of an empty list item, questioning its validity and rendering. ```markdown * a * * b ``` -------------------------------- ### Basic Markdown Table Example Source: https://github.com/mity/md4c/blob/master/test/spec-tables.txt Demonstrates a basic Markdown table with two columns and three rows of data. The `MD_FLAG_TABLES` flag must be enabled for this to be parsed as a table. ```markdown | Column 1 | Column 2 | |----------|----------| | foo | bar | | baz | qux | | quux | quuz | ``` ```html
Column 1Column 2
foobar
bazqux
quuxquuz
``` -------------------------------- ### Delimiter Run Examples: Right-flanking Source: https://github.com/mity/md4c/blob/master/test/spec.txt Examples of delimiter runs that are right-flanking but not left-flanking, important for Markdown's emphasis parsing. ```text abc*** abc_ "abc"** "abc"_ ``` -------------------------------- ### Full Reference Link Example Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates a full reference link, consisting of link text and a matching link label that points to a link reference definition elsewhere in the document. ```markdown [foo][bar] [bar]: /url "title" .

foo

``` -------------------------------- ### List Item with Subparagraph Example (Markdown) Source: https://github.com/mity/md4c/blob/master/test/spec.txt Presents a Markdown example where 'bar' is arguably a subparagraph of the list item, despite not being indented as far as 'foo'. ```markdown 10. foo bar ``` -------------------------------- ### Ordered List with Leading Zeros Source: https://github.com/mity/md4c/blob/master/test/spec.txt Illustrates that leading zeros in ordered list start numbers are handled correctly. ```markdown 0. ok ``` ```markdown 003. ok ``` -------------------------------- ### Markdown.pl Two-Space Indentation Example (Markdown) Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates how Markdown.pl parses indented text following a list marker as a continuation paragraph, even with less indentation. ```markdown - one two ``` -------------------------------- ### Markdown to Tree Structure Example Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates how a sequence of Markdown lines is transformed into a hierarchical document tree, including block quotes, lists, and paragraphs. ```markdown > Lorem ipsum dolor sit amet. > - Qui *quodsi iracundia* > - aliquando id ``` -------------------------------- ### Setext Heading Level 1 and 2 Examples Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates the creation of level 1 and level 2 setext headings. The underline character determines the heading level. ```markdown Foo *bar* ========= Foo *bar* --------- ``` -------------------------------- ### HTML Block with Non-Standard Tag Start Source: https://github.com/mity/md4c/blob/master/test/spec.txt Shows an HTML block starting with a non-standard tag-like structure. Markdown interprets this as a raw HTML block. ```html
*bar*

baz

``` -------------------------------- ### Handling Leading Dots in Paragraphs Source: https://github.com/mity/md4c/blob/master/test/regressions.txt Shows how md4c parses paragraphs that start with a dot. ```markdown . foo .

. foo

``` -------------------------------- ### Tags with Attributes Source: https://github.com/mity/md4c/blob/master/test/spec.txt Provides examples of HTML tags with various attribute formats, including quoted and unquoted values. ```html .

``` -------------------------------- ### Markdown to HTML: Basic List Item Example Source: https://github.com/mity/md4c/blob/master/test/spec.txt Illustrates the conversion of a markdown paragraph with indented code and a block quote into HTML, demonstrating basic list item parsing. ```markdown ```````````````````````````````` example A paragraph with two lines. indented code > A block quote. . ``` ```html

A paragraph with two lines.

indented code

A block quote.

``` -------------------------------- ### Delimiter Run Examples: Both Left and Right-flanking Source: https://github.com/mity/md4c/blob/master/test/spec.txt Illustrates delimiter runs that qualify as both left-flanking and right-flanking, affecting Markdown emphasis rules. ```text abc***def "abc"_"def" ``` -------------------------------- ### Empty Elements Source: https://github.com/mity/md4c/blob/master/test/spec.txt Shows examples of empty HTML elements, which self-close. ```html
.

``` -------------------------------- ### HTML Entity References Example Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates the use of various HTML entity references and their rendered output. These are recognized outside of code blocks and spans. ```html   & © Æ Ď ¾ ℋ ⅆ ∲ ≧̸ . ``` ```html

  & © Æ Ď ¾ ℋ ⅆ ∲ ≧̸

``` -------------------------------- ### Markdown List Item Starting with a List Source: https://github.com/mity/md4c/blob/master/test/spec.txt Shows how a markdown list item can begin with another list, creating nested structures. ```markdown - - foo ``` ```html
    • foo
``` -------------------------------- ### Undefined Entity Reference Example Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates that entity references not found in the HTML5 list are treated as literal text. ```html &MadeUpEntity; . ``` ```html

&MadeUpEntity;

``` -------------------------------- ### Markdown Whitespace Collapse Example Source: https://github.com/mity/md4c/blob/master/test/coverage.txt Demonstrates the effect of the `--fcollapse-whitespace` flag, which collapses multiple spaces into a single space in the output. ```markdown foo bar → baz .

foo bar baz

. --fcollapse-whitespace ``` -------------------------------- ### Nested Emphasis with Underscores Source: https://github.com/mity/md4c/blob/master/test/spec.txt Provides an example of nested emphasis using underscores, demonstrating how `_` and `__` delimiters interact within nested structures. This clarifies the parsing of complex emphasis. ```markdown _(__foo__)_ .

(foo)

``` -------------------------------- ### Document Tree Structure Example Source: https://github.com/mity/md4c/blob/master/test/spec.txt Illustrates the hierarchical structure of a document tree during markdown parsing, showing nested blocks and open elements. ```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" ``` -------------------------------- ### Delimiter Run Examples: Neither Left nor Right-flanking Source: https://github.com/mity/md4c/blob/master/test/spec.txt Shows delimiter runs that are neither left-flanking nor right-flanking, typically not used for Markdown emphasis. ```text abc *** def a _ b ``` -------------------------------- ### Permissive URL Autolinks Examples Source: https://github.com/mity/md4c/blob/master/test/spec-permissive-autolinks.txt Recognizes http, https, and ftp schemes with mandatory host, optional path, query, and fragment. Host and path components have specific character and structure requirements. ```markdown https://example.com http://example.com ftp://example.com ssh://example.com ``` ```html

https://example.com http://example.com ftp://example.com

ssh://example.com

``` ```markdown --fpermissive-url-autolinks ``` ```markdown https://example.com/images/branding/logo_272x92.png ``` ```html

https://example.com/images/branding/logo_272x92.png

``` ```markdown --fpermissive-url-autolinks ``` ```markdown https://www.google.com/search?q=md4c+markdown ``` ```html

https://www.google.com/search?q=md4c+markdown

``` ```markdown --fpermissive-url-autolinks ``` ```markdown https://example.com#fragment ``` ```html

https://example.com#fragment

``` ```markdown --fpermissive-url-autolinks ``` ```markdown http://commonmark.org (Visit https://encrypted.google.com/search?q=Markup+(business)) Anonymous FTP is available at ftp://foo.bar.baz. ``` ```html

http://commonmark.org

(Visit https://encrypted.google.com/search?q=Markup+(business))

Anonymous FTP is available at ftp://foo.bar.baz.

``` ```markdown --fpermissive-url-autolinks ``` -------------------------------- ### Markdown Strong Emphasis Examples Source: https://github.com/mity/md4c/blob/master/test/spec.txt Illustrates various ways to achieve strong emphasis using triple asterisks or combinations of single and double asterisks in Markdown. ```markdown ***strong emph*** ***strong** in emph* ***emph* in strong** **in strong *emph*** *in emph **strong*** ``` -------------------------------- ### HTML Block Example with
 Tag

Source: https://github.com/mity/md4c/blob/master/test/spec.txt

Demonstrates an HTML block where a 
 tag is nested. The HTML block is terminated by a blank line, and the content within 
 is treated as raw HTML.

```markdown
**Hello**,

_world_.
.
**Hello**,

world.

``` -------------------------------- ### HTML Block with Self-Closing Tag Source: https://github.com/mity/md4c/blob/master/test/spec.txt Example of an HTML block where the start and end tags are on the same line, followed by Markdown content. ```html

foo

``` -------------------------------- ### Markdown Lazy Continuation Lines Example Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates 'lazy continuation lines' where indentation is partially deleted from list item content. ```markdown 1. A paragraph with two lines. indented code > A block quote. ``` ```html
  1. A paragraph with two lines.

    indented code
    

    A block quote.

``` -------------------------------- ### Markdown List Item with Blank Lines Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates list items starting with a blank line, including nested code blocks. ```markdown - foo - ``` bar ``` - baz ``` ```html
  • foo
  • bar
    
  • baz
    
``` -------------------------------- ### Handling Link Definitions and Lists Source: https://github.com/mity/md4c/blob/master/test/regressions.txt Demonstrates parsing of link definitions followed by list items. ```markdown [f]: - xx - .
xx
``` -------------------------------- ### Superscript at Line Start Source: https://github.com/mity/md4c/blob/master/test/spec-superscripts.txt A caret at the very start of a line can open a superscript span. ```markdown ^2^ ``` ```html

2

``` -------------------------------- ### Image with Link in Description (Alternative) Source: https://github.com/mity/md4c/blob/master/test/spec.txt Another example showing a link within an image description, where only the text content is used for alt. ```markdown ![foo [bar](/url)](/url2) ``` ```html

foo bar

``` -------------------------------- ### Wiki Link Target Length Source: https://github.com/mity/md4c/blob/master/test/spec-wiki-links.txt Shows that a wiki link target can be up to 100 characters long. This example uses the maximum allowed length for the target. ```Markdown [[1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890]] ``` -------------------------------- ### Four-Space Rule Example (Markdown) Source: https://github.com/mity/md4c/blob/master/test/spec.txt Illustrates a Markdown structure where the four-space rule leads to parsing as multiple lists with an intervening paragraph. ```markdown - foo bar - baz ``` -------------------------------- ### Negative Ordered List Start Number Source: https://github.com/mity/md4c/blob/master/test/spec.txt A negative start number for an ordered list is not interpreted as a list item. ```markdown -1. not ok ``` -------------------------------- ### Admonition Parsing with --fadmonitions Source: https://github.com/mity/md4c/blob/master/test/regressions.txt Tests the parsing of admonitions (like notes) when the --fadmonitions extension is enabled. This example shows a standard note. ```markdown codeblock > [!note] > foo .
codeblock

note

foo

. --fadmonitions ``` -------------------------------- ### Lone Caret at Line Start with Whitespace Source: https://github.com/mity/md4c/blob/master/test/spec-superscripts.txt A lone caret at the start of a line followed by whitespace is treated as literal text. ```markdown ^ x ``` ```html

^ x

``` -------------------------------- ### Nested Emphasis and Strong Emphasis Source: https://github.com/mity/md4c/blob/master/test/spec.txt Provides examples of nested emphasis and strong emphasis, showcasing how different levels of emphasis are rendered. This demonstrates the parser's ability to handle complex inline formatting. ```markdown *(**foo**)* .

(foo)

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

Gomphocarpus (Gomphocarpus physocarpus, syn. Asclepias physocarpa)

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

foo "bar" foo

``` -------------------------------- ### Basic Task List - Markdown to HTML Source: https://github.com/mity/md4c/blob/master/test/spec-tasklists.txt Demonstrates a basic unordered task list in Markdown and its corresponding HTML output. Requires the MD_FLAG_TASKLISTS flag. ```markdown * [x] foo * [X] bar * [ ] baz ``` ```html
  • foo
  • bar
  • baz
``` -------------------------------- ### Basic Strikethrough Usage Source: https://github.com/mity/md4c/wiki/Markdown-Syntax:-Strikethrough Demonstrates the standard way to apply strikethrough to text. Ensure the MD_FLAG_STRIKETHROUGH flag is enabled for this to render correctly. ```markdown This sentence contains ~strikethrough'ed text~. ``` -------------------------------- ### Markdown with Mixed Footnote Definitions Source: https://github.com/mity/md4c/blob/master/test/spec-footnotes.txt Demonstrates that only referenced footnote definitions are emitted; unreferenced ones are ignored. This example uses the --ffootnotes flag. ```markdown Only[^1] referenced. [^1]: Used. [^2]: Unused. ``` ```html

Only1 referenced.

  1. Used.
``` ```text --ffootnotes ``` -------------------------------- ### Basic Strike-Through Source: https://github.com/mity/md4c/blob/master/test/spec-strikethrough.txt Demonstrates basic strike-through text enclosed in single tildes. ```markdown ~Hi~ Hello, world! ``` ```html

Hi Hello, world!

``` -------------------------------- ### Markdown.pl Blockquote Indentation Example (Markdown) Source: https://github.com/mity/md4c/blob/master/test/spec.txt Illustrates Markdown.pl's handling of indentation within a blockquote, where 'two' is parsed as a continuation paragraph. ```markdown > - one > > two ``` -------------------------------- ### Block vs. Inline Structure Precedence Source: https://github.com/mity/md4c/blob/master/test/spec.txt Presents an example that questions the precedence rules between block-level and inline-level structures, specifically with nested code spans and list items. ```markdown - `a long code span can contain a hyphen like this - and it can screw things up` ``` -------------------------------- ### Link Reference Definitions Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates how link reference definitions are parsed and used to create links. Multiple definitions can appear consecutively. ```markdown [foo]: /url bar === [foo] . ``` ```markdown [foo]: /url === [foo] . ``` ```markdown [foo]: /foo-url "foo" [bar]: /bar-url "bar" [baz]: /baz-url [foo], [bar], [baz] . ``` ```markdown [foo] > [foo]: /url . ``` -------------------------------- ### Autolink Parsing with Permissive Option Source: https://github.com/mity/md4c/blob/master/test/regressions.txt Tests how md4c parses URLs as autolinks when the --fpermissive-autolinks option is enabled. This example shows a Qt code review URL. ```markdown https://codereview.qt-project.org/c/qt/qtwayland/+/545836 .

https://codereview.qt-project.org/c/qt/qtwayland/+/545836

. --fpermissive-autolinks ``` -------------------------------- ### Markdown Intraword Emphasis Examples Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates how Markdown handles emphasis within words using asterisks, and the preferred way to avoid unwanted emphasis with underscores. ```markdown internal emphasis: foo*bar*baz no emphasis: foo_bar_baz ``` -------------------------------- ### Ordered List Start Number Validation Source: https://github.com/mity/md4c/blob/master/test/spec.txt Shows valid and invalid start numbers for ordered lists. Numbers must be nine digits or less. ```markdown 123456789. ok ``` ```markdown 1234567890. not ok ``` -------------------------------- ### Basic Unordered Task List Source: https://github.com/mity/md4c/wiki/Markdown-Syntax:-Task-Lists Demonstrates the basic syntax for an unordered task list with checked and unchecked items. ```markdown * [x] Foo * [x] Bar * [ ] Baz ``` -------------------------------- ### Markdown ATX Heading Syntax Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates basic ATX heading syntax with varying numbers of '#' characters. ```markdown ###### foo ``` -------------------------------- ### HTML Block with Block-Level Tag Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates starting an HTML block with a specific block-level tag on its own line. The content within the tag is treated as raw HTML. ```html *bar* ``` -------------------------------- ### Simple Open Tags Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates the basic structure of simple open HTML tags. ```html .

``` -------------------------------- ### Basic Image Syntax Source: https://github.com/mity/md4c/blob/master/test/spec.txt Use this syntax for a direct image link with an optional title. ```markdown ![foo](/url "title") ``` ```html

foo

``` -------------------------------- ### Parsing Image Links with Footnote Syntax Source: https://github.com/mity/md4c/blob/master/test/regressions.txt This example illustrates the parsing of an image link that includes characters typically associated with footnote syntax. It shows how md4c interprets this potentially ambiguous markdown. ```markdown ![]([^)*]() . ``` -------------------------------- ### Run Markdown Spec Tests Source: https://github.com/mity/md4c/blob/master/test/spec.txt Use this command to run conformance tests against a Markdown program using the spec file. ```bash python test/spec_tests.py --spec spec.txt --program PROGRAM ``` -------------------------------- ### Plain Text Example Source: https://github.com/mity/md4c/blob/master/test/spec.txt Characters not otherwise interpreted are parsed as plain textual content. ```text hello $.;'there ``` -------------------------------- ### Markdown Image Link with Reference Source: https://github.com/mity/md4c/blob/master/test/regressions.txt Demonstrates the conversion of a Markdown image link using reference-style definitions for both the image and the link. ```markdown [![alt][img]][link] [img]: img_url [link]: link_url .

alt

``` -------------------------------- ### Invalid Scheme Autolink Source: https://github.com/mity/md4c/blob/master/test/spec.txt A string with a colon but without a valid scheme (starting with a letter) is not an autolink. ```markdown ``` ```html

<m:abc>

``` -------------------------------- ### Illegal Tag Names Source: https://github.com/mity/md4c/blob/master/test/spec.txt Shows examples of tag names that are not parsed as HTML and are rendered as text. ```html <33> <__> .

<33> <__>

``` -------------------------------- ### Markdown Inline Link Source: https://github.com/mity/md4c/wiki/Markdown-Syntax:-Basics Demonstrates creating an inline link with text and a URL. ```markdown Inline link: [link text](http://www.example.com) ``` -------------------------------- ### Markdown Ordered Lists Source: https://github.com/mity/md4c/wiki/Markdown-Syntax:-Basics Illustrates syntax for creating ordered lists using numbered items with periods or parentheses. ```markdown 1. List item 1 2. List item 2 3. List item 3 or 1) List item 1 2) List item 2 3) List item 3 ``` -------------------------------- ### Made-up Scheme Autolink Source: https://github.com/mity/md4c/blob/master/test/spec.txt Shows an autolink with a made-up scheme. The scheme must start with an ASCII letter. ```markdown ``` ```html

made-up-scheme://foo,bar

``` -------------------------------- ### Basic Emphasis and Strong Emphasis Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates standard usage of single asterisks for emphasis and double asterisks for strong emphasis. ```Markdown *foo **bar*** ``` ```Markdown *foo**bar*** ``` -------------------------------- ### Wiki Link Not Prioritized Over Image Source: https://github.com/mity/md4c/blob/master/test/spec-wiki-links.txt Wiki-links are not prioritized over images; an image syntax starting with '!' will be treated as an image. ```markdown ![[foo]](foo.jpg) ``` -------------------------------- ### Basic Footnote Recognition and Rendering Source: https://github.com/mity/md4c/blob/master/test/spec-footnotes.txt Demonstrates the basic recognition of a footnote reference `[^1]` and its corresponding definition. The output shows the HTML structure for a superscript link and a footnote definition list. ```markdown Text with a footnote[^1]. [^1]: The footnote content. ``` ```html

Text with a footnote1.

  1. The footnote content.
``` -------------------------------- ### Uppercase Mailto Autolink Source: https://github.com/mity/md4c/blob/master/test/spec.txt Illustrates that autolinks are case-insensitive for schemes. This example uses an uppercase MAILTO scheme. ```markdown ``` ```html

MAILTO:FOO@BAR.BAZ

``` -------------------------------- ### IRC URI Autolink Source: https://github.com/mity/md4c/blob/master/test/spec.txt An example of an IRC URI autolink. The scheme can be any valid scheme followed by a colon. ```markdown ``` ```html

irc://foo.bar:2233/baz

``` -------------------------------- ### Bold Text Formatting Source: https://github.com/mity/md4c/wiki/Markdown-Syntax:-Basics Illustrates how to format text as bold using double asterisks or double underscores. ```markdown Similarly, text enclosed in **double asterisks** or __double underscores__ is recognized as a strong emphasis, and it usually gets rendered as a bold text. ``` -------------------------------- ### Empty Bullet List Item in Markdown Source: https://github.com/mity/md4c/blob/master/test/spec.txt Example of an empty bullet list item within a list. ```markdown - foo - - bar ``` ```html
  • foo
  • bar
``` -------------------------------- ### HTML Block: Comment Type 2 Source: https://github.com/mity/md4c/blob/master/test/spec.txt Example of an HTML block containing a multi-line HTML comment. ```html

okay

``` -------------------------------- ### Basic MD4C Build on Linux Source: https://github.com/mity/md4c/wiki/Building-MD4C Standard CMake build process for MD4C on Linux systems. This builds the library and the md2html utility. ```bash cd md4c mkdir build cd build cmake .. make ``` -------------------------------- ### Entity References in URL Attributes Source: https://github.com/mity/md4c/blob/master/test/spec.txt Example of entity references used within URL attributes in HTML. ```html [a](url "tit") .

[a](url "tit")

``` -------------------------------- ### Footnote with Empty First Line Source: https://github.com/mity/md4c/blob/master/test/spec-footnotes.txt Demonstrates a footnote definition that starts with an empty line, followed by continuation text. ```markdown Text[^1]. [^1]: Continued after empty first line. . ``` ```html

Text1.

  1. Continued after empty first line.
. ``` -------------------------------- ### Illegal Attribute Values Source: https://github.com/mity/md4c/blob/master/test/spec.txt Provides examples of attribute values that are not correctly quoted or formatted, leading to them not being parsed as attributes. ```html

``` -------------------------------- ### Plain Text Paragraphs Source: https://github.com/mity/md4c/wiki/Markdown-Syntax:-Basics Demonstrates how to format plain text into paragraphs. Consecutive lines form a single paragraph, and blank lines separate paragraphs. ```markdown This is first paragraph. And this is second paragraph. ``` -------------------------------- ### Shortcut Image Reference with Inline Formatting Source: https://github.com/mity/md4c/blob/master/test/spec.txt Supports inline formatting within the description for shortcut image references. ```markdown ![*foo* bar] [*foo* bar]: /url "title" ``` ```html

foo bar

``` -------------------------------- ### HTML Block: CDATA Type 5 Source: https://github.com/mity/md4c/blob/master/test/spec.txt Example of an HTML block containing CDATA content, which is treated as raw data. ```html

okay

``` -------------------------------- ### Localhost Autolink Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates an autolink for localhost. This is parsed as a URI if it follows the scheme and path rules. ```markdown ``` ```html

localhost:5001/foo

``` -------------------------------- ### Mixed Unordered List with Task Items Source: https://github.com/mity/md4c/wiki/Markdown-Syntax:-Task-Lists Shows how to mix ordinary list items with task list items in an unordered list. ```markdown - [x] Marked item - [ ] Unmarked item - Ordinary (non-task) item ``` -------------------------------- ### Spoiler Span at Paragraph Boundaries Source: https://github.com/mity/md4c/blob/master/test/spec-spoilers.txt A spoiler span can encompass the entire paragraph content, from start to finish. This requires the `MD_FLAG_SPOILERS` flag. ```markdown ||entire paragraph is a spoiler|| ``` ```html

entire paragraph is a spoiler

``` -------------------------------- ### Missing Whitespace Between Attributes Source: https://github.com/mity/md4c/blob/master/test/spec.txt Shows an example where missing whitespace between an attribute value and the next attribute name causes parsing issues. ```html .

<a href='bar'title=title>

``` -------------------------------- ### Email Autolink Example Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates a valid email autolink. The email address is enclosed in angle brackets and converted to a 'mailto:' link. ```markdown ``` ```html

foo@bar.example.com

``` -------------------------------- ### Wiki Link with Label Source: https://github.com/mity/md4c/blob/master/test/spec-wiki-links.txt Demonstrates a wiki link with a target and a custom label. The target can be up to 100 characters. ```Markdown [[1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890|foo]] ``` -------------------------------- ### Invalid Link Spacing Source: https://github.com/mity/md4c/blob/master/test/spec.txt Shows an example where spacing between the link text and the opening parenthesis is not allowed, resulting in the text not being recognized as a link. ```markdown [link] (/uri) .

[link] (/uri)

``` -------------------------------- ### Rule 11 Examples Source: https://github.com/mity/md4c/blob/master/test/spec.txt Illustrates Rule 11, where excess literal asterisks appear outside emphasis when delimiters do not match evenly. ```Markdown foo *** ``` ```Markdown foo *\** ``` ```Markdown foo *_* ``` ```Markdown foo ***** ``` ```Markdown foo **\*** ``` ```Markdown foo **_** ``` ```Markdown **foo* ``` ```Markdown *foo** ``` ```Markdown ***foo** ``` ```Markdown ****foo* ``` -------------------------------- ### Tilde Expansion in Paths Source: https://github.com/mity/md4c/blob/master/test/regressions.txt Demonstrates handling of tilde (~) character in paths, both with and without quotes. This test case is related to issue 242. ```markdown copy ~user1/file to ~user2/file copy "~user1/file" to "~user2/file" .

copy ~user1/file to ~user2/file

copy "~user1/file" to "~user2/file"

. --fstrikethrough ``` -------------------------------- ### Reference Link Parsing with Defined Label Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates how `[foo][bar]` is parsed as a reference link when `[bar]` is defined. The output shows the HTML rendering of the linked text. ```markdown [foo][bar][baz] [baz]: /url1 [bar]: /url2 . ``` ```html

foobaz

``` -------------------------------- ### Basic Underline with MD_FLAG_UNDERLINE Source: https://github.com/mity/md4c/blob/master/test/spec-underline.txt When MD_FLAG_UNDERLINE is enabled, a single underscore denotes an underlined span. This example shows a simple underlined word. ```markdown _foo_ ``` ```html

foo

``` ```text --funderline ``` -------------------------------- ### Tight List with Code Block Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates a tight list where blank lines within a code block do not affect list looseness. ```markdown - a - ``` b ``` - c ``` ```html
  • a
  • b
    
    
    
  • c
``` -------------------------------- ### Markdown with Superscripts and Footnotes Source: https://github.com/mity/md4c/blob/master/test/spec-footnotes.txt Illustrates the interaction between superscript spans and footnote references. This example uses the --ffootnotes and --fsuperscripts flags. ```markdown Sup ^text^ and note[^1]. [^1]: A note. ``` ```html

Sup text and note1.

  1. A note.
``` ```text --ffootnotes --fsuperscripts ``` -------------------------------- ### Image with Empty Reference Source: https://github.com/mity/md4c/blob/master/test/spec.txt Use this syntax when the image reference label is the same as the description text. ```markdown ![foo *bar*][] [foo *bar*]: train.jpg "train & tracks" ``` ```html

foo bar

``` -------------------------------- ### Relative Path Autolink Source: https://github.com/mity/md4c/blob/master/test/spec.txt Example of an autolink that appears to use a relative path component. These are treated as valid URIs if they follow the scheme rules. ```markdown ``` ```html

https://../

``` -------------------------------- ### MD4C Callback Sequence Pseudocode Source: https://github.com/mity/md4c/wiki/Embedding-Parser:-Calling-MD4C Illustrates the order of callback calls for nested markdown elements like lists, strong text, and links. Useful for understanding event flow. ```pseudocode enter_block(MD_BLOCK_DOC) enter_block(MD_BLOCK_UL) enter_block(MD_BLOCK_LI) text("foo ") enter_span(MD_SPAN_STRONG) text("bar ") enter_span(MD_SPAN_A) // target URL provided as an attribute of the detailed structure text("link") leave_span(MD_SPAN_A) text(" baz") leave_span(MD_SPAN_STRONG) leave_block(MD_BLOCK_LI) leave_block(MD_BLOCK_UL) leave_block(MD_BLOCK_DOC) ``` -------------------------------- ### Lazy Continuation Lines in Nested Markdown Structures Source: https://github.com/mity/md4c/blob/master/test/spec.txt Example of lazy continuation lines applied to nested Markdown structures like blockquotes. ```markdown > 1. > Blockquote continued here. ``` ```html
  1. Blockquote continued here.

``` -------------------------------- ### Potential Unintended List Capture Source: https://github.com/mity/md4c/blob/master/test/spec.txt Highlights a case where a list starting with '1' might still be unintentionally captured, even when intended as part of a paragraph. ```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.
``` -------------------------------- ### Preventing Unwanted List Capture with Numerals Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates how only lists starting with '1' can interrupt paragraphs to avoid spurious list captures from hard-wrapped numerals. ```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.

``` -------------------------------- ### Nested Tight List Source: https://github.com/mity/md4c/blob/master/test/spec.txt Illustrates a tight list with a nested tight sublist. ```markdown - a - b ``` ```html
  • a
    • b
``` -------------------------------- ### Invalid Wiki Link: Empty Destination with Label Source: https://github.com/mity/md4c/blob/master/test/spec-wiki-links.txt A wiki-link destination cannot be empty, even if a label is provided. This will be rendered as plain text. ```markdown [[|foo]] ``` -------------------------------- ### Markdown List Item with Leading Blank Line Source: https://github.com/mity/md4c/blob/master/test/spec.txt Illustrates a list item starting with a blank line, where subsequent content is not part of the list item. ```markdown - foo ``` ```html

foo

``` -------------------------------- ### Markdown Reference Link Source: https://github.com/mity/md4c/wiki/Markdown-Syntax:-Basics Shows how to create a link using a reference definition, separating the link text from its URL. ```markdown Or link using a reference definition: [Reference link][1] [1]: http://www.example.com ``` -------------------------------- ### Block Quote with List Item Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates how omitting the block quote marker before a list item terminates the block quote and starts a new list. ```markdown > - foo - bar ``` ```html
  • foo
  • bar
``` -------------------------------- ### HTML Block with Closing Tag Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates an HTML block starting with a closing tag. Markdown treats this as a raw HTML block, preserving the content. ```html *bar* ``` -------------------------------- ### Markdown Headings Source: https://github.com/mity/md4c/wiki/Markdown-Syntax:-Basics Shows the syntax for creating headings of levels 1 through 6 using hash symbols, and alternative underline methods for levels 1 and 2. ```markdown # Header level 1 ## Header level 2 ### Header level 3 #### Header level 4 ##### Header level 5 ###### Header level 6 First two header level may alternatively be written using an underline: Header level 1 ============== Header level 2 -------------- ``` -------------------------------- ### Ordered List with Task Items Source: https://github.com/mity/md4c/wiki/Markdown-Syntax:-Task-Lists Illustrates the use of task list items within an ordered Markdown list. ```markdown 1. [x] Foo 2. [x] Bar 3. [ ] Baz ``` -------------------------------- ### Whitespace Rule: Tilde at line start Source: https://github.com/mity/md4c/blob/master/test/spec-subscripts.txt A tilde at the beginning of a line can open a subscript span, but it cannot close one. This behavior is specific to line-initial tildes. ```markdown ~2~ ``` -------------------------------- ### Markdown with Spoilers and Footnotes Source: https://github.com/mity/md4c/blob/master/test/spec-footnotes.txt Demonstrates how spoiler spans and footnote references are rendered together. This example uses the --ffootnotes and --fspoilers flags. ```markdown Spoiler ||hidden|| and note[^1]. [^1]: Note. ``` ```html

Spoiler hidden and note1.

  1. Note.
``` ```text --ffootnotes --fspoilers ``` -------------------------------- ### Ordered Task List - Markdown to HTML Source: https://github.com/mity/md4c/blob/master/test/spec-tasklists.txt Shows an ordered task list in Markdown and its HTML representation. Ensure MD_FLAG_TASKLISTS is enabled. ```markdown 1. [x] foo 2. [X] bar 3. [ ] baz ``` ```html
  1. foo
  2. bar
  3. baz
```