### 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
one
two
one
two
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``` -------------------------------- ### 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. ```htmlFoo
bar baz
bar
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; abcdef0; &ThisIsNotDefined; &hi?; . ``` ```html  &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] . ``` ```htmlfoo 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 1 | Column 2 |
|---|---|
| foo | bar |
| baz | qux |
| quux | quuz |
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. . ``` ```htmlA paragraph with two lines.
indented code
``` -------------------------------- ### 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. ```htmlA block quote.
& © Æ Ď ¾ ℋ ⅆ ∲ ≧̸
``` -------------------------------- ### 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&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 ``` ```htmlhttps://example.com http://example.com ftp://example.com
ssh://example.com
``` ```markdown --fpermissive-url-autolinks ``` ```markdown https://example.com/images/branding/logo_272x92.png ``` ```htmlhttps://example.com/images/branding/logo_272x92.png
``` ```markdown --fpermissive-url-autolinks ``` ```markdown https://www.google.com/search?q=md4c+markdown ``` ```htmlhttps://www.google.com/search?q=md4c+markdown
``` ```markdown --fpermissive-url-autolinks ``` ```markdown https://example.com#fragment ``` ```html ``` ```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(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 withTag Source: https://github.com/mity/md4c/blob/master/test/spec.txt Demonstrates an HTML block where atag is nested. The HTML block is terminated by a blank line, and the content withinis treated as raw HTML. ```markdown
**Hello**, _world_. |
**Hello**, |
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. ``` ```htmlA paragraph with two lines.
indented code
A block quote.
bar
baz
xx
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 ](/url2) ``` ```htmlcodeblock
note
foo
^ 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 ``` ```htmlOnly1 referenced.
Hi Hello, world!
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<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. ```markdownText with a footnote1.
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. . ``` ```htmlText1.
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<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[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 ``` -------------------------------- ### 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_ ``` ```htmlfoo
``` ```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 ``` ```htmlb
Sup text and note1.

``` -------------------------------- ### 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
Blockquote continued here.
The number of windows in my house is
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 ``` ```htmlfoo
``` -------------------------------- ### 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
Spoiler