
代码可以注释,不要的代码可以先 comment out 。 写 Markdown 呢?一篇文章写出来,总是有点草稿的,每次都忍痛割爱删掉,可能下次还要再敲一遍。 所以我一般都写到某个特定的 class 的 div 里,再用 CSS 把它们隐藏。
可惜这种方法既不优雅也不通用。
刚搜了一下: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 (vim :`>>`). 亲测可用( Pandoc 、 GitHub 、简书、作业部落)。
如果你想测试一下你的 Markdown 能不能这么用,这是一点测试的文字:
a [^_^]: b c d 显示的 a c d 应当间隔一样长。
不是每种 Markdown 都能注释多行文字,测试代码:
a [^_^]: b c d 效果:
a
c d
v2ex 似乎无力了……(在我自己用的 pandoc 下,只有 a 和 d 这两行。)
我还试了 Pandoc、GitHub、简书和作业部落对此的支持,放在了这里 多行代码注释-简书 - 简书。
1 zwh8800 2016-12-21 17:31:42 +08:00 厉害了,这个评论怎么算结束?空行吗? |
2 zhidian OP |
3 yoke123 2016-12-21 17:44:28 +08:00 好像不能多行注释 必须另起一行 |
4 zhidian OP Pandoc 可以( O ), GitHub 不可以( X ),简书不可以( X ),作业部落可以( O )。其他的,大家自己试吧 ==。不能注释多行确实很麻烦。 |
5 zhidian OP 测试:[多行代码注释-简书 /作业部落, etc]( http://www.jianshucom/p/f46bd33aafa4 ) |
6 yzhen123 2016-12-21 18:17:47 +08:00 直接使用 html 注释兼容大部分 markdown 解析器 <!-- 注释 --> |
7 zhujinliang 2016-12-21 18:50:34 +08:00 via iPhone 以后要用注释开车么? |
10 zhidian OP @sox 我不知道为什么我忘了可以用 html 的注释……现在在忏悔。 或许是最近都是 markdown 转到 docx (用 pandoc ),直觉上 html 那种注释没用。不过刚才发现……也可以用。 所以我也不知道为啥自己饶了这么一个圈子。 |
12 gaocegege 2016-12-21 22:22:35 +08:00 =.= 萌 |
13 xpol 2016-12-21 22:26:28 +08:00 <!-- This is the right way to write markdown comment --> |
14 ioiioi 2016-12-21 22:33:13 +08:00 看到这里我又忍不住推荐 asciidoc ,这货的功能比 markdown 强大多了。注释、表格、图像、 callout 、复杂列表等等都是原生支持的。而且很容易扩展。 |
15 zhidian OP @ioiioi 看到了“ include::chapter1.txt[]”,似乎不错。现在我 Markdown 引入别的文件都是先用脚本过一遍拼起来……正纠结自己应该用 org-mode 还是 asciidoc 。 |
16 zhidian OP 看了下 [7. 附录:轻量级标记语言 GotGitHub]( http://www.worldhello.net/gotgithub/appendix/markups.html ) 决定上 org-mode 了。 |
17 SilentDepth 2016-12-22 10:14:08 +08:00 这个好,还可以根据写注释时的心情决定标记以微笑脸还是严肃脸还是纠结脸,「颜文」并茂 |
18 delogn 2016-12-22 16:17:59 +08:00 [^_^]: 1 [>_<]: 2 [>_>]: 3 都可以用啊,不错不错!以后吐槽和心情都可以写在注释里了! |
19 justyy 2016-12-22 22:00:05 +08:00 |