From 6cfdd9f4665b955d84e276df4f9d39e2711abf3e Mon Sep 17 00:00:00 2001 From: John R Barker Date: Fri, 26 Oct 2018 14:18:42 +0100 Subject: [PATCH] Add docs about contributing to docs (#46481) (#47658) * adds page on community contributions to docs (cherry picked from commit 4219d25fc7a51636dc023da1d003faa8e2c2d939) --- .../community/documentation_contributions.rst | 173 ++++++++++++++++++ docs/docsite/rst/community/how_can_I_help.rst | 5 + docs/docsite/rst/community/index.rst | 1 + .../developing_modules_documenting.rst | 2 +- .../dev_guide/developing_modules_general.rst | 2 +- .../rst/dev_guide/style_guide/index.rst | 2 + .../rst/dev_guide/testing_documentation.rst | 10 +- 7 files changed, 188 insertions(+), 7 deletions(-) create mode 100644 docs/docsite/rst/community/documentation_contributions.rst diff --git a/docs/docsite/rst/community/documentation_contributions.rst b/docs/docsite/rst/community/documentation_contributions.rst new file mode 100644 index 00000000000..53ee23c6670 --- /dev/null +++ b/docs/docsite/rst/community/documentation_contributions.rst @@ -0,0 +1,173 @@ +.. _community_documentation_contributions: + +***************************************** +Contributing to the Ansible Documentation +***************************************** + +Ansible has a lot of documentation and a small team of writers. Community support helps us keep up with new features, fixes, and changes. + +Improving the documentation is an easy way to make your first contribution to the Ansible project. You don't have to be a programmer, since our documentation is written in YAML (module documentation) or `reStructuredText `_ (rST). If you're using Ansible, you already use YAML in your playbooks. And rST is mostly just text. You don't even need git experience, if you use the ``Edit on GitHub`` option. + +If you find a typo, a broken example, a missing topic, or any other error or omission on this documentation website, let us know. Here are some ways to support Ansible documentation: + +.. contents:: + :local: + +Editing docs directly on GitHub +=============================== + +For typos and other quick fixes, you can edit the documentation right from the site. Look at the top right corner of this page. That ``Edit on GitHub`` link is available on every page in the documentation. If you have a GitHub account, you can submit a quick and easy pull request this way. + +To submit a documentation PR from docs.ansible.com with ``Edit on GitHub``: + +#. Click on ``Edit on GitHub``. +#. If you don't already have a fork of the ansible repo on your GitHub account, you'll be prompted to create one. +#. Fix the typo, update the example, or make whatever other change you have in mind. +#. Enter a commit message in the first rectangle under the heading ``Propose file change`` at the bottom of the GitHub page. The more specific, the better. For example, "fixes typo in my_module description". You can put more detail in the second rectangle if you like. Leave the ``+label: docsite_pr`` there. +#. Submit the suggested change by clicking on the green "Propose file change" button. GitHub will handle branching and committing for you, and open a page with the heading "Comparing Changes". +#. Click on ``Create pull request`` to open the PR template. +#. Fill out the PR template, including as much detail as appropriate for your change. You can change the title of your PR if you like (by default it's the same as your commit message). In the ``Issue Type`` section, delete all lines except the ``Docs Pull Request`` line. +#. Submit your change by clicking on ``Create pull request`` button. +#. Be patient while Ansibot, our automated script, adds labels, pings the docs maintainers, and kicks off a CI testing run. +#. Keep an eye on your PR - the docs team may ask you for changes. + +Reviewing open PRs and issues +============================= + +You can also contribute by reviewing open documentation `issues `_ and `PRs `_. To add a helpful review, please: + +- Include a comment - "looks good to me" only helps if we know why. +- For issues, reproduce the problem. +- For PRs, test the change. + +Opening a new issue and/or PR +============================= + +If the problem you've noticed is too complex to fix with the ``Edit on GitHub`` option, and no open issue or PR already documents the problem, please open an issue and/or a PR on the ``ansible/ansible`` repo. + +A great documentation GitHub issue or PR includes: + +- a specific title +- a detailed description of the problem (even for a PR - it's hard to evaluate a suggested change unless we know what problem it's meant to solve) +- links to other information (related issues/PRs, external documentation, pages on docs.ansible.com, etc.) + +Before you open a complex documentation PR +========================================== + +If you make multiple changes to the documentation, or add more than a line to it, before you open a pull request, please: + +#. Check that your text follows our :ref:`style_guide`. +#. Test your changes for rST errors. +#. Build the page, and preferably the entire documentation site, locally. + +To work with documentation on your local machine, you need the following packages installed: + +.. code-block:: none + + - libyaml + - pyyaml + - nose + - six + - tornado + - pyparsing + - gcc + - jinja2 + - rstcheck + - sphinx + +.. note:: + + On macOS with Xcode, you may need to install ``six`` and ``pyparsing`` with ``--ignore-installed`` to get versions that work wth ``sphinx``. + +.. _testing_documentation_locally: + +Testing the documentation locally +--------------------------------- + +To test an individual file for rST errors: + +.. code-block:: bash + + rstcheck changed_file.rst + +Building the documentation locally +---------------------------------- + +Building the documentation is the best way to check for errors and review your changes. Once `rstcheck` runs with no errors, navigate to ``ansible/docs/docsite`` and then build the page(s) you want to review. + +Building a single rST page +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To build a single rST file with the make utility: + +.. code-block:: bash + + make htmlsingle rst=path/to/your_file.rst + +For example: + +.. code-block:: bash + + make htmlsingle rst=community/documentation_contributions.rst + +This process compiles all the links but provides minimal log output. If you're writing a new page or want more detailed log output, refer to the instructions on :ref:`build_with_sphinx-build` + +.. note:: + + ``make htmlsingle`` adds ``rst/`` to the beginning of the path you provide in ``rst=``, so you can't type the filename with autocomplete. Here are the error messages you will see if you get this wrong: + + - If you run ``make htmlsingle`` from the ``docs/docsite/rst/`` directory: ``make: *** No rule to make target `htmlsingle'. Stop.`` + - If you run ``make htmlsingle`` from the ``docs/docsite/`` directory with the full path to your rST document: ``sphinx-build: error: cannot find files ['rst/rst/community/documentation_contributions.rst']``. + + +Building all the rST pages +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To build all the rST files without any module documentation: + +.. code-block:: bash + + MODULES=none make webdocs + +Building module docs and rST pages +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To build documentation for a few modules plus all the rST files, use a comma-separated list: + +.. code-block:: bash + + MODULES=one_module,another_module make webdocs + +To build all the module documentation plus all the rST files: + +.. code-block:: bash + + make webdocs + +.. _build_with_sphinx-build: + +Building rST files with ``sphinx-build`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Advanced users can build one or more rST files with the sphinx utility directly. ``sphinx-build`` returns misleading ``undefined label`` warnings if you only build a single page, because it does not create internal links. However, ``sphinx-build`` returns more extensive syntax feedback, including warnings about indentation errors and ``x-string without end-string`` warnings. This can be useful, especially if you're creating a new page from scratch. To build a page or pages with ``sphinx-build``: + +.. code-block:: bash + + sphinx-build [options] sourcedir outdir [filenames...] + +You can specify filenames, or ``–a`` for all files, or omit both to compile only new/changed files. + +For example: + +.. code-block:: bash + + sphinx-build -b html -c rst/ rst/dev_guide/ _build/html/dev_guide/ rst/dev_guide/developing_modules_documenting.rst + +Joining the documentation working group +======================================= + +The Documentation Working Group is just getting started, please visit the `community repo `_ for more information. + +.. seealso:: + :ref:`More about testing module documentation ` + :ref:`More about documenting modules ` diff --git a/docs/docsite/rst/community/how_can_I_help.rst b/docs/docsite/rst/community/how_can_I_help.rst index be4c24d2a84..b8ff2199b3f 100644 --- a/docs/docsite/rst/community/how_can_I_help.rst +++ b/docs/docsite/rst/community/how_can_I_help.rst @@ -28,6 +28,11 @@ There are many forums online where Ansible users ask and answer questions. Reach You can find the official :ref:`Ansible communication channels `. +Review, fix, and maintain the documentation +=========================================== + +Typos are everywhere, even in the Ansible documentation. We work hard to keep the documentation up-to-date, but you may also find out-dated examples. We offer easy ways to :ref:`report and/or fix documentation errors `. + Participate in your local meetup ================================ diff --git a/docs/docsite/rst/community/index.rst b/docs/docsite/rst/community/index.rst index 47de8cce147..7f95d161299 100644 --- a/docs/docsite/rst/community/index.rst +++ b/docs/docsite/rst/community/index.rst @@ -16,6 +16,7 @@ To get started, please read and understand the :ref:`code_of_conduct`, and then code_of_conduct how_can_I_help reporting_bugs_and_features + documentation_contributions communication development_process contributor_license_agreement diff --git a/docs/docsite/rst/dev_guide/developing_modules_documenting.rst b/docs/docsite/rst/dev_guide/developing_modules_documenting.rst index e9184cd9d2b..6c7755b068d 100644 --- a/docs/docsite/rst/dev_guide/developing_modules_documenting.rst +++ b/docs/docsite/rst/dev_guide/developing_modules_documenting.rst @@ -123,7 +123,7 @@ Module documentation should briefly and accurately define what each module and o Each documentation field is described below. Before committing your module documentation, please test it at the command line and as HTML: * As long as your module file is :ref:`available locally `, you can use ``ansible-doc -t module my_module_name`` to view your module documentation at the command line. Any parsing errors will be obvious - you can view details by adding ``-vvv`` to the command. -* You should also :ref:`test the HTML output ` of your documentation. +* You should also :ref:`test the HTML output ` of your module documentation. Documentation fields -------------------- diff --git a/docs/docsite/rst/dev_guide/developing_modules_general.rst b/docs/docsite/rst/dev_guide/developing_modules_general.rst index 9a7823bf038..92eb5fecbf2 100644 --- a/docs/docsite/rst/dev_guide/developing_modules_general.rst +++ b/docs/docsite/rst/dev_guide/developing_modules_general.rst @@ -246,7 +246,7 @@ Testing basics ==================== These two examples will get you started with testing your module code. Please review our :ref:`testing ` section for more detailed -information, including instructions for :ref:`testing documentation `, adding :ref:`integration tests `, and more. +information, including instructions for :ref:`testing module documentation `, adding :ref:`integration tests `, and more. Sanity tests ------------ diff --git a/docs/docsite/rst/dev_guide/style_guide/index.rst b/docs/docsite/rst/dev_guide/style_guide/index.rst index 0b66ac6ebfc..1ae8c8404dc 100644 --- a/docs/docsite/rst/dev_guide/style_guide/index.rst +++ b/docs/docsite/rst/dev_guide/style_guide/index.rst @@ -3,6 +3,8 @@ You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. +.. _style_guide: + ******************* Ansible Style Guide ******************* diff --git a/docs/docsite/rst/dev_guide/testing_documentation.rst b/docs/docsite/rst/dev_guide/testing_documentation.rst index 9a8ca24d583..c9aca21d604 100644 --- a/docs/docsite/rst/dev_guide/testing_documentation.rst +++ b/docs/docsite/rst/dev_guide/testing_documentation.rst @@ -1,12 +1,12 @@ :orphan: -.. _testing_documentation: +.. _testing_module_documentation: -********************* -Testing documentation -********************* +**************************** +Testing module documentation +**************************** -Before you submit a module for inclusion in the main Ansible repo, you must test your documentation for correct HTML rendering and to ensure that the argspec matches the documentation. +Before you submit a module for inclusion in the main Ansible repo, you must test your module documentation for correct HTML rendering and to ensure that the argspec matches the documentation in your Python file. The community pages offer more information on :ref:`testing reStructuredText documentation `. To check the HTML output of your module documentation: