An editor for ReStructured Text

I have recently added an editor for ReStructured Text to ETS. As you can see in the screenshots below, the editor is largely composed of two panes, with the left pane containing an editor for the RST and the right pane displaying that RST as HTML. The HTML preview can be generated by vanilla docutils or by Sphinx, and this is configurable within the application.

The HTML preview is updated live as you type. Because all RST processing occurs in a separate helper process, the application remains snappy even when editing large documents.

Both the Qt4 and the wxWidgets backends of Traits UI are supported.

ReStructured Text Editor (Qt)

ReStructured Text Editor (Wx)

Note: The editor requires the latest trunk versions of Traits and Traits UI. For more information on running the application, please see the readme file.

Edit: With the recent release of ETS 3.3.0, the trunk version of ETS is no longer required to use the editor, as it is included in that release. That being said, if you update the editor to its latest trunk version, you must also update Traits, TraitsGUI, and TraitsBackendWx/TraitsBackendQt to their latest trunk versions.

30 thoughts on “An editor for ReStructured Text

  1. avatarBryce Hendrix

    If you run (AppTools/enthought/rst/, it opens up the app. There is a file browser, from there you can open up whatever app you want.

    [edit] – I mean “…whatever ReST file you want”

  2. avatarVille

    I think you wanted:

    DEFAULT_STATIC_PATH = os.path.abspath(os.path.dirname(__file__)) + ‘/sphinx_default’

    I.e. you want absolute path, dirname gives you relative path (depending where you run it).

    Thanks for the hack btw, I’m integrating the “sphinx view” based on this code on leo-editor as well.

  3. avatarStepH

    Can we hope this wonderull tool be an independant tool one day ? I’ve “Standard Python 2.5” actually installed, and I don’t want to mess it with another distro. Or i’m missing something and I can easly install “ETS Python” side “Standard Python 2.5” ?

    I’ve think about such a tool since more than 3 year… Great work !!!

  4. avatarDave Peterson

    @StepH: ETS is not a python distribution. You can install it into any python environment as long as you meet the pre-reqs (VTK, PyQT/wxPython, NumPy, SciPy for a full ETS install).

    BTW, I don’t think you need a full install to use this tool. But I haven’t tried to figure out what the minimum install is. If you’re a user of setuptools, you could try the following now that this has been released:
    easy_install -U AppTools[nonets]

    This should install all necessary Python projects to get the ReST editor to run. The gotcha will be if there are non-Python projects needed, this won’t get them automatically. I’m talking about wx, Qt, etc.

  5. avatarEvan Patterson

    @Ville: Thanks for pointing that out. I’ve updated the editor in the trunk to make sure that DEFAULT_STATIC_PATH is absolute.

  6. avatarEvan Patterson

    @StepH: The non-ETS dependencies for the editor are:
    * ConfigObj
    * multiprocessing (standard library in Python 2.6, downloadable as a backport for Python 2.5)
    * Either Qt 4.4+ or wxPython

  7. avatarbryce hendrix

    @Marc, your best bet is to ask on the enthought-dev mail list. I know there are deb packages of ETS, and there are probably deb packages of the latest ETS release which includes this, but I am not positive.

  8. avatarJohn Francis Lee

    My ReStructured textfiles are all named .txt. Apparently I have to rename them all to .rst to use your editor? I just followed the guidelines of the inventors and implementers of ReStructured text who suggest just .txt as an extension for ReStructured text files. In any case you really ought to allow people to use whatever extension they like. Don’t you think?

  9. avatarJohn Francis Lee

    I posted a comment questioning the seeming inability of editing files without a .rst extension using this editor, hoping to be told that I’d missed the obvious… that there was a simple way to allow the editor to open a file with an .txt or other extension.

    Instead I find my comment deleted!

    Ok… I’ve obviously stumbled into hostile territory. Sorry I followed up on this at all.

  10. avatarBryce Hendrix

    The comment wasn’t deleted, just sitting in the queue to be approved. First time posters have to get approval. You wouldn’t believe the amount and variety of spam we get.

    I believe the RST editor does indeed expect ‘.rst’ files, though I’ll add ‘.txt’ files today.

  11. Pingback: Formats « Software Carpentry

  12. Pingback: Formats at Software Carpentry

  13. avatarEzequiel

    I have this error:

    Traceback (most recent call last):
    File “”, line 23, in
    from rest_editor_view import ReSTHTMLEditorView
    File “/enthought/rst/”, line 29, in
    from enthought.etsconfig.api import ETSConfig
    ImportError: No module named enthought.etsconfig.api

    you can help me to run this app?

  14. avatarKenneth Reitz

    I’m having an error when I try to run this:

    `NotImplementedError: the qt4 pyface backend doesn’t implement PyfaceResourceFactory

    Any chance for a pre-built version? I’d be happy to throw one together if I could get it to run….

    1. avatarBryce Hendrix

      This probably means you’re lacking pyqt4? I’m open to people packaging it, though I don’t think anyone @ Enthough has the time just yet. You may want to ping the enthought-dev mailing list in a few weeks.

      1. avatarKenneth Reitz

        No, I have pyqt installed and I develop with it every day.

        Qt itself was build with the following options:

        ./configure -cocoa -framework -no-dwarf2 -no-qt3support -release -nomake “examples demos” -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-sql-mysql -no-xmlpatterns -no-accessibility -no-svg -no-webkit -no-javascript-jit -no-script -no-scripttools -no-gif -no-libtiff -no-libpng -no-libmng -no-libjpeg -no-openssl -no-nis -no-cups -no-iconv -no-dbus -no-webkit -arch “x86 x86_64 ppc” -sdk /Developer/SDKs/MacOSX10.6.sdk

        Woud any of these options mess the editor up?

        I’m unfamilar with TraitsUI.

        1. avatarEvan Patterson

          The application uses Qt’s WebKit-based HTML renderer to display the HTML preview. Compiling Qt with WebKit disabled will certainly break things. Also, there is a good change that having all those image formats disabled will cause problems.

  15. Pingback: Comment diter du ReStructuredText facilement « Encolpe's What ?

  16. Pingback: An editor for ReStructured Text | Enthought[s] | TextMagic

Leave a Reply

Your email address will not be published. Required fields are marked *

Please leave these two fields as-is:

Protected by Invisible Defender. Showed 403 to 119,202 bad guys.