Alternative to using [ for links

Things I have tried

What I’m trying to do

I am a lawyer. Lawyers refer to judgments/cases/authorities all the time. Many citations for cases use brackets [ around the year in which the case was reported. What is a useful alternative?

1 Like

Has this been causing you problems? Normal usage of brackets shouldn’t conflict with Markdown.

The only time times I’d expect conflicts are if you

  • put parentheses right after the brackets: ](
  • put brackets right after the brackets: ][
  • or use doubled brackets. [[

I found one case that I think is a bug in Obsidian’s syntax highlighting: two single-bracketed items separated by a space ([like] [this]) are highlighted as a link. This kind of format resembles a “reference link”, but in CommonMark, which Obsidian’s Markdown is based on, the space between is disallowed (original Markdown allowed it, but that differed from its other link formats and can cause unintended links). Reading View renders it correctly — if you switch to it, you’ll see the text as you typed it.

Obsidian used to highlight all bracketed text, but they fixed that a while ago.(Oops, no, they didn’t; see my later post.)

If you still need an alternative:

  • You can force any Markdown syntax to be normal text by preceding it with a backslash (“escaping” it). \[
  • HTML links are uglier but should work. <a href="URL">TEXT</a>
3 Likes

Thanks, CawlinTeffid. I’m very new to Obsidian. I suspect that if I have two or more notes of cases with citations which include let’s say [2020] for example, they will be treated as linked. Will that occur?

1 Like

CawlinTeffid is correct!

Be sure to add his post as the solution for future readers!

Any words in square brackets will look like links as they take on link formatting by default. This CSS snippet works to keep the text black (at least it does in my vault).

/* SOURCE COLOUR of text in [square brackets] when not links */
span.cm-hmd-barelink.cm-link {
  color: var(--text-normal);
}

I made an error in my last reply — sorry. Obsidian does still highlight single-bracketed text, as @eightning says. I’m using the Minimal theme, which doesn’t do that. I mistakenly thought the root problem had been fixed.

To be clear, what you’re seeing isn’t a link. The editor is highlighting them to look like links, but they won’t act like links if you click on them. Switch to Reading View to see a more accurate rendering. If you are exporting your notes to share, they should look correct (unless you are sending them the note as-is and they are viewing it in Obsidian). If you just find the behavior annoying, I understand — it irritated me when I had to live with it.

So, you can:

  • Live with incorrect rendering, safe in the knowledge that they’re not real links.
  • Use @eightning’s CSS snippet to fix it.
  • Use a different theme (Minimal does the right thing; I don’t know about others).
1 Like