From ce0152819d8bec914c73293ee0f48924df6f21e7 Mon Sep 17 00:00:00 2001 From: Snehan Kekre Date: Tue, 19 Jul 2022 15:17:26 +0530 Subject: [PATCH] Update docs README with instructions on locally previewing docs (#18196) * Update docs README with instructions on locally previewing docs * Add instructions to install `watchdog` before previewing the docs --- docs/README.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index c81c12d741..c8399a1ee6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -50,11 +50,32 @@ You can adapt the `--build_dir` to set any temporary folder that you prefer. Thi the MDX files that will be rendered as the documentation on the main website. You can inspect them in your favorite Markdown editor. +## Previewing the documentation + +To preview the docs, first install the `watchdog` module with: + +```bash +pip install watchdog +``` + +Then run the following command: + +```bash +doc-builder preview {package_name} {path_to_docs} +``` + +For example: + +```bash +doc-builder preview transformers docs/source/en/ +``` + +The docs will be viewable at [http://localhost:3000](http://localhost:3000). You can also preview the docs once you have opened a PR. You will see a bot add a comment to a link where the documentation with your changes lives. + --- **NOTE** -It's not possible to see locally how the final documentation will look like for now. Once you have opened a PR, you -will see a bot add a comment to a link where the documentation with your changes lives. +The `preview` command only works with existing doc files. When you add a completely new file, you need to update `_toctree.yml` & restart `preview` command (`ctrl-c` to stop it & call `doc-builder preview ...` again). ---