I am documenting a Python module in Sphinx. I have a source code file full of examples of the use of my module. I'd like to reference this file. It is too long to inline as continuous code. Is there a way to create a link to the full source file, formatted in a code-friendly way (i.e: literal or with line numbers)?
Python 3 does this. For example, the argparse docs link to the source code (near the top of the page, where it says "Source code"). You can see how they do it by looking at the source for the docs (linked from the first link, down at the bottom of the left had column).
I assume they're using standard Sphinx, but I am having a hard time finding :source:
in their docs...
Update: the :source:
role is defined here.