Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

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

Offen Anfängerfreundlich
#3,232 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@RaphaelFakhri arbeitet bereits daran.

Seit 22.10.2026.

  • #3233 von @RaphaelFakhri — offen

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
74/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
react, typescript

Rechercherichtung

Finde die Implementierung von blocksToMarkdownLossy und prüfe, wie sie fett, kursiv und durchgestrichen formatierten Text mit Leerzeichen umschließt. Reproduziere das Problem mit dem bereitgestellten Beispiel und führe anschließend die relevanten Tests für den Markdown-Export und das Parsen aus. Fertig ist die Aufgabe, wenn führende und nachfolgende Leerzeichen außerhalb der Hervorhebungsbegrenzer bleiben und das exportierte Markdown mit den beabsichtigten Formatierungen einen Roundtrip durchläuft.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
TypeScript
Sterne
10.3k
Forks
780
Ø Merge
3 T. 11 Std.
Gemergte PRs (30 T.)
44

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus TypeCellOS/BlockNote

Alle Issues in TypeCellOS/BlockNote

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.