Nudge needed for rst to html

T

Tim Golden

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:

<code>
import docutils.core

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

</code>

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.

Thanks
TJG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top