Skip to content

Commit

Permalink
rename fuel() to vest(); although fuel() is a nice name, unfortunatel…
Browse files Browse the repository at this point in the history
…y it looks too similar to fuse() and users may accidentally call fuel() when they meant fuse() since the autocomplete will show fuel() before fuse()
  • Loading branch information
yihui committed Jan 6, 2025
1 parent 16afffa commit d94ea88
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ S3method(record_print,tbl_df)
export(crack)
export(engines)
export(fiss)
export(fuel)
export(fuse)
export(fuse_book)
export(fuse_env)
Expand All @@ -26,6 +25,7 @@ export(reactor)
export(roam)
export(sieve)
export(timing_data)
export(vest)
import(utils)
importFrom(xfun,Rscript_call)
importFrom(xfun,alnum_id)
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

- Added support for the chunk option `fig.dim`, which is a shortcut for `fig.width` and `fig.height`.

- Added a new function `fuel()` as another way to add CSS/JS assets to HTML output.
- Added a new function `vest()` as another way to add CSS/JS assets to HTML output.

- Provided templates and a Github action `yihui/litedown/site` to build package websites. See https://yihui.org/litedown/#sec:pkg-site for details.

Expand Down
4 changes: 2 additions & 2 deletions R/package.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pkg_desc = function(name = detect_pkg()) {
), '\n</tbody></table>'
)

new_asis(c(res, fuel(css = '@manual')))
new_asis(c(res, vest(css = '@manual')))
}

# format authors, adding URL and ORCID links as appropriate
Expand Down Expand Up @@ -376,7 +376,7 @@ pkg_manual = function(
res = gsub('<code class="language-R"', '<code class="language-r"', res, fixed = TRUE)
res = gsub('&#8288;', '', res, fixed = TRUE)
res = gsub('<table>', '<table class="table-full">', res, fixed = TRUE)
new_asis(c(toc, res, fuel(css = '@manual')))
new_asis(c(toc, res, vest(css = '@manual')))
}

run_examples = function(html, config, path) {
Expand Down
6 changes: 3 additions & 3 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ restore_html = function(x) {
#' @examples
#' litedown:::assets[, -1]
#' # add features
#' litedown::fuel(c('copy-button', 'tabsets'))
#' litedown::vest(c('copy-button', 'tabsets'))
#' # add css/js directly
#' litedown::fuel(css = '@tabsets', js = c('@tabsets', '@fold-details'))
fuel = function(feature = NULL, css = NULL, js = NULL) {
#' litedown::vest(css = '@tabsets', js = c('@tabsets', '@fold-details'))
vest = function(feature = NULL, css = NULL, js = NULL) {
if (length(feature)) {
a = assets[feature, , drop = FALSE]
css = c(a[, 'css'], css); js = c(a[, 'js'], js)
Expand Down
8 changes: 4 additions & 4 deletions docs/05-assets.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,20 @@ a

If the source document is R Markdown instead of Markdown, an alternative way (in
addition to configuring YAML metadata) to add assets is to call the function
`litedown::fuel()` in a code chunk. You can either pass vectors of `css` / `js`
`litedown::vest()` in a code chunk. You can either pass vectors of `css` / `js`
asset names to the `css` / `js` arguments, or the `feature` names in @tab:assets
to the `feature` argument, e.g.,

```` md
```{r, echo = FALSE}
# add assets by feature
litedown::fuel(feature = c('callout', 'copy-button'))
litedown::vest(feature = c('callout', 'copy-button'))
# or add css/js directly
litedown::fuel(css = c('@callout', '@book'), js = '@callout')
litedown::vest(css = c('@callout', '@book'), js = '@callout')
```
````

You can call `fuel()` multiple times in a document to keep adding assets.
You can call `vest()` multiple times in a document to keep adding assets.

## The default CSS {#sec:default}

Expand Down
10 changes: 5 additions & 5 deletions man/fuel.Rd → man/vest.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d94ea88

Please sign in to comment.