# Markdown Syntax
## Block Formats
Formats that apply to one or more lines.
### Paragraph
Any contiguous set of lines not formatted like one of the other formats below is
treated as a paragraph. Paragraphs are separated by double blank lines.
```markdown
Lorem ipsum dolor
sit amet.
New paragraph begins.
```
>
Lorem ipsum dolor sit amet.
>
> New paragraph begins.
Class:
* `MDParagraphReader`
### Headers
Headers are marked with one or more leading hashes.
```markdown
# Header 1 has one hash
## Header 2 has two hashes
###### Up to header 6
## Optional Matched Hashes At The End ##
```
> Header 1 has one hash
>
> Header 2 has two hashes
>
> Up to header 6
>
> Optional Matched Hashes At The End
Alternately, H1 and H2 can be marked with underlines.
```markdown
Header 1 underlined with equals
===============================
Header 2 with hyphens. Number of underline chars doesn't matter
---
```
> Header 1 underlined with equals
>
> Header 2 with hyphens. Number of underline chars doesn't matter
Classes:
* `MDUnderlinedHeadingReader`
* `MDHashHeadingReader`
### Lists
Unordered lists are bulleted with an asterisk, plus, or hyphen and space.
```markdown
* Item
+ Any of these
- Work as bullets
```
>
> - Item
> - Any of these
> - Work as bullets
>
Lists can be nested with one or more spaces below an item.
```markdown
* Item
* Sublist
* Sublist
* Item
```
>
Ordered lists start with a number, period, and space.
```markdown
1. Item
2. Item
3. Item
```
>
> - Item
> - Item
> - Item
>
Again, they can be nested.
```markdown
1. Item
1. Subitem
2. Subitem
2. Item
```
>
> - Item
> - Subitem
> - Subitem
>
> - Item
>
The first number dictates where the numbering begins. The numbers on the other
items are ignored and incremented by one.
```markdown
5. Rendered as a 5
1. Rendered as a 6
1. Rendered as a 7
```
>
> - Rendered as a 5
> - Rendered as a 6
> - Rendered as a 7
>
Numbering every item with `1.` can
save you the hassle of renumbering items when reordering them.
Classes:
* `MDUnorderedListReader`
* `MDOrderedListReader`
### Blockquote
Blockquotes enclose lengthy quoted content in an indented block.
```markdown
Lorem Ipsum said:
> Dolor sit amet
> adipiscing.
```
> Lorem Ipsum said:
>
> Dolor sit amet adipiscing.
Class:
* `MDBlockQuoteReader`
### Code Blocks
Blocks of preformatted code can be enclosed in triple backticks.
```markdown
```
function foo() {
return 'bar';
}
```
```
>
> function foo() {
> return 'bar';
> }
>
Alternately, lines indented by at least four spaces or a tab character will be
interpreted as code blocks.
```markdown
function foo() {
return 'bar';
}
```
>
> function foo() {
> return 'bar';
> }
>
Classes:
* `MDFencedCodeBlockReader`
* `MDIndentedCodeBlockReader`
### Horizontal Rule
Horizontal divider lines are written as 3 or more hyphens or asterisks on a line
by themselves, with or without interstitial whitespace.
```markdown
---
***
- - - -
* * * * * * *
```
>
>
>
>
>
>
>
Class:
* `MDHorizontalRuleReader`
### Tables
Tables consist of one header row and any number of body rows
```markdown
Header | Row | Here
---------|-----|-----
Cell | 123 | xyz
Next row | 543 | abc
```
>
>
> | Header | Row | Here |
>
>
> | Cell | 123 | xyz |
> | Next row | 543 | abc |
>
>
The pipe characters do not have to line up.
Rows can optionally have leading and/or trailing pipes. This is required for a
single column table.
```markdown
| One column |
| --- |
| 123 |
| 234 |
```
>
>
> | One column |
>
>
> | 123 |
> | 234 |
>
>
Columns can be right, center, or left aligned with colons in the divider line.
```markdown
| Left | Center | Right |
| :--- | :----: | ----: |
| 1 | 2 | 3 |
```
>
>
> | Left | Center | Right |
>
>
> | 1 | 2 | 3 |
>
>
Tables can optionally support simple [spreadsheet expressions](spreadsheet.md)
by adding the spreadsheet block reader when configuring a parser.
Classes:
* `MDTableReader`
* `MDSpreadsheetReader`
### Definition List
Definition lists show terms with definitions below them. Useful for glossaries.
```markdown
term
: definition of term
another
: definition of another
: alternate definition of another
```
>
> - term
> - definition of term
> - another
> - definition of another
> - alternate definition of another
>
Class:
* `MDDefinitionListReader`
### Abbreviation Definition
Abbreviations can be defined anywhere in the document. Anywhere that abbreviation
appears in the document will have a mouseover title showing the expanded
definition. The definition is plaintext only (no markdown).
```markdown
Always remember, ABC.
*[ABC]: Always Be Closing
```
> Always remember, ABC.
Class:
* `MDAbbreviationReader`
### CSS Modifiers
Many block structures can be modified with CSS classes, IDs, or other simple
HTML attributes inside curly braces.
```markdown
## Header with a CSS class {.mycssclass}
--- {#mydividerid}
| Table | {style=color:green;}
|---|
|123|
## Header with multiple modifiers {.linkclass #linkid lang=en}
```
> Header with a CSS class
>
>
>
>
>
> Header with multiple modifiers
Class:
* `MDModifierReader`
## Inline Formats
Formats that apply within a block to style runs of words or inject other content within text.
To prevent a punctuation character from being interpreted as formatting syntax, prefix the character with a backslash (`\\`). E.g. `3\*4\*2=24` is rendered as "3\*4\*2=24", not as "3*4*2=24".
### Strong
Text can be marked as bold by enclosing it in double asterisks.
```markdown
Some **bold** text. Can also use __underscores__ (unless underlining is enabled).
```
> Some bold text. Can also use underscores (unless underlining is enabled).
Class:
* `MDStrongReader`
### Emphasis
Text can be marked as italic by enclosing it in single underscores or single asterisks.
```markdown
Some _italic_ text. Can also use *asterisks*.
```
> Some italic text. Can also use asterisks.
Class:
* `MDEmphasisReader`
### Strikethrough
Text can be stricken out using tildes, singly or in pairs. If subscript is
enabled then only double tildes can be used.
```markdown
Not ~~this text~~. Not ~this text~ either.
```
> Not this text. Not this text either.
Class:
* `MDStrikethroughReader`
### Underline
Underline is denoted with double underscores. If this reader is in use,
"strong" styling can only be done with double asterisks.
```markdown
Some __underlined__ text.
```
> Some underlined text.
Class:
* `MDUnderlineReader`
### Highlighting
Highlighting is done with pairs of equals around text.
```markdown
Some ==highlighted== text.
```
> Some highlighted text.
Class:
* `MDHighlightReader`
### Code
Words can be rendered in monospace font using single backticks.
```markdown
The name of the function is `foo()`.
```
> The name of the function is foo().
Class:
* `MDCodeSpanReader`
### Subscript
Subscript is denoted with single tildes around the text.
```markdown
The formula for water is H~2~O.
```
> The formula for water is H2O.
Class:
* `MDSubscriptReader`
### Superscript
Superscript is represented with caret characters around the text.
```markdown
Einstein's equation E=mc^2^.
```
> Einstein's equation is E=mc2.
Class:
* `MDSuperscriptReader`
### Link
Linking to a document is done with marked text and a URL.
```markdown
Click [here](page.html).
```
> Click here.
An optional mouseover title can be added to the link after the URL.
```markdown
Click [here](page.html "Goes to a neat page").
```
> Click here.
Repetitive or lengthy URLs can be referenced out and defined elsewhere in the document.
```markdown
Click [here][foo] or [here][foo] or [even here][foo] to go to the same place.
[foo]: page.html "Optional title"
```
> Click here or
> here or
> even here to go to the same place.
Lastly, to make a link with the URL as the link text, you can use angle brackets.
```markdown
Go visit .
```
> Go visit page.html.
Classes:
* `MDLinkReader`
* `MDReferencedLinkReader`
### Image
An image is similar to link syntax with an exclamation in front. Instead of clickable link text, the text is alt text for the image.
```markdown

```
>
Images also support title attributes.
```markdown

```
>
Images also support referenced URLs.
```markdown
![alt text][foo]
[foo]: https://picsum.photos/100/75
```
>
Images can be made clickable by enclosing them in a link where the link text goes.
```markdown
[](page.html)
```
>
Classes:
* `MDImageReader`
* `MDReferencedImageReader`
### Footnote
Footnotes can be inserted into text. The text of the footnotes is added to the bottom of the document, regardless of where they're defined.
```markdown
Lorem ipsum[^1] dolor sit[^2] amet.
[^1]: Further information here
[^2]: See _Interesting Book_, pg 213
```
> Lorem ipsum dolor sit amet.
>
>
>
> - Further information here ↩︎
> - See Interesting Book, pg 213 ↩︎
>
Class:
* `MDFootnoteReader`
### HTML Tags
HTML tags can be used verbatim where markdown is too limiting.
The allowable tags, attributes, and CSS are governed by `Markdown.tagFilter`
which is a configurable `MDHTMLFilter` object. Anything not excplicitly included
in the filter is rendered as plain text or stripped from the output. For example,
Javascript event hooks are disallowed, as are scripts, stylesheets, and iframes,
among many others.
Class:
* `MDHTMLTagReader`