Search code examples
commonmark

Is there something wrong with CommonMark?


If you try **b.**a on https://spec.commonmark.org/dingus/, you would see its b. is not bolded. However, if you just omit the last a, it works.

What is the CommonMark format to bold it correctly (that is bolded a., followed by unbolded b)?

The solution to format the text correctly in CommonMark.


Solution

  • According to section 6.2 of the CommonMark specification, that behaviour is by design:

    A delimiter run is either a sequence of one or more * characters [...]

    A right-flanking delimiter run is a delimiter run that is (1) not preceded by Unicode whitespace, and either (2a) not preceded by a Unicode punctuation character, or (2b) preceded by a Unicode punctuation character and followed by Unicode whitespace or a Unicode punctuation character.

    You can get the desired visual appearance with **b.**​a, where ​ is the HTML entity "zero-width joiner", thus:

    **b.**​a

    ...and we've just found a bug in the rendering here on Stack Overflow. In edit mode, the preview shows it correctly as

    b dot a rendered correctly with b dot in bold