-
-
Notifications
You must be signed in to change notification settings - Fork 969
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
yaml_front_matter
throws error if YAML ends with comment that ends with a :
.
#2483
Comments
The error comes from Lines 727 to 731 in 9568cde
We purposely error since the start to warn user for an incomplete front matter that would cause (at the time) YAML parsing issue. So this is by design, and we do not account for comment in the validation. (we could try though) However, I am wondering if we should still validate. This is called in Lines 713 to 714 in 9568cde
to prevent the hang in
@yihui what do you think ? |
I think we can get rid of the validation. |
Thanks I went with removal. I don't think this internal function is used anywhere else (I checked Quarto and RStudio IDE and Connect) |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
Expected behaviour
A line starting with
#
would be treated as a comment and not affect the parsing of the rest of a YAML block when usingyaml_front_matter()
.Actual behaviour
If the YAML block ends with a comment that ends the line with a
colon
, that colon causesyaml_front_matter()
to return a parsing error because the YAML ends in:
, despite the colon being part of a comment. The comment can exist earlier on in the YAML, as long as it has another term afterwards.Reprex (CRAN version)
Make two Rmd files, with the same lines of YAML, but swapping the author and (commented out) date lines around.
Created on 2023-05-03 with reprex v2.0.2
I had the same result in R 4.2.1.
Reprex (development version)
Created on 2023-05-03 with reprex v2.0.2
Checklist
When filing a bug report, please check the boxes below to confirm that you have provided us with the information we need. Have you:
formatted your issue so it is easier for us to read?
included a minimal, self-contained, and reproducible example?
pasted the output from
xfun::session_info('rmarkdown')
in your issue?upgraded all your packages to their latest versions (including your versions of R, the RStudio IDE, and relevant R packages)?
installed and tested your bug with the development version of the rmarkdown package using
remotes::install_github("rstudio/rmarkdown")
?The text was updated successfully, but these errors were encountered: