mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Merge pull request #5656 from hendrikp/master
Custom search.seperator with lookbehind, in combination with highlighter, produces highlighting all over the place
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -240,7 +240,7 @@
|
|||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ 'assets/javascripts/bundle.90f9b918.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/bundle.a2cf1a4c.min.js' | url }}"></script>
|
||||||
{% for path in config.extra_javascript %}
|
{% for path in config.extra_javascript %}
|
||||||
{% if path.endswith(".mjs") %}
|
{% if path.endswith(".mjs") %}
|
||||||
<script type="module" src="{{ path | url }}"></script>
|
<script type="module" src="{{ path | url }}"></script>
|
||||||
|
|||||||
@@ -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