Backslash treatment inside backquotes is different between Jekyll and Markdown

It appears that Jekyll’s markdown-to-HTML converter retains backslashes inside backquotes. But regular markdown (e.g. at interprets them.

For example, here is a raw markdown table definition. The “Type” cell contains the string “string \| undefined”. Note that there is a backslash before the vertical bar in the unprocessed markdown:

| Property | Type                   |
| -------- | ---------------------- |
| `pdfid`  |  `string \| undefined` |

This forum’s markdown viewer removes the backslash:

Property Type
pdfid string | undefined

The same thing happens when viewed by the viewer. (I cannot paste an image of it here; as a new user, I’m limited to pasting only one image in my first post. But you can go to that site and paste the raw table definition into the left pane, and see the result.)

But when Jekyll converts it, the type of “pdfid” looks like this:

I think the backslash should be interpreted, even inside backquotes. Is this a bug in Jekyll, or in some markdown converter that Jekyll uses?

This non-sensical behavior of pipe-code-spans inside tables is clearly a bug, but it has been formalized/frozen in the Github-Flavored Markdown spec. Unfortunately, Jekyll’s default Markdown processor, Kramdown, tries to emulate all the quirks of GFM (via parser-gfm), but it misses this particular bug.

One immediate workaround is to use the CommonMark processor, which does appear to emulate the bug correctly.

1 Like

Thanks, Chuck. I switched to CommonMark, and the backslashes are gone. But now mermaid diagrams don’t draw! Instead, I get


The mermaid diagram is written as a code block, introduced with three backticks followed by the text “mermaid”. Kramdown displayed it properly.

I will investigate that issue separately, since it’s not a Jekyll problem per se. I consider this thread solved.

1 Like