|kryptoid c81fdcf841 Update 'source/index.rst'||1 年之前|
This repository contains the source files of DERO’s documentation, in reStructuredText markup language (reST).
The DERO documentation uses the default sphinx_rtd_theme with many customizations applied on top.
Editing existing pages
To edit an existing page, locate its .rst source file and open it in your favorite text editor. You can then commit the changes, push them to your fork and make a pull request. Note that the pages in classes/ should not be edited here, they are automatically generated from DERO’s XML class references. See Contribute to the Class Reference for details.
Adding new pages
To add a new page, create a .rst file with a meaningful name in the section you want to add a file to, e.g. tutorials/3d/lightbaking.rst. Write its content like you would do for any other file, and make sure to define a reference name for Sphinx at the beginning of the file (check other files for the syntax), based on the file name with a “doc” prefix (e.g. .. _doc_light_baking:).
You should then add your page to the relevant “toctree” (table of contents, e.g. basic_mining.rst). By convention, the files used to define the various levels of toctree are prefixed with an underscore, so in the above example the file should be referenced in rtd_pages/basic_mining.rst. Add your new filename to the list on a new line, using a relative path and no extension, e.g. here light_baking.
Sphinx and reStructuredText syntax
Sphinx uses specific reST comments to do specific operations, like defining the table of contents (:toctree:) or cross-referencing pages. Check the official Sphinx documentation for more details, or see how things are done in existing pages and adapt it to your needs.
Adding images and attachments
To add images, please put them in an img/ folder next to the .rst file with a meaningful name and include them in your page with:
.. image:: img/image_name.png
Similarly, you can include attachments (like assets as support material for a tutorial) by placing them into a files/ folder next to the .rst file, and using this inline markup:
Building with Sphinx
To build the HTML website (or any other format supported by Sphinx, like PDF, EPUB or LaTeX), you need to install Sphinx >= 1.3 as well as (for the HTML) the readthedocs.org theme. You also need to install the Sphinx extensions defined in
Those tools are best installed using pip, Python’s module installer. The Python 3 version might be provided (on Linux distros) as
python3-pip. You can then run:
pip install -r requirements.txt
You can then build the HTML documentation from the root folder of this repository with:
make SPHINXBUILD=~/.local/bin/sphinx-build html
# On Linux/macOS make html SPHINXOPTS=-j2 # On Windows set SPHINXOPTS=-j2 && make html
The compilation might take some time as the
classes/ folder contains many files to parse.
In case of a
EOFError, you can remove the
classes/ folder and run
make again. This will drop the class references from the final HTML documentation but will keep the rest intact. Make sure to avoid using
git add . in this case when working on a pull request, or the whole
classes/ folder will be removed when you make a commit.
You can then test the changes live by opening
_build/html/index.html in your favorite browser.
Building with Sphinx on Windows
On Windows, you need to:
Alternatively, you can build with this command instead:
sphinx-build -b html ./ _build
Note that during the first build, various installation prompts may appear and ask to install LaTeX plugins. Make sure you don’t miss them, especially if they open behind other windows, else the build may appear to hang until you confirm these prompts.
You could also install a normal
make toolchain (for example via MinGW) and build the docs using the normal
Building with Sphinx and virtualenv
If you want your Sphinx installation scoped to the project, you can install it using virtualenv. Execute this from the root folder of this repository:
virtualenv --system-site-packages env/
pip install -r requirements.txt
make html like above.