Escaped characters should have the normal text color in Live Preview

Steps to reproduce

In Live Preview, type escaped characters like \$ (very useful for entering dollar amounts) or \* (useful for entering some quick math formulas).

Expected result

When escaped, characters are meant to be normal text and should thus have the same color as normal text.

Actual result

Escaped characters appear in the same color as their non-escaped version ($ for a math formula, * for italics or bold, etc.). This is unexpected, as they are normal text. Also, and more importantly, it can make such characters harder to read (especially in some dark modes, for instance in the Things theme).

Environment

  • Operating system: macOS Ventura.
  • Debug info:
    SYSTEM INFO:
    Obsidian version: v1.0.3
    Installer version: v0.15.8
    Operating system: Darwin Kernel Version 22.1.0: Sun Oct 9 20:14:30 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T8103 22.1.0
    Login status: not logged in
    Insider build toggle: off
    Live preview: on
    Legacy editor: off
    Base theme: adapt to system
    Community theme: Things
    Snippets enabled: 1
    Restricted mode: off
    Plugins installed: 8
    Plugins enabled: 4
    1: Style Settings v0.4.12
    2: Outliner v4.1.1
    3: Remember cursor position v1.0.7
    4: Linter v1.7.0

1 Like

thanks

I had the same Problem with escaped astrices *, which were not visible in dark-themes because of app.css, line 5787:

 .cm-s-obsidian span.cm-hmd-escape-char {
   color: #666;
 }

Changing this in my css-snippets to

.cm-s-obsidian span.cm-hmd-escape-char {
    color: inherit;
}

shows the escaped characters in the same color as the sorrounding text.

3 Likes

The inherit seems not to work in comments (the only place I have different-colored text). Seems like an edge case (certainly not something I’d to encounter normally), but FYI for anyone who escapes characters in comments, I guess.

This is a nice solution.

Is inherit better in principle than var(--text-normal)?

You were \escaped for two months! :laughing:

It depends on the theme you are using and how it’s set up, but Things seems to be the same for both.

I indeed did miss Ludwig-k’s answer from 2 months ago and couldn’t escape the curse of muted escaped characters for that long! :sweat_smile:

1 Like

will be fixed in v1.2.3

2 Likes

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