Revision 10 as of 2004-02-18 19:58:17

Clear message

ReStructuredText (reST)

ReStructuredText is a complete rewrite of StructuredText by David Goodger.

It is distributed as part of DocUtils. [http://docutils.sourceforge.net/ (project page)] [http://sourceforge.net/project/showfiles.php?group_id=38414 (download)]

More information:

{i} MoinMoin contains an (incomplete) bridge to the docutils's parser, you can try this by using "#format rst" as the first line of a wiki page. See RestSample for an example. This of course only works when you use the current CVS version, and when docutils is installed.

Reading reST, Writing HTML

There's surprisingly little on the web and in the documentation about how to read reST, and output HTML.

IanBicking has contributed this code, which reads a source text (in reST), and writes HTML:

   1 html = docutils.core.publish_string(
   2            source=text,
   3            writer_name='html')
   4 html = html[html.find('<body>')+6:html.find('</body>')].strip()

"It may feel wrong, but it works, and works reliably."

There's a more "official" way, that feels less dirty, [http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/193890 described at ASPN.]

Discussion

Unable to edit the page? See the FrontPage for instructions.