Color

- 87 words - 1 minute

Using color in markdown

Enable rendering HTML in the config.toml file:

[markup]
  [markup.goldmark.renderer]
    unsafe = true

Add <span> HTML tags with a style attribute around the desired text in the markdown .md files. Markdown can be used inside the HTML tag.

Text color

Use color:

- <span style="color:red">some text in **red** color</span>
- <span style="color:green">*other* text in **green** color</span>

The result:

  • some text in red color
  • other text in green color

Background color

Use background-color:

- <span style="background-color:pink">text with background color</span>

The result:

  • text with background color