Markdown 注释工具
学习如何在 Markdown 中添加注释。为 GitHub、文档和其他平台创建隐藏注释,使用 HTML 和引用样式方法。
Markdown Comment Generator - Add Comments in Markdown
Create hidden comments in markdown for GitHub, documentation, and other platforms. Use this free tool to generate properly formatted markdown comments with different syntax methods.
Comment Settings
Markdown Comment Output
How to Add Comments in Markdown - Syntax Guide
Comments in markdown allow you to include notes, reminders, or explanations in your document without them appearing in the rendered output. This is useful for documentation, collaboration, and organizing your content.
HTML Comments in Markdown (Most Compatible)
The most widely supported method for adding comments in markdown is using HTML comment syntax. This works in GitHub, GitLab, and most markdown processors:
<!-- This is a comment that won't appear in the rendered markdown -->
<!--
Multi-line comments
are also supported
like this
-->
This text will be visible in the rendered output.
HTML comments are the most reliable way to add comments in markdown and work across virtually all platforms, including GitHub comments, documentation sites, and markdown editors.
Reference-Style Comments in Markdown
This less-known method uses reference-style link syntax that doesn't get displayed:
[//]: # (This is a comment in markdown using reference syntax)
This text will be visible.
[//]: # "Double quotes also work for comments"
[//]: # 'As do single quotes'
This method works well in GitHub markdown and many other platforms. It's less obvious than HTML comments in the source, but still effective for hiding notes in your documents.
Empty Link Comments in Markdown
Another variation uses an empty link reference:
[comment]: <> (This is another way to write comments in markdown)
Visible content appears here.
[//]: <> (Alternative version)
[_]: <> (Underscore version)
This method has moderate compatibility across markdown platforms but isn't as widely supported as HTML comments.
Extension-Specific Comments
Some markdown applications support their own special comment syntax:
%% This is an Obsidian-style comment %%
%%
Multi-line Obsidian
comments work like this
%%
The double percent syntax is specific to Obsidian and won't work in most other markdown processors, including GitHub. Use this only if you're working exclusively in Obsidian.
Practical Comment Examples in Markdown
1. Document organization with markdown comments
# Project Documentation
<!--
TODO:
- Add installation instructions
- Include screenshots
- Link to API docs
-->
## Introduction
This project provides a simple interface for...
2. Collaborative editing using comments in markdown
# Team Report
<!-- @Sarah: Please verify these numbers before publishing -->
## Financial Summary
Revenue increased by 15% compared to Q2...
<!-- @Jason: We need more details in this section -->
3. Temporarily hiding content with markdown comments
# Current Team Members
- Jane Smith, Developer
- John Doe, Designer
<!--
# Former Team Members
- Alex Johnson (2018-2021)
- Maria Garcia (2019-2022)
-->
## Contact Information
需要了解更多Markdown语法细节?我们的全面速查表涵盖了所有元素的详细说明:
探索完整Markdown语法Frequently Asked Questions About Markdown Comments
What are comments in markdown?
Comments in markdown are sections of text that are included in the source document but don't appear in the rendered output. They're useful for leaving notes, explanations, or reminders for yourself or other contributors without affecting the final displayed content. Markdown itself doesn't have a native comment syntax, but several methods (like HTML comments) are widely used.
How do I add comments in GitHub markdown?
To add comments in GitHub markdown, the most reliable method is to use HTML comment syntax: <!-- Your comment here -->
. This works in GitHub issues, pull requests, README files, and other markdown documents. GitHub also supports reference-style comments like [//]: # (Your comment here)
, which are less visible in the source.
Can I create multi-line comments in markdown?
Yes, you can create multi-line comments in markdown using HTML comment syntax. Simply place your comment between the opening and closing tags, like this:
<!--
This is a multi-line comment
that spans several lines
in the markdown document
-->
This works well in most markdown processors, including GitHub, GitLab, and standard markdown editors.
Are markdown comments visible in the source code?
Yes, all markdown comments remain visible in the source code or when editing the raw markdown file. They're only hidden when the markdown is rendered to HTML for display. This means anyone who can access your raw markdown file will be able to see the comments. If you need to hide sensitive information, don't put it in comments.
Which comment method has the best compatibility?
HTML comments (<!-- comment -->
) have the best compatibility across different markdown processors and platforms. They work in GitHub, GitLab, Reddit, Stack Overflow, most markdown editors, and static site generators. If you want your comments to work everywhere, HTML comments are the safest choice. Reference-style comments have good but not universal support, while extension-specific comments like Obsidian's %% comment %%
only work in their specific applications.
Can I use markdown comments inside code blocks?
No, markdown syntax (including comment syntax) is not processed inside code blocks. If you place an HTML comment or any other markdown comment syntax inside a code block (wrapped in backticks or indented), it will be displayed literally as text rather than being treated as a comment. Code blocks are meant to display code or text exactly as written. If you need to comment code within a code block, use the comment syntax of the language being displayed (e.g., // for JavaScript, # for Python).
Other Useful Tools
实时将 Markdown 文本转换为漂亮的 HTML。支持代码高亮、表格等功能。
完整的 Markdown 语法参考指南,包含格式化、表格、代码块等示例。
使用我们的可视化编辑器轻松创建 markdown 表格。为 GitHub markdown、文档等生成表格。自定义对齐方式,导入/导出数据,并提供实时预览。
轻松创建 Markdown 超链接。为网站、文档或 Discord 等平台生成标准、自动及引用链接的正确语法。
为 GitHub、Discord 和其他平台创建 markdown 删除线文本。学习不同的 markdown 删除线方法,使用双波浪线格式化您的文本。
学习如何在 markdown 文档中添加新行。尝试不同的换行方法,适用于 GitHub、Discord 和其他平台,使用尾随空格、反斜杠和 HTML br 标签。
即时将 HTML 表格转换为 Markdown 格式。粘贴 HTML 代码并获取格式正确的 Markdown 表格。
统计 Markdown 文本的字数、字符数并估算阅读时间。智能忽略代码块。
清理 AI 输出中的 Markdown 语法。将格式化的 Markdown 转换为简单的 TXT 内容,同时保留结构。
从 Markdown 中提取并转换数学公式为 LaTeX 格式,用于学术论文和科学文档。