blob: 6c6a4902ee553339f62d3997e4954cc006a2d423 [file] [log] [blame] [view]
Artem Titova6178672023-01-30 10:51:011<!-- go/cmark -->
2<!--* freshness: {owner: 'titovartem' reviewed: '2023-01-16'} *-->
Artem Titov86473402021-03-12 11:42:243
Artem Titova6178672023-01-30 10:51:014# How to write WebRTC documentation
Artem Titov0f2ce5c2023-01-26 20:18:465
Artem Titov86473402021-03-12 11:42:246## 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
Artem Titova6178672023-01-30 10:51:0118code because it usually describes multiple APIs and entities, so the only
Artem Titov86473402021-03-12 11:42:2419logical 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
Artem Titova6178672023-01-30 10:51:0131desired documentation. If there is no `g3doc` subfolder, create a new one.
32
33Please put the following file header into any created documentation file as the
34first line:
35
36```markdown
37<!-- go/cmark -->
38```
Xavier Décoret967d4cd2021-03-30 08:10:0439
40When you want to specify a link from one page to another - use the absolute
41path:
Artem Titov86473402021-03-12 11:42:2442
43```
Xavier Décoret967d4cd2021-03-30 08:10:0444[My document](/module/g3doc/my_document.md)
Artem Titov86473402021-03-12 11:42:2445```
46
47If you are a Googler also please specify an owner, who will be responsible for
48keeping this documentation updated, by adding the next lines at the beginning
49of your `.md` file immediately after page title:
50
Xavier Décoret967d4cd2021-03-30 08:10:0451```markdown
Artem Titova6178672023-01-30 10:51:0152<!--* freshness: {owner: '<user name>' reviewed: '<last review date in format yyyy-mm-dd>' *-->
Xavier Décoret967d4cd2021-03-30 08:10:0453```
54
Artem Titov86473402021-03-12 11:42:2455After the document is ready you should add it into `/g3doc/sitemap.md`, so it
Xavier Décoret967d4cd2021-03-30 08:10:0456will be discoverable by others.
Artem Titov86473402021-03-12 11:42:2457
58### Documentation format
59
Xavier Décoret967d4cd2021-03-30 08:10:0460The documentation is written in GitHub Markdown
61([spec](https://github.github.com/gfm/#:~:text=GitHub%20Flavored%20Markdown%2C%20often%20shortened,a%20strict%20superset%20of%20CommonMark.)).
Artem Titov86473402021-03-12 11:42:2462
63## Class/function level comments
64
Xavier Décoret967d4cd2021-03-30 08:10:0465Documentation of specific classes and function APIs and their usage, including
Artem Titov86473402021-03-12 11:42:2466their purpose, is embedded in the .h files defining that API. See
Fanny Linderborg0d2dc1f2021-07-14 14:02:1167[C++ style guide](https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++.md)
Artem Titov86473402021-03-12 11:42:2468for pointers on how to write API documentatin in .h files.