如何在Markdown中编写注释,即HTML输出中未呈现的文本?我在Markdown项目中没有发现任何东西。


当前回答

您可以这样做(YAML块):

~~~
# This is a
# multiline
# comment
...

我只尝试了乳胶输出,请为其他人确认。

其他回答

另一种方法是将注释放在样式化的HTML标记中。这样,您可以根据需要切换它们的可见性。例如,在CSS样式表中定义注释类。

.注释{display:none;}

然后,以下增强的MARKDOWN

我们不支持评论

在浏览器中显示如下

我们支持评论

我使用标准的HTML标记,例如

<!---
your comment goes here
and here
-->

注意三点划线。其优点是,在生成TeX或HTML输出时,它可以与pandoc一起工作。有关更多信息,请访问pandoc讨论组。

另请参见由越来越多的Markdown工具支持的Critic Markup。

http://criticmarkup.com/

Comment {>> <<}

Lorem ipsum dolor sit amet.{>>This is a comment<<}

Highlight+Comment {== ==}{>> <<}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. {==Vestibulum at orci magna. Phasellus augue justo, sodales eu pulvinar ac, vulputate eget nulla.==}{>>confusing<<} Mauris massa sem, tempor sed cursus et, semper tincidunt lacus.

您可以这样做(YAML块):

~~~
# This is a
# multiline
# comment
...

我只尝试了乳胶输出,请为其他人确认。

披露:我写了这个插件。

由于问题没有指定特定的markdown实现,我想提到python markdown的Comments插件,它实现了上述相同的pandoc注释样式。