Parser: a stray `{key=value}` in a paragraph is accepted silently (passes --dry-run, dropped in HTML)

Aperta
#1,444 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
tooling

Direzione di ricerca

Start by tracing how q2 parses standalone attributes and how q2 render --dry-run reports parse problems; the issue does not name source files or tests. Reproduce with Text {colspan=2} here. and compare dry-run with HTML and docx output. Done means dry-run reports the stray attribute with its location, and rendering no longer silently drops the text.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Tested with q2 0.48.0 on Windows 11. Split from #1322, which now covers only the JSON writer's hidden diagnostics.

A {key=value} block in the middle of a paragraph is accepted as a standalone attribute with nothing to attach to. Nothing reports it:

  • q2 render --dry-run finds no problems.
  • --to html succeeds and drops the text without a warning.
  • --to docx (and other formats that go through pandoc) fails in the JSON writer with "Standalone attribute not supported in JSON format" (see #1322).

This happens easily after pasting text, or when trying an attribute somewhere q2 doesn't support one (for example a list-table cell attribute outside a list table).

Repro

Text {colspan=2} here.
$ q2 render s4.qmd --dry-run
Checked 1 file — no problems found

$ q2 render s4.qmd --to html
<p>Text  here.</p>

Proposal: report a standalone attribute that has nothing to attach to at parse time, with its location:

  • An error, not a warning. It already stops every format that goes through pandoc, so making it an error everywhere means HTML and docx behave the same. HTML stops losing text without saying so, and --dry-run catches what a docx render would fail on.
  • A new Q-code, with a hint that attributes go directly after a span ([text]{key=value}), a heading, or a div/code fence.

If a warning that keeps the text as literal text fits q2 better, that would also solve it for us. What matters is that --dry-run reports it.

Lingua principale
Rust
Stelle
321
Fork
23
Merge medio
11h 39m
PR unite (30g)
251

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di quarto-dev/q2

Tutte le issue di quarto-dev/q2

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.