1*d9f75844SAndroid Build Coastguard Worker# How to write WebRTC documentation 2*d9f75844SAndroid Build Coastguard Worker 3*d9f75844SAndroid Build Coastguard Worker<?% config.freshness.owner = 'titovartem' %?> 4*d9f75844SAndroid Build Coastguard Worker<?% config.freshness.reviewed = '2021-03-01' %?> 5*d9f75844SAndroid Build Coastguard Worker 6*d9f75844SAndroid Build Coastguard Worker## Audience 7*d9f75844SAndroid Build Coastguard Worker 8*d9f75844SAndroid Build Coastguard WorkerEngineers and tech writers who wants to contribute to WebRTC documentation 9*d9f75844SAndroid Build Coastguard Worker 10*d9f75844SAndroid Build Coastguard Worker## Conceptual documentation 11*d9f75844SAndroid Build Coastguard Worker 12*d9f75844SAndroid Build Coastguard WorkerConceptual documentation provides overview of APIs or systems. Examples can 13*d9f75844SAndroid Build Coastguard Workerbe threading model of a particular module or data life cycle. Conceptual 14*d9f75844SAndroid Build Coastguard Workerdocumentation can skip some edge cases in favor of clarity. The main point 15*d9f75844SAndroid Build Coastguard Workeris to impart understanding. 16*d9f75844SAndroid Build Coastguard Worker 17*d9f75844SAndroid Build Coastguard WorkerConceptual documentation often cannot be embedded directly within the source 18*d9f75844SAndroid Build Coastguard Workercode because it usually describes multiple APIs and entites, so the only 19*d9f75844SAndroid Build Coastguard Workerlogical place to document such complex behavior is through a separate 20*d9f75844SAndroid Build Coastguard Workerconceptual document. 21*d9f75844SAndroid Build Coastguard Worker 22*d9f75844SAndroid Build Coastguard WorkerA concept document needs to be useful to both experts and novices. Moreover, 23*d9f75844SAndroid Build Coastguard Workerit needs to emphasize clarity, so it often needs to sacrifice completeness 24*d9f75844SAndroid Build Coastguard Workerand sometimes strict accuracy. That's not to say a conceptual document should 25*d9f75844SAndroid Build Coastguard Workerintentionally be inaccurate. It just means that is should focus more on common 26*d9f75844SAndroid Build Coastguard Workerusage and leave rare ones or side effects for class/function level comments. 27*d9f75844SAndroid Build Coastguard Worker 28*d9f75844SAndroid Build Coastguard WorkerIn the WebRTC repo, conceptual documentation is located in `g3doc` subfolders 29*d9f75844SAndroid Build Coastguard Workerof related components. To add a new document for the component `Foo` find a 30*d9f75844SAndroid Build Coastguard Worker`g3doc` subfolder for this component and create a `.md` file there with 31*d9f75844SAndroid Build Coastguard Workerdesired documentation. If there is no `g3doc` subfolder, create a new one; 32*d9f75844SAndroid Build Coastguard Worker 33*d9f75844SAndroid Build Coastguard WorkerWhen you want to specify a link from one page to another - use the absolute 34*d9f75844SAndroid Build Coastguard Workerpath: 35*d9f75844SAndroid Build Coastguard Worker 36*d9f75844SAndroid Build Coastguard Worker``` 37*d9f75844SAndroid Build Coastguard Worker[My document](/module/g3doc/my_document.md) 38*d9f75844SAndroid Build Coastguard Worker``` 39*d9f75844SAndroid Build Coastguard Worker 40*d9f75844SAndroid Build Coastguard WorkerIf you are a Googler also please specify an owner, who will be responsible for 41*d9f75844SAndroid Build Coastguard Workerkeeping this documentation updated, by adding the next lines at the beginning 42*d9f75844SAndroid Build Coastguard Workerof your `.md` file immediately after page title: 43*d9f75844SAndroid Build Coastguard Worker 44*d9f75844SAndroid Build Coastguard Worker```markdown 45*d9f75844SAndroid Build Coastguard Worker<?\% config.freshness.owner = '<user name>' %?> 46*d9f75844SAndroid Build Coastguard Worker<?\% config.freshness.reviewed = '<last review date in format yyyy-mm-dd>' %?> 47*d9f75844SAndroid Build Coastguard Worker``` 48*d9f75844SAndroid Build Coastguard Worker 49*d9f75844SAndroid Build Coastguard WorkerIf you want to configure the owner for all pages under a directory, create a 50*d9f75844SAndroid Build Coastguard Worker`g3doc.lua` file in that directory with the content: 51*d9f75844SAndroid Build Coastguard Worker 52*d9f75844SAndroid Build Coastguard Worker```lua 53*d9f75844SAndroid Build Coastguard Workerconfig = super() 54*d9f75844SAndroid Build Coastguard Workerconfig.freshness.owner = '<user name>' 55*d9f75844SAndroid Build Coastguard Workerreturn config 56*d9f75844SAndroid Build Coastguard Worker``` 57*d9f75844SAndroid Build Coastguard Worker 58*d9f75844SAndroid Build Coastguard WorkerAfter the document is ready you should add it into `/g3doc/sitemap.md`, so it 59*d9f75844SAndroid Build Coastguard Workerwill be discoverable by others. 60*d9f75844SAndroid Build Coastguard Worker 61*d9f75844SAndroid Build Coastguard Worker### Documentation format 62*d9f75844SAndroid Build Coastguard Worker 63*d9f75844SAndroid Build Coastguard WorkerThe documentation is written in GitHub Markdown 64*d9f75844SAndroid Build Coastguard Worker([spec](https://github.github.com/gfm/#:~:text=GitHub%20Flavored%20Markdown%2C%20often%20shortened,a%20strict%20superset%20of%20CommonMark.)). 65*d9f75844SAndroid Build Coastguard Worker 66*d9f75844SAndroid Build Coastguard Worker## Class/function level comments 67*d9f75844SAndroid Build Coastguard Worker 68*d9f75844SAndroid Build Coastguard WorkerDocumentation of specific classes and function APIs and their usage, including 69*d9f75844SAndroid Build Coastguard Workertheir purpose, is embedded in the .h files defining that API. See 70*d9f75844SAndroid Build Coastguard Worker[C++ style guide](https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++.md) 71*d9f75844SAndroid Build Coastguard Workerfor pointers on how to write API documentatin in .h files. 72