Skip to content

Commit ed505fb

Browse files
authored
Merge pull request #352 from ByteInternet/docsearch-earch
Docsearch search + Sphinx 8
2 parents 87568a8 + cc53ced commit ed505fb

File tree

13 files changed

+68
-47
lines changed

13 files changed

+68
-47
lines changed

.github/workflows/lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
python-version: ['3.10']
15+
python-version: ['3.12']
1616

1717
steps:
1818
- uses: actions/checkout@v3

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
python-version: ['3.8', '3.9', '3.10', '3.11']
11+
python-version: ['3.11', '3.12']
1212

1313
steps:
1414
- uses: actions/checkout@v3

docs/_static/css/main.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/_static/scss/components/_breadcrumbs.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ li.wy-breadcrumbs-aside a {
4545
line-height: 50px;
4646
width: 100%;
4747
position: fixed;
48-
top: 60px;
48+
top: 72px;
4949
border-bottom: 1px solid var(--grey-border);
5050
z-index:20;
5151
background-color: white;

docs/_static/scss/components/_layout.scss

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,14 @@
143143
}
144144

145145
.wy-side-nav-search {
146-
width: 100%;
147-
background-color: var(--primary-blue);
148-
padding: 0;
149-
position: fixed;
150146
top: 0;
151-
height: 60px;
147+
width: 1500px;
148+
height: 72px;
149+
margin-left: auto;
150+
margin-right: auto;
151+
margin-bottom: 0;
152+
background-color: transparent;
153+
padding: 0;
152154
display: grid;
153155
grid-template-columns: 300px 1fr 300px;
154156
justify-content: center;
@@ -168,6 +170,10 @@
168170
}
169171
}
170172

173+
a.icon {
174+
display: flex;
175+
}
176+
171177
@media (max-width: $breakpoint-laptop) {
172178
display: grid;
173179
grid-template-columns: 300px 1fr 300px;
@@ -198,7 +204,7 @@
198204
height: calc(100vh - 60px);
199205
overflow-y: scroll;
200206
position: fixed;
201-
top: 110px;
207+
top: 122px;
202208
padding-bottom: 60px;
203209
padding-top: 5px;
204210
background-color: #fff;
@@ -436,6 +442,14 @@
436442

437443

438444
/* header*/
445+
body > header {
446+
background-color: var(--primary-blue);
447+
position: fixed;
448+
left: 0;
449+
right: 0;
450+
z-index: 10;
451+
}
452+
439453
.wy-side-nav-search img {
440454
background-color: transparent;
441455
position: relative;

docs/_static/scss/components/_module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
@use "layout";
33
@use "article-meta";
44
@use "breadcrumbs";
5+
@use "search";
56

67
@use "../breakpoints" as *;
78

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DocSearch-Button {
2+
background: white;
3+
}

docs/_templates/layout.html

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,22 @@
2828
{%- endblock -%}
2929

3030
{#- CSS #}
31-
{%- if sphinx_version_info < (4, 0) -%}
32-
<link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
33-
<link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
34-
{%- endif %}
35-
{%- if theme_analytics_id %}
36-
<link rel="stylesheet" href="{{ pathto('_static/cookieconsent.css', 1) }}" type="text/css" />
37-
{%- endif %}
38-
{%- for css in css_files %}
39-
{%- if css|attr("rel") %}
40-
<link rel="{{ css.rel }}" href="{{ pathto(css.filename, 1) }}" type="text/css"{% if css.title is not none %} title="{{ css.title }}"{% endif %} />
31+
{%- for css_file in css_files %}
32+
{%- if css_file|attr("filename") %}
33+
{{ css_tag(css_file) }}
4134
{%- else %}
42-
<link rel="stylesheet" href="{{ pathto(css, 1) }}" type="text/css" />
35+
<link rel="stylesheet" href="{{ pathto(css_file, 1)|escape }}" type="text/css" />
4336
{%- endif %}
4437
{%- endfor %}
4538

46-
{%- for cssfile in extra_css_files %}
47-
<link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
39+
{#
40+
"extra_css_files" is an undocumented Read the Docs theme specific option.
41+
There is no need to check for ``|attr("filename")`` here because it's always a string.
42+
Note that this option should be removed in favor of regular ``html_css_files``:
43+
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_css_files
44+
#}
45+
{%- for css_file in extra_css_files %}
46+
<link rel="stylesheet" href="{{ pathto(css_file, 1)|escape }}" type="text/css" />
4847
{%- endfor -%}
4948

5049
{#- FAVICON #}
@@ -163,7 +162,7 @@
163162
{%- else %}
164163
<a href="{{ pathto(master_doc) }}" class="icon logo-title">
165164
<img src="https://static.hypernode.com/img/logo/Hypernode-logo-diap.svg">
166-
{{ project }}
165+
{{ project }}
167166
{%- endif %}
168167

169168
{%- if logo %}

docs/_templates/searchbox.html

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
{%- if 'singlehtml' not in builder %}
22
<div role="search" class="search-bar-container">
3-
<form id="rtd-search-form" class="wy-form main-search-bar" action="{{ pathto('search') }}" method="get">
4-
<input class="main-search-bar__input" type="text" name="q" placeholder="{{ _('Search Docs...') }}" aria-label="{{ _('Search docs') }}" />
5-
<svg class="search-icon" version="1.1" viewBox="0 0 1000 1000" x="0px" xmlns="http://www.w3.org/2000/svg" y="0px"><path d="M968.2,849.4L667.3,549c83.9-136.5,66.7-317.4-51.7-435.6C477.1-25,252.5-25,113.9,113.4c-138.5,138.3-138.5,362.6,0,501C219.2,730.1,413.2,743,547.6,666.5l301.9,301.4c43.6,43.6,76.9,14.9,104.2-12.4C981,928.3,1011.8,893,968.2,849.4z M524.5,522c-88.9,88.7-233,88.7-321.8,0c-88.9-88.7-88.9-232.6,0-321.3c88.9-88.7,233-88.7,321.8,0C613.4,289.4,613.4,433.3,524.5,522z"></path></svg>
6-
<input type="hidden" name="check_keywords" value="yes" />
7-
<input type="hidden" name="area" value="default" />
8-
</form>
3+
<div id="rtd-search-form" class="wy-form main-search-bar">
4+
<div id="docsearch"></div>
5+
</div>
96
</div>
107
{%- endif %}

docs/conf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"hypernode.sphinx.extensions.updated_at",
5050
"hypernode.sphinx.extensions.meta_robots",
5151
"hypernode.sphinx.extensions.github_actions_logging",
52+
"sphinx_docsearch",
5253
]
5354

5455
# Add any paths that contain templates here, relative to this directory.
@@ -117,3 +118,7 @@
117118
notfound_no_urls_prefix = True
118119

119120
myst_heading_anchors = 5
121+
122+
docsearch_app_id = "ML4HHD5658"
123+
docsearch_api_key = "03f6d3f4f55562ca202f03baeb04b350" # Public Search API Key
124+
docsearch_index_name = "hypernode"

0 commit comments

Comments
 (0)