diff --git a/altdoc/altdoc_preprocessing.R b/altdoc/altdoc_preprocessing.R index f25d21963..7ba52dc72 100644 --- a/altdoc/altdoc_preprocessing.R +++ b/altdoc/altdoc_preprocessing.R @@ -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")) {