سؤال

For sublime text, I installed RstPreview, downloaded docutils-0.11, and installed it by running C:\Anaconda\python setup.py install in Command Prompt (I am using windows 7 64 bits).

When I press Ctrl+Shift+R to parse a .rst file I get the following,

enter image description here

The build system is set to C:\Anaconda\python where docutils imports normally, but seemingly sublime text tries to import docutils from the internal Python system for which I don't know how to install libraries.

Thanks in advance!

هل كانت مفيدة؟

المحلول

After reading through the issues for this plugin, it doesn't look like there is any good way of getting it to work on Windows. I can expand on the technicalities if you want, but basically this plugin relies on installing a third-party package (docutils) into the version of Python used by Sublime Text, which on Windows is completely separate from any version of Python you may have installed such as Anaconda. The author has never tested it on Windows, and from what I could find no one has posted any way to get it to run successfully on that platform.

As an alternative, you may want to look at the OmniMarkupPreviewer plugin. From its description:

OmniMarkupPreviewer is a plugin for both Sublime Text 2 and Sublime Text 3 that preview markups in web browsers. OmniMarkupPreviewer renders markups into htmls and send it to web browser in the backgound, which enables a live preview. Besides, OmniMarkupPreviewer provide support for exporting result to html file as well.

It supports reStructuredText among several other formats, and while I haven't tested it personally, it looks like it would fit your needs.

نصائح أخرى

I just came across restview, which does work on windows and offers a nice approach for providing feedback about how your rst file will be rendered as html. Here is an excerpt from the restview pypi page.

A viewer for ReStructuredText documents that renders them on the fly.

Pass the name of a ReStructuredText document to restview, and it will launch a web server on localhost:random-port and open a web browser. Every time you reload the page, restview will reload the document from disk and render it. This is very convenient for previewing a document while you’re editing it.

You can also pass the name of a directory, and restview will recursively look for files that end in .txt or .rst and present you with a list.

Finally, you can make sure your Python package has valid ReStructuredText in the long_description field by using

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top