Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wanjj_1210
ant-design
提交
a2b07e2a
A
ant-design
项目概览
wanjj_1210
/
ant-design
与 Fork 源项目一致
从无法访问的项目Fork
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
ant-design
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a2b07e2a
编写于
10月 19, 2015
作者:
偏
偏右
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #408 from ant-design/feature-header-anchor
Add link anchor to every title in markdown document
上级
44cb11a2
f4695414
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
25 addition
and
2 deletion
+25
-2
site/static/style.css
site/static/style.css
+16
-0
site/templates/component.html
site/templates/component.html
+1
-1
site/templates/page.html
site/templates/page.html
+1
-1
site/theme.js
site/theme.js
+7
-0
未找到文件。
site/static/style.css
浏览文件 @
a2b07e2a
...
...
@@ -610,6 +610,22 @@ footer ul li > a {
margin
:
0
;
}
.markdown
.anchor
{
opacity
:
0
;
transition
:
opacity
0.3s
ease
;
margin-left
:
8px
;
}
.markdown
h1
:hover
.anchor
,
.markdown
h2
:hover
.anchor
,
.markdown
h3
:hover
.anchor
,
.markdown
h4
:hover
.anchor
,
.markdown
h5
:hover
.anchor
,
.markdown
h6
:hover
.anchor
{
opacity
:
1
;
display
:
inline-block
;
}
#api
~
ul
>
li
>
p
>
strong
~
code
{
background
:
#fff
;
color
:
#CC7300
;
...
...
site/templates/component.html
浏览文件 @
a2b07e2a
...
...
@@ -12,7 +12,7 @@
</a>
{%- endif %}
</h1>
{{ post.html }}
{{ post.html
|add_anchor
}}
</article>
{%- if post.meta.template === 'component' %}
{%- include "demos.html" %}
...
...
site/templates/page.html
浏览文件 @
a2b07e2a
...
...
@@ -18,7 +18,7 @@
<section
class=
"main-container"
>
<article
class=
"markdown"
>
<h1>
{{ post.title }} {{ post.meta.chinese }}
</h1>
{{ post.html }}
{{ post.html
|add_anchor
}}
</article>
</section>
{% endblock %}
...
...
site/theme.js
浏览文件 @
a2b07e2a
...
...
@@ -172,6 +172,13 @@ module.exports = function(nico) {
result
.
push
(
p
);
});
return
result
;
},
add_anchor
:
function
(
content
)
{
for
(
var
i
=
1
;
i
<=
6
;
i
++
)
{
var
reg
=
new
RegExp
(
'
(<h
'
+
i
+
'
\\
sid="(.*?)">.*?)(<
\
/h
'
+
i
+
'
>)
'
,
'
g
'
);
content
=
content
.
replace
(
reg
,
'
$1<a href="#$2" class="anchor">#</a> $3
'
);
}
return
content
;
}
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录