Skip to content

Commit

Permalink
add the meta variable 'plain-title' for HTML, so the <title> won't co…
Browse files Browse the repository at this point in the history
…ntain HTML tags
  • Loading branch information
yihui committed Aug 29, 2024
1 parent fdddad1 commit a26ce2d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: litedown
Type: Package
Title: A Lightweight Version of R Markdown
Version: 0.1.5
Version: 0.1.6
Authors@R: c(
person("Yihui", "Xie", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666")),
person()
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

- A data frame (or matrix/tibble) wrapped in `I()` is fully printed to a table now by default. Without `I()`, data objects are truncated to 10 rows by default when printing to tables.

- Added the meta variable `plain-title` for HTML output, which is the plain version of the document title (i.e., without HTML tags), and used in the `<title>` tag.

- The implicit latest version of jsdelivr resources will be resolved to an explicit version, e.g., `https://cdn.jsdelivr.net/npm/@xiee/utils/css/default.css` will be resolved to `https://cdn.jsdelivr.net/npm/@xiee/[email protected]/css/default.css`, where `X.Y.Z` is the current latest version. This will make sure the HTML output containing jsdelivr resources is stable.

# CHANGES IN litedown VERSION 0.1
Expand Down
1 change: 1 addition & 0 deletions R/mark.R
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ build_output = function(format, options, template, meta) {
if (!name %in% names(meta)) meta[[name]] <<- value
}
set_meta('css', 'default')
set_meta('plain-title', str_trim(commonmark::markdown_text(meta[['title']])))
meta = set_math(meta, options, b)
meta = set_highlight(meta, options, b)
# if the class .line-numbers is present, add js/css for line numbers
Expand Down
2 changes: 1 addition & 1 deletion inst/resources/litedown.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<meta name="generator" content="$generator$">

<title>$title$</title>
<title>$plain-title$</title>

$css$

Expand Down

0 comments on commit a26ce2d

Please sign in to comment.