Skip to content

Commit fb1a133

Browse files
DerekNonGenericaddaleax
authored andcommitted
doc: spruce up user journey to local docs browsing
This patch improves the means by which the docs are viewed locally. * Remove extraneous code in the `docserve` Makefile target * Document the `docserve` task for all to know * Bring all code snippets in this section up to speed * Clarify the purpose of each documentation browsing method Fixes: nodejs/node#34977 PR-URL: nodejs/node#34986 Reviewed-By: Richard Lau <[email protected]>
1 parent 6d6c6fa commit fb1a133

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

Diff for: BUILDING.md

+26-16
Original file line numberDiff line numberDiff line change
@@ -423,41 +423,51 @@ To build the documentation:
423423

424424
This will build Node.js first (if necessary) and then use it to build the docs:
425425

426-
```console
427-
$ make doc
426+
```bash
427+
make doc
428428
```
429429

430430
If you have an existing Node.js build, you can build just the docs with:
431431

432-
```console
433-
$ NODE=/path/to/node make doc-only
432+
```bash
433+
NODE=/path/to/node make doc-only
434434
```
435435

436-
To read the documentation:
436+
To read the man page:
437437

438-
```console
439-
$ man doc/node.1
438+
```bash
439+
man doc/node.1
440440
```
441441

442-
If you prefer to read the documentation in a browser,
443-
run the following after `make doc` is finished:
442+
If you prefer to read the full documentation in a browser, run the following.
444443

445-
```console
446-
$ make docopen
444+
```bash
445+
make docserve
447446
```
448447

449-
This will open a browser with the documentation.
448+
This will spin up a static file server and provide a URL to where you may browse
449+
the documentation locally.
450+
451+
If you're comfortable viewing the documentation using the program your operating
452+
system has associated with the default web browser, run the following.
453+
454+
```bash
455+
make docopen
456+
```
457+
458+
This will open a file URL to a one-page version of all the browsable HTML
459+
documents using the default browser.
450460

451461
To test if Node.js was built correctly:
452462

453-
```console
454-
$ ./node -e "console.log('Hello from Node.js ' + process.version)"
463+
```bash
464+
./node -e "console.log('Hello from Node.js ' + process.version)"
455465
```
456466

457467
To install this version of Node.js into a system directory:
458468

459-
```console
460-
$ [sudo] make install
469+
```bash
470+
[sudo] make install
461471
```
462472

463473
#### Building a debug build

Diff for: Makefile

+2-3
Original file line numberDiff line numberDiff line change
@@ -771,9 +771,8 @@ docopen: $(apidocs_html)
771771
@$(PYTHON) -mwebbrowser file://$(PWD)/out/doc/api/all.html
772772

773773
.PHONY: docserve
774-
docserve: $(apidocs_html)
775-
@$(PYTHON) -mwebbrowser http://localhost:8000/all.html
776-
@$(PYTHON) -m http.server -d $(PWD)/out/doc/api
774+
docserve: $(apidocs_html) $(apiassets)
775+
@$(PYTHON) -m http.server 8000 --bind 127.0.0.1 --directory out/doc/api
777776

778777
.PHONY: docclean
779778
docclean:

0 commit comments

Comments
 (0)