Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

| in backticks breaks Table Syntax  #549

Closed

Description

@mDuo13

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>'

Activity

  1. waylan commented on Feb 28, 2017

    @waylan
    Member

    We made some recent changes addressing this specific issue (see #530 which is available in 2.6.8). Which version of Python-Markdown are you using?

  2. mDuo13 commented on Feb 28, 2017

    @mDuo13
    Author

    Ah, yes, I'm only on 2.6.2. Upgrading to 2.6.8 fixed the issue. Sorry for the dupe!

  3. facelessuser commented on Feb 28, 2017

    @facelessuser
    Collaborator

    That looks like an old version. I get this on the current:

    '<table>\n<thead>\n<tr>\n<th>Title</th>\n<th>Row</th>\n</tr>\n</thead>\n<tb
    \n<tr>\n<td><code>a1|a2</code></td>\n<td>b</td>\n</tr>\n</tbody>\n</table>'
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions