Air incorrectly formatting Python code cell in Quarto document
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 446
- Forks
- 32
- Avg merge
- 16h 48m
- Merged PRs (30d)
- 1
Description
I am attempting to use Air in a repo that has some Quarto documents with both R and Python cells. It seems to recognize the Python cell is not R code and Air does not attempt to format it, but it incorrectly formats any Quarto options defined in the cell.
Reproducible example:
---
title: "Test"
format: html
---
```{r}
#| label: setup
library(tidyverse)
library(reticulate)
```
```{python}
#| echo: false
from sklearn.linear_model import LinearRegression
import pandas as pd
```
is formatted into
---
title: "Test"
format: html
---
```{r}
#| label: setup
library(tidyverse)
library(reticulate)
```
```{python}
# | echo: false
from sklearn.linear_model import LinearRegression
import pandas as pd
```
Notice Air is adding a space inside of #| so the line is no longer recognized by Quarto when you render the document
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided mixed R/Python Quarto document and inspect how Air processes options inside non-R cells. Verify the formatter's output for the Python cell, then add coverage for the shown example if the relevant test entry point is found. Done means R code is formatted while Quarto options such as #| echo: false remain renderable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, r
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100