Bug when italics and bold are applied to a text that has a space

Steps to reproduce

  1. Start with this text in a note: **Hello** World
  2. Select All
  3. Hit the keyboard shortcut for Italics (e.g. ⌘I)

Expected result

_**Hello** World_

Actual result

***Hello** World*

Screenshot

Environment

  • Operating system: macOS 12.0.1
  • Obsidian version: 0.13.0

The actual result is correct. It’s the preview that is wrong.

Hmm, that’s true. Ok, well - still a bug I guess?

Looks like an upstream (codemirror) thing. So I guess it’s a wontfix.

Well, if it “works” by using underscores for italics, how about just having Obsidian use that instead of *s?

This is not a code mirror problem. The editor is looking fine in your screenshot. The problem is in the preview.

I’m not sure that Obsidian is alone is previewing emphasis incorrectly where the pairing is split in this way. See e.g. Markdown Live Preview.

I can’t find any reference but perhaps the markdown spec is unclear on what to do with these cases.

But it’s a simple enough workaround as your own example made clear. You manually insert underscores in place of single asterisks for the italics.

The GitHub link is, I think, a red herring since it refers to a different case, where a space intervenes before a closing bold (or italic).

This gif should be self-explanatory

Canvas Rendering bug

it happens only when the bold and italic is at the end of the sentence

Environment

  • Operating system:
  • Debug info:
    SYSTEM INFO:
    Obsidian version: v1.1.12
    Installer version: v1.1.9
    Operating system: Windows 10 Pro 10.0.19044
    Login status: logged in
    Catalyst license: insider
    Insider build toggle: on
    Live preview: on
    Legacy editor: off
    Base theme: dark
    Community theme: none
    Snippets enabled: 0
    Restricted mode: on

RECOMMENDATIONS:
none


Additional information

2 Likes

thanks

I can’t tell if this is bug report is marked as only being relevant to reading mode, but I am observing the same in live preview in Obsidian 1.2.1

Maybe relevant:

image

It seems that the bold class styling is simply being overridden. Maybe simply removing font-weight: var(--italic-weight); would be a fix?

I am happy to make a new bug report that specifically targets live preview if this would be preferred