doc: Add extension to generate repository links
To promote cross-links between the documentation and the code, create a small Sphinx extension which transforms links relative to the repository root into a reference to the repository URL. It attempts to read the version from the Read the Docs configuration and falls back to `git rev-parse HEAD`. The links can be written as follows: :repo:`path/to/file.bb` The environment variable REPO_URL_PATTERN can be used to modify the repo URL for development purposes. The Read the Docs version_name is not useful for determining the Git ref for the purposes of linking to the source code because of the special value "latest", which refers to the default branch. Use the gitlab_version variable instead, which despite the name is simply the "commit_name" of the version according to: https://github.com/readthedocs/readthedocs.org/blob/6.3.0/readthedocs/doc_builder/backends/sphinx.py#L95 and https://github.com/readthedocs/readthedocs.org/blob/6.3.0/readthedocs/builds/models.py#L254 Changelog: other Signed-off-by:Tomás González <tomasagustin.gonzalezorlando@arm.com> Signed-off-by:
Peter Hoyes <Peter.Hoyes@arm.com> Signed-off-by:
Robbie Cao <robbie.cao@arm.com>
Loading
Please register or sign in to comment