Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

クローズ 初心者向け
#3,232 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

関連するプルリクエストがすでにマージされています。

  • #3233 @RaphaelFakhri による — マージ済み

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
74/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
react, typescript

調査の方向性

blocksToMarkdownLossyの実装を見つけ、太字、斜体、取り消し線のテキストに空白が含まれる場合、どのように囲んでいるかを確認してください。提示された例で問題を再現し、その後、関連するMarkdownのエクスポートとパースのテストを実行してください。先頭と末尾の空白が強調記号の外側に残り、エクスポートされたMarkdownを再度読み込んでも意図したスタイルが保たれれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
10.3k
フォーク
780
平均マージ
3日 6時間
マージ済み PR(30日)
48

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TypeCellOS/BlockNote のほかの issue

TypeCellOS/BlockNote の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。