Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(website): improve search #925

Merged
merged 8 commits into from
Mar 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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