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上作到這一點。

相關文章
相關標籤/搜索