| 1 |
.. -*- restructuredtext -*- |
| 2 |
|
| 3 |
======================= |
| 4 |
README for reST Builder |
| 5 |
======================= |
| 6 |
|
| 7 |
Sphinx_ extension to build reST (reStructuredText_) files. |
| 8 |
|
| 9 |
This extension is in particular useful to use in combination with the autodoc |
| 10 |
extension to automatically generate documentation for use by any rst parser |
| 11 |
(such as the GitHub wiki). |
| 12 |
|
| 13 |
In itself, the extension is fairly straightforward -- it takes the parsed reST |
| 14 |
file from Sphinx_ and outputs it as reST. |
| 15 |
|
| 16 |
Requirements |
| 17 |
============ |
| 18 |
|
| 19 |
* Sphinx_ 1.4 or later |
| 20 |
* Python 3.5 or later |
| 21 |
|
| 22 |
Installing |
| 23 |
========== |
| 24 |
|
| 25 |
Using pip |
| 26 |
--------- |
| 27 |
|
| 28 |
:: |
| 29 |
|
| 30 |
pip install sphinxcontrib-restbuilder |
| 31 |
|
| 32 |
Manual |
| 33 |
------ |
| 34 |
|
| 35 |
:: |
| 36 |
|
| 37 |
git clone https://github.com/sphinx-contrib/restbuilder.git |
| 38 |
cd restbuilder |
| 39 |
python setup.py install |
| 40 |
|
| 41 |
If you want to try reST builder without using the setuptools installer, |
| 42 |
you can put the reST builder in an extension subdirectory, and adjust |
| 43 |
``sys.path`` to tell Sphinx where to look for it: |
| 44 |
|
| 45 |
- Add the extensions directory to the path in ``conf.py``. E.g.:: |
| 46 |
|
| 47 |
sys.path.append(os.path.abspath('exts')) |
| 48 |
|
| 49 |
Usage |
| 50 |
===== |
| 51 |
|
| 52 |
- Set the builder as a extension in ``conf.py``:: |
| 53 |
|
| 54 |
extensions = ['sphinxcontrib.restbuilder'] |
| 55 |
|
| 56 |
- Run sphinx-build with target ``rst``:: |
| 57 |
|
| 58 |
sphinx-build -b rst -c . build/rst |
| 59 |
|
| 60 |
Configuration |
| 61 |
============= |
| 62 |
|
| 63 |
The following four configuration variables are defined by sphinxcontrib.restbuilder: |
| 64 |
|
| 65 |
:literal:`rst_file_suffix` |
| 66 |
This is the file name suffix for generated reST files. The default is |
| 67 |
``".rst"``. |
| 68 |
|
| 69 |
:literal:`rst_link_suffix` |
| 70 |
Suffix for generated links to reST files. The default is whatever |
| 71 |
`rst_file_suffix` is set to. |
| 72 |
|
| 73 |
:literal:`rst_file_transform` |
| 74 |
Function to translate a docname to a filename. |
| 75 |
By default, returns `docname` + :literal:`rst_file_suffix`. |
| 76 |
|
| 77 |
:literal:`rst_link_transform`: |
| 78 |
Function to translate a docname to a (partial) URI. |
| 79 |
By default, returns `docname` + :literal:`rst_link_suffix`. |
| 80 |
|
| 81 |
|
| 82 |
Further Reading |
| 83 |
=============== |
| 84 |
|
| 85 |
.. _Sphinx: http://sphinx-doc.org/ |
| 86 |
.. _`sphinx-contrib`: http://bitbucket.org/birkenfeld/sphinx-contrib |
| 87 |
.. _reStructuredText: http://docutils.sourceforge.net/rst.html |
| 88 |
|
| 89 |
Feedback |
| 90 |
======== |
| 91 |
|
| 92 |
The reST builder is in a preliminary state. It's not (yet) widely used, so |
| 93 |
any feedback is particularly welcome. |