Backslashes Should Not Be Hidden Before Non-Special Characters in Obsidian Live Preview

I’m trying to get backslash escape characters that precedes non-special characters to display properly in Obsidian’s live preview mode.

By default, backslashes preceding all characters (not only the special ones) are hidden in live preview due to implementation of this feature request:

It does make sense to treat backlashes specially before characters you can escape like here: Basic Syntax | Markdown Guide, but not the ones preceding other characters.

The backslashes only show up in Live Priew when actively editing, which makes my text jump around distractingly. What is really annoying for me is that when I try to edit the text it jumps under my cursor (hiding and unhiding) which moves the text behind it, which is a bit distracting for me.
Read mode displays them properly, so I’d like live preview to do the same. For example, I want \index to display fully instead of hiding the \ when I am not editing this line. In latex to which I convert my markdown notes through pandoc \ has similar function to escape characters, but for whole words.

I know I can switch to source mode, but that loses some of the benefits of live preview.

Basing on the feedback, I may consider converting this post into feature request or bug report as the '` slash before non-special character should be treated differently as it have different functions.

I received help on discord with this CSS code

.cm-line:not(.cm-active) .cm-widgetBuffer +,
.cm-line:active:not(:focus-within) {
    content: "\\";
    color: var(--text-faint);

It prevents text from jumping when directly under cursor, but it doesnt work with all situations (like showing them when not focused on the paragraph) .

If anyone has ideas for a CSS fix, please share! I’d love to get this working without losing live preview functionality.


I agree this can be annoying. I proposed this previously in a specific context here: Escaped space as non-breaking space in viewing mode - #3 by xacto

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