FrankWiles.com

TIL: Today I Learned

Github Markdown Alerts

I was working on some rust code and ran across the README for cargo shear

Screenshot of cargo shear README with blue 'note' alert

I’m a huge fan of these types of alerts in docs, it’s one of the things I miss from systems like Sphinx and something I tend to add (or at least strive to add) to any markdown docs using something like MDX.

So I immediately started to investigate how they accomplished it. I wrongly fully assumed it was an image or some injected CSS magic.

Lucky for all of us I was wrong, it’s fully supported by Github!

If you use these special bits of Github flavored Markdown:

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.

It will render like this!

Screenshot of example README with alert examples

I for one am super happy I found this and will likely overuse it until my co-workers are a bit annoyed.