这篇笔记的目标是整顿Markdown 的一些不罕用,却又非常有用的小技巧。
什么是Markdown?
Markdown 是一种轻量级标记语言,创始人为约翰·格鲁伯。它容许人们应用易读易写的纯文本格式编写文档,而后转换成无效的XHTML文档。这种语言排汇了很多在电子邮件中已有的纯文本标记的个性。 —— 维基百科
Markdown 高级技巧
在Markdown 中,能够直接插入 HTML,目前反对的HTML 元素有:
<kbd>
<b>
<i>
<em>
<sub>
<sup>
<br>
- 等
键盘标签
能够应用<kbd>
标签使文本看起来像按钮,这与惯例反引号文本略有不同。
Copy code with Control + C
可视化差别
能够应用反引号可视化差别,并diff
依据须要突出显示红色或绿色的线。
10 PRINT “BASIC IS COOL”- 20 GOTO 11+ 20 GOTO 10
暗藏不必要的输入
增加简短的谬误日志或简短程序输入的问题能够解决的谬误有帮忙的,但如果它占用页的垂直空间,能够思考应用<details>
和<summary>
标签。
<details><summary>git clone 胜利,点击查看详情信息</summary><pre>Cloning into 'php-markdown-blog'...remote: Enumerating objects: 67, done.remote: Counting objects: 100% (67/67), done.remote: Compressing objects: 100% (55/55), done.remote: Total 67 (delta 12), reused 59 (delta 7), pack-reused 0Unpacking objects: 100% (67/67), done.</details>
<details>
<summary>git clone 胜利,点击查看详情信息</summary>
<pre>
Cloning into 'php-markdown-blog'...
remote: Enumerating objects: 67, done.
remote: Counting objects: 100% (67/67), done.
remote: Compressing objects: 100% (55/55), done.
remote: Total 67 (delta 12), reused 59 (delta 7), pack-reused 0
Unpacking objects: 100% (67/67), done.
</details>
使图像文字居中
HTML 中的<div align="center">
竟然能够神奇的利用在 Markdown 中,然所有内容居中。
<div align="center"><p>This is some centered text.</p></div>
<div align="center">
<p>This is some centered text.</p>
</div>
较小的文字
应用<sub>
、<sup>
标签,能够使文字变小,非常适合在图像上面增加形容。
<div align="center"><br><sup><strong>Fig 1:</strong> Megatocat into action</sup></div>View more octocats on the [Octodex](https://octodex.github.com/)!
<div align="center">
Fig 1: Megatocat into action
</div>
View more octocats on the Octodex
参考链接
- GitHub ProTips