Function
docutils.core.publish_from_doctree

Signature

publish_from_doctree(document, destination_path=None, writer=None, writer_name='pseudoxml', settings=None, settings_spec=None, settings_overrides=None, config_section=None, enable_exit_status=None)

Documentation String

Set up & run a Publisher to render from an existing document tree data structure, for programmatic use with string I/O. Return a pair of encoded string output and document parts.

Note that document.settings is overridden; if you want to use the settings of the original document, pass settings=document.settings.

Also, new document.transformer and document.reporter objects are generated.

For encoded string output, be sure to set the 'output_encoding' setting to the desired encoding. Set it to 'unicode' for unencoded Unicode string output. Here's one way:

publish_from_doctree(
    ..., settings_overrides={'output_encoding': 'unicode'})

Parameters: document is a docutils.nodes.document object, an existing document tree.

Other parameters: see publish_programmatically.