Skip to content

Commit

Permalink
standardize the docco linear format
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Dec 1, 2023
1 parent ab4498f commit fe2711d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 35 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

- Unbalanced chunk delimiters (fences) in R Markdown documents are no longer allowed, as announced two years ago at <https://yihui.org/en/2021/10/unbalanced-delimiters/> (#2306). This means the opening delimiter must strictly match the closing delimiter, e.g., if a code chunk starts with four backticks, it must also end with four; or if a chunk header is indented by two spaces, the closing fence must be indented by exactly two spaces. For authors who cannot update their R Markdown documents for any reason at the moment, setting `options(knitr.unbalanced.chunk = TRUE)` (e.g., in `.Rprofile`) can temporarily prevent **knitr** from throwing an error, but it is strongly recommended that you fix the problems as soon as possible, because this workaround will be removed in future.

## MINOR CHANGES

- Fixed broken vignettes, improved CSS for HTML vignettes, and reduced the file sizes.

# CHANGES IN knitr VERSION 1.45

## NEW FEATURES
Expand Down
14 changes: 14 additions & 0 deletions R/rocco.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,17 @@ rocco = function(input, ...) {
)
)
}

# the Docco linear style
docco_linear = function(...) {
knit2html(..., meta = list(
css = c(
'https://ashkenas.com/docco/resources/linear/public/stylesheets/normalize.css',
'https://ashkenas.com/docco/resources/linear/docco.css', '@prism-xcode'
),
js = '@npm/@xiee/utils/js/center-img.min.js',
`header-includes` = '<style type="text/css">.container{width:auto;max-width:920px;}.page{width:auto;max-width:800px;}.page pre{width:100%;max-width:768px;}pre, code{font-size:90%;}</style>',
`include-before` = '<div class="container"><div class="page">',
`include-after` = '<div class="fleur">h</div></div></div>'
))
}
6 changes: 2 additions & 4 deletions R/utils-vignettes.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ vtangle = function(file, ..., encoding = 'UTF-8', quiet = FALSE) {
}

vweave_docco_linear = vweave
body(vweave_docco_linear)[5L] = expression(knit2html(
file, encoding = encoding, quiet = quiet, envir = globalenv(),
template = system.file('misc', 'docco-template.html', package = 'knitr'),
...
body(vweave_docco_linear)[5L] = expression(docco_linear(
file, encoding = encoding, quiet = quiet, envir = globalenv(), ...
))

vweave_docco_classic = vweave
Expand Down
31 changes: 0 additions & 31 deletions inst/misc/docco-template.html

This file was deleted.

0 comments on commit fe2711d

Please sign in to comment.