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

Code chunks with empty attributes fail to parse #28

Open
gadenbuie opened this issue Aug 13, 2021 · 1 comment
Open

Code chunks with empty attributes fail to parse #28

gadenbuie opened this issue Aug 13, 2021 · 1 comment

Comments

@gadenbuie
Copy link

Bit of an odd case that I just ran into. A chunk with an empty set of braces

```{}
# example code
```

is parsed as a plain code block by pandoc/rmarkdown

text <-  c(
  "```{}", 
  "# example code", 
  "```"
)

withr::with_tempfile("tf", {
  writeLines(knitr::knit(text = text), tf)
  rmarkdown::pandoc_convert(tf, from = "markdown", to = "html")
})
#> <pre><code># example code</code></pre>

but is flagged as invalid syntax by parse_rmd().

parsermd::parse_rmd(text)
#> Error: Failed to parse line 1, expected chunk engine
#> ```{}
#> ~~~~^
@rundel
Copy link
Owner

rundel commented Aug 15, 2021

I think there should be an approach that handles this and #27 using a look ahead - I'll play around with it and see what I can get working

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

No branches or pull requests

2 participants