File tree 4 files changed +82
-1
lines changed
4 files changed +82
-1
lines changed Original file line number Diff line number Diff line change 9
9
Theme options
10
10
=============
11
11
12
- This theme only adds one configuration value:
12
+ This theme adds the following configuration option,
13
+ and the ones under `docsearch options`_:
13
14
14
15
.. confval:: accent_color
15
16
28
29
display_version=False,
29
30
)
30
31
32
+ Docsearch options
33
+ -----------------
34
+
35
+ These two configuration values are required to use docsearch_:
36
+
37
+ .. _docsearch: https://docsearch.algolia.com/
38
+
39
+ .. confval:: docsearch_key
40
+
41
+ :type: str
42
+
43
+ The API key provided by docsearch.
44
+
45
+ .. confval:: docsearch_index
46
+
47
+ :type: str
48
+
49
+ The index name used by docsearch.
50
+
51
+ The following configuration values are optional:
52
+
53
+ .. confval:: docsearch_doc_version
54
+
55
+ :type: str
56
+ :default: ``'latest'`` or ``'stable'``
57
+
58
+ The documentation version searched.
59
+ The default is ``'stable'`` if ``READTHEDOCS_VERSION=stable`` is set,
60
+ and ``'latest'`` otherwise.
61
+
62
+ .. confval:: docsearch_js_version
63
+
64
+ :type: str
65
+ :default: ``'2.6'``
66
+
67
+ The docsearch library version used.
68
+
31
69
"""
32
70
33
71
from pathlib import Path
Original file line number Diff line number Diff line change 1
1
{% extends "sphinx_rtd_theme/layout.html" %}
2
+
3
+ <!-- Have to use htmltitle to include this earlier as our style -->
4
+ {%- block htmltitle %}
5
+ {{ super() }}
6
+ {% if theme_docsearch_key and theme_docsearch_index %}
7
+ < link rel =stylesheet href ="https://cdn.jsdelivr.net/npm/docsearch.js@{{ theme_docsearch_js_version }}/dist/cdn/docsearch.min.css "/>
8
+ {% endif %}
9
+ {%- endblock -%}
10
+
11
+ <!-- Styles that come last -->
2
12
{%- block extrahead %}
3
13
{{ super() }}
4
14
{% if theme_accent_color %}
7
17
</ style >
8
18
{% endif %}
9
19
{% endblock %}
20
+
21
+ {% set safe_version = version if version in ["latest", "stable"] else "latest" %}
22
+
23
+ {% block scripts %}
24
+ {{ super() }}
25
+ {% if theme_docsearch_key and theme_docsearch_index %}
26
+ < script src ="https://cdn.jsdelivr.net/npm/docsearch.js@{{ theme_docsearch_js_version }}/dist/cdn/docsearch.min.js "> </ script >
27
+ < script >
28
+ document . addEventListener ( 'DOMContentLoaded' , ( ) => docsearch ( {
29
+ apiKey : '{{ theme_docsearch_key }}' ,
30
+ indexName : '{{ theme_docsearch_index }}' ,
31
+ inputSelector : '#rtd-search-form > input[name="q"]' ,
32
+ algoliaOptions : { facetFilters : [ 'version:{{ theme_docsearch_doc_version or safe_version }}' ] } ,
33
+ debug : false ,
34
+ } ) )
35
+ </ script >
36
+ {% endif %}
37
+ {% endblock %}
Original file line number Diff line number Diff line change 9
9
.wy-side-nav-search input [type = "text" ] { border-width : 0 }
10
10
.wy-side-nav-search a .icon-home { font-size : 2em ; color : var (--accent-color ) }
11
11
.wy-side-nav-search a .icon-home ::before { content : none }
12
+ .wy-menu li a { overflow : hidden; text-overflow : ellipsis; } /* display ellipsis in long items */
12
13
14
+ /* DocSearch adaptations */
15
+
16
+ .wy-nav-side { overflow : visible; }
17
+ .wy-side-scroll { overflow : inherit; }
18
+
19
+ /* Making it a bit wider */
20
+ .algolia-autocomplete .ds-dropdown-menu {
21
+ max-width : 1000px ;
22
+ min-width : 80vw ;
23
+ }
13
24
14
25
/* Custom classes */
15
26
Original file line number Diff line number Diff line change @@ -18,3 +18,7 @@ style_external_links = False
18
18
style_nav_header_background =
19
19
# added by scanpydoc
20
20
accent_color =
21
+ docsearch_key =
22
+ docsearch_index =
23
+ docsearch_doc_version =
24
+ docsearch_js_version = 2.6
You can’t perform that action at this time.
0 commit comments