Built-in highlighting for ```qmd (and ```markdown / ```md) code blocks with q2's own qmd parser
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- rust
調査の方向性
Start by tracing q2's code block highlighting and built-in grammar registration, then inspect the bundled tree-sitter-qmd parser and its highlights.scm query. Check how aliases and grammar injections are handled for embedded code cells and YAML front matter. Done means qmd, markdown, and md blocks receive the requested syntax highlighting, including the listed Quarto constructs.
索引モデルが issue の本文から書いたものです。
説明
q2 has no built-in highlighting for Quarto markdown in code blocks: ```qmd, ```markdown, and ```md render as plain <pre> with no sourceCode wrapper. Documentation about Quarto and about publishing tools shows a lot of qmd and markdown. q2 already has its own qmd parser, tree-sitter-qmd, so it is the natural grammar for these blocks.
Versions
- q2 0.41.0 (macOS, arm64)
- Quarto 1.11.7, for comparison
Repro
index.qmd, with no _quarto.yml:
---
title: qmd highlighting
engine: markdown
---
`````qmd
---
title: "Report"
format: html
---
## Results
Some **bold** text and a [link](https://example.com).
```{python}
#| echo: false
print("hello")
```
`````
````markdown
## Results
Some **bold** text.
````
q2 render index.qmd
Quarto 1.11.7
```qmd: not highlighted (<pre class="qmd">). Pandoc's highlighter does not knowqmd.```markdown: highlighted with Pandoc's Markdown syntax (<pre class="sourceCode markdown">, heading tokens).
q2 0.41.0
Both blocks are <pre class="qmd code-with-copy"> and <pre class="markdown code-with-copy">, with no spans and no div.sourceCode wrapper.
Request
Highlight qmd, with markdown and md as aliases, using q2's own parser: front matter, headings, emphasis, links, code cells and their #| options, shortcodes, and divs. Ideally, embedded code cells and YAML front matter are highlighted with the matching built-in grammars, like an injection.
Notes
I tried the user-grammar route first. tree-sitter build --wasm on crates/tree-sitter-qmd/tree-sitter-markdown gives a 1.1 MB WASM file. It loads from _quarto/grammars/ only under the name markdown, because the WASM exports tree_sitter_markdown and the user-grammar loader derives the language function from the file name, so it cannot register qmd. With the bundled queries/highlights.scm, only **strong** and some punctuation get spans. Headings, links, front matter, and the nested code cell stay plain. A built-in, native path seems better than asking projects to vendor a large WASM build of q2's own parser.
- 主要言語
- Rust
- スター
- 293
- フォーク
- 20
- 平均マージ
- 7時間 45分
- マージ済み PR(30日)
- 187
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
quarto-dev/q2 のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
quarto-dev/q2#1031 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
quarto-dev/q2#957 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
quarto-dev/q2#1079 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
quarto-dev/q2#1053 ·
メンテナーはふだん 1 日以内に返信
-
hub-client: "Expand markup" and "Expand preview" should hide the other pane instead of shrinking itオープン
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
quarto-dev/q2#1037 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
binding:python bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
coollabsio/orbit#72 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
bug order-flow studies ui
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
userFRM/egui-charts#2417 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 2 日以内に返信