Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Markdown export breaks bold, italic and strikethrough when the styled text starts with a space

Chiusa Adatta ai principianti
#3,232 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Una pull request collegata è già stata integrata.

  • #3233 di @RaphaelFakhri — integrata

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
74/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
react, typescript

Direzione di ricerca

Trova l’implementazione di blocksToMarkdownLossy e verifica come racchiude il testo in grassetto, corsivo e barrato quando contiene spazi bianchi. Riproduci il problema con l’esempio fornito, quindi esegui i test pertinenti di esportazione e parsing del Markdown. Il lavoro è completato quando gli spazi iniziali e finali restano fuori dai delimitatori di enfasi e il Markdown esportato conserva gli stili previsti dopo un round trip.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

blocksToMarkdownLossy puts the emphasis delimiters directly around styled text, even when that text starts with a space. A Markdown opening delimiter followed by whitespace doesn't count as emphasis, so the output shows literal asterisks in any CommonMark/GFM renderer, and BlockNote's own Markdown parser reads it wrong as well.

This happens often in practice: selecting a word together with the space before it (for example, by dragging or with Shift+Ctrl+Left) and pressing Ctrl+B produces a text run like " world" with bold: true.

Trailing whitespace is already moved outside **/*. Leading whitespace is not, and strikethrough has no whitespace handling at all.

Steps to reproduce

editor.blocksToMarkdownLossy([
  {
    type: "paragraph",
    content: [
      { type: "text", text: "Normal", styles: {} },
      { type: "text", text: " bold", styles: { bold: true } },
      { type: "text", text: " and", styles: {} },
      { type: "text", text: " italic ", styles: { italic: true } },
      { type: "text", text: "and", styles: {} },
      { type: "text", text: " strike ", styles: { strike: true } },
      { type: "text", text: "end", styles: {} },
    ],
  },
]);

What did you expect to happen?

Normal **bold** and *italic* and ~~strike~~ end

Actual output:

Normal** bold** and* italic* and~~ strike ~~end

If you parse that output back with tryParseMarkdownToBlocks, the styles are lost or land on the wrong text, and literal */~~ characters stay in the document.

BlockNote version

main at 45d07d3.

Lingua principale
TypeScript
Stelle
10.3k
Fork
780
Merge medio
3g 6h
PR unite (30g)
48

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TypeCellOS/BlockNote

Tutte le issue di TypeCellOS/BlockNote

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.