mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
also exclude lookbehinds from hightlighter seperator, to better support custom seperators for camelCasing + PascalCasing
This commit is contained in:
@@ -60,9 +60,9 @@ export type SearchHighlightFactoryFn = (query: string) => SearchHighlightFn
|
|||||||
export function setupSearchHighlighter(
|
export function setupSearchHighlighter(
|
||||||
config: SearchConfig
|
config: SearchConfig
|
||||||
): SearchHighlightFactoryFn {
|
): SearchHighlightFactoryFn {
|
||||||
// Hack: temporarily remove pure lookaheads
|
// Hack: temporarily remove pure lookaheads and lookbehinds
|
||||||
const regex = config.separator.split("|").map(term => {
|
const regex = config.separator.split("|").map(term => {
|
||||||
const temp = term.replace(/(\(\?[!=][^)]+\))/g, "")
|
const temp = term.replace(/(\(\?[!=<][^)]+\))/g, "")
|
||||||
return temp.length === 0 ? "<22>" : term
|
return temp.length === 0 ? "<22>" : term
|
||||||
})
|
})
|
||||||
.join("|")
|
.join("|")
|
||||||
|
|||||||
Reference in New Issue
Block a user