Use the Markdown syntax tree for inline formatting in markup mode

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

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

@d3m1d0v がすでに取り組んでいます。

2026年10月1日 から。

  • #1313 @d3m1d0v による — オープン

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
15/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
markdown, typescript
領域
frontend

調査の方向性

The issue asks to replace the text-splitting inline formatting logic in markup mode with ranges built from the Markdown syntax tree, using ensureSyntaxTree from @codemirror/language. Read the current formatting command code and the Markdown language setup first, then check linked pull request #1313 before starting. Done means every listed block type and command keeps its markers intact, with tests for each case and for undo and redo.

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

説明

enhancement

Inline formatting currently splits selections at blank lines and checks markers at range edges. It does not use the Markdown structure.

This can place formatting markers around block syntax, mix markers from separate elements, or produce invalid Markdown.

Examples:

  • List markers become part of bold or italic text.
  • Heading markers lose their meaning.
  • A selection across table cells can wrap table separators.
  • Code content can receive formatting markers as literal text.
  • Existing nested formatting can be detected incorrectly.

Proposed solution:
Use ensureSyntaxTree from @codemirror/language to read the existing Markdown syntax tree and build formatting ranges from syntax nodes.

Expected behavior:

  • Format text in each paragraph, list item, heading, or table cell separately.
  • Keep list markers, heading markers, quote prefixes, table separators, and code fences intact.
  • Support nested blocks, task lists, and multiline text.
  • Define handling for inline code, fenced code, and indented code. Formatting must not silently change literal code content.
  • Check which YFM blocks the existing parser supports and define a fallback for unsupported syntax.
  • Use syntax nodes to detect existing formatting where possible.
  • Preserve partial selections, selection direction, multiple selections, and cursor placement.
  • Keep formatting markers selected so users can apply several styles in sequence.
  • Apply each command as one undoable transaction.
  • Do not apply changes based on an incomplete syntax tree.

Apply the shared range logic to text styles, text color, inline math, and inline code. Keep command-specific rules where needed.

Add tests for each block type, mixed selections across blocks, nested formatting, consecutive commands, undo, and redo. Test states must use the same Markdown language configuration as the editor.

主要言語
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 を短くまとめたダイジェスト。