obsidian-export icon indicating copy to clipboard operation
obsidian-export copied to clipboard

Uniform rendering of links

Open jforberg opened this issue 3 years ago • 3 comments

Render all links as Link in the export. Remove the special case where dead links were rendered as Emphasis instead. This makes it much easier to style links in the final output.

jforberg avatar Feb 04 '22 10:02 jforberg

@zoni I have rebased my branch on top of yours. Would you consider accepting this pull request? The current behaviour of translating [dead link] -> *dead link* makes the output quite challenging to style.

jforberg avatar Jun 24 '25 12:06 jforberg

I just started some work on this last weekend, as a matter of fact, and plan to have it in for the next release. You can explore the customizable-missing-note-handling branch if you're interested in the details.

What I'd like to expose is options to:

  • Rewrite links (current behavior)
  • Keep dead links as-is (more Obsidian-like)
  • Skip embeds that can't be found (current behavior)
  • Replace embeds that can't be found with the text "note name" is not created yet" (more Obsidian-like)
  • Print / suppress printing of "Warning: Note name not found" messages

..but I'm not sure yet what the best CLI design is for the different argument flags that would be needed.

zoni avatar Jun 24 '25 12:06 zoni

Hi, that sounds like a good idea. In my view it is normal for a wiki to contain dead links, they just represent articles that haven't been written yet. For embeds I think it can be considered an error if the link is dead.

The link->emph rewrite is problematic for my usecase, because I want to turn my notes into a printed version without any hyperlinks. Translating links into a plain <em> makes it impossible to style them as desired.

I think the behaviour proposed in this PR can be a good default behaviour, but maybe it can be good to have more fine-grained options too.

jforberg avatar Jun 24 '25 14:06 jforberg