Markdown

Hugo supports Markdown syntax for formatting text, creating lists, and more. This page will show you some of the most common Markdown syntax examples.

Markdown Examples

Styling Text

StyleSyntaxExampleOutput
Bold**bold text****bold text**bold text
Italic*italicized text**italicized text*italicized text
Strikethrough~~strikethrough text~~~~strikethrough text~~strikethrough text
Subscript<sub></sub>This is a <sub>subscript</sub> textThis is a subscript text
Superscript<sup></sup>This is a <sup>superscript</sup> textThis is a superscript text

Blockquotes

Blockquote with attribution

Don’t communicate by sharing memory, share memory by communicating.
Rob Pike1

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.

Alerts

Alerts are a Markdown extension based on the blockquote syntax that you can use to emphasize critical information. GitHub-style alerts are supported. Please make sure you are using the latest version of Hextra and Hugo 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
> [!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.

Tables

Tables aren’t part of the core Markdown spec, but Hugo supports them out-of-the-box.

NameAge
Bob27
Alice23
Markdown
|   Name | Age  |
|--------|------|
|    Bob | 27   |
|  Alice | 23   |

Inline Markdown within tables

ItalicsBoldCode
italicsboldcode
Markdown
| Italics   | Bold     | Code   |
| --------  | -------- | ------ |
| *italics* | **bold** | `code` |

Code Blocks

Lists

Ordered List

  1. First item
  2. Second item
  3. Third item
Markdown
1. First item
2. Second item
3. Third item

Unordered List

  • List item
  • Another item
  • And another item
Markdown
* List item
* Another item
* And another item

Nested list

  • Fruit
    • Apple
    • Orange
    • Banana
  • Dairy
    • Milk
    • Cheese
Markdown
* Fruit
  * Apple
  * Orange
  * Banana
* Dairy
  * Milk
  * Cheese

Images

landscape

Markdown
![landscape](https://picsum.photos/800/600)

With caption:

landscape
Unsplash Landscape

Markdown
![landscape](https://picsum.photos/800/600 "Unsplash Landscape")

Configuration

Hugo uses Goldmark for Markdown parsing. Markdown rendering can be configured in hugo.yaml under markup.goldmark. Below is the default configuration for Hextra:

hugo.yaml
markup:
  goldmark:
    renderer:
      unsafe: true
  highlight:
    noClasses: false

For more configuration options, see Hugo documentation on Configure Markup.

Learning Resources


  1. The above quote is excerpted from Rob Pike’s talk during Gopherfest, November 18, 2015. ↩︎

Last updated on