Skip to content
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

Empty chunks can not be knitted when caching is enabled #918

Closed
holgerbrandl opened this issue Dec 17, 2014 · 2 comments
Closed

Empty chunks can not be knitted when caching is enabled #918

holgerbrandl opened this issue Dec 17, 2014 · 2 comments
Labels
bug Bugs
Milestone

Comments

@holgerbrandl
Copy link

  1. Create a fake myscript.Rmd with an empty chunk (using ` instead of the backtick for sure)
backtick-backick-backtick{r }
backtick-backick-backtick
  1. And then try it to knit it with caching being enabled
opts_chunk$set(cache = TRUE)
knit2html("myscript.Rmd")

knit2html seems to be blocked and runs forever.

This may look like a very artificial use-case but it occurs for me frequently when knitr::spining R-scripts: Whenever spin() encounters an R comment wrapped by 2 markdown lines, it creates an empty chunk. E.g.

#'  # some title
### comment

#' some other markdown

However, I think spin is working correctly here by ignoring the comment and trimming away empty lines within the chunk. knit2html should be more robust and process empty chunks even if caching is enabled. It does so if caching is disabled.

I'm using R v3.1 with knitr v1.8

yihui added a commit to rstudio/markdown that referenced this issue Dec 18, 2014
@yihui yihui closed this as completed in 586212b Dec 18, 2014
@yihui yihui added this to the v1.9 milestone Dec 18, 2014
@yihui yihui added the bug Bugs label Dec 18, 2014
@yihui
Copy link
Owner

yihui commented Dec 18, 2014

Thanks. Just fixed it. Please install the development versions of markdown and knitr:

devtools::install_github(c('rstudio/markdown', 'yihui/knitr'))

yihui added a commit to yihui/formatR that referenced this issue Dec 18, 2014
jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Apr 17, 2016
Upstream changes:
CHANGES IN formatR VERSION 1.3

NEW FEATURES

	o `tidy_source()` can deal with multibyte characters that cannot represented
	in the system native encoding now (on Windows)

	o `usage()` works for functions obtained from `::` or `:::` now, e.g.
	`usage(formatR::tidy_source)`

		   CHANGES IN formatR VERSION 1.2

MAJOR CHANGES

  o the minimal required R version is 3.0.2 now

		   CHANGES IN formatR VERSION 1.1

NEW FEATURES

  o added a new argument `output` to usage()

BUG FIXES

  o fixed yihui/knitr#918: when code is NULL, parse() will hang (with a question
  mark waiting for input)
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bugs
Projects
None yet
Development

No branches or pull requests

2 participants