Leah
Leah

Reputation: 103

Including dynamic content in documentation generated by Python Sphinx

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?

Upvotes: 9

Views: 3235

Answers (1)

mzjn
mzjn

Reputation: 50947

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.

Upvotes: 7

Related Questions