Skip to content

Commit

Permalink
doc: spruce up user journey to local docs browsing
Browse files Browse the repository at this point in the history
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 <riclau@uk.ibm.com>
  • Loading branch information
Derek Lewis authored and addaleax committed Sep 22, 2020
1 parent 6d6c6fa commit fb1a133
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
42 changes: 26 additions & 16 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,41 +423,51 @@ To build the documentation:

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

```console
$ make doc
```bash
make doc
```

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

```console
$ NODE=/path/to/node make doc-only
```bash
NODE=/path/to/node make doc-only
```

To read the documentation:
To read the man page:

```console
$ man doc/node.1
```bash
man doc/node.1
```

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

```console
$ make docopen
```bash
make docserve
```

This will open a browser with the documentation.
This will spin up a static file server and provide a URL to where you may browse
the documentation locally.

If you're comfortable viewing the documentation using the program your operating
system has associated with the default web browser, run the following.

```bash
make docopen
```

This will open a file URL to a one-page version of all the browsable HTML
documents using the default browser.

To test if Node.js was built correctly:

```console
$ ./node -e "console.log('Hello from Node.js ' + process.version)"
```bash
./node -e "console.log('Hello from Node.js ' + process.version)"
```

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

```console
$ [sudo] make install
```bash
[sudo] make install
```

#### Building a debug build
Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -771,9 +771,8 @@ docopen: $(apidocs_html)
@$(PYTHON) -mwebbrowser file://$(PWD)/out/doc/api/all.html

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

.PHONY: docclean
docclean:
Expand Down

0 comments on commit fb1a133

Please sign in to comment.