Debian Codegraph @

docs/doc_conventions.md

raw symbols SCIP
1 # Documentation Conventions
2
3 ## Guiding Principles
4
5 Follow the [Documentation Principles](http://www.writethedocs.org/guide/writing/docs-principles/)
6 described by [Write The Docs](http://www.writethedocs.org)
7
8 In addition:
9
10 - We have gone to great lengths to retain compatibility with the standard library `cmd`, the
11 documentation should make it easy for developers to understand how to move from `cmd` to `cmd2`,
12 and what benefits that will provide
13 - We should provide both descriptive and reference documentation.
14 - API reference documentation should be generated from docstrings in the code
15 - Documentation should include rich hyperlinking to other areas of the documentation, and to the API
16 reference
17
18 ## Style Checker
19
20 We strongly encourage all developers to use [Prettier](https://prettier.io/) for formatting all
21 **Markdown** and YAML files. The easiest way to do this is to integrate it with your IDE and
22 configure your IDE to format on save. You can also install `prettier` either using `npm` or OS
23 package manager such as `brew` or `apt`.
24
25 ## Naming Files
26
27 All source files in the documentation must:
28
29 - have all lower case file names
30 - if the name has multiple words, separate them with an underscore
31 - end in '.md'
32
33 ## Indenting
34
35 In Markdown all indenting is significant. Use 4 spaces per indenting level.
36
37 ## Wrapping
38
39 Hard wrap all text so that line lengths are no greater than 100 characters. It makes everything
40 easier when editing documentation, and has no impact on reading documentation because we render to
41 html.
42
43 ## Titles and Headings
44
45 Reference the [Markdown Basic Syntax](https://www.markdownguide.org/basic-syntax/) for syntax basics
46 or [The Markdown Guide](https://www.markdownguide.org/) for a more complete reference.
47
48 ## Inline Code
49
50 Code blocks can be created in two ways:
51
52 - Indent the block - this will show as a monospace code block, but won't include highlighting
53 - use the triple backticks followed by the code language, e.g. `python` and close with triple
54 backticks
55
56 If you want to show non-Python code, like shell commands, then use a different language such as
57 `javascript`, `shell`, `json`, etc.
58
59 ## Links
60
61 See the [Links](https://www.markdownguide.org/basic-syntax/) Markdown syntax documentation.
62
63 ## API Documentation
64
65 The API documentation is mostly pulled from docstrings in the source code using the Zensical
66 [mkdocstrings](https://mkdocstrings.github.io/) plugin.
67
68 When using `mkdocstrings`, it must be preceded by a blank line before and after, i.e.:
69
70 ```markdown
71 ::: cmd2.history.History
72
73 ::: cmd2.history.HistoryItem
74 ```
75
76 ### Links to API Reference
77
78 To reference a class, method, or function, use block quotes around the name of the full namespace
79 path for it followed by empty block quotes. So to reference `cmd2.Cmd`, you use `[cmd2.Cmd][]`.
80
81 If you want to change the name to use something shorter than the full namespace resolution you can
82 put the full path in the 2nd set of block quotes instead of leaving it empty and put the shorter
83 name in the one on the left. So you could also use `[Cmd][cmd2.Cmd]` to link to the API
84 documentation for `cmd2.Cmd`.
85
86 ## Referencing cmd2
87
88 Whenever you reference `cmd2` in the documentation, enclose it in backticks. This indicates to
89 Markdown that this words represents code and will stand out when rendered as HTML.