How to print a reStructuredText node tree?

838 views Asked by At

Section Parsing the Document of The Docutils Hacker's Guide mentions the quicktest.py utility that can be used to print a node tree representation of a parsed reStructuredText document. However I can't find quicktest.py anywhere in my docutils distribution installed in /usr/lib/python2.7/dist-packages/docutils. Is there other way to print the document tree?

1

There are 1 answers

1
vitaut On BEST ANSWER

As pointed out by @mzjn the quicktest.py script is available at https://sourceforge.net/p/docutils/code/HEAD/tree/trunk/docutils/tools/quicktest.py

A document tree can also be printed as follows:

from docutils.core import publish_string
print publish_string(rst)

where rst is a string containing reStructuredText to be processed.