I. Sphinx INTRODUCTION
Sphinx is a document generation tool in simple terms. Used to generate Restructuredtext format source files such as HTML, PDF, Latex. Editors do not have to deal with the format of the text themselves, the program automatically according to the source files in the format, and automatically generate chapter links and other work.
Sphinx is written in Python and originally created for Python language documents, and by default, Sphinx will highlight code for Python, but it also allows you to define other programming languages such as C and Ruby.
There are many open source projects that use Sphinx as a document generation system, the most famous of which is the official Python document. The Sphinx official website also lists projects using Sphinx, with nearly 90 or so, including the famous open source projects.
Some Chinese translation projects also use Sphinx, such as PYMOTWCN.
Two. Installation and configuration of the Sphinx
1. Install Python
- python2.5 or 2.6,2.7 can.
- If it is a Windows platform, it is recommended to download ActivePython
- Other platforms can download the official Python version directly
2. To confirm that the Setuptools has been installed
- If it is already installed, you will find a easy_install.exe under the Scripts folder under the Python installation path.
- Setuptools Download
3. Enter Easy_install Sphinx at the command line
- Easy_install can automatically download and install Sphinx and other modules it relies on.
- Easy_install-u Sphinx
three.Establish Sphinx Project
It is recommended to use Sphinx's own Configuration tool Sphinx-quickstart. -Create a project catalog, such as D\:note. -Start command line in this directory, enter Sphinx-quickstart
D:\note>sphinx-quickstart
The program prompts you to enter some options, such as the input root directory. Most use the default option and press ENTER directly.
-
-
-
The options you need to specify are:
-
-
Detach source and build directories for easy administration
> separate source and build directories (y/n) [N]: y
-
Specify project name, author name , version number
The project name is occur in several places in the built documentation.
> project name:note
> author name (s): LK
Sphinx has the notion of a "version" and a "release" for the
Software. Each version can has multiple releases. for example, for
Python The version is something like 2.5 or 3.0, while the release is
something like 2.5.1 or 3.0a1. If you don ' t need this dual structure,
just set both to the same value.
> project version: 0.1
> project release [0.1]:
-
* autodoc: Automatically insert Docstrings from modules (y/n) [N]: y   /strong>
* Viewcode:include links to the source code of documented Python objects (y/n) [N]:y
4. Being sure to create a makefile. It makes life simple.
-
-
When you are finished, you can see the following directories and files in the note directory
-
- When the build directory runs the Make command, the generated files are in this directory
- Source directory where the document is placed
- Make.bat Batch processing command
- Makefile
Basically done, you can use make HTML commands to generate HTML-like documents. If make HTML does not work, you can use this command: Sphinx-build-b HTML source Build
Four. Syntax
1. Title====================
Document title
=====================
--------
Sub-headings
--------
Chapter Title
========
2. Paragraph1) An empty line can be segmented2) The contents of the same paragraph need to be left aligned (i.e., sibling indentation) 3. Wrap and add a small dot before each line, and indentThe minus space text is-text 4. Hyperlinks (ref. http://blog.csdn.net/jiyucn/article/details/2157189) 1 links mainly include the following
Independent Links,
Re
StructuredText will automatically convert the URL to a link. such as http://www.ubuntu.org.cn/http://www.ubuntu.org.cn/
named links, naming links to help remember and reduce space usage. Use the < link name >_ in the body, use the _< link name in the note;: [link target] For example Ubuntuubuntu_. _ubuntu:http://www.ubuntu.org.cn/if spaces and punctuation are present in the link name, you can use the
`Wrap the link name up ' Ubuntu cn ' _. _ ' Ubuntu cn ': http://www.ubuntu.org.cn/
Anonymous Links, links that do not use link names are primarily used to convert large pieces of text to links. If you use this part of the text as the link name, the link name is also written into the comment ... ' is used primarily to convert large pieces of text to links. If you use this part of the text as the link name, the link name will also be written into the comment ... ' __ __ http://www.ubuntu.org.cn/Anonymous links are often used with named links ' here is a big paragraph of text ... ' __ __ a named Link _ You can define this named link in any location ... _ A named Link:
Anchor Point, the destination address of the link is left blank and the anchor point can be marked at the current location. Jump to Anchor point _. _ Anchor Point: < page location > click the anchor name to jump to the anchor point marker.
Title Link, jump to the title inside the article
Re
StructuredText defines the title of the same time, also defined a title link, in the body using the title name _ can jump to the title title ======== jump to the title name _
Embedded Links, the link target is embedded in the link. (
Re
StructuredText does not pass, not recommended) ' Ubuntu
Reference website:
http://bigzhu.org/blog/%E7%94%A8sphinx%E5%B0%86python%E7%9A%84%E6%B3%A8%E9%87%8A%E7%94%9F%E6%88%90%E6%96% 87%e6%a1%a3
Http://sphinx-doc-zh.readthedocs.org/en/latest/rest.html rst Introduction Chinese
http://www.osseye.com/?p=239 Sphinx Real-time indexing architecture reality
Http://codinn.com/projects/sphinx/view/contents.htmlphinx User Manual
http://wowubuntu.com/restructuredtext-sphinx.html documents with notes Restructuredtext and Sphinx
http://www.cnblogs.com/Lvkun/archive/2010/04/01/1702245.html using Sphinx notes
Http://notes.yeshiwei.com/sphinx.html
http://www.ibm.com/developerworks/cn/opensource/os-sphinx-documentation/ use sphinx to make concise and beautiful documents
Http://www.oschina.net/p/sphinx-doc
Http://www.cosdiv.com/page/M0/S225/225320.html using Sphinx notes
Sphinx using Notes