Skip to content

Commit f9cf1ac

Browse files
committed
fix #913: remove non-printable characters in search_index.json (which are not searchable anyway and lead to invalid JSON)
1 parent 285cba4 commit f9cf1ac

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: bookdown
22
Type: Package
33
Title: Authoring Books and Technical Documents with R Markdown
4-
Version: 0.20.1
4+
Version: 0.20.2
55
Authors@R: c(
66
person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")),
77
person("JJ", "Allaire", role = "ctb"),

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGES IN bookdown VERSION 0.21
22

3+
## BUG FIXES
4+
5+
- Make sure `search_index.json` contains valid characters for the JSON format (thanks, @wlandau, #913).
6+
37
## MINOR CHANGES
48

59
- The `--file-scope` behavior introduced in bookdown v0.20 is now disabled by default. This is due to broken TOC links for duplicate section names (e.g., "Exercises"; see #909) that have automatically generated identifiers.

R/gitbook.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ write_search_data = function() {
7979
x = matrix(strip_search_text(x), nrow = 3)
8080
x = apply(x, 2, xfun::json_vector, to_array = TRUE)
8181
x = paste0('[\n', paste0(x, collapse = ',\n'), '\n]')
82+
x = gsub('[^[:print:]]', '', x)
8283
write_utf8(x, output_path('search_index.json'))
8384
}
8485

0 commit comments

Comments
 (0)