GFM enables the table extension, where an additional leaf block type is available.
A table is an arrangement of data with rows and columns, consisting of a single header row, a delimiter row separating the header from the data, and zero or more data rows.
Each row consists of cells containing arbitrary text, in which inlines are parsed, separated by pipes (|). A leading and trailing pipe is also recommended for clarity of reading, and if there’s otherwise parsing ambiguity. Spaces between pipes and cell content are trimmed. Block-level elements cannot be inserted in a table.
The delimiter row consists of cells whose only content are hyphens (-), and optionally, a leading or trailing colon (:), or both, to indicate left, right, or center alignment respectively.
| foo | bar |
| --- | --- |
| baz | bim |
| foo | bar |
|---|---|
| baz | bim |
Cells in one column don’t need to match length, though it’s easier to read if they are. Likewise, use of leading and trailing pipes may be inconsistent:
| abc | defghi |
:-: | -----------:
bar | baz
| abc | defghi |
|---|---|
| bar | baz |
Include a pipe in a cell’s content by escaping it, including inside other inline spans:
| f\|oo |
| ------ |
| b `\|` az |
| b **\|** im |
| f|oo |
|---|
b | az |
| b | im |
The table is broken at the first empty line, or beginning of another block-level structure:
| abc | def |
| --- | --- |
| bar | baz |
> bar
| abc | def |
|---|---|
| bar | baz |
bar
| abc | def |
| --- | --- |
| bar | baz |
bar
bar
| abc | def |
|---|---|
| bar | baz |
| bar |
bar
The header row must match the delimiter row in the number of cells. If not, a table will not be recognized
| abc | def |
| --- |
| bar |
| abc | def | | --- | | bar |
The remainder of the table’s rows may vary in the number of cells. If there are a number of cells fewer than the number of cells in the header row, empty cells are inserted. If there are greater, the excess is ignored
| abc | def |
| --- | --- |
| bar |
| bar | baz | boo |
| abc | def |
|---|---|
| bar | |
| bar | baz |
If there are no rows in the body, no <tbody> is generated in HTML output
| abc | def |
| --- | --- |
| abc | def |
|---|
GFM enables the tasklist extension, where an additional processing step is performed on list items.
A task list item is a list item where the first block in it is a paragraph which begins with a task list item marker and at least one whitespace character before any other content.
A task list item marker consists of an optional number of spaces, a left bracket ([), either a whitespace character or the letter x in either lowercase or uppercase, and then a right bracket (]).
When rendered, the task list item marker is replaced with a semantic checkbox element; in an HTML output, this would be an element.
If the character between the brackets is a whitespace character, the checkbox is unchecked. Otherwise, the checkbox is checked.
This spec does not define how the checkbox elements are interacted with: in practice, implementors are free to render the checkboxes as disabled or inmutable elements, or they may dynamically handle dynamic interactions (i.e. checking, unchecking) in the final rendered document.
- [ ] foo
- [x] bar
- foo
- bar
Task lists can be arbitrarily nested
- [x] foo
- [ ] bar
- [x] baz
- [ ] bim
- foo
- bar
- baz
- bim
GFM enables the strikethrough extension, where an additional emphasis type is available.
Strikethrough text is any text wrapped in two tildes (~).
~~Hi~~ Hello, world!
Hi Hello, world!
As with regular emphasis delimiters, a new paragraph will cause strikethrough parsing to cease.
This ~~has a
new paragraph~~.
This ~~has a
new paragraph~~.
GFM enables the autolink extension, where autolinks will be recognised in a greater number of conditions.
Autolinks can also be constructed without requiring the use of < and to > to delimit them, although they will be recognized under a smaller set of circumstances. All such recognized autolinks can only come at the beginning of a line, after whitespace, or any of the delimiting characters *, _, ~, and (.
An extended www autolink will be recognized when the text www. is found followed by a valid domain. A valid domain consists of segments of alphanumeric characters, underscores (_) and hyphens (-) separated by periods (.). There must be at least one period, and no underscores may be present in the last two segments of the domain.
The scheme http will be inserted automatically
www.commonmark.org
After a valid domain, zero or more non-space non-< characters may follow
Visit www.commonmark.org/help for more information.
Visit www.commonmark.org/help for more information.
We then apply extended autolink path validation as follows
Trailing punctuation (specifically, ?, !, ., ,, :, *, _, and ~) will not be considered part of the autolink, though they may be included in the interior of the link:
Visit www.commonmark.org.
Visit www.commonmark.org/a.b.
Visit www.commonmark.org.
Visit www.commonmark.org/a.b.
When an autolink ends in ), we scan the entire autolink for the total number of parentheses. If there is a greater number of closing parentheses than opening ones, we don’t consider the unmatched trailing parentheses part of the autolink, in order to facilitate including an autolink inside a parenthesis:
www.google.com/search?q=Markup+(business)
www.google.com/search?q=Markup+(business)))
(www.google.com/search?q=Markup+(business))
(www.google.com/search?q=Markup+(business)
www.google.com/search?q=Markup+(business)
www.google.com/search?q=Markup+(business)))
(www.google.com/search?q=Markup+(business))
(www.google.com/search?q=Markup+(business)
This check is only done when the link ends in a closing parentheses ), so if the only parentheses are in the interior of the autolink, no special rules are applied:
www.google.com/search?q=(business))+ok
www.google.com/search?q=(business))+ok
If an autolink ends in a semicolon (;), we check to see if it appears to resemble an entity reference; if the preceding text is & followed by one or more alphanumeric characters. If so, it is excluded from the autolink
www.google.com/search?q=commonmark&hl=en
www.google.com/search?q=commonmark&hl;
www.google.com/search?q=commonmark&hl=en
www.google.com/search?q=commonmark&hl;
< immediately ends an autolink
www.commonmark.org/he<lp
An extended url autolink will be recognised when one of the schemes http://, or https://, followed by a valid domain, then zero or more non-space non-< characters according to extended autolink path validation
http://commonmark.org
(Visit https://encrypted.google.com/search?q=Markup+(business))
(Visit https://encrypted.google.com/search?q=Markup+(business))
An extended email autolink will be recognised when an email address is recognised within any text node. Email addresses are recognised according to the following rules
One ore more characters which are alphanumeric, or ., -, _, or +.An @ symbol.One or more characters which are alphanumeric, or - or _, separated by periods (.). There must be at least one period. The last character must not be one of - or _.
The scheme mailto: will automatically be added to the generated link
foo@bar.baz
+ can occur before the @, but not after.
hello@mail+xyz.example isn't valid, but hello+xyz@mail.example is.
hello@mail+xyz.example isn't valid, but hello+xyz@mail.example is.
., -, and _ can occur on both sides of the @, but only . may occur at the end of the email address, in which case it will not be considered part of the address
a.b-c_d@a.b
a.b-c_d@a.b.
a.b-c_d@a.b-
a.b-c_d@a.b_
a.b-c_d@a.b-
a.b-c_d@a.b_
GFM enables the tagfilter extension, where the following HTML tags will be filtered when rendering HTML output:
<title><textarea><style><xmp><iframe><noembed><noframes><script><plaintext>
Filtering is done by replacing the leading < with the entity <. These tags are chosen in particular as they change how HTML is interpreted in a way unique to them (i.e. nested HTML is interpreted differently), and this is usually undesireable in the context of other rendered Markdown content.
All other HTML tags are left untouched.
<strong> <title> <style> <em>
<blockquote>
<xmp> is disallowed. <XMP> is also disallowed.
</blockquote>
<title> <style>
<xmp> is disallowed. <XMP> is also disallowed.***