Markdown image URL links are not clickable after adding 'title' attribute

According to the CommonMark spec, markdown image syntax can include a quoted title after the URL, like so: ![image description text](/path/to/image.jpg "a title attribute").

Using this format does display the image correctly in Obsidian’s Preview mode, but in Edit mode, the image URL doesn’t work. The URL is still clickable, but instead of navigating to the image, it creates a new note with the title image.jpg "a title attribute" inside of /path/to.

Using Obsidian v0.11.5,
macOS 10.15.7

Please let me know if I can provide any more information!

Can reproduce on Obsidian 0.11.13/AppImage, Installer 0.10.11, Linux Mint 20.1/Cinnamon.

It also occurred in regular links

Steps to reproduce

Enter [some link with title](http://127.0.0.1:8080/1/2/3 "hello world") in edit mode

Expected result

cmd/ctrl + click on url part of link (http://127.0.0.1:8080/1/2/3) in edit mode should open http://127.0.0.1:8080/1/2/3

Actual result

Seems that http://127.0.0.1:8080/1/2/3 "hello world" is opened

can be reproduced in both Live Preview and traditional cm5 editor

In local http server listening at 8080, the server recieved the followings:

Available on:
  http://127.0.0.1:8080
  http://172.24.108.142:8080
Hit CTRL-C to stop the server

[2021-11-22T02:48:38.726Z]  "GET /1/2/3%20%22hello%20world%22" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15"
[2021-11-22T02:48:38.728Z]  "GET /1/2/3%20%22hello%20world%22" Error (404): "Not found"

Environment

  • Operating system: macOS 12.0.1 (21A559)
  • Obsidian version: v0.13.4

Proposed solution

It seems that MarkdownView.triggerClickableToken is using all the text inside .cm-string.cm-url.cm-list-1 generated from Editor.getClickableTokenAt to open link:

I think that a gatekeeper that remove title part before URL being opened in click handler could be a workaround before the editor markdown parser is fixed:

window.open(e.text.replace(/(?<url>[^ ]+) +"(?:.+)" */,"$1"));

Glad to see it being partially fixed in v0.13.6

  • Fixed markdown links with “title” not working correctly.

https://forum.obsidian.md/t/obsidian-release-v0-13-6-insider-build/27676/2


The link clicks are handled properly now, but the rendered live preview doesn’t seem to work properly:

(not created yet shows regardless of file exists or not)

will be fixed 0.13.7

1 Like

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