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


当前回答

以下方法非常有效

<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

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

kramdown基于Ruby的markdown引擎,这是Jekyll的默认引擎,因此GitHubPages通过其扩展语法内置了注释支持:

{::comment}
This text is completely ignored by kramdown - a comment in the text.
{:/comment}

Do you see {::comment}this text{:/comment}?
{::comment}some other comment{:/}

这样做的好处是允许在线评论,但缺点是不能移植到其他Markdown引擎。

将注释放在非eval、非echo R块中怎么样?即。,

```{r echo=FALSE, eval=FALSE}
All the comments!
```

对我来说似乎很好。

以下方法非常有效

<empty line>
[whatever comment text]::

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

<empty line>
[whatever]::
[whatever]:whatever
[whatever]: :
[whatever]: whatever
[whatever]: # whatever with spaces

你可以试试

[](
Your comments go here however you cannot leave
// a blank line so fill blank lines with
//
Something
)