Skip to content
Back to Journal
GuideMay 5, 2026·2 min read

How to Add a Comment in Markdown

Hide text in markdown that won't appear in the rendered output. HTML comment syntax and platform support.

The quick answer: Use HTML comment syntax — — to hide text from the rendered output.

Syntax

Text inside is completely hidden in the final output. It's still visible in the source markdown file.

Multi-Line Comments

Everything between is hidden, regardless of how many lines it spans.

Use Cases

Comments are useful for:

  • Notes to yourself — "TODO: add example here"
  • Disabling content — temporarily hide a section without deleting it
  • Collaboration notes — leave instructions for other editors
  • Draft sections — keep unfinished content in the file without publishing it

Platform Support

HTML comments work on GitHub, GitLab, Obsidian, and most markdown renderers that allow HTML. They also work in PDF exports from MarkdownTools.

Discord and Slack do not render HTML — comments will appear as literal text including the HTML comment is the universally accepted workaround. Some editors (like Obsidian) accept %% as a comment delimiter in their own extended syntax.


Full reference: Markdown Comments.

MT

MarkdownTools Team

May 5, 2026

Try it free

Make your AI output beautiful

Paste markdown from ChatGPT or Claude. Pick a theme. Export as PDF or HTML in seconds.

Open App — It's Free