yihui / knitr

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

Should `spin` treat roxygen2 function documentation like R code? #1050

Closed zachary-foster closed 8 years ago

zachary-foster commented 9 years ago

I thought it would be awesome to write an R package as a literate programming document, with the code itself producing part of the HTML documentation via spin. One issue I ran into while exploring this possibility is that roxygen2 documentation is treated as Rmarkdown by spin. I know that I can change the value of the doc option when using spin so that the roxygen2 comments are not parsed, but I would like my R files to compile with the default options so things like "compile R notebook" (ctrl + shft + K) work as expected. I also noticed I could comment out the roxygen2 documentation using /* and */, but then it does not show up in the Rmd output.

In short, I would like to produce a document that can be spun using spin's default options in which the roxygen2 function documentation is part of the code chunks. I can see a few ways this could be accomplished:

I am just getting into using spin so I am sorry if I overlooked some existing functionality that can solve my problem. Thanks for everything!

yihui commented 9 years ago

I can see your problem, but sorry, I don't have a good solution for you, nor do I have much time to think about it at the moment.

yihui commented 8 years ago

You might be interested in this idea I wrote about last year: https://github.com/yihui/rlp

github-actions[bot] commented 4 years ago

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.