fix(blockquote): render fenced code blocks inside plain blockquotes#26
Merged
Conversation
コードフェンス (```) を含む引用ブロックが正しく描画されず、``` が インラインの <code> として扱われる問題を修正した。 原因は content_builder の引用内コードフェンス処理が current_alert_type (= コールアウト `> [!NOTE]` のとき)でのみ有効になっていたため。通常の `> ` 引用では current_alert_type が nil でこの分岐に入らず、`> ```sh` が インライン描画に流れて ``` が普通のコードスパンになっていた。 - ゲート条件を `current_alert_type and line:match "^>"` から `line:match "^>"` に緩め、通常の引用でもフェンスを認識させる - 分岐内の apply_alert_styling 2 か所を current_alert_type でガードし、 通常の引用にコールアウト用スタイルが掛からないようにする これで引用内コードブロックはフェンス行が本文化されず、│ プレフィックス 付きで String 描画され、code_blocks に登録されてシンタックスハイライトの 対象になる。回帰テストを 3 件追加。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
問題
以下のように引用ブロックの中にコードフェンスがあると正しく描画できず、
```が普通の<code>〜</code>として扱われていました。原因
content_builder.luaの引用内コードフェンス処理がcurrent_alert_typeが設定されているとき、つまり> [!NOTE]のようなコールアウト (アラート) の場合だけ動作するようゲートされていました。通常の
>引用ではcurrent_alert_typeがnilのためこの分岐に入らず、> ```shがインライン描画に流れて```が普通のコードスパンになっていました。修正
current_alert_type and line:match "^>"からline:match "^>"に緩め、通常の引用でもフェンスを認識するようにした。apply_alert_styling呼び出し 2 か所をcurrent_alert_typeでガードし、通常の引用にコールアウト用のスタイルが誤って掛からないようにした (│はFloatBorder、コード本体はString)。これで引用内コードブロックは、フェンス行が本文化されず、
│プレフィックス付きでString描画され、code_blocksに登録されてシンタックスハイライトの対象になります。テスト
tests/markdown_checkbox_test.lua): フェンス行が本文化されないこと・コードブロックが登録されること・ハイライト (FloatBorder + String、アラートスタイルなし) の確認。🤖 Generated with Claude Code