Skip to content

Commit a9e7f64

Browse files
committed
Fix header formatting: shorten nav title and prevent nav items from wrapping
1 parent a49171d commit a9e7f64

3 files changed

Lines changed: 29 additions & 3 deletions

File tree

docs/source/_static/navbar.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.bd-header .bd-navbar-elements .nav-link {
2+
white-space: nowrap;
3+
}

docs/source/conf.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
# add these directories to sys.path here. If the directory is relative to the
1919
# documentation root, use os.path.abspath to make it absolute, like shown here.
2020
#
21+
22+
2123
import glob
2224
import os
2325
import shutil
@@ -27,9 +29,11 @@
2729
import pytorch_sphinx_theme2 # type: ignore[import-not-found]
2830

2931
# To let us import ./custom_directives.py
32+
3033
sys.path.insert(0, os.path.abspath("."))
3134
# -- Project information -----------------------------------------------------
3235

36+
3337
project = "ExecuTorch"
3438
copyright = "2024, ExecuTorch"
3539
author = "ExecuTorch Contributors"
@@ -41,6 +45,7 @@
4145
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
4246
# ones.
4347

48+
4449
import os
4550
import sys
4651

@@ -78,34 +83,39 @@
7883

7984
# Import executorch version
8085
# Adopted from PyTorch docs pattern
86+
8187
from executorch import version as et_version # type: ignore[attr-defined]
8288

8389
executorch_version = str(et_version.__version__)
8490

8591
# Check if this is a release build from environment variable
8692
# The workflow sets RELEASE=true for tagged releases, RELEASE=false otherwise
8793
# We need to properly parse the string as a boolean (any non-empty string is truthy in Python)
94+
8895
RELEASE = os.environ.get("RELEASE", "false").lower() == "true"
8996

9097
# The version info for the project you're documenting, acts as replacement for
9198
# |version| and |release|, also used in various other places throughout the
9299
# built documents.
93100
#
94101
# The short X.Y version.
102+
95103
version = "main"
96104
# The full version, including alpha/beta/rc tags.
105+
97106
release = "main"
98107

99108
# Customized html_title here.
100109
# Default is " ".join(project, release, "documentation") if not set
110+
101111
if RELEASE:
102112
# Turn 0.8.0a0+a90e907 into 0.8
103113
# Note: the release candidates should no longer have the aHASH suffix, but in any
104114
# case we wish to leave only major.minor, even for rc builds.
115+
105116
version = ".".join(executorch_version.split("+")[0].split(".")[:2])
106117
html_title = " ".join((project, version, "documentation"))
107118
release = version
108-
109119
switcher_version = "main" if not RELEASE else version
110120

111121
print(f"executorch_version: {executorch_version}")
@@ -153,13 +163,14 @@
153163
source_dir = sphinx_gallery_conf["examples_dirs"][i]
154164

155165
# Create gallery dirs if it doesn't exist
166+
156167
os.makedirs(gallery_dir, exist_ok=True)
157168

158169
# Copy .md files from source dir to gallery dir
170+
159171
for f in glob.glob(os.path.join(source_dir, "*.md")):
160172

161173
shutil.copyfile(f, gallery_dir)
162-
163174
source_suffix = [".rst", ".md"]
164175

165176

@@ -171,20 +182,24 @@
171182
# List of patterns, relative to source directory, that match files and
172183
# directories to ignore when looking for source files.
173184
# This pattern also affects html_static_path and html_extra_path.
185+
174186
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "tutorial-template.md"]
175187
exclude_patterns += sphinx_gallery_conf["examples_dirs"]
176188
exclude_patterns += ["*/index.rst"]
177189

178190
# autosectionlabel throws warnings if section names are duplicated.
179191
# The following tells autosectionlabel to not throw a warning for
180192
# duplicated section names that are in different documents.
193+
181194
autosectionlabel_prefix_document = True
182195

183196
# -- Options for HTML output -------------------------------------------------
184197

185198
# The theme to use for HTML and HTML Help pages. See the documentation for
186199
# a list of builtin themes.
187200
#
201+
202+
188203
html_theme = "pytorch_sphinx_theme2"
189204
html_theme_path = [pytorch_sphinx_theme2.get_html_theme_path()]
190205

@@ -193,6 +208,7 @@
193208
# documentation.
194209
#
195210

211+
196212
html_theme_options = {
197213
"logo": {
198214
"image_light": "_static/img/et-logo.png",
@@ -262,20 +278,26 @@
262278
# Add any paths that contain custom static files (such as style sheets) here,
263279
# relative to this directory. They are copied after the builtin static files,
264280
# so a file named "default.css" will overwrite the builtin "default.css".
281+
265282
html_static_path = ["_static"]
266283

284+
html_css_files = ["navbar.css"]
285+
267286
# Add custom 404 page for GitHub Pages
287+
268288
html_additional_pages = {"404": "404.html"}
269289

270290

271291
# Example configuration for intersphinx: refer to the Python standard library.
292+
272293
intersphinx_mapping = {
273294
"python": ("https://docs.python.org/", None),
274295
"numpy": ("https://numpy.org/doc/stable/", None),
275296
"torch": ("https://docs.pytorch.org/docs/stable/", None),
276297
}
277298

278299
# Redirects for moved pages
300+
279301
redirects = {
280302
"getting-started-setup": "getting-started.html",
281303
"export-overview": "using-executorch-export.html",
@@ -304,6 +326,7 @@
304326

305327
# Custom directives defintions to create cards on main landing page
306328

329+
307330
from custom_directives import ( # type: ignore[import-not-found]
308331
CustomCardEnd,
309332
CustomCardItem,

docs/source/user-pathways.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(user-pathways)=
2-
# Find Your Path in ExecuTorch
2+
# Find Your Path
33

44
**ExecuTorch** serves a wide range of users — from ML engineers taking their first steps in on-device inference, to embedded systems developers targeting bare-metal microcontrollers, to researchers pushing the boundaries of LLM deployment. This page helps you navigate directly to the content most relevant to your experience level, goals, and target platform.
55

0 commit comments

Comments
 (0)