Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Macro Definitions are block elements which can contain any markdown element
Macro definitions start with a line of
>>>macroName where macro name consists of a-z, A-Z,
0-9, - or _ and is terminated by a line with
<<<. All text between these lines is parsed as
markdown blocks. Macro definition blocks can only be defined at the document level without any
indentation and are not rendered in the output.
Macro reference is an inline element of the form
<<<macroName>>> and is replaced by the macro
definition rendered content, including any block elements. This implies that it is possible to
include block elements where they are normally not possible using plain markdown.
When a macro definition contains a single paragraph node then it will be rendered as text
contained by the paragraph without the
<p></p> wrapper to allow plain text to be rendered as
an inline text.
If a macro reference contains an undefined
macroName then the node will be rendered as plain
text consisting of
Recursive macros are resolved by stopping macro expansion on the first macro reference which refers to a macro definition which is currently being expanded. The first recursive macro reference will result in no expansion.
Paragraph with a <<<simpleMacro>>>. >>>simpleMacro **bold** text <<<
Is equivalent to:
Paragraph with a **bold** text.
Paragraph with a <<<blockMacro>>> inserted. >>>blockMacro 1. item 1 1. item 2 <<<
<p>Paragraph with a <ol> <li>item 1</li> <li>item 2</li> </ol> inserted.</p>
Paragraph with a
- item 1
- item 2
Adding complex content to tables is possible with macros.
| Complex | Data | |-------------|--------------| | <<<macro>>> | <<<macro2>>> | >>>macro 1. Item 1 2. Item 2 3. Item 3 | Column 1 | Column 2 | |----------|----------| | a | b | | c | d | > Block Quote and more <<< >>>macro2 - Item 1 - Item 2 - Item 3 <<<
<table> <thead> <tr><th> Complex </th><th> Data </th></tr> </thead> <tbody> <tr><td> <ol> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ol> <table> <thead> <tr><th> Column 1 </th><th> Column 2 </th></tr> </thead> <tbody> <tr><td> a </td><td> b </td></tr> <tr><td> c </td><td> d </td></tr> </tbody> </table> <blockquote> <p>Block Quote and more</p> </blockquote> </td><td> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul> </td></tr> </tbody> </table>
To result in: