Nudge needed for rst to html

Tim Golden mail at
Thu Sep 6 13:16:09 CEST 2007

I'm a bit embarrassed about this, but I've scoured
the docutils docs and I can't seem to work out how
to take a block of ReStructuredText and output a
raw HTML fragment, ideally without a surrounding
document or embedded/linked css etc. (I'm trying
to allow rst in our helpdesk system which can render
nicely on the web version and be readable in text).

I thought that:

import docutils.core

html = docutils.core.publish_string ("Hello, world!", writer_name="html")


would do the trick, but that produces an entire document with
an embedded style block. I imagine I need to push something into
the settings_spec / config_section parameter there, but despite
a certain amount of walking up the code tree I can't confirm whether
that's true, or what to put if it is.

I'm very happy to be pointed to tfm on this one, or a code
sample would be gratefully received. Maybe it's not possible
without writing my own HTML writer backend, in which case
a pointer there would be useful.


More information about the Python-list mailing list