-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Knitting with the Button in the IDE renders HTML even with method != 'html' #562
Comments
@yihui continuing the discussion here. I tested with blogdown 0.21 and this also happens with
|
I've figured out the reason, but don't know what the proper solution should be. When you knit a single Rmd with the Knit button, RStudio starts up the R session in the directory of the Rmd file, instead of the project root. The |
I tried that to verified that by adding a chunk with |
It only works with |
I just pushed a fix to execute |
I am not sure to follow completely. What I tried is adding in the Rmd file ```{r}
blogdown:::build_method()
``` Having this in .Rprofile options(
# to automatically serve the site on RStudio startup, set this option to TRUE
blogdown.serve_site.startup = FALSE,
# to disable knitting Rmd files on save, set this option to FALSE
blogdown.knit.on_save = FALSE,
# build .Rmd to .html (via Pandoc); to build to Markdown, set this option to 'markdown'
blogdown.method = 'custom'
) And got
in the HTML produced by the knit button So I concluded (wrongly it seems) that the method was correctly seen. With > packageVersion("blogdown")
[1] ‘0.21.81’ Would having a configuration file instead of a .Rprofile a solution that would prevent this ? I'll try to come up with a reproducible example to add in the list of issue for RStudio IDE. |
And same thing with custom made option in .Rprofile. In fact, I guess this is because we run Thanks for the quick fix ! One more hack we'll need to maintain then ! |
Oh you are right. It was because Line 161 in 94d84f9
and the new R session is started from the root directory of the project. |
About the importance of creating good test before coming to a conclusion 😅 |
I recently ran into a problem described in this post, and then I found this issue. I guess perhaps this issue is related to the problem but as a novice, I don't quite follow your discussions, so I still can't figure out the solution. I'd really appreciate if you can help! 😃 |
Sorry to bother but @cderv would you mind giving some advice? I posted my question on rstudio community and stackoverflow but haven't received any reply so far. 😅 |
It seems there is something we don't expect in RStudio IDE when using the knit button with blogdown.
blogdown offer different rendering method like
However, even with this method, a HTML is produced when it should not be only when using the knit button
This steps should help reproduce
options(blogdown.method = "custom")
in .Rprofile. This should tell blogdown to let thebuild.R
script do the rendering.blogdown:::build_method()
is"custom"
build.R
empty - as do nothing.blogdown::build_site(build_rmd = TRUE)
will correctly do nothingIt is the same with
method = "markdown"
I was under the impression that the Knit button in the IDE would run
rmarkdown::render_site(<absolut_input_path>)
butrmarkdown::render_site(<absolut_input_path>)
in the R console will correctly output a .md fileThis happens only with .Rmd to .md - .Rmarkdown are correctly rendered to .markdown.
It is as if the IDE is modifying the behavior somehow. IDE bug ?
Discovered in #530
The text was updated successfully, but these errors were encountered: