How to make a styled Markdown admonition box in a GitHub Gist?

Solution 1:

Use emoji to call the user attention

> :warning: **If you are using mobile browser**: Be very careful here!

Github example

Here is list of others emojis (just copy paste):

https://gist.github.com/roachhd/1f029bd4b50b8a524f3c

Or you can also use GitHub markdown:

https://gist.github.com/rxaviers/7360908

Solution 2:

You can make a box with some bold text in by using tables, like so:

| WARNING: be careful to baz the quux before initializing the retro encabulator! |
| --- |

This renders like this:

An image of a single-cell table, containing the text "WARNING: be careful to baz the quux before initializing the retro encabulator!"

It's a bit of an abuse of syntax, but it works. There's unfortunately no way to apply other formatting like colours, as Chris noted.

Solution 3:

Most repositories I've been a part of use the blockquote to simulate an admonition:

> **WARNING**: Be careful, or else!

Below is an example of it being used at the top, as well as inside, a section:

enter image description here

Solution 4:

In standard markdown using the UTF8 symbol this looks pretty good:

> **⚠ WARNING: Aliens are coming.**  
> A description of the colour, smell and dangerous behaviour of the aliens.

Which Renders like this:

⚠ WARNING: Aliens are coming.
A description of the colour, smell and dangerous behaviour of the aliens.

Solution 5:

GitHub Flavored Markdown doesn't have anything like that and its HTML, generated or inline, is aggressively sanitized.

You'll likely have to make do with the basics, e.g.

_**Warning:** Be very careful here._

or

### Warning

Be very careful here