netbox/docs/reference/markdown.md

255 lines
5.4 KiB
Markdown
Raw Normal View History

2022-06-16 22:26:37 +02:00
# Markdown
2024-03-26 21:26:47 +01:00
NetBox supports Markdown rendering for certain text fields. Some common examples are provided below. For a complete Markdown reference, please see [Markdownguide.org](https://www.markdownguide.org/basic-syntax/).
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
## Headings
2022-06-16 22:26:37 +02:00
```no-highlight
2024-03-26 21:26:47 +01:00
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
2022-06-16 22:26:37 +02:00
```
2024-03-26 21:26:47 +01:00
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
Alternatively, for H1 and H2, an underline-ish style:
2022-06-16 22:26:37 +02:00
```no-highlight
2024-03-26 21:26:47 +01:00
Heading 1
=========
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
Heading 2
---------
2022-06-16 22:26:37 +02:00
```
2024-03-26 21:26:47 +01:00
<h1>Heading 1</h1>
<h2>Heading 2</h2>
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
## Text
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
```no-highlight
Italicize text with *asterisks* or _underscores_.
```
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
Italicize text with *asterisks* or _underscores_.
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
```no-highlight
Bold text with two **asterisks** or __underscores__.
```
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
Bold text with two **asterisks** or __underscores__.
2022-06-16 22:26:37 +02:00
```no-highlight
2024-03-26 21:26:47 +01:00
Strike text with two tildes. ~~Deleted text.~~
2022-06-16 22:26:37 +02:00
```
2024-03-26 21:26:47 +01:00
Strike text with two tildes. ~~Deleted text.~~
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
## Line Breaks
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
By default, Markdown will remove line breaks between successive lines of text. For example:
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
```no-highlight
This is one line.
And this is another line.
One more line here.
```
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
This is one line.
And this is another line.
One more line here.
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
To preserve line breaks, append two spaces to each line (represented below with the `⋅` character).
2022-06-16 22:26:37 +02:00
```no-highlight
2024-03-26 21:26:47 +01:00
This is one line.⋅⋅
And this is another line.⋅⋅
One more line here.
```
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
This is one line.
And this is another line.
One more line here.
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
## Lists
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
Use asterisks or hyphens for unordered lists. Indent items by four spaces to start a child list.
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
```no-highlight
* Alpha
* Bravo
* Charlie
* Child item 1
* Child item 2
* Delta
```
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
* Alpha
* Bravo
* Charlie
* Child item 1
* Child item 2
* Delta
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
Use digits followed by periods for ordered (numbered) lists.
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
```no-highlight
1. Red
2. Green
3. Blue
1. Light blue
2. Dark blue
4. Orange
2022-06-16 22:26:37 +02:00
```
2024-03-26 21:26:47 +01:00
1. Red
2. Green
3. Blue
1. Light blue
2. Dark blue
4. Orange
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
## Links
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
Text can be rendered as a hyperlink by encasing it in square brackets, followed by a URL in parentheses. A title (text displayed on hover) may optionally be included as well.
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
```no-highlight
Here's an [example](https://www.example.com) of a link.
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
And here's [another link](https://www.example.com "Click me!"), this time with a title.
```
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
Here's an [example](https://www.example.com) of a link.
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
And here's [another link](https://www.example.com "Click me!"), with a title.
2022-06-16 22:26:37 +02:00
## Images
2024-03-26 21:26:47 +01:00
The syntax for embedding an image is very similar to that used for a hyperlink. Alternate text should always be provided; this will be displayed if the image fails to load. As with hyperlinks, title text is optional.
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
```no-highlight
![Alternate text](/path/to/image.png "Image title text")
2022-06-16 22:26:37 +02:00
```
2024-03-26 21:26:47 +01:00
## Code Blocks
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
Single backticks can be used to annotate code inline. Text enclosed by lines of three backticks will be displayed as a code block.
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
```no-highlight
Paragraphs are rendered in HTML using `<p>` and `</p>` tags.
2022-06-16 22:26:37 +02:00
```
2024-03-26 21:26:47 +01:00
Paragraphs are rendered in HTML using `<p>` and `</p>` tags.
2022-06-16 22:26:37 +02:00
````
```
2024-03-26 21:26:47 +01:00
def my_func(foo, bar):
# Do something
return foo * bar
2022-06-16 22:26:37 +02:00
```
````
2024-03-26 21:26:47 +01:00
```no-highlight
def my_func(foo, bar):
# Do something
return foo * bar
2022-06-16 22:26:37 +02:00
```
## Tables
2024-03-26 21:26:47 +01:00
Simple tables can be constructed using the pipe character (`|`) to denote columns, and hyphens (`-`) to denote the heading. Inline Markdown can be used to style text within columns.
2022-06-16 22:26:37 +02:00
```no-highlight
2024-03-26 21:26:47 +01:00
| Heading 1 | Heading 2 | Heading 3 |
|-----------|-----------|-----------|
| Row 1 | Alpha | Red |
| Row 2 | **Bravo** | Green |
| Row 3 | Charlie | ~~Blue~~ |
2022-06-16 22:26:37 +02:00
```
2024-03-26 21:26:47 +01:00
| Heading 1 | Heading 2 | Heading 3 |
|-----------|-----------|-----------|
| _Row 1_ | Alpha | Red |
| Row 2 | **Bravo** | Green |
| Row 3 | Charlie | ~~Blue~~ |
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
Colons can be used to align text to the left or right side of a column.
2022-06-16 22:26:37 +02:00
```no-highlight
2024-03-26 21:26:47 +01:00
| Left-aligned | Centered | Right-aligned |
|:-------------|:--------:|--------------:|
| Text | Text | Text |
| Text | Text | Text |
| Text | Text | Text |
2022-06-16 22:26:37 +02:00
```
2024-03-26 21:26:47 +01:00
| Left-aligned | Centered | Right-aligned |
|:-------------|:--------:|--------------:|
| Text | Text | Text |
| Text | Text | Text |
| Text | Text | Text |
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
## Blockquotes
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
Text can be wrapped in a blockquote by prepending a right angle bracket (`>`) before each line.
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
```no-highlight
> I think that I shall never see
> a graph more lovely than a tree.
> A tree whose crucial property
> is loop-free connectivity.
```
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
> I think that I shall never see
> a graph more lovely than a tree.
> A tree whose crucial property
> is loop-free connectivity.
2022-06-16 22:26:37 +02:00
2024-03-26 21:26:47 +01:00
Markdown removes line breaks by default. To preserve line breaks, append two spaces to each line (represented below with the `⋅` character).
2022-06-16 22:26:37 +02:00
```no-highlight
2024-03-26 21:26:47 +01:00
> I think that I shall never see⋅⋅
> a graph more lovely than a tree.⋅⋅
> A tree whose crucial property⋅⋅
> is loop-free connectivity.
2022-06-16 22:26:37 +02:00
```
2024-03-26 21:26:47 +01:00
> I think that I shall never see
> a graph more lovely than a tree.
> A tree whose crucial property
> is loop-free connectivity.
2022-06-16 22:26:37 +02:00
## Horizontal Rule
2024-03-26 21:26:47 +01:00
A horizontal rule is a single line rendered across the width of the page using a series of three or more hyphens or asterisks. It can be useful for separating sections of content.
```no-highlight
Content
2022-06-16 22:26:37 +02:00
---
2024-03-26 21:26:47 +01:00
More content
2022-06-16 22:26:37 +02:00
***
2024-03-26 21:26:47 +01:00
Final content
2022-06-16 22:26:37 +02:00
```
2024-03-26 21:26:47 +01:00
Content
2022-06-16 22:26:37 +02:00
---
2024-03-26 21:26:47 +01:00
More content
2022-06-16 22:26:37 +02:00
***
2024-03-26 21:26:47 +01:00
Final content