(live preview) Extra bracket in external links when the link text has a bracket itself

Steps to reproduce

In the live preview mode, add an external link and include a bracket in the link text:
[test [2]](https://example.com)

The preview link will include brackets outside the whole link:

Source mode:
image

Live preview:
image

In the example above, the “test [2]” also is not clickable (clicking on the text doesn’t open the link).

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

Y

Expected result

Actual result

Environment

SYSTEM INFO:
	Obsidian version: v1.6.3
	Installer version: v1.4.13
	Operating system: Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:27 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T8103 23.3.0
	Login status: not logged in
	Insider build toggle: off
	Live preview: on
	Base theme: adapt to system
	Community theme: none
	Snippets enabled: 1
	Restricted mode: on

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.

Additional information

2 Likes

I was trying to figure this out with a snippet approach and this works for me:

.markdown-source-view.is-live-preview div:not(.cm-active) > span.cm-formatting.cm-formatting-link.cm-hmd-barelink.cm-link {
  color: transparent;           
  display: inline-block;   
  width: 0;  
}

.markdown-source-view.is-live-preview .cm-hmd-barelink {
  text-decoration: var(--link-decoration) !important;
}

I have tested it with the default theme and all snippets and community plugins disabled.

Here’s my debug info:

SYSTEM INFO:
	Obsidian version: v1.11.5
	Installer version: v1.8.4
	Operating system: Windows 11 Home 10.0.26200
	Login status: not logged in
	Language: en
	Insider build toggle: off
	Live preview: on
	Base theme: light
	Community theme: none
	Snippets enabled: 1
	Restricted mode: off
	Plugins installed: 10
	Plugins enabled: 0

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.

Actually, it worked on a different computer, not on this one. The installer version on that one is v.1.9.12. I’m assuming that is making a difference.

Tested with newer installer: this made a difference. So, I can confirm this works with at least installer versions v.1.9.12 and the newest v.1.11.5. I think it means anything newer than v.1.9.12, but I don’t want to make that statement, since I have only tested these 2 versions.