文档利器reStructuredText

关于为啥要用reStructuredText,这个不用多说,方便,简洁。单从Python和Django的官网文档就是用reStructuredText来编写的,就可以看出这是一把利器。 reStructuredText(简写rst)能够转换的格式很多,包括html、xml、pdf及Latex等。 一开始在windows下使用rst来编写,采用vim编辑器,可以装一个rst的插件vst.vim,可以提供语法高亮等功能。 但是使用:Vst html转换成html文件,格式不够漂亮,后来网上搜到sphinx,能够生成格式漂亮的html。 于是转到ubuntu下,使用sphinx。 关于rst的编写规范,网上资料挺多,可以参考 http://wiki.venj.me/restructuredtext-quick-reference#jieshi 编写一个简单的rst文件,示例如下。 文档利器reStructuredText
文章图片

ubuntu下使用sphinx,只需要安装python-sphinx包即可 root@archer:/home/archer# apt-get install python-sphinx 安装后,就可以使用sphinx-quickstart命令来使用了,先建一个目录,然后进入目录执行sphinx-quickstart(注意要root权限) root@archer:/home/archer# mkdir use_rst root@archer:/home/archer# cd use_rst root@archer:/home/archer/use_rst# sphinx-quickstart 执行过程中会让设置一些东西,只管一路enter,遇到Project Name、Author Name(s)、Project Version、Project Release时自己填一下 文档利器reStructuredText
文章图片

执行完后目录下生成一些文件
文档利器reStructuredText
文章图片

然后make html root@archer:/home/archer/use_rst# make html 执行成功后在_build/html下生成了对应的html文件,使用浏览器访问可以看到效果。 文档利器reStructuredText
文章图片

    推荐阅读