Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: :srcref: can deep-link to specific source lines #188

Merged
merged 4 commits into from
Feb 19, 2024

Conversation

reneme
Copy link
Collaborator

@reneme reneme commented Feb 16, 2024

This extends the :srcref: rST role with deep-links into specific source lines. This feature was explicitly requested here. Additionally, I integrated the :srcref: extension @FAlbertDev added in #186.

As an example, I deep-linked a source location in the Kyber crypto doc. The result (in HTML output) looks like that:

image

... and links to: https://github.com/randombit/botan/blob/7f15ce7b39d6bd34dda9af4d2cb08a6e18c64c01/src/lib/pubkey/kyber/kyber_common/kyber.cpp#L1042

Usage

In reStructuredText the :srcref: annotation understands the following:

Example Description
:srcref:`src/lib/hash/sha1/sha1.cpp` Simply link to the sha1.cpp on GitHub, using the full path as link text, namely "src/lib/hash/sha1/sha1.cpp".
:srcref:`src/lib/pubkey/xmss/` Simply link to the xmss directory on GitHub, using the full path as link text, namely "src/lib/pubkey/xmss".
:srcref:`XMSS <src/lib/pubkey/xmss/>` Link to the xmss directory, using "XMSS" as link text.
:srcref:`\[src/lib/hash]/sha1/sha1.cpp` Link to the sha1.cpp, using an elided path as link text, namely: ".../sha1/sha1.cpp".
:srcref:`TLS 1.3 key export <src/lib/tls/tls13/tls_cipher_state.cpp:400|CipherState::export_key>` Deep-link to tls_cipher_state.cpp line 400, using "TLS 1.3 key export" as link text. The string CipherState::export_key must be found in this line, so that a Continuous Integration job can check that the deep-link didn't get out of sync with the upstream source code.
:srcref:`\[src/lib/tls/tls13]/tls_cipher_state.cpp:400|CipherState::export_key>` Deep-link to tls_cipher_state.cpp line 400, using an elided path as link text, namely: "...tls_cipher_state.cpp:400". The search string works the same as explained above.

FAlbertDev and others added 4 commits February 15, 2024 10:49
:srcref: can now also specify a specific source line, along with a
string that is expected to be found in this line. This search string
can be checked-for in CI to catch when line annotations and upstream
source code diverge.
@reneme reneme added the enhancement New feature or request label Feb 16, 2024
@reneme reneme self-assigned this Feb 16, 2024
This was referenced Feb 16, 2024
@reneme reneme merged commit 546998a into main Feb 19, 2024
22 checks passed
@reneme reneme deleted the feature/srcref_2 branch February 19, 2024 12:19
reneme added a commit that referenced this pull request Feb 19, 2024
... most notably, add deep-links to keygen, encaps and decaps in the
upstream implementation. This uses functionality recently merged in GH #188.
reneme added a commit that referenced this pull request Feb 19, 2024
... most notably, add deep-links to keygen, encaps and decaps in the
upstream implementation. This uses functionality recently merged in GH #188.
reneme added a commit that referenced this pull request Feb 19, 2024
reneme added a commit that referenced this pull request Feb 22, 2024
FAlbertDev pushed a commit that referenced this pull request May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants