mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-19 14:26:01 -04:00
doc: Documenting Code clean up
This commit is contained in:
parent
fa3e4103ab
commit
4e9e8f52ac
BIN
docs/_static/doc-code-documentation-inline.png
vendored
BIN
docs/_static/doc-code-documentation-inline.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
@ -56,17 +56,17 @@ When writing code for this repository, please follow guidelines below.
|
||||
:align: center
|
||||
:alt: Sample void function documented inline and after rendering
|
||||
|
||||
5. When documenting members of a ``struct``, ``typedef`` or ``enum``, place specific comment like below after each member.
|
||||
5. When documenting a ``define`` as well as members of a ``struct`` or ``enum``, place specific comment like below after each member.
|
||||
|
||||
.. image:: _static/doc-code-member.png
|
||||
:align: center
|
||||
:alt: Sample of member documentation inline and after rendering
|
||||
|
||||
|
||||
6. To provide well formatted lists, break the line after command (like ``@return`` in example below).
|
||||
|
||||
.. code-block:: c
|
||||
::
|
||||
|
||||
...
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK if erase operation was successful
|
||||
@ -75,7 +75,6 @@ When writing code for this repository, please follow guidelines below.
|
||||
* - ESP_ERR_NVS_NOT_FOUND if the requested key doesn't exist
|
||||
* - other error codes from the underlying storage driver
|
||||
*
|
||||
...
|
||||
|
||||
7. Overview of functionality of documented header file, or group of files that make a library, should be placed in the same directory in a separate ``README.rst`` file. If directory contains header files for different APIs, then the file name should be ``apiname-readme.rst``.
|
||||
|
||||
@ -86,9 +85,8 @@ There is couple of tips, how you can make your documentation even better and mor
|
||||
|
||||
1. Add code snippets to illustrate implementation. To do so, enclose snippet using ``@code{c}`` and ``@endcode`` commands.
|
||||
|
||||
.. code-block:: c
|
||||
::
|
||||
|
||||
...
|
||||
*
|
||||
* @code{c}
|
||||
* // Example of using nvs_get_i32:
|
||||
@ -99,33 +97,28 @@ There is couple of tips, how you can make your documentation even better and mor
|
||||
* // have its default value.
|
||||
* @endcode
|
||||
*
|
||||
...
|
||||
|
||||
The code snippet should be enclosed in a comment block of the function that it illustrates.
|
||||
|
||||
2. To highlight some important information use command ``@attention`` or ``@note``.
|
||||
|
||||
.. code-block:: c
|
||||
::
|
||||
|
||||
...
|
||||
*
|
||||
* @attention
|
||||
* 1. This API only impact WIFI_MODE_STA or WIFI_MODE_APSTA mode
|
||||
* 2. If the ESP32 is connected to an AP, call esp_wifi_disconnect to disconnect.
|
||||
*
|
||||
...
|
||||
|
||||
Above example also shows how to use a numbered list.
|
||||
|
||||
3. Use markdown to make your documentation even more readable. You will add headers, links, tables and more.
|
||||
|
||||
.. code-block:: c
|
||||
::
|
||||
|
||||
...
|
||||
*
|
||||
* [ESP32 Technical Reference](http://espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf)
|
||||
*
|
||||
...
|
||||
|
||||
.. note::
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user