blob: a29d686e66f67d794b773a2d922c522f88297fc2 [file] [log] [blame] [view]
Artem Titov86473402021-03-12 11:42:241# How to write WebRTC documentation
2
3<?% config.freshness.owner = 'titovartem' %?>
4<?% config.freshness.reviewed = '2021-03-01' %?>
5
6## Audience
7
8Engineers and tech writers who wants to contribute to WebRTC documentation
9
10## Conceptual documentation
11
12Conceptual documentation provides overview of APIs or systems. Examples can
13be threading model of a particular module or data life cycle. Conceptual
14documentation can skip some edge cases in favor of clarity. The main point
15is to impart understanding.
16
17Conceptual documentation often cannot be embedded directly within the source
18code because it usually describes multiple APIs and entites, so the only
19logical place to document such complex behavior is through a separate
20conceptual document.
21
22A concept document needs to be useful to both experts and novices. Moreover,
23it needs to emphasize clarity, so it often needs to sacrifice completeness
24and sometimes strict accuracy. That's not to say a conceptual document should
25intentionally be inaccurate. It just means that is should focus more on common
26usage and leave rare ones or side effects for class/function level comments.
27
28In the WebRTC repo, conceptual documentation is located in `g3doc` subfolders
29of related components. To add a new document for the component `Foo` find a
30`g3doc` subfolder for this component and create a `.md` file there with
Xavier Décoret967d4cd2021-03-30 08:10:0431desired documentation. If there is no `g3doc` subfolder, create a new one;
32
33When you want to specify a link from one page to another - use the absolute
34path:
Artem Titov86473402021-03-12 11:42:2435
36```
Xavier Décoret967d4cd2021-03-30 08:10:0437[My document](/module/g3doc/my_document.md)
Artem Titov86473402021-03-12 11:42:2438```
39
40If you are a Googler also please specify an owner, who will be responsible for
41keeping this documentation updated, by adding the next lines at the beginning
42of your `.md` file immediately after page title:
43
Xavier Décoret967d4cd2021-03-30 08:10:0444```markdown
Artem Titov86473402021-03-12 11:42:2445<?\% config.freshness.owner = '<user name>' %?>
46<?\% config.freshness.reviewed = '<last review date in format yyyy-mm-dd>' %?>
47```
48
Xavier Décoret967d4cd2021-03-30 08:10:0449If you want to configure the owner for all pages under a directory, create a
50`g3doc.lua` file in that directory with the content:
51
52```lua
53config = super()
54config.freshness.owner = '<user name>'
55return config
56```
57
Artem Titov86473402021-03-12 11:42:2458After the document is ready you should add it into `/g3doc/sitemap.md`, so it
Xavier Décoret967d4cd2021-03-30 08:10:0459will be discoverable by others.
Artem Titov86473402021-03-12 11:42:2460
61### Documentation format
62
Xavier Décoret967d4cd2021-03-30 08:10:0463The documentation is written in GitHub Markdown
64([spec](https://github.github.com/gfm/#:~:text=GitHub%20Flavored%20Markdown%2C%20often%20shortened,a%20strict%20superset%20of%20CommonMark.)).
Artem Titov86473402021-03-12 11:42:2465
66## Class/function level comments
67
Xavier Décoret967d4cd2021-03-30 08:10:0468Documentation of specific classes and function APIs and their usage, including
Artem Titov86473402021-03-12 11:42:2469their purpose, is embedded in the .h files defining that API. See
Fanny Linderborg0d2dc1f2021-07-14 14:02:1170[C++ style guide](https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++.md)
Artem Titov86473402021-03-12 11:42:2471for pointers on how to write API documentatin in .h files.