Obsidian failed to recognize "|" in a table cell

Steps to reproduce

  1. Create a simple table with a few columns.
  2. In one of the cell, try to input something containing “|”. For example, x<10 || x>20.

Expected result

A line formatted as code block, with the desired output: x<10 || x>20

Actual result

OB interprets “|” as column separator and just displays “`x<10” and discards everything behind… (not displaying “|| x>20”).

Environment

SYSTEM INFO:
Obsidian version: v1.9.12
Installer version: v1.8.10
Operating system: Windows 11 Pro 10.0.22631
Login status: not logged in
Language: en
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 3
Plugins enabled: 3
1: Print v0.3.8
2: Mermaid Tools v1.3.0
3: Better Export PDF v1.11.0


Additional information

  1. If I input “x<10 \|\| x>20", trying to escapge the "|", OB will lieterally output: x < 10 \|\| x > 20, which means under influence of "…`”, the "" is not escaped.
  2. Correct solution under OB: <code>&#124;&#124;</code>, use HTML entity.
  3. VSC can do well with simple “\|\|”, which is simpler and follows my intuition.

I can only guess that this could relevant :blush: :

Agree to a certain extent…

Hmm, the escaped pipes worked for me:

| Col1 | Col2               |
| ---- | ------------------ |
|      | x < 10 \|\| x > 20 |

image

Am I doing something different than you are?

Relevant threads:

Hello.

The OP mentions wanting to put the text in a code block:

| No Code Block | In a Code Block |
| ---- | -------------------- |
|x < 10 \|\| x > 20| `x < 10 \|\| x > 20` |

:thinking:

Oh, I see now. Thank you for clarifying, and thank you for the helpful example.

That’s a tough one – a pipe within a code block within a table.

I can’t think of any way around it. Bummer. :frowning:

1 Like

Horrible, terrible, hack :winking_face_with_tongue:

```dataviewjs
dv.table(
 ["No Code Block",   "In a Code Block",    "In a Math Block"  ],
[["x< 10 || x > 20", "`x < 10 || x > 20`", "$x< 10 || x > 20$"]]
)
```

Result:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.