Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Asterisks surrounded by spaces are parsed as emphasis (`a * b * c` → `a <em> b </em> c`)

Aberta
#28 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
55/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
markdown, typescript
Domínio
content

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
TypeScript
Estrelas
432
Forks
11
Merge médio
57min
PRs com merge (30d)
4

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de TanStack/markdown

Todas as issues de TanStack/markdown

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.