Asterisks surrounded by spaces are parsed as emphasis (`a * b * c` → `a <em> b </em> c`)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- markdown, typescript
- Ambito
- content
Direzione di ricerca
Start by reproducing with renderHtml('a * b * c') from the @tanstack/markdown/html entry point. The fault is in how unescaped * delimiters are classified as left- or right-flanking when whitespace sits on both sides, so look at the inline emphasis delimiter handling in the parser that renderHtml calls. Done means both repro inputs render as literal asterisks, real italic still becomes emphasis, and escaped asterisks are unchanged.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version: @tanstack/markdown 1.0.0 (renderHtml and the React adapter)
Repro
import { renderHtml } from '@tanstack/markdown/html'
renderHtml('5 * 4 * 3 = 60')
// actual: <p>5 <em> 4 </em> 3 = 60</p>
// expected: <p>5 * 4 * 3 = 60</p>
renderHtml('a * b * c')
// actual: <p>a <em> b </em> c</p>
// expected: <p>a * b * c</p>
Expected
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.
- Lingua principale
- TypeScript
- Stelle
- 432
- Fork
- 11
- Merge medio
- 57m
- PR unite (30g)
- 4
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di TanStack/markdown
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
A blockquote with U+2028 or U+2029 loops the parser foreverForse già presa @elwan-l1 l’ha presa 20 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 70/100
Tutte le issue di TanStack/markdown
Issue simili
-
backend refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
NIAEFEUP/tts#927 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
callstackincubator/react-native-harness#296 ·
I maintainer di solito rispondono entro 1 giorno
-
status:in-linear
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
n8n-io/n8n#42293 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
verified
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 5 giorni
-
Add inputmode attribute support (forwarded to the inner input)Forse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Neovici/cosmoz-input#467 ·
I maintainer di solito rispondono entro 1 giorno