Skip to content

Commit a0a2f3e

Browse files
committed
Update to new PT Theme
stack-info: PR: #2361, branch: drisspg/stack/76
1 parent e4f2715 commit a0a2f3e

File tree

8 files changed

+271
-67
lines changed

8 files changed

+271
-67
lines changed

docs/README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# torchao Documentation
2+
3+
This directory contains the source files for the torchao documentation.
4+
5+
## Building the Documentation
6+
7+
### Prerequisites
8+
9+
Install the required dependencies:
10+
11+
```bash
12+
pip install -r requirements.txt
13+
pip install sphinx-serve
14+
```
15+
16+
### Build the Documentation
17+
18+
To build the HTML documentation:
19+
20+
```bash
21+
make html
22+
```
23+
24+
The built documentation will be in the `build/html` directory.
25+
26+
### Serve the Documentation Locally
27+
28+
After building, you can serve the documentation locally using `sphinx-serve`:
29+
30+
```bash
31+
sphinx-serve -b build
32+
```
33+
34+
This will start a local server (typically at http://localhost:8000) where you can view the documentation with live reload capabilities.
35+
36+
## Documentation Structure
37+
38+
- `source/` - Source files for the documentation
39+
- `conf.py` - Sphinx configuration file
40+
- `index.rst` - Main documentation entry point
41+
- `tutorials.rst` - Tutorials section index
42+
- `_static/` - Static files (CSS, images, etc.)
43+
- `_templates/` - Custom templates
44+
- `tutorials_source/` - Executable tutorial Python files (for sphinx-gallery)
45+
- `tutorials/` - Generated tutorial gallery (auto-generated, don't edit)
46+
- `build/` - Generated documentation output (created after building)
47+
48+
## Tutorial Types
49+
50+
This documentation has two types of tutorials:
51+
52+
### 1. Static Tutorials
53+
Educational content, guides, and explanations that are written as `.rst` or `.md` files:
54+
- Located directly in `source/` (e.g., `serialization.rst`, `subclass_basic.rst`)
55+
- Referenced in `source/tutorials.rst`
56+
- These are traditional documentation pages
57+
58+
### 2. Executable Tutorials
59+
Interactive code examples and demos that can be run:
60+
- Source files: `source/tutorials_source/*.py` (Python scripts with special formatting)
61+
- Generated output: `source/tutorials/` (auto-generated HTML gallery)
62+
- Built using sphinx-gallery extension
63+
- Each Python file becomes a downloadable notebook and HTML page
64+
65+
When you run `make html`, sphinx-gallery automatically converts Python files in `tutorials_source/` into an interactive gallery in the `tutorials/` directory.

docs/README.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/requirements.txt

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
sphinx-gallery>0.11
2-
sphinx==5.0.0
3-
sphinx_design
4-
sphinx_copybutton
5-
sphinx-tabs
6-
matplotlib
1+
sphinx==5.3.0
2+
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git@pytorch_sphinx_theme2#egg=pytorch_sphinx_theme2
3+
sphinxcontrib.katex==0.8.6
4+
sphinxext-opengraph==0.9.1
5+
docutils==0.17.1 # Changed from 0.16 to match sphinx-tabs requirement
6+
sphinx-design==0.4.0
7+
sphinxcontrib-mermaid==1.0.0
8+
myst-parser==0.18.1 # if want to contribute in markdown
9+
sphinx-gallery==0.11.1 # if hosting interactive tutorials
10+
sphinx-tabs==3.4.0
11+
sphinx-copybutton==0.5.2
12+
sphinx-sitemap==2.6.0
713
myst-parser
814
sphinxcontrib-mermaid==1.0.0
9-
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme

docs/source/_static/css/custom.css

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,40 @@ article.pytorch-article .sphx-glr-thumbnails .sphx-glr-thumbcontainer {
185185
article.pytorch-article div.section div.wy-table-responsive tbody td {
186186
width: 50%;
187187
}
188+
189+
/* Mermaid diagram styling */
190+
.mermaid {
191+
text-align: center;
192+
margin: 1.5em 0;
193+
}
194+
195+
/* Ensure mermaid diagrams are visible */
196+
div.mermaid {
197+
display: block !important;
198+
width: 100% !important;
199+
min-height: 200px;
200+
background: #f8f9fa;
201+
border: 1px solid #dee2e6;
202+
border-radius: 0.25rem;
203+
padding: 1rem;
204+
}
205+
206+
/* Fix for mermaid in pytorch theme */
207+
.pytorch-article .mermaid {
208+
overflow: visible !important;
209+
}
210+
211+
/* Fix for navbar overlapping content */
212+
.bd-container {
213+
padding-top: 1rem !important;
214+
}
215+
216+
/* Add proper spacing between navbar and content */
217+
.bd-article-container {
218+
margin-top: 1rem;
219+
}
220+
221+
/* Ensure proper spacing for the main content area */
222+
article.bd-article {
223+
padding-top: 1rem;
224+
}

docs/source/_templates/layout.html

Lines changed: 0 additions & 34 deletions
This file was deleted.

docs/source/api_reference.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
API Reference
2+
=============
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
7+
api_ref_intro
8+
api_ref_dtypes
9+
api_ref_quantization
10+
api_ref_sparsity
11+
api_ref_float8
12+
api_ref_kernel

0 commit comments

Comments
 (0)