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


当前回答

Vim Instant Markdown用户需要使用

<!---
First comment line...
//
_NO_BLANK_LINES_ARE_ALLOWED_
//
_and_try_to_avoid_double_minuses_like_this_: --
//
last comment line.
-->

其他回答

您可以这样做(YAML块):

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

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

以下方法非常有效

<empty line>
[whatever comment text]::

该方法利用语法通过引用创建链接由于使用[1]创建了链接引用:http://example.org不会呈现,同样,以下任何内容也不会呈现

<empty line>
[whatever]::
[whatever]:whatever
[whatever]: :
[whatever]: whatever
[whatever]: # whatever with spaces
<!--- ... --> 

不适用于PandocMarkdown(Pandoc1.12.2.1)。注释仍显示在html中。以下措施确实奏效:

Blank line
[^Comment]:  Text that will not appear in html source
Blank line

然后使用+脚注扩展名。它本质上是一个从未被引用的脚注。

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

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

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

Vim Instant Markdown用户需要使用

<!---
First comment line...
//
_NO_BLANK_LINES_ARE_ALLOWED_
//
_and_try_to_avoid_double_minuses_like_this_: --
//
last comment line.
-->