Skip to content
All referenceStructure

Markdown Comment

Learn how to add comments in markdown that won't render in the output. Syntax for HTML comments, platform support, and use cases.

What is markdown comment?

Markdown doesn't have its own comment syntax. To add hidden comments that won't appear in the rendered output, use HTML comments (<!-- -->). These are useful for notes to collaborators, TODOs, and temporary content.

Syntax

HTML comment

HTML comments are hidden in the rendered output. Most markdown parsers pass them through.

Result

Multi-line comment

Comments can span multiple lines. Everything between <!-- and --> is hidden.

Result

Platform support

PlatformSupportedNotes
GitHubYesHidden in rendered markdown
GitLabYes
DiscordNoShows raw text — no comment support
SlackNoShows raw text
RedditNoNo comment support
Stack OverflowYes
NotionNoUse /comment for Notion-native comments
ObsidianYesAlso supports %%comment%% syntax

Common mistakes

Wrong
// This is a comment
Right
<!-- This is a comment -->

Markdown doesn't support // or # comments like programming languages. Use HTML comment syntax.

Wrong
<!- Comment ->
Right
<!-- Comment -->

HTML comments require exactly <!-- to open and --> to close. Missing dashes will break the syntax.

Tips for comment

1Use for TODOs

Comments are perfect for leaving notes: <!-- TODO: update stats --> won't show in the rendered document.

2Temporarily hide content

Wrap sections in <!-- --> to hide them without deleting. Useful for drafts and content you might restore later.

3Comments aren't private

HTML comments are hidden in rendered output but visible in page source. Don't put sensitive info in comments.

Frequently asked questions

Everything you need to know.

1

How do I add a comment in markdown?

Use HTML comment syntax: <!-- your comment here -->. The comment won't appear in the rendered output.

Related elements

Try it in the editor

Paste your markdown and see comment rendered instantly with professional themes.