You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Asterisks surrounded by spaces are parsed as emphasis (a * b * c → a <em> b </em> c) #28
Under CommonMark's delimiter-run rules, a * followed by whitespace is not left-flanking, so it can't open emphasis. A * preceded by whitespace is not right-flanking, so it can't close emphasis. Both delimiters here have whitespace on both sides, so the text should render literally.
Other parsers agree:
Input
commonmark.js 0.31.2
markdown-it 15.0.2
micromark 4.0.3
@tanstack/markdown 1.0.0
5 * 4 * 3 = 60
5 * 4 * 3 = 60
5 * 4 * 3 = 60
5 * 4 * 3 = 60
5 <em> 4 </em> 3 = 60
a * b * c
a * b * c
a * b * c
a * b * c
a <em> b </em> c
*real italic*
<em>real italic</em>
<em>real italic</em>
<em>real italic</em>
<em>real italic</em>
Why it matters
Arithmetic and multiplication in plain text (2 * 3, width * height) are common in user-written notes, and they silently turn into italics.
Escaped asterisks (5 \* 4 \* 3) render correctly. Only the flanking check on unescaped delimiters is affected.
import{renderHtml}from"@tanstack/markdown/html";renderHtml("first I calculate 3 * 12, which equals 36, and then 5 * 7");// <p>first I calculate 3 <em> 12, which equals 36, and then 5 </em> 7</p>
Per CommonMark, a * followed by whitespace is not left-flanking, so it cannot open emphasis, and the expected output is the text unchanged. We hit it rendering LLM reasoning summaries, which often write arithmetic this way.
Activity
herkulano commentedon Nov 25, 2026
Still present in
@tanstack/markdown@1.2.1:Per CommonMark, a
*followed by whitespace is not left-flanking, so it cannot open emphasis, and the expected output is the text unchanged. We hit it rendering LLM reasoning summaries, which often write arithmetic this way.