Hi -

I am revising the python debugger that I wrote several years ago [1] and have been adding better terminal support. For example, the next release will include syntax colorization via pygments.

Debugger commands can have somewhat extensive online help. This is stored as the docstring of command's class.

For example, here is the help for the debugger's "eval" command, or docstring for class EvalCommand:

   eval <python-statement>

   Run code in the context of the current frame.

   If no string is given, we run the string from the current source code
   about to be run. If the command ends ? (via an alias) and no string is
   given, the following translations occur:

      {if|elif} <expr> :    => <expr>
      while <expr> :      => <expr>
      return <expr>       => <expr>
      var = <expr >       => <expr>

   The above is done via regular expression matching. No fancy parsing is done, say,
   to look to see if expr is split across a line or whether var an assignment
   might have multiple variables on the left-hand side.


   eval 1+2  # 3
   eval      # Run current source-code line
   eval?     # but strips off leading 'if', 'while', ..
             # from command

   See also 'set autoeval', `pr', `pp' and `examine'.

   Aliases: eval?

I would like to use richer formatting than just plain text for terminal output. For example <python-statement> might be italicized and "Examples:" might be made bold or put in some sort of section.  The debugger currently also allows terminal highlighting to be turned off. So in that case, tagging should be adjusted, or the tagging shouldn't look too ugly if it does happen to have to bleed through. And simple docutils-like tagging is also nicer for programmers reading the source code.

Also, the debugger allows for line widths to get set. So the paragraph that starts "The above is done..." should be reflowed to adjust to desired line width, same as columnize[2] does to to reflow lists of things.

So I am considering docutuils/reStructuredTextr. Also, there is a pygments lexer in case I need that; this is useful since pygments will be a dependency in the next release. 

Is there a reStructuredText to terminal formatter? Is there some other simple thing I could use instead that is equivalent or more desirable? Other thoughts?

Thanks in advance.

[1] https://code.google.com/p/pydbgr/
[2] https://code.google.com/p/pycolumnize/