Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rmd YAML header? #399

Closed
Tracked by #390
gaborcsardi opened this issue Dec 11, 2024 · 0 comments · Fixed by #400
Closed
Tracked by #390

Rmd YAML header? #399

gaborcsardi opened this issue Dec 11, 2024 · 0 comments · Fixed by #400

Comments

@gaborcsardi
Copy link
Member

gaborcsardi commented Dec 11, 2024

This is pretty difficult, unfortunately, but could not come up with a
simpler solution.

  • We use tree-sitter to parse and search the YAML, so that we can have
    coordinates, and also the search is much simpler than when using a YAML
    parser.
  • The tree-sitter parser cannot scan the actual values of the scalars, so
    we use a YAML parser for that (libyaml). (No, it is not better to scan
    them manually, they are quite involved.)
  • Scanning the scalars is a transformation, not just a subsetting, so
    we lose the correct coordinates for the things (e.g. R code) within
    the values. We still have the coordinates for the values, though.
  • We don't handle references correctly, because the tree-sitter parser
    does not help with that. For that we'd need to parse the whole YAML
    with libyaml. Maybe we'll do that in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant