Skip to content

Commit

Permalink
229 report echo code for plotting and displaying it within the R code…
Browse files Browse the repository at this point in the history
… in a PDF file. (#230)

fixes: #229

I added `\newpage` before the R code to ensure that all R code is placed
on a new page in the PDF. Additionally, I set` echo = FALSE` to prevent
the display of the code within picture blocks."
  • Loading branch information
kartikeyakirar authored Oct 20, 2023
1 parent 6110a02 commit 19c7303
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/Renderer.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ Renderer <- R6::R6Class( # nolint: object_name_linter.
block_content_list <- split_text_block(block$get_content(), 30)
paste(
sprintf(
"---\n\n```{r, echo=FALSE}\ncode_block(\n%s)\n```\n",
"\\newpage\n\n---\n\n```{r, echo=FALSE}\ncode_block(\n%s)\n```\n",
shQuote(block_content_list, type = "cmd")
),
collapse = "\n\n"
)
} else {
sprintf(
"--- \n\n```{r, %s}\n%s\n```\n",
"\\newpage\n\n--- \n\n```{r, %s}\n%s\n```\n",
paste(names(params), params, sep = "=", collapse = ", "),
block$get_content()
)
Expand All @@ -171,7 +171,7 @@ Renderer <- R6::R6Class( # nolint: object_name_linter.
title <- block$get_title()
if (length(title)) params["fig.cap"] <- shQuote(title)
sprintf(
"\n```{r, %s}\nknitr::include_graphics(path = '%s')\n```\n",
"\n```{r, echo = FALSE, %s}\nknitr::include_graphics(path = '%s')\n```\n",
paste(names(params), params, sep = "=", collapse = ", "),
basename_pic
)
Expand Down

0 comments on commit 19c7303

Please sign in to comment.