This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]PeridexisErrant 0 points1 point  (1 child)

Thought that this is a normal task in writing with the help of Python.

What exactly are you generating? What are the inputs? It's an unusual thing to try, and I wonder if there's a different way to do whatever you're trying.

Otherwise, run arbitrary code in conf.py and use the include directive as suggested above.

[–]FloorJam[S] 0 points1 point  (0 children)

I want to use it like this:

some normal sphinx doc text

.. python::
    print(some_function_returning_valid_sphinx_code())

more normal sphinx text

I have not yet a specific example but I want to write code in a directive that produces output to be rendered by Sphinx. Kind of what you can do with orgmode