Markdown parser is too greedy when parsing text wrapped in single brackets

I know there have been a lot of posts about this, but they all seem to be locked. Some are even bug reports where the only response is “not a bug” with no explanation about why it’s not considered a bug.

https://forum.obsidian.md/search?q=Single%20bracket

Because of the way the parser works, you can even end up in situations where the next word is not rendered. For example, the following will render “[Foo]” as a link, but “[Bar]” will not be rendered at all in the live editor.

I really think there is a bug in the markdown parser. User’s shouldn’t need to manually escape uses of brackets.

Steps to reproduce

  1. Open a new/vanilla Vault
  2. Type in “[Foo] [Bar]”
  3. Move the cursor to a different line

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

Y

Expected result

“[Bar]” should render

Both “[Foo]” and “[Bar]” should render as plain text, not a link.

Actual result

“[Bar]” will disappear.

Environment

SYSTEM INFO:
Obsidian version: v1.6.5
Installer version: v1.4.13
Operating system: Darwin Kernel Version 24.0.0: Mon Jul 1 21:58:14 PDT 2024; root:xnu-11215.0.132.501.1~1/RELEASE_ARM64_T6000 24.0.0
Login status: logged in
Catalyst license: insider
Insider build toggle: on
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: on

1 Like

Related:

1 Like

This is specifically a quirk of Live Preview. If you switch to Reading View (which typically renders more correctly because it’s not also trying to be a text editor made of lines), you’ll see the text as expected.

Live Preview is highlighting what looks like an incomplete reference-style link. You can probably work around it for now by “escaping” one of the brackets by placing a backslash before it.