Sphinx

Posted on May 7, 2025

The official Github page of Sphinx, Sphinx Themes and Sphinx Docs

uv pip install sphinx

Verify installation using,

sphinx-build --version

To create documentation layout,

sphinx-quickstart docs

Docs folder should be there

ls

It should show the docs folder inside the directory

To build

sphinx-build -M html docs/source/ docs/build/

I have moved the docs inside sphinx because github can either deploy from root or /docs. I created a docs folder in main dir and copied the contents of docs/build/html to docs. We also need to add .nojekyll file inside docs so that the static files are served. Since I have written down all the docs in wiki as markdown, it is better to include a plugin that reads .md files. So install, myst_parser.

Add the plugin to the conf.py file

extensions = ["myst_parser",]

source_suffix = {
    ".rst": "restructuredtext",
    ".md": "markdown",
}

In index.rst, include the code to read the pages,

.. toctree::
   :maxdepth: 2
   :caption: Contents:
   :glob:

   pages/*

Create a folder called pages inside sources and copy paste all the .md files from wiki. Now run sphinx and copy all the files inside build to docs in the main dir. Add .nojekyll file inside docs/ so that the static files are rendered.