Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd option to add external links to source code #1770
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
twiss commentedMay 2, 2020
•
edited
This feature is meant as a compromise between copying all source code to the documentation directory (
outputSourceFiles = true), and having no links to the source code at all (outputSourceFiles = false). Instead, this option allows you to link to an external source code repository (e.g. GitHub or GitLab).templates.default.externalSourceLinks.urlPrefixoption points to the location where the source code is hosted; the path of the file is appended to it.templates.default.externalSourceLinks.linenoPrefixoption defaults to'L'and refers to theLin#L5which points to line 5 on both GitHub and GitLab.This was manually tested against v3, not v4, because I couldn't get
npm installing v4 from GitHub or a sibling directory to work. I also didn't see any tests for theoutputSourceFilesfeature, so I wasn't sure how to test this. All existing tests pass in v4 too, though, and the patch applied cleanly, so I imagine it should work.Here is another example for how I intend to use this, automatically taking the repository url and version tag from package.json: https://github.com/twiss/openpgpjs/blob/v5-test/.jsdocrc.js. This should be convenient when updating the documentation whenever you release a new version, for example. That should also minimize the risk that the linked source code doesn't match the processed source code.