Geen vetgedrukte opmaak van tekst tussen haakjes

AI-generated summary

The discussion addresses an issue where bold formatting in Markdown fails when text within parentheses is surrounded by leading or trailing characters, such as in “40773**(5255)**”. tmomas provides multiple examples demonstrating inconsistent behavior, particularly when punctuation or additional text is present. The issue appears to stem from limitations in the Markdown specification, as justin explains, referencing the CommonMark spec and a dingus tool to confirm that this behavior is expected and not a bug. The consensus is that this is a known constraint of Markdown parsers, which prioritize performance and consistency over complex parsing scenarios.

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.

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.