facebook/lexical

Bug: Block math equation is falsely converted to inline equation on MarkdownShortcutPlugin

クローズ

#6,936 opened on 2024/12/10

 (6 件のコメント) (0 件のリアクション) (0 人の担当者)JavaScript (1,349 件のフォーク)batch import
good first issuemarkdown

Repository metrics

Stars
 (16,523 個のスター)
PR merge metrics
 (平均マージ 2d 16h) (30d で 103 merged PRs)

説明

Typing an equation like "$$x^2 + y^2 = z^2$$" via "Insert Equation" and then pressing the MarkdownShortcutPlugin changes the equation to inline ($...$).

Lexical version: Current Playground version

Steps To Reproduce

  1. Enter an equation, e.g. "x^2 + y^2 = z^2" via the toolbar (Insert -> Insert Equation) and uncheck "inline".
  2. Press the Markdown button

Link to code example: https://playground.lexical.dev/

The current behavior

Block math equations like "$$...$$" are converted to inline "$...$" when using the ##MarkdownShortcutPlugin.

The expected behavior

Block math equations like "$$...$$" should stay the same when using the MarkdownShortcutPlugin.

Potential Solutions

Possibly quick: A new BLOCK_EQUATION transformer could be added to address the "$$" scenario. MarkdownTransformers Way more complicated: One might migrate "$, $$" in general to modern LaTex syntax like "[...]"

Impact of fix

Users who rely on markdown capabilities are type safe with equations.

コントリビューターガイド