No bold formatting of text in parentheses

Problem: No bold formatting for text in parentheses, when there are leading or trailing characters around the parentheses.

Example text in which we want to highlight (5255):

1.0.15 Build 20200721 rel.40773(5255)

40773**(5255)** -> NOK
40773(5255)
407735255


Now we add a single dot at the end of the first line.
Notice how 1st, 2nd + 3rd line change:

40773**(5255).
40773(5255)
40773
5255**


Playing around with other examples

No parentheses: All is OK.

parentheses -> OK
parentheses -> OK
aparentheses1 -> OK
aparenthesesa -> OK
aparentheses.1 -> OK
aparentheses#1 -> OK
aparentheses?1 -> OK

With parentheses: Strange things happen.

parentheses -> OK
(parentheses) -> OK
**(parentheses)**1 -> NOK
(parentheses).1 -> OK
**(parentheses)**a -> NOK
(parentheses).a -> NOK
(parentheses)#1 -> OK
(parentheses)?1 -> OK

a**(parentheses)1 -> NOK
a
(parentheses)**1 -> NOK

a**(parentheses)**1 -> NOK


Two times the same line, separated by blank line

paren**(thes)**es -> NOK

paren**(thes)**es -> NOK


Same as above, except no blank line separation

(paren)theses -> NOK
paren
(theses)
-> NOK


If I recall correctly, this is a limitation of the Markdown spec.

https://github.com/commonmark/commonmark-spec/blob/bc1ebdb9a938dd94af0a7022f7b64b01a18cb411/spec.txt#L6092

https://spec.commonmark.org/dingus/

This is the spec we follow. Try there – it doesn’t work either.

There are limitations to what parsers can do in a performant way, and I can’t say I’ve seen a Markdown parser work as you’re describing in any instance, though I could be wrong.

1 Like