Don't treat square bracketed text as a link unless followed by parens

Use case or problem

I want to use square brackets as normal without having to escape them. Markdown should only treat square bracket text as a link IF it is followed by ().

Proposed solution

Fix it.

Current workaround (optional)

.cm-s-obsidian span.cm-link, .cm-s-obsidian span.cm-link:hover {
color: var(–text-normal);
text-decoration: none;
}

This removes highlighting for actual links as well.

Related feature requests (optional)

There’s an older comment here:

The issue in the editor (there’s no issue in Reading view) is that single square brackets are in a state of limbo until you do something with them. They could become a [markdown](link.md), a [reference]: link, a [^footnote], and so on.

The CSS assigned to [something] is cm-hmd-barelink, so you could try this for the time being:

.cm-s-obsidian {
    & .cm-link.cm-hmd-barelink {
        color: var(--text-normal);
    }
    
    & .cm-link.cm-hmd-barelink:hover {
        color: var(--text-normal);
        text-decoration: none;
    }
}

or non-nested:

.cm-s-obsidian .cm-link.cm-hmd-barelink {
    color: var(--text-normal);
}

.cm-s-obsidian .cm-link.cm-hmd-barelink:hover {
    color: var(--text-normal);
    text-decoration: none;
}
1 Like

Yeah, this is a quirk of Live Preview’s syntax highlighting — it’s highlighting too eagerly. WhiteNoise’s comment doesn’t make sense to me. Fortunately we can work around it with CSS snippets (I use the non-nested one that trainbuffer posted)l