mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Migrate to new theme (#149331)
- Migrate pytorch docs, cpp docs and functorch docs to the pytorch_sphinx_theme2 - Migrate index.rst to markdown and restructure to use high-level horizontal bar sections Python API, Developer Notes - Added python-api.md which becomes the main container for the API docs. This file will be used to add all api references in the toctree. It would be great to have lint for this file: https://github.com/pytorch/pytorch/issues/150718 - Enabled mermaid sphinx extension and opengraph sphinx extension Pull Request resolved: https://github.com/pytorch/pytorch/pull/149331 Approved by: https://github.com/malfet, https://github.com/atalman, https://github.com/albanD
This commit is contained in:
committed by
PyTorch MergeBot
parent
1ffaa00ad7
commit
cd7bc60e11
@ -1,13 +0,0 @@
|
||||
.codeblock-height-limiter {
|
||||
max-height: 500px;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.highlight pre {
|
||||
border: 1px solid rgba(0,0,0,0.15);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
div.cell div.cell_input {
|
||||
border-bottom-width: 0px;
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
{% extends "!layout.html" %}
|
||||
<link rel="canonical" href="{{ theme_canonical_url }}{{ pagename }}.html" />
|
||||
|
||||
{% block sidebartitle %}
|
||||
<div class="version">
|
||||
<a href='https://pytorch.org/functorch/versions.html'>{{ version }} ▼</a>
|
||||
</div>
|
||||
{% include "searchbox.html" %}
|
||||
{% endblock %}
|
@ -13,20 +13,19 @@
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#
|
||||
import os
|
||||
import sys
|
||||
|
||||
import functorch
|
||||
|
||||
|
||||
# import sys
|
||||
|
||||
# source code directory, relative to this file, for sphinx-autobuild
|
||||
# sys.path.insert(0, os.path.abspath('../..'))
|
||||
|
||||
|
||||
RELEASE = os.environ.get("RELEASE", False)
|
||||
|
||||
|
||||
import pytorch_sphinx_theme
|
||||
sys.path.insert(0, os.path.abspath(".."))
|
||||
import pytorch_sphinx_theme2
|
||||
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
@ -77,8 +76,10 @@ napoleon_use_ivar = True
|
||||
autosummary_generate = True
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ["_templates"]
|
||||
|
||||
templates_path = [
|
||||
"_templates",
|
||||
os.path.join(os.path.dirname(pytorch_sphinx_theme2.__file__), "templates"),
|
||||
]
|
||||
# The suffix(es) of source filenames.
|
||||
# You can specify multiple suffix as a list of string:
|
||||
#
|
||||
@ -161,20 +162,66 @@ autodoc_docstring_signature = True
|
||||
#
|
||||
#
|
||||
|
||||
html_theme = "pytorch_sphinx_theme"
|
||||
html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]
|
||||
html_theme = "pytorch_sphinx_theme2"
|
||||
html_theme_path = [pytorch_sphinx_theme2.get_html_theme_path()]
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#
|
||||
|
||||
switcher_version = "main" if not RELEASE else version
|
||||
|
||||
html_theme_options = {
|
||||
"icon_links": [
|
||||
{
|
||||
"name": "X",
|
||||
"url": "https://x.com/PyTorch",
|
||||
"icon": "fa-brands fa-x-twitter",
|
||||
},
|
||||
{
|
||||
"name": "GitHub",
|
||||
"url": "https://github.com/pytorch/pytorch",
|
||||
"icon": "fa-brands fa-github",
|
||||
},
|
||||
{
|
||||
"name": "PyTorch Forum",
|
||||
"url": "https://discuss.pytorch.org/",
|
||||
"icon": "fa-brands fa-discourse",
|
||||
},
|
||||
{
|
||||
"name": "PyPi",
|
||||
"url": "https://pypi.org/project/torch/",
|
||||
"icon": "fa-brands fa-python",
|
||||
},
|
||||
],
|
||||
"collapse_navigation": False,
|
||||
"display_version": True,
|
||||
"logo_only": True,
|
||||
"pytorch_project": "functorch",
|
||||
"navigation_with_keys": True,
|
||||
"analytics_id": "UA-117752657-2",
|
||||
"logo": {"text": "Home"},
|
||||
"switcher": {
|
||||
"json_url": "https://pytorch.org/functorch/functorch-versions.json",
|
||||
"version_match": switcher_version,
|
||||
},
|
||||
"navbar_start": ["version-switcher"],
|
||||
}
|
||||
|
||||
theme_variables = pytorch_sphinx_theme2.get_theme_variables()
|
||||
|
||||
html_context = {
|
||||
"theme_variables": theme_variables,
|
||||
"display_github": True,
|
||||
"github_url": "https://github.com",
|
||||
"github_user": "pytorch",
|
||||
"github_repo": "pytorch",
|
||||
"feedback_url": "https://github.com/pytorch/pytorch",
|
||||
"github_version": "main",
|
||||
"doc_path": "functorch/docs/source",
|
||||
"library_links": theme_variables.get("library_links", []),
|
||||
"community_links": theme_variables.get("community_links", []),
|
||||
"language_bindings_links": html_theme_options.get("language_bindings_links", []),
|
||||
}
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
@ -184,23 +231,11 @@ html_static_path = ["_static"]
|
||||
|
||||
html_css_files = [
|
||||
"css/custom.css",
|
||||
"https://cdn.jsdelivr.net/npm/katex@0.10.0-beta/dist/katex.min.css",
|
||||
]
|
||||
|
||||
|
||||
# Called automatically by Sphinx, making this `conf.py` an "extension".
|
||||
def setup(app):
|
||||
# NOTE: in Sphinx 1.8+ `html_css_files` is an official configuration value
|
||||
# and can be moved outside of this function (and the setup(app) function
|
||||
# can be deleted).
|
||||
html_css_files = [
|
||||
"https://cdn.jsdelivr.net/npm/katex@0.10.0-beta/dist/katex.min.css"
|
||||
]
|
||||
|
||||
# In Sphinx 1.8 it was renamed to `add_css_file`, 1.7 and prior it is
|
||||
# `add_stylesheet` (deprecated in 1.8).
|
||||
add_css = getattr(app, "add_css_file", app.add_stylesheet)
|
||||
for css_file in html_css_files:
|
||||
add_css(css_file)
|
||||
|
||||
|
||||
# -- Options for HTMLHelp output ------------------------------------------
|
||||
|
Reference in New Issue
Block a user