Skip to content

Commit 286f366

Browse files
authored
Improve documentation section about contributing to docs (#3555)
* Improve section in docs about contributing to docs * Add note about doc build command depending on the OS * Improve section in docs about contributing to docs * Add note about doc build command depending on the OS * Fix wrong toctree path in docs/source/contributing/docs.rst
1 parent 02391d7 commit 286f366

File tree

9 files changed

+89
-13
lines changed

9 files changed

+89
-13
lines changed

docs/source/contributing.rst

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,10 @@ To get an overview of what our community is currently working on, check out
3838
Contributing can be confusing, so here are a few guides:
3939

4040
.. toctree::
41-
:maxdepth: 2
41+
:maxdepth: 3
4242

4343
contributing/development
44-
contributing/docstrings
45-
contributing/references
46-
contributing/examples
47-
contributing/typings
48-
contributing/admonitions
44+
contributing/docs
4945
contributing/testing
5046
contributing/performance
5147
contributing/internationalization

docs/source/contributing/development.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Develop your contribution
147147

148148
Update the docstrings (the text in triple quotation marks) of any functions
149149
or classes you change and include them with any new functions you add.
150-
See the :doc:`documentation guide <docstrings>` for more information about how we
150+
See the :doc:`documentation guide <docs/docstrings>` for more information about how we
151151
prefer our code to be documented. The content of the docstrings will be
152152
rendered in the :doc:`reference manual <../reference>`.
153153

@@ -245,7 +245,8 @@ sticks to our coding conventions.
245245
a look at the built HTML files to see whether the formatting of the documentation
246246
you added looks as you intended. You can build the documentation locally
247247
by running ``make html`` from the ``docs`` directory. Make sure you have `Graphviz <https://graphviz.org/>`_
248-
installed locally in order to build the inheritance diagrams.
248+
installed locally in order to build the inheritance diagrams. See :doc:`docs` for
249+
more information.
249250

250251
Finally, if the pipeline passes and you are satisfied with your changes: wait for
251252
feedback and iterate over any requested changes. You will likely be asked to

docs/source/contributing/docs.rst

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
====================
2+
Adding Documentation
3+
====================
4+
5+
Building the documentation
6+
--------------------------
7+
8+
When you clone the Manim repository from GitHub, you can access the
9+
``docs/`` folder which contains the necessary files to build the
10+
documentation.
11+
12+
To build the docs locally, open a CLI, enter the ``docs/`` folder with the
13+
``cd`` command and execute the following depending on your OS:
14+
15+
- Windows: ``./make.bat html``
16+
- macOS and Linux: ``make html``
17+
18+
The first time you build the docs, the process will take several
19+
minutes because it needs to generate all the ``.rst`` (reST:
20+
reStructured Text) files from scratch by reading and parsing all the
21+
Manim content. The process becomes much shorter the next time, as it
22+
rebuilds only the parts which have changed.
23+
24+
25+
Sphinx library and extensions
26+
-----------------------------
27+
28+
Manim uses `Sphinx <https://www.sphinx-doc.org>`_ for building the
29+
docs. It also makes use of Sphinx extensions such as:
30+
31+
- `Autodoc: <https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html>`_
32+
imports Manim's Python source code, extracts its docstrings and
33+
generates documentation from them.
34+
- `Autosummary: <https://www.sphinx-doc.org/en/master/usage/extensions/autosummary.html>`_
35+
a complement to Autodoc which adds a special directive ``autosummary``,
36+
used in Manim to automatically document classes, methods,
37+
attributes, functions, module-level variables and exceptions.
38+
Autosummary makes use of `Jinja templates <https://jinja.palletsprojects.com/templates/>`_,
39+
which Manim defines for autosummarizing classes and modules
40+
inside ``docs/source/_templates/``.
41+
- `Graphviz extension for Sphinx: <https://www.sphinx-doc.org/en/master/usage/extensions/graphviz.html>`_
42+
embeds graphs generated by the `Graphviz <https://graphviz.org/>`_
43+
module, which must be installed in order to render the
44+
inheritance diagrams in the :doc:`/reference`.
45+
- `Napoleon: <https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html>`_
46+
enables Sphinx to read Google style docstrings and, in
47+
particular for Manim, `NumPy style docstrings <https://numpydoc.readthedocs.io/en/latest/format.html>`_
48+
- see :doc:`docs/docstrings` for more information.
49+
50+
51+
Sphinx theme
52+
------------
53+
54+
The theme used for this website is `Furo <https://sphinx-themes.org/sample-sites/furo/>`_.
55+
56+
57+
Custom Sphinx directives
58+
------------------------
59+
60+
Manim implements **custom directives** for use with Autodoc and Autosummary, which
61+
are defined in :mod:`~.docbuild`:
62+
63+
.. currentmodule:: manim.utils.docbuild
64+
65+
.. autosummary::
66+
67+
:toctree: ../reference
68+
autoaliasattr_directive
69+
autocolor_directive
70+
manim_directive
71+
72+
73+
Index
74+
-----
75+
76+
.. toctree::
77+
:maxdepth: 2
78+
79+
docs/admonitions
80+
docs/docstrings
81+
docs/examples
82+
docs/references
83+
docs/typings
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

manim/utils/docbuild/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
55
- :doc:`/contributing/development`, specifically the ``Documentation``
66
bullet point under :ref:`polishing-changes-and-submitting-a-pull-request`
7-
- :doc:`/contributing/docstrings`
8-
- :doc:`/contributing/references`
9-
- :doc:`/contributing/examples`
10-
- :doc:`/contributing/typings`
11-
- :doc:`/contributing/admonitions`
7+
- :doc:`/contributing/docs`
128
139
.. autosummary::
1410
:toctree: ../reference

0 commit comments

Comments
 (0)