Skip to content
FeaturesPricingBlogDownload
Home / Markdown syntax / Comments in Markdown

Comments in Markdown

To write a comment in Markdown that does not appear in the rendered output, wrap it in an HTML comment: <!-- like this -->. Markdown has no comment syntax of its own, but CommonMark passes HTML comments through, and browsers never display them. GitHub documents this as the way to hide content from rendered Markdown.

Visible paragraph.

<!-- TODO: add the screenshot before publishing -->

Another visible paragraph.

What are the ways to comment in Markdown?

Method Syntax Notes
HTML comment <!-- text --> Works inline and across lines
Link reference trick [//]: # (text) Pure Markdown, on its own line after a blank line
Obsidian comment %% text %% Obsidian only; other apps show it as text

How do HTML comments work?

An HTML comment starts with <!-- and ends with -->. On its own line, it can span several lines, blank lines included, and everything up to the closing --> is hidden:

<!--
Draft section, not ready yet.

## Pricing
Numbers still to confirm.
-->

Markdown inside a comment is not rendered, so headings and links in it stay hidden. A comment can also sit inside a paragraph, as in Ship on Friday <!-- or Monday? --> after review., but there it cannot contain a blank line, because the blank line ends the paragraph.

What is the [//]: # comment trick?

It is a link reference definition that nothing links to. CommonMark never displays link definitions, so the text in parentheses stays hidden even where HTML is removed:

Paragraph above.

[//]: # (This line does not appear in the output.)

Paragraph below.

It has limits. It must start its own line, a blank line must come before it, and the comment text cannot contain parentheses unless they are escaped with a backslash. Use it when a renderer strips HTML comments or shows them as text.

Where do comments stay hidden?

App or spec <!-- --> [//]: # %% %%
CommonMark Hidden in a browser Hidden Shown as text
GitHub Hidden Hidden Shown as text
VS Code preview Hidden Hidden Shown as text
Obsidian Hidden Hidden Hidden
Noteline export Left out Left out Shown as text

Are Markdown comments private?

No. A comment is hidden from the rendered view, not from anyone with the file. Readers of the raw .md see it, and a renderer that passes HTML through leaves <!-- --> comments in the page source, where anyone can read them with View Source. Keep passwords, private notes and internal remarks out of files you share.

What else are comments used for?

  • Separating two lists. Two lists in a row merge into one. An empty comment <!-- --> on its own line between them keeps them apart, as the CommonMark spec suggests. See lists.
  • Notes to co-authors in a shared README or docs file.
  • Markers for tools, such as <!-- toc -->, that some generators replace with a table of contents.
  • Turning off a section without deleting it.

Comments in Noteline

Noteline's editor shows comments as typed, so your notes to yourself stay visible while you write. HTML export, printing and the desktop app's Word and PDF export leave out both <!-- --> comments and [//]: # lines. Obsidian's %% %% has no special meaning in Noteline and exports as normal text.

Common questions

Can I put --> inside a comment?

No. The first --> closes the comment, and the rest shows as text. Rephrase the comment or add a space, as in -- >.

Do comments work in GitHub issues and pull requests?

Yes. GitHub hides <!-- --> comments there too, which is why issue templates use them for instructions that disappear once the issue is posted.

Is there a keyboard shortcut for comments?

Some editors toggle <!-- --> around the selection with Cmd+/ or Ctrl+/, VS Code among them. Others have no shortcut, and you type the markers.

Noteline

Download Noteline↓See pricing→

Related

  • HTML in Markdown
  • Markdown lists
  • Markdown links
  • Markdown headings
  • How to write a README: structure, template and GitHub tips
  • Markdown syntax

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