.. _docs:

Contribute to our docs
**********************

.. toctree::
    :maxdepth: 1
    :hidden:

    Style guide <style_docs.rst>
    Directory layout <docs_layout.rst>
    Find documentation issues <find_issues.rst>

The documentation for cloud-init is hosted in the
`cloud-init GitHub repository`_ and rendered on `Read the Docs`_. It is mostly
written in reStructuredText.

The process for contributing to the docs is largely the same as for code,
except that for cosmetic changes to the documentation (spelling, grammar, etc)
you can also use the GitHub web interface to submit changes as quick PRs.

Previewing the docs
===================

The documentation for submitted/active PRs is automatically built by Read the
Docs and served from the PR's "conversation" tab as an automatic check.

However, while you are working on docs for a feature you are adding, you will
most likely want to build the docs locally. There is a Makefile target to build
the documentation for you:

.. code-block:: shell-session

    $ tox -e doc

This will do two things:

- Build the documentation using Sphinx.
- Run doc8 against the documentation source code.

Once built, the HTML files will be viewable in `doc/rtd_html`. Use your
web browser to open `index.html` to view and navigate the site.

How are the docs structured?
============================

We use `Diataxis`_ to organize our documentation. There is more detail on the
layout of the ``doc`` directory in the :doc:`docs_layout` article.

We also have a :doc:`style_docs` that will help you if you need to edit or
write any content.

.. LINKS
.. include:: ../links.txt
.. _cloud-init GitHub repository: https://github.com/canonical/cloud-init/tree/main/doc/rtd
.. _Read the Docs: https://readthedocs.com/
.. _tagging s-makin: https://github.com/s-makin
