The short answer: use an HTML comment for portable notes

Write `<!--` before the note and `-->` after it. A compatible renderer treats that range as raw HTML comment content, so it does not appear as visible prose in the rendered document.

This is HTML syntax embedded in Markdown, not a dedicated Markdown comment feature. That distinction matters because some publishing systems disable or sanitize raw HTML.

Markdown source
# Release notes

<!-- Check the version number before publishing. -->

Version 2.4 is available.
Rendered result
Release notes

Version 2.4 is available.
NeedUseWhat to expect
A note hidden from the rendered page<!-- note -->Broad compatibility where raw HTML comments are allowed
A private secretDo not put it in MarkdownAnyone with the source may read it
An Obsidian-only editing note%% note %%Visible only to tools that support Obsidian comments
A literal example of comment syntaxA fenced code blockThe markers are shown as code

Single-line and multiline HTML comments

A short comment can stay on one line. A longer editorial note can span several lines as long as the opening and closing markers are present.

Keep the markers easy to spot. A missing `-->` can cause a larger part of the document to be treated as raw HTML or hidden unexpectedly, depending on the renderer.

  • Use a complete opening and closing marker.
  • Do not rely on comments to disable executable code in another language.
  • Preview the final document after changing a multiline comment.
Two valid forms
<!-- Replace this screenshot after launch. -->

<!--
Reviewer: confirm the figures in the table.
Remove this note before publishing.
-->
Rendered result
Neither note appears as visible page content in a compatible renderer.

Hidden from the page does not mean private

A Markdown comment normally stays in the `.md` file. A reader can open the raw file, use a repository's source view, inspect an exported file, or retrieve the original through version history.

Comments are appropriate for harmless editorial context: a fact to verify, a section waiting for review, or a reminder to replace an image. They are not an access-control mechanism.

Safe editing noteUnsafe content
Confirm this date before releasePassword or API key
Replace the draft diagramPrivate customer information
Reviewer: check this calculationUnannounced financial result
Keep this heading for the next revisionAnything that must be deleted, not merely hidden

How comments behave on GitHub

GitHub documents HTML comments as the way to hide content from rendered Markdown. The hidden text still exists in the repository file, and GitHub lets readers switch from the rendered view to the source.

Use comments in README files for contributor reminders only when it is acceptable for every repository reader to see them. In a public repository, assume the raw comment is public.

README source
## Installation

<!-- Keep this command synchronized with package.json. -->

```sh
npm install
```
GitHub rendering
The reminder is omitted from the rendered README; it remains in the README.md source.

Obsidian comments are useful but not portable

Obsidian supports `%% comment %%` for inline or block comments. Obsidian hides them outside Editing view, which makes the syntax convenient for personal notes and drafting inside a vault.

The `%%` form is an Obsidian extension. Another Markdown renderer may show the percent signs and the note as ordinary text. Use HTML comments instead when the same file must move between GitHub, a CMS, a static-site generator, and multiple editors.

Obsidian-only source
The proposal is ready. %%Ask Sam to check the budget.%%

%%
This whole block is an editing note.
%%
Compatibility warning
Obsidian hides these comments in Reading view; a generic renderer may display them.

Comment markers inside code are examples, not comments

Inline code and fenced code blocks preserve literal characters. Put `<!-- note -->` inside a code block when you want to teach the syntax or show an HTML file; do not expect the Markdown renderer to remove it.

The language inside a fenced block controls highlighting, not whether Markdown comment rules run inside that block.

Markdown source
```html
<!-- This marker is displayed as code. -->
<p>Example</p>
```
Rendered result
A visible HTML code block containing the comment marker and paragraph tag.

Why a comment may appear or disappear in another renderer

CommonMark defines HTML comments as raw HTML, but a product can still disable raw HTML or sanitize the generated HTML for security. Some systems preserve the comment in generated source; others remove it during conversion or publishing.

A local preview proves only how that preview behaves. Before relying on a comment, test the file in the actual destination: the repository, documentation generator, CMS, note app, or export format that readers will use.

Observed resultLikely reasonNext check
Comment hidden in previewRenderer accepts HTML commentsInspect the raw Markdown source
Markers appear as textRaw HTML is disabled or escapedCheck the destination's Markdown settings
Comment missing from exported HTMLSanitizer or converter removed itInspect both source and exported artifact
Content after a comment disappearsClosing marker may be missingValidate `<!--` and `-->` pairs

Choose comments according to where the file will live

Portability matters more than convenience when several tools share the same Markdown file. HTML comments are the safer default for a repository or publishing workflow that accepts raw HTML. Platform-specific markers are reasonable when the file is deliberately tied to one application.

  1. Name the final rendererDecide whether the document will live on GitHub, in Obsidian, in a CMS, or in another publishing system.
  2. Use the narrowest safe noteKeep comments short, non-sensitive, and directly related to editing the surrounding content.
  3. Test source and outputCheck the rendered view, raw source, downloaded file, and version history before publishing.
  4. Delete resolved commentsRemove notes that no longer help the next editor instead of leaving permanent clutter.
Compare Markdown source and previewUse a harmless test comment before publishing to the real destination

The standards behind the behavior

CommonMark specifies HTML comments within raw HTML blocks and inline raw HTML. GitHub and Obsidian then document the behavior of their own renderers and extensions. These references are more reliable than assuming every app implements the same dialect.

Frequently asked questions

Markdown syntax FAQs

What is the syntax for a comment in Markdown?

Markdown has no universal Markdown-only comment marker. Where raw HTML is supported, use `<!-- comment -->` to hide a note from rendered output.

Are Markdown comments private?

No. A comment may be hidden from the rendered page but remain readable in the `.md` source, repository history, downloaded file, or generated artifact. Never place secrets or personal data in it.

Do HTML comments work on GitHub?

Yes. GitHub documents HTML comments for hiding content from rendered Markdown. The text remains in the repository source and should be treated as public in a public repository.

What does `%% comment %%` mean in Markdown?

It is Obsidian-specific comment syntax, not portable core Markdown. Obsidian hides it outside Editing view, while another renderer may display the markers and text.

Can a Markdown comment span several lines?

Yes. An HTML comment can span several lines between `<!--` and `-->`. Preview the document afterward because a missing closing marker can hide or alter more content than intended.

Why is my Markdown comment visible?

The destination may disable raw HTML, escape it as text, or use a different dialect. Confirm the syntax is outside a code block and test it in the final renderer.

Do comment markers work inside a fenced code block?

They remain literal code inside the fence. This is useful for examples, but the marker is not processed as a Markdown or HTML comment there.

Should resolved editing notes stay in the file?

Usually no. Remove a comment after it has served its purpose unless it gives future editors durable, non-sensitive context.