2020-03-03 11:06:00 -06:00
# Markdown style guide
2020-10-02 13:02:11 -05:00
This guide for Markdown style helps keep contributions consistent across all documentation created for Grafana products. Refer to the guide and update its sections as needed when a Subject Matter Expert answers a question on Markdown style, or a decision is made about how to apply Markdown.
2020-03-03 11:06:00 -06:00
## Headers
2020-10-02 13:02:11 -05:00
In Markdown, the number of "#" symbols creates different heading levels, similar to HTML heading levels:
2020-03-03 11:06:00 -06:00
**Example**
2020-10-02 13:02:11 -05:00
- \# is \<h1>.
- \#\# is \<h2>.
- \#\#\# is \<h3>.
2020-03-03 11:06:00 -06:00
2021-09-29 07:34:40 -05:00
Start your document with a single `#` for the title of the page. Add the sub-headings with two `##` .
2020-03-03 11:06:00 -06:00
## Bold and emphasis
2020-10-02 13:02:11 -05:00
- Make text **bold** using two asterisks.
2020-03-03 11:06:00 -06:00
2021-09-29 07:34:40 -05:00
**Example:** It is `**important**` to use GitHub-flavored Markdown emoji consistently.
2020-03-03 11:06:00 -06:00
2021-09-29 07:34:40 -05:00
- Make text `_emphasized_` using single ` _underscores_` . Do not use the single asterisk, it can be easily confused with bold.
2020-03-03 11:06:00 -06:00
2020-09-25 12:16:11 -05:00
**Example:** GitHub-flavored markdown emoji should _only_ appear in specific cases.
2020-03-03 11:06:00 -06:00
## Links and references
2020-09-25 12:16:11 -05:00
Create links to other website by wrapping the display text in square brackets, and the web URL in curved brackets.
2020-03-03 11:06:00 -06:00
\[text to display](www.website.com)
2020-10-02 13:02:11 -05:00
**Example:** For more information on including emoji in GitHub-flavored markdown, refer to the [webfx page on emoji ](https://www.webfx.com/tools/emoji-cheat-sheet/ ) for a list of emoji.
2020-03-03 11:06:00 -06:00
## Block quotes
2020-09-25 12:16:11 -05:00
Include block quotes inside text using right-facing arrows:
2020-03-03 11:06:00 -06:00
**Example**
> Any important information
> about emoji can be separated into
> a blockquote.
## Code blocks
2020-10-02 13:02:11 -05:00
Code blocks written with markdown can show off syntax highlighting specific to different languages. Use three back tics to create a code block:
2020-03-03 11:06:00 -06:00
```
function testNum(a) {
if (a > 0) {
return "positive";
} else {
return "NOT positive";
}
}
```
2020-10-02 13:02:11 -05:00
Write the name of the language after the first set of back tics, no spaces, to show specific syntax highlighting. For example; "\```javascript" produces the following:
2020-03-03 11:06:00 -06:00
```javascript
function testNum(a) {
if (a > 0) {
2021-09-29 07:34:40 -05:00
return 'positive';
2020-03-03 11:06:00 -06:00
} else {
2021-09-29 07:34:40 -05:00
return 'NOT positive';
2020-03-03 11:06:00 -06:00
}
}
```
2021-09-29 07:34:40 -05:00
2020-03-03 11:06:00 -06:00
## Tables
2020-10-02 13:02:11 -05:00
Construct a table by typing the table headings, and separating them with a "|" character. Then, add a second line of dashes ("-") separated by another "|" character. When constructing the table cells, separate each cell data with another "|".
2020-03-03 11:06:00 -06:00
**Example**
Heading one | Heading two
\------------|------------
Cell one data| Cell two data
Will publish as:
2021-09-29 07:34:40 -05:00
| Heading one | Heading two |
| ------------- | ------------- |
| Cell one data | Cell two data |
2020-03-03 11:06:00 -06:00
## Lists
### Numbered lists
To avoid inconsistent list numbering, use repetitive list numbering:
\1. First
\1. Second
\1. Third
The list above will always display as:
1. First
2. Second
3. Third
### Unordered lists
2020-10-02 13:02:11 -05:00
Build a list of points - an unordered or unnumbered list - by using "\-" (hyphen) characters.
2020-03-03 11:06:00 -06:00
**Example**
2020-09-25 12:16:11 -05:00
- First
- Another item
- The last list item
2020-03-03 11:06:00 -06:00
## Images
2020-12-07 12:50:44 -06:00
_Do not_ use image shortcodes at this time.
2020-03-03 11:06:00 -06:00
Include images in a document using the following syntax:
2020-12-07 12:50:44 -06:00
```
2021-09-30 11:59:35 -05:00
![Alt text ](link to image, starting with /static/img/docs/ if it is to an internal image "Title of image in sentence case" )
2020-12-07 12:50:44 -06:00
```
2021-01-12 15:41:19 -06:00
> **Note:** Alt text does not appear when the user hovers the mouse over the image, but title text does.
2021-09-29 07:34:40 -05:00
**Examples:**
2021-01-12 15:41:19 -06:00
2021-09-30 11:59:35 -05:00
- \!\[Grafana logo](/link/to/grafanalogo/logo.png "Grafana logo")
- \!\[Example](/static/img/docs/folder_name/alert_test_rule.png "Example title")
2020-03-03 11:06:00 -06:00
This follows the format of "!", alt text wrapped in "[]" and the link URL wrapped in "()".
2020-12-07 12:50:44 -06:00
You can also use HTML such as the following:
2021-09-29 07:34:40 -05:00
2020-12-07 12:50:44 -06:00
```
< img src = "example.png"
alt="Example image"
style="float: left; margin-right: 5px;" />
```
In most cases, use the markdown syntax rather than the HTML syntax. Only use the HTML if you need to change the image in ways unsupported by Markdown.
2020-03-03 11:06:00 -06:00
## Comments
2020-09-25 12:16:11 -05:00
You can include comments that will not appear in published markdown using the following syntax:
2020-03-03 11:06:00 -06:00
\[comment]: < > (Comment text to display)
2020-09-25 12:16:11 -05:00
The word "comment" wrapped in "[]" followed by a ":", a space, "< >", and then the comment itself wrapped in "()".