Code blocks in a language without a grammar get no div.sourceCode wrapper, so they lose the code-block box
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 72/100
Direzione di ricerca
Start by tracing how q2 renders fenced code blocks and adds sourceCode classes or the div.sourceCode wrapper, comparing the grammar and no grammar paths. Reproduce with the provided ini, default, and bash blocks in index.qmd. Done when language blocks without a grammar retain the code block box, and the behavior for blocks with no language matches the intended choice.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
When q2 has no grammar for a code block's language, it writes a bare <pre class="<lang> code-with-copy">, with no div.sourceCode wrapper and no sourceCode classes. The theme draws the code-block box (background, border, padding) on div.sourceCode, so these blocks render as plain text on the page background. Quarto 1 (Pandoc) wraps every block whose language its highlighter knows in div.sourceCode, even when it adds no colors. An example is ```default.
So a migrated site loses the code-block box on every block in a language outside q2's grammar set, not only the colors.
Versions
- q2 0.41.0 (macOS, arm64)
- Quarto 1.11.7, for comparison
- Chrome, 1280×800 viewport, default theme
Repro
_quarto.yml:
project:
type: website
website:
title: Example
index.qmd:
---
title: Code styling
---
```ini
[Widget]
; Turn the widget on.
Enabled = true
```
```default
/opt/widget/1.0/bin/widget
```
```bash
echo "highlighted in both"
```
q2 render
Expected (Quarto 1.11.7)
All three blocks are div.sourceCode > pre.sourceCode.<lang>, and all three have the box. Computed style of each div.sourceCode: background rgba(233, 236, 239, 0.65), border 1px solid. The default block has the box but no colors.
<pre class="sourceCode ini code-with-copy">
<pre class="sourceCode default code-with-copy">
<pre class="sourceCode bash code-with-copy">
Actual (q2 0.41.0)
<pre class="ini code-with-copy">
<pre class="default code-with-copy">
<pre class="sourceCode bash">
Only the bash block has the box. The ini and default blocks have background rgba(0, 0, 0, 0) and no border.
Notes
- Quarto 1 still leaves blocks with no language, and languages its highlighter does not know (for example
text,nginx), without the wrapper. So "wrap every block that has a language class" would box a few blocks that Quarto 1 does not. To me that looks like the better default, but it is a choice. - Scale, from one real documentation site (about 2,070 code blocks): 617 blocks lost the box after the migration. They were
ini466,default113,markdown24,toml5, and a few each ofdockerfile,xml,powershell,apache,conf, andtxt. - A user grammar in
_quarto/grammars/<lang>/fixes this for one language, because a highlighted block gets the wrapper. But that does not helpdefault, which has nothing to highlight.
- Lingua principale
- Rust
- Stelle
- 293
- Fork
- 20
- Merge medio
- 7h 45m
- PR unite (30g)
- 187
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di quarto-dev/q2
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
quarto-dev/q2#1031 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
quarto-dev/q2#957 ·
I maintainer di solito rispondono entro 1 giorno
-
Built-in highlighting for ```qmd (and ```markdown / ```md) code blocks with q2's own qmd parserForse già presa @cscheid l’ha presa oggi. Apertaenhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
quarto-dev/q2#1081 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
quarto-dev/q2#1053 ·
I maintainer di solito rispondono entro 1 giorno
-
hub-client: "Expand markup" and "Expand preview" should hide the other pane instead of shrinking itAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
quarto-dev/q2#1037 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di quarto-dev/q2
Issue simili
-
An EXE started from the shell with MAXALLOC FFFFh leaves a 0-paragraph free block after its ownApertabug low-priority
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
dividebysandwich/rust-dos#629 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
eliasstravik/herdr-projects#758 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
enhancement needs:sonnet ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno