[MarkdownViewer] Mermaid classDiagram with <<annotation>> fails with "Syntax error in text"
メンテナーはふだん 4 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 75/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- csharp, html, javascript
- 領域
- desktop, documentation
調査の方向性
Read QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/Resources/md2html.html, focusing on the Mermaid fence handler and how its output is assigned to innerHTML. Check how the Markdown renderer exposes escapeHtml, then preview the supplied class diagram and confirm annotations such as <<interface>> render correctly while other Mermaid diagrams still work.
索引モデルが issue の本文から書いたものです。
説明
Environment
- QuickLook version: 4.5.0
- Plugin: QuickLook.Plugin.MarkdownViewer (bundled mermaid 11.13.0)
- OS: Windows 11 24H2
Description
A Mermaid classDiagram that contains annotations such as <<interface>> fails to render in the Markdown preview and shows "Syntax error in text".
The same diagram renders correctly with mermaid 11.13.0 elsewhere (e.g. mermaid.live, standalone mermaid).
Steps to reproduce
Create a .md file with the following content and preview it with QuickLook:
classDiagram
class IWeaponOutput {
<<interface>>
+Emit(ShotRequest request)
}
Expected: Class box with the «interface» annotation.
Actual: "Syntax error in text".
Removing the <<interface>> line makes the diagram render correctly.
Cause
In QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/Resources/md2html.html, the mermaid fence content is inserted without HTML escaping:
if (lang === 'mermaid') {
return '<div class="mermaid">' + str + '</div>';
}
The rendered output is then assigned to innerHTML, so the browser parses the diagram source as HTML. <<interface>> becomes an <interface> element (lowercased, with an auto-inserted closing tag), and mermaid receives corrupted text.
Any < followed by a letter in the diagram source is affected, e.g. <<ScriptableObject>>, <<enumeration>>, or generic text like List<T>.
Suggested fix
Escape the content before inserting it:
if (lang === 'mermaid') {
return '<div class="mermaid">' + md.utils.escapeHtml(str) + '</div>';
}
(or markdownit().utils.escapeHtml(str) if md is not in scope at that point).
Mermaid decodes HTML entities when it reads the element's content, so the escaped source should render correctly.
- 主要言語
- C#
- スター
- 25.7k
- フォーク
- 1.4k
- 平均マージ
- 4日 8分
- マージ済み PR(30日)
- 3
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
QL-Win/QuickLook のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 60/100
QL-Win/QuickLook#2028 · コメント 3 件 ·
メンテナーはふだん 4 日以内に返信
-
[Bug] If the first character entered into the search box is a space, the preview window will close.対応中かも @MORTEM3845 が 12 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 4 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
メンテナーはふだん 4 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
メンテナーはふだん 4 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 35/100
QL-Win/QuickLook#2050 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
QL-Win/QuickLook の issue をすべて見る
似ている issue
-
Add All Contributorsオープンenhancement ready-for-human
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
fboucher/2d6-dungeon-app#288 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
Unity-Technologies/unity-agent-plugin#118 ·
メンテナーはふだん 1 日以内に返信
-
The Recommended preset turns on Import Uno DSP, which only works with the Material theme対応中かも @agneszitte が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
unoplatform/uno.templates#2388 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
eyalgolan/statecraft-israel#2732 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
StratumServer/Optimum#198 ·
メンテナーはふだん 1 日以内に返信