A bold, italic or strikethrough span whose text starts or ends with punctuation, with a letter or digit just outside it, reads back as literal asterisks. Reproduced on main:
| storage |
read writes |
publish sends |
<p>a<strong>(b)</strong>c</p> |
a**(b)**c |
<p>a**(b)**c</p> |
<p><strong>&copy;</strong>a</p> |
**\©**a (since #203) |
literal asterisks |
CommonMark's flanking rule has two halves. The whitespace half (a delimiter next to whitespace on the wrong side does not open or close) was fixed for marks in #204. The punctuation half remains: a closing ** preceded by punctuation closes only if it is followed by whitespace or punctuation, and an opening ** followed by punctuation opens only if it is preceded by whitespace or punctuation. So **(b)**c does not close, and the whole span publishes as text with its asterisks.
Escaping cannot fix it, since the punctuation is the span's own text. Possible fixes:
- Write such a span as inline HTML (
<strong>(b)</strong>), which goldmark passes through and the forward converter already accepts.
- Use the
_ delimiter where it helps. It has stricter intraword rules, so it is probably not a general answer.
Found while working on #203; the table property test's generator now keeps a mark's text from starting or ending with punctuation to avoid it.
A bold, italic or strikethrough span whose text starts or ends with punctuation, with a letter or digit just outside it, reads back as literal asterisks. Reproduced on
main:<p>a<strong>(b)</strong>c</p>a**(b)**c<p>a**(b)**c</p><p><strong>&copy;</strong>a</p>**\©**a(since #203)CommonMark's flanking rule has two halves. The whitespace half (a delimiter next to whitespace on the wrong side does not open or close) was fixed for marks in #204. The punctuation half remains: a closing
**preceded by punctuation closes only if it is followed by whitespace or punctuation, and an opening**followed by punctuation opens only if it is preceded by whitespace or punctuation. So**(b)**cdoes not close, and the whole span publishes as text with its asterisks.Escaping cannot fix it, since the punctuation is the span's own text. Possible fixes:
<strong>(b)</strong>), which goldmark passes through and the forward converter already accepts._delimiter where it helps. It has stricter intraword rules, so it is probably not a general answer.Found while working on #203; the table property test's generator now keeps a mark's text from starting or ending with punctuation to avoid it.