Skip to content

Commit a08e853

Browse files
Derek Lewisrichardlau
Derek Lewis
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: #34977 PR-URL: #34986 Reviewed-By: Richard Lau <[email protected]>
1 parent 2b445bb commit a08e853

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

BUILDING.md

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

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

420-
```console
421-
$ make doc
420+
```bash
421+
make doc
422422
```
423423

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

426-
```console
427-
$ NODE=/path/to/node make doc-only
426+
```bash
427+
NODE=/path/to/node make doc-only
428428
```
429429

430-
To read the documentation:
430+
To read the man page:
431431

432-
```console
433-
$ man doc/node.1
432+
```bash
433+
man doc/node.1
434434
```
435435

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

439-
```console
440-
$ make docopen
438+
```bash
439+
make docserve
441440
```
442441

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

445455
To test if Node.js was built correctly:
446456

447-
```console
448-
$ ./node -e "console.log('Hello from Node.js ' + process.version)"
457+
```bash
458+
./node -e "console.log('Hello from Node.js ' + process.version)"
449459
```
450460

451461
To install this version of Node.js into a system directory:
452462

453-
```console
454-
$ [sudo] make install
463+
```bash
464+
[sudo] make install
455465
```
456466

457467
#### Building a debug build

Makefile

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

777777
.PHONY: docserve
778-
docserve: $(apidocs_html)
779-
@$(PYTHON) -mwebbrowser http://localhost:8000/all.html
780-
@$(PYTHON) -m http.server -d $(PWD)/out/doc/api
778+
docserve: $(apidocs_html) $(apiassets)
779+
@$(PYTHON) -m http.server 8000 --bind 127.0.0.1 --directory out/doc/api
781780

782781
.PHONY: docclean
783782
docclean:

0 commit comments

Comments
 (0)