How to convert reStructuredText to plain text

后端 未结 2 1586
我寻月下人不归
我寻月下人不归 2021-01-17 10:07

I plan to use reStructuredText to write documentation with the main purpose of generating some nice HTML pages. For this I use the docutils rst2html.py tool.

However

2条回答
  •  别那么骄傲
    2021-01-17 10:32

    I have also seen this done by rendering to html using rst2html, then converting the html to plain text by using a command-line html browser, such as:

    • lynx http://lynx.browser.org
    • links http://links.sourceforge.net
    • w3m http://w3m.sourceforge.net
    • elinks http://elinks.or.cz

    Each of these browsers has a command-line switch or similar to render its output to a .txt file, so you could create a two line script called 'rst2txt', something like:

    rst2html docs.rst docs.html
    lynx -dump docs.html > docs.txt
    

提交回复
热议问题