In want to add a link with custom display text that contains square brackets so the link is displayed as
I tried escaping with backslash like so:
[[Link Name|\[1\]]], but this incorrectly displays
\[1\] where the last backslash is not part of the link text.
How to I correctly escape square brackets within internal links custom text?
You could try some Unicode alternatives.
Picking up where
@ariehen left off, here is a page showing various possibilities for brackets which come in pairs, aka having both an opening and closing bracket as you indicated you wanted.
Where the latter shows a multitude of various ways to gather such lists. In short, I think there should exist some pair of brackets which shouldn’t have any meaning within Obsidian besides the visual meaning you’ll give them. Some of the alterna…
If you find a set you like, you can use
GitHub - manic/obsidian-wrap-with-shortcuts: Wrap selected text in custom tags with shortcuts. or Templater and set a hotkey for them.
Do you mean it is
not possible to have actual square brackets in link custom text?
I mean… I can just use normal parentheses in that case… but it seems like it should be possible to use square brackets.
I’m not sure. I had never tried using
within the link text before, but tested a few combinations of escaping things, like you, and couldn’t get it. I think it’s related to:
There are bug reports of people not liking the way things in non-escaped single square brackets are highlighted (see
this and this). I don’t think they should be highlighted either, but I realise that’s just a personal preference!
But preference aside, live preview is currently handling nested non-escaped square brackets erratically. Reading view displays everything perfectly sensibly and consistently so I’d describe this as a bug/set of bugs rather than personal preference. I hope I’ve managed…
You don’t need to escape the brackets — the link will work.
In my testing on iOS the closing bracket appears in normal text color instead of link color on both Live Preview and Reading View, so Obsidian probably needs some work somewhere, but the link functioned.
Yes, the link works, but the first closing bracket which should have been escaped is parsed as a closing bracket of the link. That is why the last one is considered to be outside the link.
@ariehen comment above, I understand that this is in fact a bug. Is my specific use case a known bug or should I fill a bug report?
I think it’s essentially the same bug as the one ariehen linked, but go ahead and post a new bug report (if one doesn’t already exist) because that thread seems focused on Markdown links and this one is about wiki links. If WhiteNoise thinks it belongs with the other report they’ll merge it in.