Skip to content
All Markdown syntax

Comments in Markdown

Text

Markdown syntax

Needs HTML
<!-- This is a comment -->

HTML comment. Hidden on GitHub and in most renderers. Can span lines.

Markdown has no comment syntax of its own. The HTML comment is the common choice; the link-reference trick works even where HTML is stripped. Either way the text stays in the source file, so never put secrets in a comment.

All ways to write it

  • <!-- This is a comment -->
    HTML comment. Hidden on GitHub and in most renderers. Can span lines.Needs HTML
  • [//]: # (This is a comment)
    An unused link reference, so nothing renders. Needs a blank line before it.Works everywhere

Example

You type

Shown paragraph.

<!-- TODO: add the screenshot from the 2.0 release -->

[//]: # (Reviewer note: check the numbers in this table)

Another shown paragraph.

You get

Shown paragraph.

Another shown paragraph.

Both comments are in the source, and neither appears in the preview.

Questions

Are Markdown comments private?

No. Anyone who opens the raw file sees them, and an HTML comment is also sent in the page source. Use them for notes, not secrets.

Why does my [//]: # comment show up?

It needs a blank line above it and must start at the beginning of the line. Inside a paragraph it is plain text.

Comments in Confluence

Confluence pages have inline comments for review notes, which readers can resolve. Inside a Markdown Macro+ macro, the Markdown source stays editable, so check the live preview to confirm a comment is hidden before you save.

Related syntax

Also in Text

See all Markdown syntax