From aa349e0b7c383e942a564c0dd8c3d42a787b7101 Mon Sep 17 00:00:00 2001 From: josh rotenberg Date: Fri, 7 May 2021 20:29:01 -0700 Subject: [PATCH 1/3] update serve documentation --- guide/src/cli/serve.md | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/guide/src/cli/serve.md b/guide/src/cli/serve.md index 3bd6dd93f7..a4935a3360 100644 --- a/guide/src/cli/serve.md +++ b/guide/src/cli/serve.md @@ -1,7 +1,13 @@ # The serve command -The serve command is used to preview a book by serving it over HTTP at -`localhost:3000` by default. Additionally it watches the book's directory for +The serve command is used to preview a book by serving it via HTTP at +`localhost:3000` by default: + +```bash +mdbook serve +``` + +The `serve` command watches the book's `src` directory for changes, rebuilding the book and refreshing clients for each change. A websocket connection is used to trigger the client-side refresh. @@ -19,22 +25,12 @@ mdbook serve path/to/book #### Server options -`serve` has four options: the HTTP port, the WebSocket port, the HTTP hostname -to listen on, and the hostname for the browser to connect to for WebSockets. - -For example: suppose you have an nginx server for SSL termination which has a -public address of 192.168.1.100 on port 80 and proxied that to 127.0.0.1 on port -8000\. To run use the nginx proxy do: +The `serve` hostname defaults to `localhost`, and the port defaults to 3000. Either option can be specified on the command line: ```bash -mdbook serve path/to/book -p 8000 -n 127.0.0.1 --websocket-hostname 192.168.1.100 +mdbook serve path/to/book -p 8000 -n 127.0.0.1 ``` -If you were to want live reloading for this you would need to proxy the -websocket calls through nginx as well from `192.168.1.100:` to -`127.0.0.1:`. The `-w` flag allows for the websocket port to be -configured. - #### --open When you use the `--open` (`-o`) flag, mdbook will open the book in your From f4b4a331d78a95104c162cd2a704801dfeba3469 Mon Sep 17 00:00:00 2001 From: josh rotenberg Date: Fri, 7 May 2021 21:02:55 -0700 Subject: [PATCH 2/3] consisten note format, update gitignore language --- guide/src/cli/serve.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guide/src/cli/serve.md b/guide/src/cli/serve.md index a4935a3360..728568f052 100644 --- a/guide/src/cli/serve.md +++ b/guide/src/cli/serve.md @@ -51,5 +51,5 @@ contain file patterns described in the [gitignore documentation](https://git-scm.com/docs/gitignore). This can be useful for ignoring temporary files created by some editors. -_Note: Only `.gitignore` from book root directory is used. Global -`$HOME/.gitignore` or `.gitignore` files in parent directories are not used._ +***Note:*** *Only the `.gitignore` from the book root directory is used. Global +`$HOME/.gitignore` or `.gitignore` files in parent directories are not used.* From c922b8aae68cb4373df1eec0716357da41f5f2c8 Mon Sep 17 00:00:00 2001 From: josh rotenberg Date: Sat, 8 May 2021 09:51:30 -0700 Subject: [PATCH 3/3] backquote port --- guide/src/cli/serve.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guide/src/cli/serve.md b/guide/src/cli/serve.md index 728568f052..016d3c6766 100644 --- a/guide/src/cli/serve.md +++ b/guide/src/cli/serve.md @@ -23,9 +23,9 @@ root instead of the current working directory. mdbook serve path/to/book ``` -#### Server options +### Server options -The `serve` hostname defaults to `localhost`, and the port defaults to 3000. Either option can be specified on the command line: +The `serve` hostname defaults to `localhost`, and the port defaults to `3000`. Either option can be specified on the command line: ```bash mdbook serve path/to/book -p 8000 -n 127.0.0.1