quarto-dev / quarto-dev/q2

issue better error message on encountering old-style code chunk options

Open
#152 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement error-messages readers-writers
Dominant language
Rust
Stars
255
Forks
17
Avg merge
6h 20m
Merged PRs (30d)
109

Description

Chunks with old style options are mangled

An executable code block {r eval=FALSE} is re-written as {.{r} eval="FALSE"}.

$ printf -- '```{r eval=FALSE}\nx = 1\n```\n' | cargo run --bin pampa -- -t qmd
Warning: [Q-2-8] Code block options in header
. . .
```{.{r} eval="FALSE"}
x = 1
```

$ printf -- '```{r eval=FALSE}\nx = 1\n```\n' | cargo run --bin pampa --     
Warning: [Q-2-8] Code block options in header
. . .
[ CodeBlock ( "" , ["{r}"] , [("eval", "FALSE")] ) "x = 1" ]%    

Table caption attributes are not written

$ printf '%s\n' '| A | B |' '|---|---|' '| 1 | 2 |' '' ': ABCD {tbl-colwidths="[30,70]"}'
| A | B |
|---|---|
| 1 | 2 |

: ABCD {tbl-colwidths="[30,70]"}

$ printf '%s\n' '| A | B |' '|---|---|' '| 1 | 2 |' '' ': ABCD {tbl-colwidths="[30,70]"}' | cargo run --bin pampa -- -t qmd
| A   | B   |
| --- | --- |
| 1   | 2   |

: ABCD

$ printf '%s\n' '| A | B |' '|---|---|' '| 1 | 2 |' '' ': ABCD {tbl-colwidths="[30,70]"}' | cargo run --bin pampa --
[ Table ( "" , [] , [("tbl-colwidths", "[30,70]")] ) (Caption Nothing [ Plain [Str "ABCD"] ]) [(AlignDefault, ColWidthDefault), (AlignDefault, ColWidthDefault)] (TableHead ( "" , [] , [] ) [Row ( "" , [] , [] ) [Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "A"]] , Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "B"]] ] ]) [TableBody ( "" , [] , [] ) (RowHeadColumns 0) [] [Row ( "" , [] , [] ) [Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "1"]] , Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "2"]] ] ]] (TableFoot ( "" , [] , [] ) [] ) ]%   

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing both cases with cargo run --bin pampa: the old-style {r eval=FALSE} code block and the table caption with tbl-colwidths. Trace the pampa parsing and qmd output paths, then verify that code options are not mangled and table caption attributes are preserved in output and the parsed representation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.