Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Script to check knitr version is high enough to render code blocks in…
Browse files Browse the repository at this point in the history
… challenges
  • Loading branch information
sritchie73 committed Jun 5, 2015
1 parent f226829 commit 7d92fce
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tools/check_knitr_version.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Check the knitr version is high enough to render
# code blocks embedded in blockquotes (i.e. challenges and tool tips).
version.string <- packageDescription("knitr")$Version
version.numbers <- as.integer(strsplit(version.string, "\\.")[[1]])
if (version.numbers[1] <= 1 & version.numbers[2] <= 10 & version.numbers[3] < 12)
stop("knitr must be version 1.10.12 or higher")

3 comments on commit 7d92fce

@aammd
Copy link

@aammd aammd commented on 7d92fce Jun 5, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this!! very nicely done

@sritchie73
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@fmichonneau
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can simply do:

if (packageVersion("knitr") < "1.10.12") stop("knitr must be version 1.10.12 or higher")

The fix allowing chunks to be quoted was introduced on April 19th (yihui/knitr@3f52d47) with version 1.9.20 (yihui/knitr@75a8ec0)

Please sign in to comment.