Skip to content

Commit f3d16ec

Browse files
msaroufimpytorchmergebot
authored andcommitted
Add doc preview command (pytorch#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 - ``` ![Screenshot 2024-11-26 at 10 05 46 AM](https://github.com/user-attachments/assets/3b275c33-1515-4e21-b540-f5a68c8a8e55) Pull Request resolved: pytorch#141590 Approved by: https://github.com/svekars, https://github.com/malfet
1 parent 65dbd5c commit f3d16ec

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,11 @@ readthedocs theme.
417417
```bash
418418
cd docs/
419419
pip install -r requirements.txt
420+
make html
421+
make serve
420422
```
421-
You can then build the documentation by running `make <format>` from the
422-
`docs/` folder. Run `make` to get a list of all available output formats.
423+
424+
Run `make` to get a list of all available output formats.
423425

424426
If you get a katex error run `npm install katex`. If it persists, try
425427
`npm install -g katex`

docs/Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ html-stable:
4141
# See conf.py for more details.
4242
RELEASE=1 make html
4343

44-
.PHONY: help Makefile docset onnx exportdb
44+
.PHONY: help Makefile docset onnx exportdb serve
45+
46+
serve:
47+
@cd $(BUILDDIR)/html && $(PYCMD) -m http.server $(PORT)
4548

4649
# Catch-all target: route all unknown targets to Sphinx using the new
4750
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).

0 commit comments

Comments
 (0)