Including dynamic content in documentation generated by Python Sphinx
python-sphinx
Solution
Here are two Sphinx extensions that can do this:
- autorun: executes Python code in `runblock` directives, captures the output and inserts it into documents.
- programoutput: executes arbitrary commands using the `program-output` directive and inserts the output into documents.
Problem
I am using Sphinx to generate documentation for my project, and building the documentation as part of the product's install process. I would like to dynamically include the hostname in the text and/or code-blocks. I have not seen any explanations in the documentation nor any facility for including the output of a shell command or anything other than specific line(s) from a specific file. Does this functionality exist?