Skip to content

Commit 497258c

Browse files
authored
Add Github UI instructions for docs (esphome#1838)
1 parent 218a68c commit 497258c

File tree

8 files changed

+108
-46
lines changed

8 files changed

+108
-46
lines changed

guides/contributing.rst

Lines changed: 108 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,114 @@ setup, please feel free to submit a pull request.
2828
The ESPHome documentation is built using `sphinx <http://www.sphinx-doc.org/>`__ and uses
2929
`reStructuredText <http://docutils.sourceforge.net/rst.html>`__ for all source files.
3030

31+
If you're not familiar with writing rST, see :ref:`rst-syntax` for a quick refresher.
32+
33+
Through Github
34+
**************
35+
36+
This guide essentially goes over the same material found in `GitHub's Editing files in another user's repository <https://docs.github.com/en/repositories/working-with-files/managing-files/editing-files#editing-files-in-another-users-repository>`__. You may also find that page helpful to read.
37+
38+
At the bottom of each page in the docs, there is a "Edit this page on GitHub" link. Click this link and you'll see something like this:
39+
40+
.. figure:: images/docs_ghedit_1.png
41+
:align: center
42+
:width: 80.0%
43+
:alt: a screenshot of an rST file opened in GitHub, with the edit button circled
44+
45+
Click the edit button to start making changes. If you're not sure about some element of syntax, see the quick-start :ref:`rst-syntax` guide.
46+
47+
Once you've made your changes, give them a useful name and press "Propose changes". At this point, you've made the changes on your own personal copy of the docs in GitHub, but you still need to submit them to us.
48+
49+
.. figure:: images/docs_ghedit_2.png
50+
:align: center
51+
:width: 80.0%
52+
:alt: the commit creation screen in GitHub, with the commit title and "Propose changes" button circled
53+
54+
To do that, you need to create a "Pull request":
55+
56+
.. figure:: images/docs_ghedit_3.png
57+
:align: center
58+
:width: 80.0%
59+
:alt: the pull request prompt screen in GitHub with the "Create pull request" button circled
60+
61+
Fill out the new pull request form, replacing the ``[ ]`` with ``[x]`` to indicate that you have followed the instructions.
62+
63+
.. figure:: images/docs_ghedit_4.png
64+
:align: center
65+
:width: 80.0%
66+
:alt: the pull request creation screen in GitHub with the "Create pull request" button circled
67+
68+
After waiting a while, you might see a green or a red mark next to your commit in your pull request:
69+
70+
.. figure:: images/docs_ghedit_ci_failed.png
71+
:align: center
72+
:width: 80.0%
73+
:alt: the pull request with a commit with a red x next to it
74+
75+
This means that there is some error stopping your pull request from being fully processed. Click on the X, click on "Details" next to the lint step, and look and see what's causing your change to fail.
76+
77+
.. figure:: images/docs_ghedit_ci_details.png
78+
:align: center
79+
:width: 80.0%
80+
:alt: failed lint substep of build, with "details" link circled
81+
82+
.. figure:: images/docs_ghedit_ci_logs.png
83+
:align: center
84+
:width: 80.0%
85+
:alt: log messages showing reason for failed build
86+
87+
For example, in this case, you'd want to go to line 136 of ``pzemac.rst`` and adjust the number of ``===`` so that it completely underlines the section heading.
88+
89+
Once you make that change, the pull request will be built again, and hopefully this time where will be no other errors.
90+
91+
Build
92+
*****
93+
94+
.. note::
95+
96+
The easiest way is to use the `esphome-docs Docker image <https://hub.docker.com/r/esphome/esphome-docs/>`__:
97+
98+
.. code-block:: bash
99+
100+
docker run --rm -v "${PWD}/":/data/esphomedocs -p 8000:8000 -it esphome/esphome-docs
101+
102+
With ``PWD`` referring to the root of the ``esphome-docs`` git repository. Then go to ``<CONTAINER_IP>:8000`` in your browser.
103+
104+
This way, you don't have to install the dependencies to build the documentation.
105+
106+
To check your documentation changes locally, you first need install Sphinx (with **Python 3**).
107+
108+
.. code-block:: bash
109+
110+
# in ESPHome-Docs repo:
111+
pip install -r requirements.txt
112+
113+
Then, use the provided Makefile to build the changes and start a simple web server:
114+
115+
.. code-block:: bash
116+
117+
# Start web server on port 8000
118+
make webserver
119+
120+
# Updates then happen via:
121+
make html
122+
123+
Notes
124+
*****
125+
126+
Some notes about the docs:
127+
128+
- Use the English language (duh...)
129+
- An image tells a thousand words, please use them wherever possible. But also don't forget to shrink them, for example
130+
I often use https://tinypng.com/
131+
- Try to use examples as often as possible (also while it's great to use highly accurate,
132+
and domain-specific lingo, it should not interfere with new users understanding the content)
133+
- Fixes/improvements for the docs themselves should go to the ``current`` branch of the
134+
esphomedocs repository. New features should be added against the ``next`` branch.
135+
- Always create new branches in your fork for each pull request.
136+
137+
.. _rst-syntax:
138+
31139
Syntax
32140
******
33141

@@ -214,52 +322,6 @@ documents establish the following character order for better consistency.
214322
reStructured text can do a lot more than this, so if you're looking for a more complete guide
215323
please have a look at the `Sphinx reStructuredText Primer <http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html>`__.
216324

217-
Build
218-
*****
219-
220-
.. note::
221-
222-
The easiest way is to use the `esphome-docs Docker image <https://hub.docker.com/r/esphome/esphome-docs/>`__:
223-
224-
.. code-block:: bash
225-
226-
docker run --rm -v "${PWD}/":/data/esphomedocs -p 8000:8000 -it esphome/esphome-docs
227-
228-
With ``PWD`` referring to the root of the ``esphome-docs`` git repository. Then go to ``<CONTAINER_IP>:8000`` in your browser.
229-
230-
This way, you don't have to install the dependencies to build the documentation.
231-
232-
To check your documentation changes locally, you first need install Sphinx (with **Python 3**).
233-
234-
.. code-block:: bash
235-
236-
# in ESPHome-Docs repo:
237-
pip install -r requirements.txt
238-
239-
Then, use the provided Makefile to build the changes and start a simple web server:
240-
241-
.. code-block:: bash
242-
243-
# Start web server on port 8000
244-
make webserver
245-
246-
# Updates then happen via:
247-
make html
248-
249-
Notes
250-
*****
251-
252-
Some notes about the docs:
253-
254-
- Use the English language (duh...)
255-
- An image tells a thousand words, please use them wherever possible. But also don't forget to shrink them, for example
256-
I often use https://tinypng.com/
257-
- Try to use examples as often as possible (also while it's great to use highly accurate,
258-
and domain-specific lingo, it should not interfere with new users understanding the content)
259-
- Fixes/improvements for the docs themselves should go to the ``current`` branch of the
260-
esphomedocs repository. New features should be added against the ``next`` branch.
261-
- Always create new branches in your fork for each pull request.
262-
263325
.. _setup_dev_env:
264326

265327
Setting Up Development Environment

guides/images/docs_ghedit_1.png

34.5 KB
Loading

guides/images/docs_ghedit_2.png

7.36 KB
Loading

guides/images/docs_ghedit_3.png

21.1 KB
Loading

guides/images/docs_ghedit_4.png

7.74 KB
Loading
9.12 KB
Loading
3.01 KB
Loading
10.6 KB
Loading

0 commit comments

Comments
 (0)