You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
set rmarkdown context into knit_opts during render #32
No, the rmarkdown v1 comment is just something to tell RStudio to use markdown::markdownToHTML rather than rmarkdown::render. By the time you get into rmarkdown::render you are using R Markdown v2 (it doesn't know anything about this special comment).
Your test would therefore look like this:
rmd_version <- knitr::opts_knit$get("rmarkdown.version")if (is.null(rmd_version)) { # using the markdown package} else if (rmd_version >= 2) { # using the rmarkdown package}
It seems the rmarkdown v1 comment can be used, it just lags by one render. Having this flag available is making testing of hooks much quicker than switching to another instance/server.
Activity
Thell commentedon Mar 28, 2014
Shouldn't this be
null?jjallaire commentedon Mar 28, 2014
No, the rmarkdown v1 comment is just something to tell RStudio to use markdown::markdownToHTML rather than rmarkdown::render. By the time you get into rmarkdown::render you are using R Markdown v2 (it doesn't know anything about this special comment).
Your test would therefore look like this:
Thell commentedon Mar 31, 2014
It seems the
rmarkdown v1comment can be used, it just lags by one render. Having this flag available is making testing of hooks much quicker than switching to another instance/server.Run one:
## [1] "using hook_markdown_latest"add:
<!-- rmarkdown v1 -->Run one:
## [1] "using hook_markdown_latest"Run two:
## [1] "using hook_markdown_v1"remove:
<!-- rmarkdown v1 -->Run one:
## [1] "using hook_markdown_v1"Run two:
## [1] "using hook_markdown_latest"github-actions commentedon Nov 3, 2020
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.