feat: マークダウンレンダリングの改善 (#54)#58
Merged
Merged
Conversation
- highlight.js (common) によるコードブロックのシンタックスハイライト - コピーボタン(イベント委譲 + Extension Host 経由のクリップボード操作) - リスト・見出し・段落の適切なスペーシング - ネストされたコードブロックの前処理ユーティリティ - marked を Marked インスタンスに変更(グローバル状態汚染の回避) - DOMPurify で SVG 要素を許可する設定 - highlight.js テーマを VSCode CSS 変数に連動
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.
概要
Issue #54 に対応し、マークダウンレンダリングを改善しました。
変更内容
1. シンタックスハイライト
highlight.js/lib/commonを使用し、コードブロックにシンタックスハイライトを適用--vscode-*) に連動したカラースキーム2. コピーボタン
dangerouslySetInnerHTMLと共存postMessage("copyToClipboard")経由で Extension Host のvscode.env.clipboard.writeText()を使用3. スペーシング改善
ul/ol/li) のコンパクトなマージンh1〜h6のサイズ階層とマージンp) の適切な余白4. ネストされたコードブロック
preprocessNestedCodeBlocks()ユーティリティで、内側にコードフェンスを含むブロックの外側フェンスを自動拡張設計判断
highlight.js/lib/common(37言語)new Marked()インスタンスmarked.use()のグローバル副作用を回避onClickon container)dangerouslySetInnerHTMLが DOM を置換するためaddEventListenerは不可navigator.clipboardが使用不可createRoot+dangerouslySetInnerHTMLの併用は detached DOM を生むテスト
markdown.test.ts: ネストコードブロック前処理の 9 テスト追加Closes #54