-
Notifications
You must be signed in to change notification settings - Fork 886
Description
GitHub-Flavored Markdown, PHP Markdown Extra, and the Python Markdown Extra extension all support table syntax, which depends on the bar character (|
) to delineate columns. However, only Python's parser does not nicely handle bar characters in code font
(backticks) even within tables. It splits a column on any bar character, even if it's part of a code-font sequence. (This causes it to drop the code syntax and any content from extraneous columns, as well.)
A better behavior would be to match the GFM and PHP Markdown Extra behavior, which doesn't split tables on bars that are inside backticks (code-font block).
| Title | Row |
|---|---|
| `a1|a2` | b |
GitHub rendering (PHP Markdown Extra does the same):
Title | Row |
---|---|
`a1 | a2` |
Python's rendering looks a little more like this:
Title | Row |
---|---|
`a1 | a2` |
Actual output from the interpreter:
>>> s2 = """
... | Title | Row |
... |---|---|
... | `a1|a2` | b |
...
... """
>>>
>>> markdown.markdown(s2, ['markdown.extensions.extra'])
'<table>\n<thead>\n<tr>\n<th>Title</th>\n<th>Row</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>`a1</td>\n<td>a2`</td>\n</tr>\n</tbody>\n</table>'