Since Markdown does not have its own comment syntax, the standard way to add comments is by using HTML comments.
The basic syntax is:
<!-- Your comment goes here -->
Anything written between <!-- and --> is treated as a comment.
When the Markdown document is rendered, the comment is hidden from the visible page.
For example:
<!-- This section needs more examples -->
The comment stays in the source file but does not appear in the rendered output.
This is the most widely supported way to add comments in Markdown.
Single-Line Comments
Most comments are only one line long.
Example:
<!-- Review this section before publishing -->
Single-line comments are perfect for:
- Quick reminders
- TODO items
- Review notes
- Small editing instructions
They keep the Markdown file organized without interrupting the visible content.
Multi-Line Comments
Comments can also span multiple lines.
Example:
<!--
Update this section after the next release.
Add more screenshots.
Check all download links.
-->
Multi-line comments are useful for:
- Project planning
- Writing detailed notes
- Explaining future improvements
- Leaving instructions for other writers
Everything inside the comment remains hidden in the rendered document.
Comments Between Sections
A common practice is placing comments between major sections of a document.
Example:
# Installation
Installation instructions go here.
<!-- Add Linux installation steps later -->
# Configuration
Configuration instructions go here.
Output
Rendered Output
Installation
Installation instructions go here.
Configuration
Configuration instructions go here.
Readers only see the headings and content. The editing note stays hidden inside the Markdown source.
Comments Around Images
Comments are often used to remind writers to replace or update images.
Example:
<!-- Replace this screenshot after updating the dashboard -->

This helps documentation teams keep track of outdated screenshots.
Deep dive: Read the complete Markdown Images guide for syntax, URLs, alt text, and GitHub paths.
Comments Around Code Examples
You can also place comments before code blocks.
Example:
<!-- Verify this command before the next release -->
```bash
npm install
```
The code block appears normally, while the comment stays hidden.
This is helpful when commands may change in future versions.
Deep dive: Read the complete Markdown Code Blocks guide for fenced blocks, syntax highlighting, and GitHub behavior.
Comments in GitHub README, Technical Documentation, and Tutorials
Comments in GitHub README Files
HTML comments work well in GitHub README files.
For example:
Output
Rendered Output
My Project
Welcome to the project documentation.
GitHub renders the README without showing the comment. This allows repository maintainers to leave notes without exposing them to visitors.
Another example:
Many open-source projects use comments like this to manage future improvements.
Comments in Technical Documentation
Documentation teams often use comments during the writing process.
Example:
Output
Rendered Output
Authentication
Use your API key to authenticate requests.
The published documentation stays clean while editors can still see the reminder.
Comments in Markdown Tutorials
When writing tutorials, comments can store editing notes without distracting readers.
Example:
This is especially useful for large documentation websites where pages are updated regularly.
For GitHub-specific syntax extensions, see GitHub Flavored Markdown.