1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-09-24 19:38:27 +02:00

Truncate search result text for performance reasons

This commit is contained in:
squidfunk 2017-03-16 16:26:52 +01:00 committed by Martin Donath
parent 675a75e000
commit d77d900479
3 changed files with 6 additions and 4 deletions

View File

@ -151,7 +151,7 @@
{% endblock %}
</div>
{% block scripts %}
<script src="{{ base_url }}/assets/javascripts/application-1380e43b15.js"></script>
<script src="{{ base_url }}/assets/javascripts/application-c5d094b286.js"></script>
<script>app.initialize({url:{base:"{{ base_url }}"}})</script>
{% for path in extra_javascript %}
<script src="{{ path }}"></script>

View File

@ -205,14 +205,16 @@ export default class Result {
</h1>
{section.text.length ?
<p class="md-search-result__teaser">
{{ __html: section.text.replace(match, highlight) }}
{{ __html: this.truncate_(
section.text.replace(match, highlight), 400)
}}
</p> : {}}
</article>
</a>
)
})}
</li>
) /* {this.truncate_(doc.text, 140)} */
)
})
/* Bind click handlers for anchors */