mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Add doc preview command (#141590)
Convenience, when we build pytorch docs 1. Docs for build weren't clear that `make html` is the main command intended to be ran 2. Once you run `make html` you need to visualize the work, opening up a simple http server seems like the simplest solution so adding a `make serve command` Usage ```shell numpy ❯ make serve PORT=8080 # Add port optionally Serving HTTP on :: port 8080 (http://[::]:8080/) ... ::1 - - [26/Nov/2024 10:05:41] "GET / HTTP/1.1" 200 - ::1 - - [26/Nov/2024 10:05:41] "GET /_static/copybutton.css HTTP/1.1" 200 - ::1 - - [26/Nov/2024 10:05:41] "GET /_static/katex-math.css HTTP/1.1" 200 - ```  Pull Request resolved: https://github.com/pytorch/pytorch/pull/141590 Approved by: https://github.com/svekars, https://github.com/malfet
This commit is contained in:
committed by
PyTorch MergeBot
parent
65dbd5cc2d
commit
f3d16ec76f
@ -417,9 +417,11 @@ readthedocs theme.
|
|||||||
```bash
|
```bash
|
||||||
cd docs/
|
cd docs/
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
make html
|
||||||
|
make serve
|
||||||
```
|
```
|
||||||
You can then build the documentation by running `make <format>` from the
|
|
||||||
`docs/` folder. Run `make` to get a list of all available output formats.
|
Run `make` to get a list of all available output formats.
|
||||||
|
|
||||||
If you get a katex error run `npm install katex`. If it persists, try
|
If you get a katex error run `npm install katex`. If it persists, try
|
||||||
`npm install -g katex`
|
`npm install -g katex`
|
||||||
|
@ -41,7 +41,10 @@ html-stable:
|
|||||||
# See conf.py for more details.
|
# See conf.py for more details.
|
||||||
RELEASE=1 make html
|
RELEASE=1 make html
|
||||||
|
|
||||||
.PHONY: help Makefile docset onnx exportdb
|
.PHONY: help Makefile docset onnx exportdb serve
|
||||||
|
|
||||||
|
serve:
|
||||||
|
@cd $(BUILDDIR)/html && $(PYCMD) -m http.server $(PORT)
|
||||||
|
|
||||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||||
|
Reference in New Issue
Block a user