sphinx
sphinx copied to clipboard
Add `start_line` and `end_line` information in `linkcode`
Subject: Add start_line and end_line information in linkcode
Feature or Bugfix
- Feature
Purpose
- Allow the
linkcodeextension to add a line anchor in the generated link
Detail
- Add 2
infokeys forlinkcode_resolve:start_lineandend_line(Noneby default) - Use the
viewcode-find-sourceevent first to find the lines informations (to be used withsphinx-autoapifor example)- If it failed, optionally (
linkcode_line_try_importsetting) use the same import method as insphinx.ext.viewcode(sphinx.pycode.ModuleAnalyzer) to find the line informations (same warning)
- If it failed, optionally (
- Documentation updated (not sure this is correct though)
Relates
- I think it might close https://github.com/sphinx-doc/sphinx/issues/1556