Markdown中的评论

将注释存储在markdown文件中的语法是什么,例如文件顶部的CVS $ Id $注释? 降价项目我什么都没发现。 html


#1楼

披露:我写了插件。 python

因为问题没有指定特定的降价实现,我想说起python-markdownComments插件 ,它实现了上面提到的相同的pandoc评论风格。 浏览器


#2楼

我相信全部先前提出的解决方案(除了须要特定实现的解决方案以外)致使注释包含在输出HTML中,即便它们未被显示。 markdown

若是你想要一个严格意义上的评论(转换文档的读者不该该看到它,即便使用“查看源”)你能够(ab)使用连接标签(用于参考样式连接)可用于Markdown核心规范: less

http://daringfireball.net/projects/markdown/syntax#link ide

那是: 工具

[comment]: <> (This is a comment, it will not be included)
[comment]: <> (in  the output file unless you use it in)
[comment]: <> (a reference style link.)

或者你能够走得更远: ui

[//]: <> (This is also a comment.)

为了提升平台兼容性(并保存一次击键),还可使用# (这是一个合法的超连接目标)而不是<>spa

[//]: # (This may be the most platform independent comment)

为了得到最大的可移植性,在此类注释以前和以后插入一个空行很是重要,由于当定义与常规文本相比时,某些Markdown解析器没法正常工做。 Babelmark最近的研究代表,先后的空白线都很重要。 若是以前没有空行,一些解析器将输出注释,而且若是以后没有空行,则一些解析器将排除如下行。 .net

一般,这种方法应该适用于大多数Markdown解析器,由于它是核心规范的一部分。 (即便定义了多个连接时的行为,或者定义了连接但从未使用过期,也未严格指定)。


#3楼

另请参阅Critic Markup,由愈来愈多的Markdown工具提供支持。

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.

#4楼

若是您正在使用Jekyll或octopress,也可使用。

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

首先解析Liquid标签{% comment %} ,而后在MarkDown处理器进入以前将其删除。 访问者在尝试从浏览器中查看源时将看不到。


#5楼

这适用于GitHub:

[](Comment text goes here)

生成的HTML看起来像:

<a href="Comment%20text%20goes%20here"></a>

这基本上是一个空连接。 显然你能够在渲染文本的源代码中读到它,但不管如何你均可以在GitHub上作到这一点。

相关文章
相关标签/搜索