Add a configurable Markdown link serialization policy
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- react, typescript
- 領域
- frontend
調査の方向性
Start at the public blocksToMarkdownLossy entry point and trace into the lower-level Markdown exporter’s link serialization. Verify how URL-only links and separately labelled links are currently emitted. Done means an opt-in explicit style is supported, auto preserves existing output, and both link cases have coverage.
索引モデルが issue の本文から書いたものです。
説明
What’s broken?
The Markdown exporter does not provide a public option to control how links are serialized.
When a URL-only link is created in BlockNote, blocksToMarkdownLossy may serialize it as a bare URL:
https://example.com
This is valid in GFM, but it loses the explicit distinction between ordinary text and a Markdown link. It also makes it difficult for applications to enforce a consistent Markdown export policy.
What did you expect to happen?
Applications should be able to choose whether links are serialized as:
https://example.com
or explicitly as:
[https://example.com](https://example.com)
For links with a separate label, the explicit format should remain:
[Documentation](https://example.com)
The default behavior should remain unchanged for backward compatibility.
Steps to reproduce
- Create a BlockNote editor.
- Insert a link where the displayed text is the same as the URL.
- Export the document with
blocksToMarkdownLossy. - Observe that the result may contain a bare URL instead of explicit Markdown link syntax.
Example:
const markdown = editor.blocksToMarkdownLossy(editor.document);
console.log(markdown);
Observed output:
https://example.com
Desired opt-in output:
[https://example.com](https://example.com)
BlockNote version
v0.54.0
Environment
React application, macOS
Proposed API
One possible API would be an export option:
editor.blocksToMarkdownLossy(editor.document, {
linkStyle: "explicit",
});
Possible values:
type MarkdownLinkStyle = "auto" | "explicit";
Where:
"auto"preserves the current behavior."explicit"always emits[label](url)for links.- Links with different labels continue to emit
[label](url).
The option could be exposed through the lower-level Markdown exporter API as well.
Additional context
We initially implemented an application-level HTML-to-Markdown serializer only to change this link behavior. However, that requires duplicating BlockNote’s complete Markdown serialization logic and creates compatibility and maintenance risks when BlockNote changes its exporter.
A public link serialization option or hook would allow applications to customize this behavior without forking the whole serializer.
Contribution
I’d be interested in contributing a fix for this issue.
- 主要言語
- TypeScript
- スター
- 10.2k
- フォーク
- 772
- 平均マージ
- 3日 11時間
- マージ済み PR(30日)
- 17
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TypeCellOS/BlockNote のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
TypeCellOS/BlockNote#3098 ·
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
TypeCellOS/BlockNote#3073 ·
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
TypeCellOS/BlockNote#3072 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
TypeCellOS/BlockNote#2949 · コメント 1 件 ·
-
a11y
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
TypeCellOS/BlockNote#2855 ·
TypeCellOS/BlockNote の issue をすべて見る
似ている issue
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
-
code-quality refactoring
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
langchain-ai/deepagents#6450 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
vercel/react-tweet#225 ·