Do you plan to have a dedicated Quarto parser to handle R code chunks?

Open
#1,441 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
8/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Active
Tech stack
markdown, r, rust
Domain
devtools

Research direction

This is a design question rather than a code change, and the payload names no files to edit. Start by reading the linked pull request #1440 to see how Ark currently detects earlier library() calls in Quarto chunks, then check how the #| eval: false case from the issue would be handled. Done means a maintainer answers whether a dedicated Quarto/R Markdown chunk parser is planned, before anyone writes code.

Written by the indexing model from the issue text.

Description

Hi, I'm not sure this is the right place to ask but I have a question regarding how Ark handles Quarto documents, which might influence how Jarl does it.

Currently, Jarl can check Quarto and R Markdown documents but this support is a bit brittle because it uses the following process:

  • parse the text of the file
  • extract the code chunks and code options with regex
  • concatenate chunks (possibly after excluding chunks that we know are never evaluated)
  • check the code as a single file
  • remap diagnostics to their original location

The two weak parts are 1) the extraction of code chunks based on regex, and 2) determining the list of chunk options for each chunk (in particular, Jarl doesn't handle chunk options defined in the YAML frontmatter, for now).

I suspect this is (or will be) a challenge encountered by Ark as well when it needs to report diagnostics in Quarto files. For instance, https://github.com/posit-dev/ark/pull/1440 adds support to detect earlier library() calls, but I think a library() call shouldn't be considered as populating the namespace if it is in a chunk with #| eval: false and, AFAICT, this case isn't handled by the linked PR.

If this is indeed an issue for Ark too, I suppose a more robust solution would be to have a dedicated Quarto parser that gathers chunks and their options, and that resolves options defined in the frontmatter and those defined in the chunks themselves. Although Quarto 2 is developed in Rust, it might be overkill since I wouldn't need all the extra stuff about Markdown syntax. Is my understanding correct? Is this something that you plan to develop? If so, would it also handle R Markdown files? I'm asking simply to avoid duplicated work if this is on the roadmap for the near future.

Dominant language
Rust
Stars
342
Forks
31
Avg merge
1d 11h
Merged PRs (30d)
31

Getting set up

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.

More from posit-dev/ark

All issues in posit-dev/ark

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.