1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395
|
# Documentation Standards
## Introduction
The following are the standards to be used by Cacti Group members and
Contributes when maintaining the documentation of Cacti or any of its plugins.
These standards have also been applied to the Travis CI checker on GitHub.
## Reporting corrections / omissions
Please report any errors or corrections on the Cacti Documentation GitHub
repository which is located at
[https://github.com/cacti/documentation/](https://github.com/cacti/documentation/)
where all changes can be tracked. Any **Pull Requests** will be welcome to help
speed up changes by allowing the Cacti Group to simply verify the changes are
correct before submitting them.
## Copyright
All documentation should be marked as copyright to the Cacti Group. This is done
by simply adding the following text to the bottom of the page (including the
blank line):
```markdown
---
Copyright (c) 2004-2024 The Cacti Group
```
## Titles
### Title Levels
When creating documentation titles, they should:
- use the \# symbol with 1 - 5 hashes
_The actual count of hashes represents the sub-level of the title._
- not have multiple level 1 headers
`MD025 Multiple top level headers in the same document`
- not have punctuation at the end of the header
`MD026 Trailing punctuation in header`
- not use `----` or `====` on a line that follows a header
`MD003 Header style`
- increment down only one sub-level at a time
_You may go back up any number of levels_
```markdown
# Main Title 1
## Main Title 1.Sub Title 1
### Main Title 1.Sub Title 1.Sub Title 1
### Main Title 1.Sub Title 1.Sub Title 2
## Main Title 1.Sub Title 2
### Main Title 1.Sub Title 2.Sub Title 1
### Main Title 1.Sub Title 2.Sub Title 2
# Main Title 2
### Main Title 2.Invalid Sub Title 1.Invalid Sub Title 1
```
- not use other title definition symbols
_Whilst they are valid markdown, they will result in style errors._
Failure to follow this will result in an `MD001` error during Travis CI checks.
###### Example 1. Incorrect Markdown for Title Levels
```markdown
# Welcome
Welcome to us
## Using the software 1.2
To use most functions of our software, navigate the menus
#### Accessing the menus 1.2.1.1
The menus are located at the top of the page ...
```
###### Example 2. Corrected Markdown for Title Levels
```markdown
# Welcome
Welcome to us
## Using the software 1.2
To use most functions of our software, navigate the menus
### Accessing the menus 1.2.1
The menus are located at the top of the page ...
```
### Title Spacing
All titles should be separated with blank lines either side of the title. The
only exception to this is if the title is on the first line of the page. They
should also have a single space between the hash symbols and text.
###### Example 3. Incorrect Markdown for Title Spacing
```markdown
# Welcome
Welcome to us
## Using the software 1.2
To use most functions of our software, navigate the menus
### Accessing the menus 1.2.1
The menus are located at the top of the page ...
```
###### Example 4. Correct Markdown for Title Spacing
```markdown
# Welcome
Welcome to us
## Using the software 1.2
To use most functions of our software, navigate the menus
### Accessing the menus 1.2.1
The menus are located at the top of the page ...
```
### Titles for Captions
Titles for examples, images and tables are the only exception to the Title Level
rule. These are normally set to 6 (Six) hash symbols (e.g., `######`). The
format of the text should be such that it reads the type of caption, a number,
full stop, then the description
```markdown
###### <caption type> <number>. <description>
```
###### Example 5. Example of this caption
```markdown
###### Example 5. Example of this caption
```
## Text
### Standard Text
Any text written outside of code blocks must:
- be formatted such that it does not exceed 79 characters. This is to make it
easier to read and adjust the paragraphs in any editor.
`MD013 Line length`
- have blank lines between paragraphs
- not have multiple blank lines
`MD012 Multiple consecutive blank lines`
- not have trailing spaces
`MD009 Trailing spaces`
- not use HTML outside of fenced code blocks
`MD033 Inline HTML`
### Tables
All tables should have a caption applied to them in the style that was listed
above.
### Lists
All lists should:
- use a single `-` (dash) character for bullet points
- use the same indentation for the same level
`MD005 Inconsistent indentation for list items at the same level`
- start at the beginning of a line (no spaces/indents) for the top level
`MD006 Consider starting bulleted lists at the beginning of the line`
- use a digit following by a full stop for numbered lists
- should have a single space between the list item marker and the start of the
text
- have blanks lines around items in the same fashion as titles
`MD030 Spaces after list markers`
- wrap text with indentation as they are exempt from the text-width formatting
rule
```markdown
- wrap text with indentation as they are exempt from the text-width formatting
rule
```
- may include sub-items in a similar fashion to titles by:
- indenting sub-items or examples by two spaces per level
- indenting one level at a time
- include examples such as:
````markdown
- may include sub-items in a similar fashion to titles by:
- indenting sub-items or examples by three spaces per level
- indenting one level at a time
- include examples such as:
```markdown
- may include sub-items in a similar fashion to titles by:
- indenting sub-items or examples by three spaces per level
```
````
### Inline Code
Inline code can be included using the single backtick (\`) method to produce
code-like references. An example of this would be to:
###### Example 6. Inline Code
```markdown
use the \`--help\` parameter on the command
```
Which would produce:
---
use the `--help` parameter on the command
---
### Code Blocks
All code blocks must be:
- surround by blank lines to separate them from other text
`MD031 Fenced code blocks should be surrounded by blank lines`
- fenced with three backticks (\`\`\`) and not any other code block fencing
characters.
- have a language applied to them by entering the name after the three
backticks.
`MD040 Fenced code blocks should have a language specified`
- an exception to the above text formatting rules as they may contain example
lines that are required to be on a single line.
Where possible, it is advised to try and make use of continuation lines (\\) so
that these are easily readable on any screen.
###### Example 7. Code Block with Style
````markdown
```markdown
This is a markdown example, <b> will display <b> not start a bold HTML style
Also ` will actually be displayed not interpreted
```
````
The style used on the fenced code block should match the contents of the code
block. In the above example, we used `markdown` as we were displaying a markdown
example. The following table is a basic example what is most commonly used in
the documentation:
| Type | Markdown Language | Usage |
| -------: | :---------------: | ------------------------------------------ |
| C++ | c++ | Formats code block as C++ |
| PHP | php | Formats code block as PHP |
| SQL | sql | Formats code block as SQL |
| Script | bash | Formats code block as bash script |
| | sh | Formats code block as posix script |
| Shell | console | Formats code block as command line example |
| Markdown | markdown | Formats code block as Markdown |
### URLs
All URLs should be formatted in the markdown format and not just inserted
directly into the text. The format for this is:
```markdown
[text for link](https://url/wanted)
```
Failing to do this will result in `MD034 Bare URL used`
This would produce: [text for link](https://url/wanted)
### Horizontal Rules
Horizontal rules should be made using three or more consecutive hyphens on a
single line. Again, these should be surrounded by spaces.
```markdown
Paragraph 1 text
---
Paragraph 2 text
```
## Link new files to README.md
Before testing your changes make sure you add the necessary links to README.md
for any new files
Running this script will help you check for any missing links.
```console
bin/check_missing_link.sh
```
## Testing changes
To locally test the changes made to any Markdown document, you will need to have
ruby installed and then run:
```console
gem install mdl
```
If this pre-requisite has already been completed, then you can simply type the
following into your shell
```console
cd <cacti_docs>
bin/check_markdown_style.sh
```
Which will generate the same output that is seen on the Travis CI build status.
You should ensure that any reported errors are corrected before submitting your
pull request.
```console
Documentation-Standards.md:221: MD031 Fenced code blocks should be surrounded by blank lines
Documentation-Standards.md:230: MD031 Fenced code blocks should be surrounded by blank lines
Documentation-Standards.md:232: MD031 Fenced code blocks should be surrounded by blank lines
Documentation-Standards.md:265: MD031 Fenced code blocks should be surrounded by blank lines
Documentation-Standards.md:268: MD031 Fenced code blocks should be surrounded by blank lines
Documentation-Standards.md:290: MD031 Fenced code blocks should be surrounded by blank lines
Documentation-Standards.md:292: MD031 Fenced code blocks should be surrounded by blank lines
Documentation-Standards.md:161: MD032 Lists should be surrounded by blank lines
Documentation-Standards.md:250: MD032 Lists should be surrounded by blank lines
Documentation-Standards.md:253: MD032 Lists should be surrounded by blank lines
Documentation-Standards.md:256: MD032 Lists should be surrounded by blank lines
Documentation-Standards.md:236: MD033 Inline HTML
Documentation-Standards.md:240: MD033 Inline HTML
```
---
Copyright (c) 2004-2024 The Cacti Group
|