Skip to content

Commit

Permalink
docs(website): improve search (#925)
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebacher authored Mar 17, 2024
1 parent 3eccccb commit 93b45d6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions altdoc/altdoc_preprocessing.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,25 @@ hierarchy = append(list("Reference" = "reference_home.md"), hierarchy)
# Insert the links in the settings
yml$nav[[3]]$Reference = hierarchy


# Customize the search
plugins = yml$plugins
replacement = list(
separator = paste0("[\\s\\-\\$]+|(", paste(classes, collapse = "_|"), "_)")
)
if (is.character(plugins)) {
plugins = setNames(as.list(plugins), plugins)
plugins[["search"]] = replacement
} else if (is.list(plugins)) {
for (i in seq_along(plugins)) {
if (plugins[[i]] == "search") {
plugins[[i]] = list(search = replacement)
}
}
}
yml$plugins = plugins


# These two elements should be lists in the yaml format, not single elements,
# otherwise mkdocs breaks
for (i in c("extra_css", "plugins")) {
Expand Down

0 comments on commit 93b45d6

Please sign in to comment.