Skip to content

Commit

Permalink
Add highlight for search terms
Browse files Browse the repository at this point in the history
Signed-off-by: Tao He <linzhu.ht@alibaba-inc.com>
  • Loading branch information
sighingnow committed May 9, 2023
1 parent 17fd3f6 commit 9056b92
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
14 changes: 9 additions & 5 deletions docs/_templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
</script>

<!-- preload searchindex.js -->
<script src='' id="searchindexjs" type="text/javascript"></script>

<script
type="text/javascript"
src="{{ pathto('_static/searchtools.js', 1) }}">
</script>
{% endblock %}

{% block body %}
Expand All @@ -75,8 +76,11 @@
}

ready(function() {
let searchindexjs = document.getElementById("searchindexjs");
searchindexjs.src = "{{ pathto('searchindex.js', 1) }}";
// preload searchindex.js
let script = document.createElement("script");
script.src = "{{ pathto('searchindex.js', 1) }}";
script.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(script);
});
</script>
{% endblock %}
5 changes: 5 additions & 0 deletions docs/_templates/search.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% extends "!search.html" %}

{%- block regular_scripts -%}
{{ super() }}
{%- endblock regular_scripts-%}

0 comments on commit 9056b92

Please sign in to comment.