Live Preview: Backslash '\' is auto-inserted into inline code and math in tables

Steps to reproduce

create a normal table with at least 2 columns and 2 rows

type into one of the cells this bit of code: ls | column

Did you follow the troubleshooting guide? [Y/N]

Yes, the bug persists even in sandbox mode

Expected result

I would expect to see my code exactly as I entered it: `ls | column`

Actual result

Instead of seeing the code I typed, a backslash is auto-inserted into the middle of it like so: ls \| column Deleting the '' results in the ‘|’ being deleted as well. I cannot figure out how to type my inline code without the backslash getting auto-inserted.

Environment

SYSTEM INFO:
Obsidian version: v1.6.3
Installer version: v1.5.12
Operating system: Windows 10 Pro 10.0.22631
Login status: not logged in
Insider build toggle: off
Live preview: on
Base theme: dark
Community theme: Minimal v7.5.4
Snippets enabled: 0
Restricted mode: off
Plugins installed: 14
Plugins enabled: 11
	1: BRAT v1.0.1
	2: Advanced Tables v0.21.0
	3: Breadcrumbs v4.2.35-beta
	4: Colored Tags v5.0.0
	5: Dataview v0.5.66
	6: Highlightr v1.2.2
	7: Minimal Theme Settings v7.5.0
	8: Open vault in VSCode v1.2.2
	9: Outliner v4.8.1
	10: Paste URL into selection v1.7.0
	11: Style Settings v1.0.8

RECOMMENDATIONS:
Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.
Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.


Additional information

2 Likes

I don’t see the screenshots I added in my original message so I’m posting them here just in case.

Here are two screenshots of the bug, one from my notebook and one from the sandbox:

Screenshot 2024-06-10 231444
Screenshot 2024-06-10 231529

I just found another issue with the backslash being auto-inserted into inline code. I entered this line into a table: | and instead of displaying as expected, it auto-inserts a \ into the inline code so it looks like this: \|

Thanks!

And yet another issue with backslash in inline code. When I use it in an inline code it just disappears. I tried typing more than one but that didn’t work either. My inline code looks like this: Set-Location .\Documents\ but of course the backslashes are completely missing.

The backslash not showing bug is here.

Regarding auto-inserting \ in tables, It is something that we currently do in tables, to make the tables work in reading mode.

This is the broader issue.

At some point we will have a more permanent solution that won’t require escaping the | in inline code and math.

1 Like

Thanks for your reply and thanks for posting a link to the issue. I’ll keep an eye on the thread.

I have the same problem, too. Refer to the Typora, the markdown table should ignore the | in the inline code. My current solution is: <code>ls \| column</code> .

When using vertical bars | in a table in the live preview double bars appear.

Creating a new table and putting |x| in one of the cells (which Obsidian will helpfully automatically turn into $\|x\|$ renders with double bars:

image

Workaround: use $\vert x \vert$.

There are some similar bug reports, but none that quite match this behaviour or are recent enough to include the live-preview table editor (as far as I can tell)

This is problematic because it makes discerning norms and absolute values difficult. I am able to reproduce this in the Sandbox Vault on Obsidian 1.8.9

Steps to reproduce

  • create a table
  • insert $|$ or $$|$$ into a cell

Expected result

When using $|$ outside of the table, the latex renders correctly by showing a vertical line “|”. This should also render the same way when inserted into a table.

Actual result

When using $|$ inside a table the result is a double vertical line “||”.

Environment

SYSTEM INFO:
Obsidian version: v1.5.3
Installer version: v1.4.16
Operating system: Darwin Kernel Version 23.2.0: Wed Nov 15 21:59:33 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T8112 23.2.0
Login status: not logged in
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 2
Restricted mode: on


Additional information

2 Likes

This is a limitation of tables right now. To make obsidian work in tables | is actually turned in to \| which renders as ||.

1 Like

Previous post: Cannot use the absolute value symbol "|" in mathematical formulas in tables

The fix described is to use $\vert$.