如何在 Markdown 注釋一段文字

寫代碼你可以注釋,不需要處理的代碼就 comment out。
寫 Markdown 呢?一篇文章寫出來,總是有點草稿的,每次都忍痛割愛刪掉,可能下次還要再敲一遍。
所以我一般都寫到某個特定的 class 的 div 里,再用 CSS 把它們隱藏。

可惜這種方法既不優雅也不通用。
機智如我如果一下就 bing 到了:syntax - Comments in Markdown - Stack Overflow

你可以用下面這些:

[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.)
[//]: <> (This is also a comment.)
[//]: # (This may be the most platform independent comment)

我決定以后用:

[^_^]:
    commentted-out contents
    should be shift to right by four spaces (`>>`).

親測可用(Pandoc、GitHub、簡書、作業部落)。十分完美,除了這個 warning:

pandoc: Duplicate note reference `^' "source" (line 85, column 1)

如果你想測試一下你的 Markdown 能不能這么用,這是一點測試的文字:

a

[^_^]:
    b

c

d

顯示的 a c d 應當間隔一樣長。如下:

a

c

d


@delogn 的評論:

[^_^]:
    1

[>_<]:
    2

[>_>]:
    3

都可以用啊,不錯不錯!以后吐槽和心情都可以寫在注釋里了!

贊贊贊!

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容