Merge pull request #266 from squidfunk/fix/search-missing-results

Fixed missing search results when only a h1 is present
This commit is contained in:
Martin Donath 2017-04-08 19:12:00 +02:00 committed by GitHub
commit 7a6acb8a7b
6 changed files with 11 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -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-4f7a197d35.js"></script>
<script src="{{ base_url }}/assets/javascripts/application-0b7df094bf.js"></script>
<script>app.initialize({url:{base:"{{ base_url }}"}})</script>
{% for path in extra_javascript %}
<script src="{{ path }}"></script>

View File

@ -179,13 +179,16 @@ 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 */

View File

@ -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;
}
}