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


当前回答

<!--- ... --> 

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

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

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

其他回答

另请参见由越来越多的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.

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

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

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

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

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

对我来说似乎很好。

如果您正在使用Jekyll或octopress,下面的操作也会起作用。

{% comment %} 
    These commments will not include inside the source.
{% endcomment %}

Liquid标记{%comment%}首先被解析,并在MarkDown处理器到达它之前被删除。访问者在尝试从浏览器查看源代码时将看不到。

此Markdown注释不会在带有Jekyll的GitHub Pages网站上呈现

[whatever]: text

因为Jekyll使用Liquid模板语言来处理模板,所以这个Liquid注释也不会在使用Jekyll的GitHubPages网站上呈现

{% comment %}
This is a long comment string 

Newline

Stuff
{% endcomment %}