mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-12 01:50:52 +01:00
Fixed highlighting not working for two or more words
This commit is contained in:
parent
5ef40b5e3d
commit
67bea5e152
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
material/assets/stylesheets/application-b1a1975878.css
Normal file
1
material/assets/stylesheets/application-b1a1975878.css
Normal file
File diff suppressed because one or more lines are too long
@ -38,7 +38,7 @@
|
||||
<script src="{{ base_url }}/assets/javascripts/modernizr-56ade86843.js"></script>
|
||||
{% endblock %}
|
||||
{% block styles %}
|
||||
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-b168d32589.css">
|
||||
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-b1a1975878.css">
|
||||
{% if config.extra.palette %}
|
||||
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-f78e5cb881.palette.css">
|
||||
{% endif %}
|
||||
@ -150,7 +150,7 @@
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% block scripts %}
|
||||
<script src="{{ base_url }}/assets/javascripts/application-ae2e7c9801.js"></script>
|
||||
<script src="{{ base_url }}/assets/javascripts/application-ff7132a167.js"></script>
|
||||
<script>app.initialize({url:{base:"{{ base_url }}"}})</script>
|
||||
{% for path in extra_javascript %}
|
||||
<script src="{{ path }}"></script>
|
||||
|
@ -179,18 +179,24 @@ export default class Result {
|
||||
if (doc.parent) {
|
||||
const ref = doc.parent.location
|
||||
items.set(ref, (items.get(ref) || []).concat(item))
|
||||
} else {
|
||||
const ref = doc.location
|
||||
items.set(ref, (items.get(ref) || []))
|
||||
}
|
||||
return items
|
||||
}, new Map)
|
||||
|
||||
/* Assemble highlight regex from query string */
|
||||
const match = new RegExp(
|
||||
`\\b(${escape(this.value_.trim().replace(" ", "|"))})`, "img")
|
||||
`\\b(${escape(this.value_.trim()).replace(" ", "|")})`, "img")
|
||||
const highlight = string => `<em>${string}</em>`
|
||||
|
||||
/* Render results */
|
||||
result.forEach((items, ref) => {
|
||||
const doc = this.docs_.get(ref)
|
||||
// console.log(ref, items)
|
||||
// if (!items.length)// && !doc.text.length && !doc.title.match(match))
|
||||
// return
|
||||
|
||||
/* Append search result */
|
||||
this.list_.appendChild(
|
||||
|
@ -443,9 +443,9 @@ $md-toggle__search--checked:
|
||||
}
|
||||
}
|
||||
|
||||
// Add a little spacing on the last link
|
||||
&:last-child {
|
||||
padding-bottom: 0.8rem;
|
||||
// Add a little spacing on the teaser of the last link
|
||||
&:last-child .md-search-result__teaser {
|
||||
margin-bottom: 1.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user