Markdown export breaks bold, italic and strikethrough when the styled text starts with a space
メンテナーはふだん 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
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TypeCellOS/BlockNote のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
TypeCellOS/BlockNote#2949 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
a11y
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
TypeCellOS/BlockNote#2855 ·
メンテナーはふだん 1 日以内に返信
-
a11y
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
TypeCellOS/BlockNote#2829 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Comment thread actions: hover-only controls and unlabeled buttons in ThreadsSideba対応中かも @matthewlipski が 1 日前に担当しました。 オープンa11y
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
TypeCellOS/BlockNote#2824 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
A failed upload from a file drop or paste leaves a stuck "Loading..." block対応中かも @nperez0111 が今日担当しました。 オープンneeds-triage
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
TypeCellOS/BlockNote#3246 ·
メンテナーはふだん 1 日以内に返信
TypeCellOS/BlockNote の issue をすべて見る
似ている issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
source-cooperative/docs.source.coop#41 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Nimblesite/SharpLsp#468 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
solidjs-community/solid-primitives#1082 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信