Installing Sphinx¶
Sphinx is based on Python so you should have Python installed on your system. Although it is possible to install Python and Sphinx in Windows, it’s recommended to use a Linux distribution preferably Ubuntu for this purpose.
If your main OS is Windows, you can use VMWare or VirtualBox to install Ubuntu as a guest OS.
In order to start using Sphinx and generate documents first of all you need to install the Sphinx engine:
sudo apt-get install python3-sphinx
Then you should initialize your documentation build environment:
sphinx-quickstart
Having a nice theme gives an elegant appearance to your documentation and make it much more readable:
pip install sphinx-rtd-theme
The default language supported in Sphinx is reStructuredText. If you prefer Markdown you can install it on Sphinx using this command:
pip install recommonmark
Whenever you need to generate the HTML output you can use this command:
make html
If you want to have a beautiful PDF output you should first install the LaTeX engine:
sudo apt-get install texlive-latex-recommended
sudo apt-get install texlive-fonts-recommended
sudo apt-get install texlive-latex-extra
sudo apt-get install latexmk
Then by entering the following command the PDF output will be generated:
make latexpdf
Required packages for build process of Sphinx are put in a file called requirements.txt. Use the following command to install them:
pip install -r requirements.txt
If you need other packages to be installed on Sphinx, it is recommended to add them to this requirements.txt file.
To study more about Sphinx and reStructuredText please refer to the following links: