Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何添加锚点 #58

Closed
vincent4j opened this issue Jun 29, 2014 · 0 comments
Closed

如何添加锚点 #58

vincent4j opened this issue Jun 29, 2014 · 0 comments

Comments

@vincent4j
Copy link
Contributor

markdown 在 标题标签(#、## 等)下会自动将其添加为锚点,并且锚点的 id 就为标签的内容;然而,我们的内容大多是中文,就会被转化成 Unicode,可读性较差。

不考虑可读性

直接添加标题标签自动生成的锚点 id,形如:#%E6%94%AF%E6%8C%81-android-21-%E5%8F%8A%E4%BB%A5%E4%B8%8A%E7%89%88%E6%9C%AC

举例:

https://github.com/vincent4j/android-training-course-in-chinese/blob/gh-pages/SOURCE/basics/actionbar/setting-up.md#%E4%BB%85%E6%94%AF%E6%8C%81-android-30-%E5%8F%8A%E4%BB%A5%E4%B8%8A%E7%89%88%E6%9C%AC

考虑可读性

不使用 标题标签,直接通过 html 语言替代,如此锚点 id 就可以自行指定。
效果:http://daringfireball.net/projects/markdown/syntax#overview
源码:http://daringfireball.net/projects/markdown/syntax.text

提示:此方法在 github 上不可行,但在 Jekyll 上是可行的。原因应该是,github 上的 markdown 语法是对标准 markdown 语法有过优化。所以对我们的工程来说,这样写是完全没问题的,因为我们最终跑在 Jekyll 上。
示例效果:
http://design.1sters.com/material_design/components/menus.html#menus_behavior
示例源码:
https://github.com/1sters/material_design_zh/blob/master/SOURCE/components/menus.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant