Pipe character is not properly escaped in table

Steps to reproduce

  • Install Obsidian from direct download on their website as I did a day ago ! (awesome tool btw, keep up the good work)
  • Create a note and insert the code bellow
| col1 | col2 |
| --- | --- |
| `<h2>{{ value \| lowercase }}</h2>` |  I've escape the pipe that is inside the code block because I am in a table. |

Expected result

On GitHub flavored Markdown, or even in this web markdown editor, the backslash used to escape the pipe in the code block is not rendered.

col1 col2
<h2>{{ value | lowercase }}</h2> I’ve escape the pipe that is inside the code block because I am in a table.

Actual result

Result in obsidian:

as you can see, the escape character is visually rendered.


  • Operating system: Windows Version 10.0.19044 Build 19044
  • Debug info:
    Obsidian version: v1.0.3
    Installer version: v1.0.3
    Operating system: Windows 10 Home 10.0.19044
    Login status: not logged in
    Insider build toggle: off
    Live preview: on
    Legacy editor: off
    Base theme: dark
    Community theme: none
    Snippets enabled: 0
    Restricted mode: off
    Plugins installed: 1
    Plugins enabled: 0


Additional information

Of course, if you don’t escape the pipe in the code block then the whole table is broken. For me anything in a code block is code and should not interact with Markdown syntax. For instance, a # in a python code block would not create a title so I find it quite silly that you have a different behavior for pipes in code blocks that are in a table.

But I guess this is more a Markdown subject than an Obsidian one. But for sure \| should be rendered | in my case.

I’ve tried to look in forum before posting, but maybe I missed it… In that case I apologize in advance.

As a workaround, you can use another character (such as a light vertical) instead of a vertical line / pipe.

col1 col2
<h2>{{ value │ lowercase }}</h2> I’ve escaped the pipe that is inside the code block because I am in a table.
| col1 | col2 | 
| --- | --- | 
| `<h2>{{ value │ lowercase }}</h2>` | I've escaped the pipe that is inside the code block because I am in a table. |

I think this is not a bug but rather a feature request, especially as - as you wrightly stated - it is a markdown issue.

You can use a workaround, however:

Instead of backticks, place your code in html markup (<code></code>) and replace the pipe by &#124. This will show you the desired result without breaking the table.

Thanks for that work around, but I am afraid of the headache it could cause finding that the pipe is not the correct pipe in the IDE…

1 Like

Thanks for this workaround, which I do prefer over the first answer.

But I strongly disagree on the fact that is not a bug. The fact that Markdown is inconsistent on syntax character need to be escape is another subject. Escaping a syntax character should not render the escape character, but only the escaped character. At least from a user point of view.

Well, this is how it works in obsidian, even in tables.

Your case is different, because you are inserting a codeblock in your table. And this is actually what I expect from codeblocks: that it’s content is not rendered anyhow.

And yes, following this logic, the pipe character shouldn’t be rendered as well as long as it is located within a codeblock. But the way it works is default markdown behaviour as you can see here.