lorenzwalthert / stylermd

Make markdown or plain text fit 80 characters. Or any limit you want.
21 stars 2 forks source link

use pandoc as backend #19

Open lorenzwalthert opened 2 years ago

lorenzwalthert commented 2 years ago

Seem like RStudio visual mode uses something like this to convert .Rmd into standard pandoc markdown:

pandoc -s -f markdown+backtick_code_blocks+fenced_code_attributes -t markdown -o new-README.Rmd README.Rmd

with code chunks:

``` {#r eval=FALSE}
a::b()
1

Maybe they could even expose the functionality. Also see: https://github.com/rstudio/rstudio/issues/7922

If they don't want:
* adapt header to required format above, i.e. prefix langauge with `#`, remove all commas (with regex).
* render.
* go through all headers and replace them with the old version.

Would be a nice pre-commit hook.
lorenzwalthert commented 2 years ago

Reference: https://github.com/r-lib/styler/pull/941