downlit
downlit copied to clipboard
downlit_md_path() should only modify R CodeBlocks
At least I didn't expect the YAML chunk below to be modified?
just_yaml <- c("```yaml", "layout: single", "```")
tmp <- tempfile()
file.create(tmp)
#> [1] TRUE
tmp2 <- tempfile()
file.create(tmp2)
#> [1] TRUE
writeLines(just_yaml, tmp)
downlit::downlit_md_path(tmp, tmp2)
readLines(tmp2)
#> [1] "<pre class='chroma'>"
#> [2] "<span class='nv'>layout</span><span class='o'>:</span> <span class='nv'>single</span>"
#> [3] "</pre>"
Created on 2021-01-04 by the reprex package (v0.3.0.9001)
Re-opening — this is fiddly because the CodeBlock AST differs between versions. Probably no point in tackling this until the pandoc package is available.