|
| 1 | +# Documentation Process for NeMo |
| 2 | + |
| 3 | +## Building the Documentation |
| 4 | + |
| 5 | +1. Create and activate a virtual environment. |
| 6 | + |
| 7 | +1. Install the documentation dependencies: |
| 8 | + |
| 9 | + ```console |
| 10 | + $ python3 -m pip install -r requirements/requirements_docs.txt |
| 11 | + ``` |
| 12 | + |
| 13 | +1. Build the documentation: |
| 14 | + |
| 15 | + ```console |
| 16 | + $ make -C docs html |
| 17 | + ``` |
| 18 | + |
| 19 | +## Checking for Broken Links |
| 20 | + |
| 21 | +1. Build the documentation, as described in the preceding section, but use the following command: |
| 22 | + |
| 23 | + ```shell |
| 24 | + make -C docs clean linkcheck |
| 25 | + ``` |
| 26 | + |
| 27 | +1. Run the link-checking script: |
| 28 | + |
| 29 | + ```shell |
| 30 | + ./docs/check_for_broken_links.sh |
| 31 | + ``` |
| 32 | + |
| 33 | +If there are no broken links, then the script exits with `0`. |
| 34 | + |
| 35 | +If the script produces any output, cut and paste the `uri` value into your browser to confirm |
| 36 | +that the link is broken. |
| 37 | + |
| 38 | +```json |
| 39 | +{ |
| 40 | + "filename": "nlp/text_normalization/nn_text_normalization.rst", |
| 41 | + "lineno": 247, |
| 42 | + "status": "broken", |
| 43 | + "code": 0, |
| 44 | + "uri": "https://research.fb.com/wp-content/uploads/2019/03/Neural-Models-of-Text-Normalization-for-Speech-Applications.pdf", |
| 45 | + "info": "400 Client Error: Bad Request for url: https://research.facebook.com/wp-content/uploads/2019/03/Neural-Models-of-Text-Normalization-for-Speech-Applications.pdf" |
| 46 | +} |
| 47 | +``` |
| 48 | + |
| 49 | +If the link is OK, and this is the case with many URLs that reference GitHub repository file headings, |
| 50 | +then cut and paste the JSON output and add it to `docs/false_positives.json`. |
| 51 | +Run the script again to confirm that the URL is no longer reported as a broken link. |
| 52 | + |
| 53 | +There may be false positives due to Sphinx not being able to detect links from built html files. |
| 54 | +Instead of adding those to the `docs/false_positives.json` file, it would be best to rewrite the |
| 55 | +reference using a [:ref:](https://www.sphinx-doc.org/en/master/usage/referencing.html#role-ref). |
| 56 | + |
| 57 | +For example, instead of writing `Modules <../api.html#modules>` to link to the modules section of |
| 58 | +a `api.rst` file, write it as ``:ref:`Modules <asr-api-modules>` ``. And in the `api.rst` file, add |
| 59 | +this label before the section being linked to: |
| 60 | + |
| 61 | +``` |
| 62 | +.. _asr-api-modules: |
| 63 | +``` |
0 commit comments