Skip to content
FeaturesPricingBlogDownload

← All posts

GitHub Markdown tips: alerts, suggestions and more

GitHub Markdown tips for issues, pull requests and repo files: alerts, suggested changes, code permalinks, diagrams, math, footnotes and dark-mode images.

Diagram card on a light background showing a GitHub note alert, a suggestion block and a Mermaid diagram rendered from Markdown

GitHub renders more than standard Markdown. On top of headings, lists and tables it supports alert blocks such as > [!NOTE] and > [!WARNING], one-click suggested changes in pull request reviews, code permalinks that render as snippets, Mermaid diagrams, math, footnotes and images that switch with dark mode. Most of these work in issues, pull requests, discussions and .md files in a repository; a few work only in conversations, and the tips below say which.

Everything here is based on GitHub's basic writing and formatting syntax documentation and the pages linked from it, checked November 2026.

Which GitHub Markdown features work where?

Use this table to check before you rely on a feature in a README or a docs file.

Feature Repo files Issues and PRs
Alerts (> [!NOTE]) Yes Yes
Collapsed sections (<details>) Yes Yes
Mermaid diagrams Yes Yes
Math ($...$) Yes Yes
Footnotes Yes Yes
Clickable task list checkboxes No Yes
Suggested changes No PR review comments only
Autolinked #123 references No Yes
Color swatches No Yes, and discussions

Wikis are a separate case. GitHub notes, for example, that "Footnotes are not supported in wikis," so preview a wiki page before relying on any of these there.

How do you add a note or warning box on GitHub?

Write a blockquote whose first line is the alert type in brackets. GitHub renders it as a colored box with an icon and a title.

> [!NOTE]
> Useful information that users should know, even when skimming.

> [!TIP]
> Helpful advice for doing things better or more easily.

> [!IMPORTANT]
> Key information users need to know to achieve their goal.

> [!WARNING]
> Urgent information that needs immediate attention.

> [!CAUTION]
> Risks or negative outcomes of certain actions.

GitHub's own guidance is to use alerts only when they are crucial and "limit them to one or two per article," to avoid placing them back to back, and notes that "Alerts cannot be nested within other elements." Elsewhere, the same text shows as an ordinary quote with a literal [!NOTE] line, which still reads fine. The blockquotes page covers the base syntax.

How do you suggest a code change in a pull request review?

In a review comment on a line of the diff, put the replacement text in a fenced block with the language set to suggestion. The author sees your change as a diff and can commit it from the pull request.

This reads better without the double negative:

```suggestion
if (isEnabled) {
```

Select several lines in the diff before commenting to replace a whole range. Suggestions only work in review comments on changed lines, not in issue comments or files.

How do you show a code snippet from the repository?

Open the file on GitHub, click a line number (Shift-click a second one for a range), choose Copy permalink from the line menu, and paste the link on its own line in an issue or pull request comment. GitHub renders it as a snippet of those lines at that commit.

https://github.com/acme/tool/blob/3f2a9c1/src/export.ts#L40-L52

The link pins a commit hash, so the snippet does not change when the file does. The preview appears only in the same repository's issues and pull requests; elsewhere it stays a plain link.

How do references and mentions link automatically?

In issues, pull requests and comments, GitHub turns short references into links:

  • #123 or GH-123 links to issue or pull request 123 in the same repository.
  • acme/tool#123 links to an issue in another repository.
  • A commit SHA, full or the first seven characters, links to the commit.
  • @username or @org/team mentions a person or team and notifies them.

These do not link inside repository files such as CHANGELOG.md, so write full URLs there. Also take care with @ in examples: a bare @name in an issue notifies a real account, so put example handles in backticks.

How do you hide long logs in an issue?

Wrap them in a <details> element with a <summary> line. The section starts collapsed and opens on click.

<details>
<summary>Full error log</summary>

```text
Error: ENOENT: no such file or directory, open 'config.json'
    at Object.openSync (node:fs:603:3)
```

</details>

Leave a blank line after <summary> and before </details> so the Markdown inside renders. More options are on the collapsible sections page.

Can GitHub render diagrams and math?

Yes. A fenced block with the language mermaid renders as a diagram, and GitHub also renders geojson, topojson and stl blocks as maps and 3D models.

```mermaid
flowchart LR
  A[Open PR] --> B{Checks pass?}
  B -- yes --> C[Review]
  B -- no --> D[Fix]
  D --> B
```

For math, write LaTeX between $ signs inline, between $$ on their own lines for a display block, or in a fenced block with the language math. If an expression contains a dollar sign that confuses the parser, the inline form $`...`$ keeps it intact. Diagram syntax is covered on the Mermaid page.

How do you make an image switch with dark mode?

Use the HTML <picture> element with a prefers-color-scheme media query. GitHub serves the matching image for the viewer's theme.

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="docs/logo-dark.png">
  <img alt="Acme Tool logo" src="docs/logo-light.png">
</picture>

The <img> inside is the fallback for light mode and for any renderer that ignores <source>, so give it real alt text.

What smaller tricks save time?

A handful of small features that are easy to miss:

  1. Paste a URL over selected text in a comment box to turn the text into a link.
  2. Show a color. In issues, pull requests and discussions, a value in backticks such as `#0969da`, `rgb(9,105,218)` or `hsl(212,92%,45%)` shows a swatch.
  3. Hide notes from readers with an HTML comment, <!-- reviewer: confirm the default -->. It stays in the source and does not render.
  4. Show keys with <kbd>Ctrl</kbd>+<kbd>C</kbd>.
  5. Clickable checklists. - [ ] Add tests in an issue or pull request description renders a checkbox that anyone who can edit the description can tick.
  6. Escape formatting with a backslash, as in \*literal asterisks\*. GitHub notes this does not apply in issue and pull request titles.
  7. Edit in the browser. Press . on a repository page to open it in the github.dev editor, with a Markdown preview.

How do you check how a file will render?

For comments, use the Preview tab above the text box. For repository files, push to a branch and open the file on GitHub, or use the preview in the github.dev editor. Local Markdown editors show standard syntax faithfully but do not all render GitHub-only features such as alerts, permalinks and autolinked references, so treat GitHub's own preview as the final check for those.

Writing GitHub files in Noteline

Noteline, which we make, edits READMEs, changelogs and docs in a repository as plain .md files. Tables, task lists, fenced code with highlighting and Mermaid diagrams render as you type. GitHub alert syntax is saved exactly as you write it, but it is not drawn as a colored box in the editor, and permalinks and #123 references are GitHub features, so check those in GitHub's preview. A guide to the README itself is in how to write a README.

Start with one note. Keep the file.

Open a folder and write. Every note is a plain .md file, with no account to create.

Try desktop free for 14 days ↓Free on iPhone, iPad and Android →

Desktop: 14-day trial, then $9.99 once. Mobile apps: free. No account.

Keep reading

  • Markdown blockquotes
  • Mermaid diagrams
  • How to keep AI meeting notes as Markdown files you own
  • AI memory files: what your assistant should remember, kept in Markdown
  • An AI research workflow in Markdown: sources, summaries and claims

A Markdown note editor with everything you need

We’re listening

Tell us what you need or what gets in your way. If something isn’t working, write to us any time.

contact@noteline.io→

Product

  • Download
  • Pricing
  • Features
  • Changelog

Learn

  • Markdown syntax
  • Use cases
  • Blog

Compare

  • vs Obsidian
  • vs Notion

Support

  • Help
  • Support
  • Privacy
  • Terms

© 2026 Notelinecontact@noteline.io