2023-07-25 23:27:01 +01:00
---
title: Markdown
2023-08-17 23:09:49 +01:00
weight: 2
2023-07-25 23:27:01 +01:00
---
2023-08-19 13:42:59 +01:00
Hugo supports [Markdown ](https://en.wikipedia.org/wiki/Markdown ) syntax for formatting text, creating lists, and more. This page will show you some of the most common Markdown syntax examples.
2023-07-25 23:27:01 +01:00
2023-08-19 13:42:59 +01:00
<!-- more -->
2023-07-25 23:27:01 +01:00
2023-08-19 13:42:59 +01:00
## Markdown Examples
2023-07-25 23:27:01 +01:00
2023-08-19 13:42:59 +01:00
### Styling Text
2023-07-25 23:27:01 +01:00
2023-08-19 13:42:59 +01:00
| Style | Syntax | Example | Output |
| -------- | -------- | ------ | ------ |
| Bold | `**bold text**` | `**bold text**` | **bold text** |
2024-05-21 04:09:03 -05:00
| Italic | `*italicized text*` | `*italicized text*` | *italicized text* |
2023-08-19 13:42:59 +01:00
| Strikethrough | `~~strikethrough text~~` | `~~strikethrough text~~` | ~~strikethrough text~~ |
| Subscript | `<sub></sub>` | `This is a <sub>subscript</sub> text` | This is a < sub > subscript</ sub > text |
| Superscript | `<sup></sup>` | `This is a <sup>superscript</sup> text` | This is a < sup > superscript</ sup > text |
2023-07-25 23:27:01 +01:00
2023-08-19 13:42:59 +01:00
### Blockquotes
2023-07-25 23:27:01 +01:00
2023-08-19 13:42:59 +01:00
Blockquote with attribution
2023-07-25 23:27:01 +01:00
> Don't communicate by sharing memory, share memory by communicating.<br>
> — <cite>Rob Pike[^1]</cite>
[^1]: The above quote is excerpted from Rob Pike's [talk ](https://www.youtube.com/watch?v=PAAkCSZUG1c ) during Gopherfest, November 18, 2015.
2024-08-11 18:03:51 +02:00
```markdown {filename=Markdown}
> Don't communicate by sharing memory, share memory by communicating.<br>
> — <cite>Rob Pike[^1]</cite>
[^1]: The above quote is excerpted from Rob Pike's [talk ](https://www.youtube.com/watch?v=PAAkCSZUG1c ) during Gopherfest, November 18, 2015.
```
2024-12-14 23:44:10 +00:00
### Alerts
2024-12-28 16:23:58 +00:00
{{< new-feature version = "v0.9.0" > }}
2024-12-14 23:44:10 +00:00
Alerts are a Markdown extension based on the blockquote syntax that you can use to emphasize critical information.
[GitHub-style alerts ](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts ) are supported.
Please make sure you are using the latest version of Hextra and [Hugo v0.134.0 ](https://github.com/gohugoio/hugo/releases/tag/v0.134.0 ) or later.
> [!NOTE]
> Useful information that users should know, even when skimming content.
> [!TIP]
> Helpful advice for doing things better or more easily.
> [!IMPORTANT]
> Key information users need to know to achieve their goal.
> [!WARNING]
> Urgent info that needs immediate user attention to avoid problems.
> [!CAUTION]
> Advises about risks or negative outcomes of certain actions.
```markdown {filename=Markdown}
> [!NOTE]
> Useful information that users should know, even when skimming content.
> [!TIP]
> Helpful advice for doing things better or more easily.
> [!IMPORTANT]
> Key information users need to know to achieve their goal.
> [!WARNING]
> Urgent info that needs immediate user attention to avoid problems.
> [!CAUTION]
> Advises about risks or negative outcomes of certain actions.
```
2023-08-19 13:42:59 +01:00
### Tables
2023-07-25 23:27:01 +01:00
Tables aren't part of the core Markdown spec, but Hugo supports them out-of-the-box.
2024-08-11 18:03:51 +02:00
| Name | Age |
|--------|------|
| Bob | 27 |
| Alice | 23 |
```markdown {filename=Markdown}
| Name | Age |
|--------|------|
| Bob | 27 |
| Alice | 23 |
```
2023-07-25 23:27:01 +01:00
#### Inline Markdown within tables
| Italics | Bold | Code |
| -------- | -------- | ------ |
| *italics* | **bold** | `code` |
2024-08-11 18:03:51 +02:00
```markdown {filename=Markdown}
| Italics | Bold | Code |
| -------- | -------- | ------ |
| *italics* | **bold** | `code` |
```
2023-08-19 13:42:59 +01:00
### Code Blocks
2023-07-25 23:27:01 +01:00
2023-08-19 13:42:59 +01:00
{{< cards > }}
2023-08-28 22:45:29 +01:00
{{< card link = "../../guide/syntax-highlighting" title = "Syntax Highlighting" icon = "sparkles" > }}
2023-08-19 13:42:59 +01:00
{{< / cards > }}
2023-07-30 22:18:28 +01:00
2023-08-19 13:42:59 +01:00
### Lists
2023-07-25 23:27:01 +01:00
#### Ordered List
1. First item
2. Second item
3. Third item
2024-08-11 18:03:51 +02:00
```markdown {filename=Markdown}
1. First item
2. Second item
3. Third item
```
2023-07-25 23:27:01 +01:00
#### Unordered List
* List item
* Another item
* And another item
2024-08-11 18:03:51 +02:00
```markdown {filename=Markdown}
* List item
* Another item
* And another item
```
2023-07-25 23:27:01 +01:00
#### Nested list
* Fruit
* Apple
* Orange
* Banana
* Dairy
* Milk
* Cheese
2024-08-11 18:03:51 +02:00
```markdown {filename=Markdown}
* Fruit
* Apple
* Orange
* Banana
* Dairy
* Milk
* Cheese
```
2023-08-19 13:42:59 +01:00
### Images
2023-07-30 22:18:28 +01:00
2024-08-22 05:05:30 -04:00

2024-08-11 18:03:51 +02:00
```markdown {filename=Markdown}
2024-08-22 05:05:30 -04:00

2024-08-11 18:03:51 +02:00
```
2023-07-30 22:18:28 +01:00
2023-08-19 13:42:59 +01:00
With caption:
2023-07-30 22:18:28 +01:00
2024-08-22 05:05:30 -04:00

2024-08-11 18:03:51 +02:00
```markdown {filename=Markdown}
2024-08-22 05:05:30 -04:00

2024-08-11 18:03:51 +02:00
```
2023-07-30 22:18:28 +01:00
2025-02-13 04:22:41 +01:00
For more advanced functionality, use Hugo's built-in [Figure shortcode ](https://gohugo.io/shortcodes/figure/ ).
2023-08-19 13:42:59 +01:00
## Configuration
2023-07-30 22:18:28 +01:00
2023-08-19 13:42:59 +01:00
Hugo uses [Goldmark ](https://github.com/yuin/goldmark ) for Markdown parsing.
Markdown rendering can be configured in `hugo.yaml` under `markup.goldmark` .
Below is the default configuration for Hextra:
2023-07-30 22:18:28 +01:00
2023-08-19 13:42:59 +01:00
```yaml {filename="hugo.yaml"}
markup:
goldmark:
renderer:
unsafe: true
highlight:
noClasses: false
2023-07-30 22:18:28 +01:00
```
2023-07-25 23:27:01 +01:00
2023-08-19 13:42:59 +01:00
For more configuration options, see Hugo documentation on [Configure Markup ](https://gohugo.io/getting-started/configuration-markup/ ).
2023-07-25 23:27:01 +01:00
2023-08-19 13:42:59 +01:00
## Learning Resources
2023-07-25 23:27:01 +01:00
2023-08-19 13:42:59 +01:00
* [Markdown Guide ](https://www.markdownguide.org/ )
* [Markdown Cheatsheet ](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet )
* [Markdown Tutorial ](https://www.markdowntutorial.com/ )
* [Markdown Reference ](https://commonmark.org/help/ )