Built-in highlighting for ```qmd (and ```markdown / ```md) code blocks with q2's own qmd parser

Abierto
#1,081 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@cscheid ya está trabajando en esto.

Desde el 6/11/2026.

  • #1091 de @cscheid — abierto

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
rust

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement

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 know qmd.
  • ```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.

Lenguaje dominante
Rust
Estrellas
293
Forks
20
Merge medio
7 h 45 min
PR fusionados (30 d)
187

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de quarto-dev/q2

Todos los issues de quarto-dev/q2

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.