|
| 1 | +===================== |
| 2 | +Writing documentation |
| 3 | +===================== |
| 4 | + |
| 5 | +The documentation uses the `Sphinx <https://www.sphinx-doc.org/>`_ |
| 6 | +documentation system. |
| 7 | + |
| 8 | +How the documentation is organized |
| 9 | +================================== |
| 10 | + |
| 11 | +The documentation is organized into several categories: |
| 12 | + |
| 13 | +* :doc:`Tutorials </intro/index>` take the reader by the hand through a series |
| 14 | + of steps to create something. |
| 15 | + |
| 16 | + The important thing in a tutorial is to help the reader achieve something |
| 17 | + useful, preferably as early as possible, in order to give them confidence. |
| 18 | + |
| 19 | + Explain the nature of the problem we're solving, so that the reader |
| 20 | + understands what we're trying to achieve. Don't feel that you need to begin |
| 21 | + with explanations of how things work - what matters is what the reader does, |
| 22 | + not what you explain. It can be helpful to refer back to what you've done and |
| 23 | + explain afterward. |
| 24 | + |
| 25 | +* :doc:`Topic guides </topics/index>` aim to explain a concept or subject at a |
| 26 | + fairly high level. |
| 27 | + |
| 28 | + Link to reference material rather than repeat it. Use examples and don't be |
| 29 | + reluctant to explain things that seem very basic to you - it might be the |
| 30 | + explanation someone else needs. |
| 31 | + |
| 32 | + Providing background context helps a newcomer connect the topic to things |
| 33 | + that they already know. |
| 34 | + |
| 35 | +* :doc:`Reference guides </ref/index>` contain technical references for APIs. |
| 36 | + They describe the functioning of Django MongoDB Backend's internal machinery |
| 37 | + and instruct in its use. |
| 38 | + |
| 39 | + Keep reference material tightly focused on the subject. Assume that the |
| 40 | + reader already understands the basic concepts involved but needs to know or |
| 41 | + be reminded of how Django MongoDB Backend does it. |
| 42 | + |
| 43 | + Reference guides aren't the place for general explanation. If you find |
| 44 | + yourself explaining basic concepts, you may want to move that material to a |
| 45 | + topic guide. |
| 46 | + |
| 47 | +* :doc:`How-to guides </howto/index>` are recipes that take the reader through |
| 48 | + steps in key subjects. |
| 49 | + |
| 50 | + What matters most in a how-to guide is what a user wants to achieve. |
| 51 | + A how-to should always be result-oriented rather than focused on internal |
| 52 | + details of how Django MongoDB Backend implements whatever is being discussed. |
| 53 | + |
| 54 | + These guides are more advanced than tutorials and assume some knowledge about |
| 55 | + how Django MongoDB Backendo works. |
| 56 | + |
| 57 | +How to start contributing documentation |
| 58 | +======================================= |
| 59 | + |
| 60 | +Clone the Django repository to your local machine |
| 61 | +------------------------------------------------- |
| 62 | + |
| 63 | +If you'd like to start contributing to the docs, get the source code |
| 64 | +repository: |
| 65 | + |
| 66 | +.. code-block:: bash |
| 67 | +
|
| 68 | + $ git clone https://github.com/mongodb/django-mongodb-backend.git |
| 69 | +
|
| 70 | +If you're planning to submit these changes, you might find it useful to make a |
| 71 | +fork of this repository and clone your fork instead. |
| 72 | + |
| 73 | +Set up a virtual environment and install dependencies |
| 74 | +----------------------------------------------------- |
| 75 | + |
| 76 | +Create and activate a virtual environment, then install the dependencies: |
| 77 | + |
| 78 | +.. code-block:: bash |
| 79 | +
|
| 80 | + $ python -m venv .venv |
| 81 | + $ source .venv/bin/activate |
| 82 | + $ python -m pip install -e ".[docs]" |
| 83 | +
|
| 84 | +Build the documentation locally |
| 85 | +------------------------------- |
| 86 | + |
| 87 | +You build the HTML output from the ``docs`` directory: |
| 88 | + |
| 89 | +.. code-block:: bash |
| 90 | +
|
| 91 | + $ cd docs |
| 92 | + $ make html |
| 93 | +
|
| 94 | +Your locally-built documentation will be accessible at |
| 95 | +``_build/html/index.html`` and it can be viewed in any web browser. |
| 96 | + |
| 97 | +Making edits to the documentation |
| 98 | +--------------------------------- |
| 99 | + |
| 100 | +The source files are ``.rst`` files located in the ``docs/`` directory. |
| 101 | + |
| 102 | +These files are written in the reStructuredText markup language. To learn the |
| 103 | +markup, see the :ref:`reStructuredText reference <sphinx:rst-index>`. |
| 104 | + |
| 105 | +To edit this page, for example, edit the file |
| 106 | +``docs/internals/contributing/writing-documentation.txt`` and rebuild the |
| 107 | +HTML with ``make html``. |
0 commit comments