Skip to content

Backslashes appear in output when escaping inline code in a table cell #583

@pjeby

Description

@pjeby

Subject of the issue

When using inline code in a table cell, it's necessary to backslash-escape pipe characters. On Github, the backslashes are removed before parsing the table cell contents, so that they aren't included in the output. Remark doesn't do this, so there is no way to put a pipe character inside inline code in a table cell without at least one spurious backslash being passed through to the output.

(Note that this is not the same issue as #465, which is about what happens if you don't escape the pipe character.)

Your environment

Steps to reproduce

Process this markdown with the remark-gfm extension:

| Ways of Reading Stdout         |     Linux | OS X (bash 3.2) | Windows  |
| ------------------------------ | --------: | --------------: | -------: |
| `[[ ${spork-} ]] \|\| spork ...` |   40433/s |         33840/s |  17667/s |
| Total Performance Improvement  |     34.1x |           24.7x |   271.8x |

Expected behavior

The markdown should be parsed as on Github, dropping the backslashes from the inline code, i.e:

Ways of Reading Stdout Linux OS X (bash 3.2) Windows
[[ ${spork-} ]] || spork ... 40433/s 33840/s 17667/s
Total Performance Improvement 34.1x 24.7x 271.8x

Actual behavior

When parsed with remark 9, neither backslash is removed. When parsed with remark 13, the second and all subsequent backslashed pipe characters in the cell are correctly removed, but the first backslash is passed through unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    👀 no/externalThis makes more sense somewhere else

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions