yihui / knitr

A general-purpose tool for dynamic report generation in R
https://yihui.org/knitr/
2.36k stars 873 forks source link

export some pandoc syntax helper #2331

Closed cderv closed 3 months ago

cderv commented 3 months ago

I saw we have some helpers https://github.com/yihui/knitr/blob/031e08c74c501e0e1a5d625e0c053977b7a230ec/R/hooks-md.R#L228-L238

What about exporting pandoc_div in addition to knitr::raw_block (which could probably be rewritten using fenced_block() 🤔

I often try to create some Divs or RawBlock as raw Markdow output, and having hepler function for that (support classes and attributes) can be useful.

I can also put them in quarto R package directly;

yihui commented 3 months ago

I think that's a good idea. I'd probably move them to xfun, so they can be shared across more packages.

yihui commented 3 months ago

FYI I just added a function fenced_block() to xfun. Note that classes are just a special case of attributes, i.e., class = 'foo' is equivalent to attr = '.foo', so I didn't provide a specific class argument to xfun::fenced_block().