MarkdownPaper Open reader

Guide

How to color text in Markdown

Markdown has no way to color text. HTML can, with a style attribute, but GitHub and many other apps remove styles for safety, so colored text usually shows in the default color. To make text stand out, use bold, a callout, or a diff block instead.

You write

<span style="color: red">This text was meant to be red.</span>

You see

This text was meant to be red.

The text above is not red here, because MarkdownPaper removes styles the same way GitHub does.

On this page

Why styles are removed

A Markdown file can come from anyone. If it could use any HTML and CSS, a README could cover the page, fake a login box, or hide text. So GitHub, MarkdownPaper and most other apps allow only a safe set of HTML tags, and style attributes are not on the list.

What works instead

Bold or italic for a word that must not be missed:

You write

The deadline is **Friday at noon**.

You see

The deadline is Friday at noon.

A callout for a whole note or warning. GitHub and MarkdownPaper show these with a label and an icon:

You write

> [!WARNING]
> This deletes every file in the folder.

You see

Warning

This deletes every file in the folder.

Highlight with <mark>, which most apps allow:

You write

Read the <mark>last paragraph</mark> before you sign.

You see

Read the last paragraph before you sign.

A diff block for green and red lines, when showing what changed:

You write

```diff
+ Added: dark mode
- Removed: the old toolbar
```

You see

+ Added: dark mode
- Removed: the old toolbar

Colors in GitHub issues

In GitHub issues, pull requests and discussions, a color code inside backticks, like `#a74820`, shows a small swatch of that color next to it. It shows the color, but does not color the text, and it does not work in README files.

Where colored text does work

Apps that render Markdown without removing HTML styles will show them. That includes some static site generators and editors, but it is not portable: the same file loses its colors on GitHub. If color matters, Markdown is the wrong format for that part, and an exported HTML file or a document app is the better tool.

Questions

How do I make red text in Markdown?

Plain Markdown cannot. <span style="color: red">text</span> works only in apps that keep HTML styles, which GitHub does not.

Can I color text in a GitHub README?

No. GitHub removes the style attribute. Use bold, a callout or a diff block to draw attention instead.

How do I highlight text in Markdown?

Use <mark>text</mark>. See Markdown text formatting for highlight and other styles.

Next