doc: extensions: add custom role 'module_file'

Added another custom role `module_file` which functions like
`zephyr_file` but for any module in the west manifest.

The new role must take a module as an argument. Example syntax:

```rst
:module_file:`module-name: path/within/module`
```

or with custom link text:

```rst
:module_file:`my link text <module-name: path/within/module>`
```

This change also moves the hardcoded project name and link to
github to `doc/conf.py` by adding the configuration values
`link_roles_manifest_project` and `link_roles_manifest_baseurl`

Signed-off-by: Gaute Svanes Lunde <gaute.lunde@nordicsemi.no>
This commit is contained in:
Gaute Svanes Lunde 2022-10-12 15:29:10 +02:00 committed by Carles Cufí
commit 6acdb1b73a
2 changed files with 52 additions and 27 deletions

View file

@ -251,6 +251,11 @@ html_redirect_pages = redirects.REDIRECTS
warnings_filter_config = str(ZEPHYR_BASE / "doc" / "known-warnings.txt")
# -- Options for zephyr.link-roles ----------------------------------------
link_roles_manifest_project = "zephyr"
link_roles_manifest_baseurl = "https://github.com/zephyrproject-rtos/zephyr"
# -- Options for notfound.extension ---------------------------------------
notfound_urls_prefix = f"/{version}/" if is_release else "/latest/"