Serializer keeps a link open across a whitespace-only marked node

オープン
#1,263 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
半日
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
typescript
領域
tooling

調査の方向性

Start in MarkdownSerializerState.renderInline and the expelEnclosingWhitespace step it relies on, since the issue traces the bug to renderInline setting marks = active for a whitespace-only marked node. Reproduce with the BaseSchemaSpecs, LinkSpecs and BoldSpecs setup from the issue and confirm the output drops the autolink. Done means the link is closed before the space is written, the serializer test prints the autolink followed by text, and a parsing regression test covers the round trip.

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

説明

bug

MarkdownSerializerState.renderInline keeps the previous link active when the next node contains only marked whitespace.

Reproduce with BaseSchemaSpecs, LinkSpecs and BoldSpecs:

const href = 'https://ya.ru/';
const content = doc(p(a({href}, href), bold(' '), 'text'));

serializer.serialize(content);

Expected:

<https://ya.ru/> text

Actual:

<https://ya.ru/ >text

The result is not a valid autolink. After parsing, < and > become visible text.

When expelEnclosingWhitespace removes all text from the bold node, renderInline sets marks = active. This keeps the previous link open while writing the space, although the original space node has no link mark.

Close marks absent from the original node before writing its whitespace. Add regression tests for serialization and parsing.

主要言語
TypeScript
スター
428
フォーク
48
平均マージ
5日 15時間
マージ済み PR(30日)
47

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

gravity-ui/markdown-editor のほかの issue

gravity-ui/markdown-editor の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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