reStructuredText介绍

reStructuredText介绍

Authors: 机械唯物主义 <linjunhalida@gmai.com>
Date: 2010-11-10

什么是reStructuredText?

一种写文档的方式. 简称: ReST

已经有那么多的写文档的方式了, 为什么要用它?

  • 简单, 现场学,现场会
  • 易读
  • 方便生成html/pdf等其他格式

Q: 有wiki了, 为什么还用它?

A: 恩恩, 目标不一样, rest是用来嵌入到代码注释中的..

怎么玩?

不多说, 直接用: http://goo.gl/1jNF4

大家可以上 http://www.tele3.cz/jbar/rest/rest.html 或者: http://goo.gl/1jNF4 直接试用

语法

那么具体的语法怎么学呢? 何必再写一份? 大家自己看就好了哈 我也看不懂多少英文, 但是会抄就好了..

There should be one-- and preferably only one --obvious way to do it.

google: rest

http://docutils.sourceforge.net/docs/user/rst/quickstart.html http://docutils.sourceforge.net/docs/user/rst/quickref.html

如何生成其他格式

需要安装docutils

  • html: 有个东西叫rst2html:

              rst2html xxx.rst xxx.html
              
  • pdf: 有个东西叫rst2pdf:

              rst2pdf xxx.rst
              
  • latex: 有个东西叫rst2latex:

              rst2latex --input-encoding=utf-8 --output-encoding=utf-8 xxx.rst >> s.tex
              

没有弄明白rst2pdf如何弄中文.. 发了 issue

python code

from docutils.core import publish_string
          content = publish_string(
              source="doc here"
              writer_name='html'
              )
          

我用它来干什么?

  • 写博客
  • 写文档
  • 问题: 好像没有支持ReST的网站..

连接

  • 官方网站: ReST

建立时间: 2010/11/10 15:39:00

更新时间: 2010/12/19 19:17:00

blog comments powered by Disqus
===>