Skip to content

Commit b40bf3a

Browse files
committed
Update to support octicon and change header anchor styles
1 parent 7e69bfc commit b40bf3a

File tree

8 files changed

+35
-44
lines changed

8 files changed

+35
-44
lines changed

bower.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"markdown-it-sup": "^1.0.0",
4848
"markdown-it-container": "^2.0.0",
4949
"mermaid": "^0.5.8",
50-
"MathJax": "^2.6.1"
50+
"MathJax": "^2.6.1",
51+
"octicons": "^3.5.0"
5152
}
5253
}

public/css/extra.css

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -81,30 +81,6 @@
8181
height: 100%;
8282
}
8383

84-
h1:hover .header-link,
85-
h2:hover .header-link,
86-
h3:hover .header-link,
87-
h4:hover .header-link,
88-
h5:hover .header-link,
89-
h6:hover .header-link {
90-
opacity: 1;
91-
-webkit-transition: opacity 0.2s ease-in-out 0.1s;
92-
-moz-transition: opacity 0.2s ease-in-out 0.1s;
93-
-o-transition: opacity 0.2s ease-in-out 0.1s;
94-
transition: opacity 0.2s ease-in-out 0.1s;
95-
}
96-
.header-link {
97-
position: relative;
98-
left: 0.5em;
99-
right: 0.5em;
100-
opacity: 0;
101-
font-size: 0.8em;
102-
-webkit-transition: opacity 0.2s ease-in-out 0.1s;
103-
-moz-transition: opacity 0.2s ease-in-out 0.1s;
104-
-o-transition: opacity 0.2s ease-in-out 0.1s;
105-
transition: opacity 0.2s ease-in-out 0.1s;
106-
}
107-
10884
.ui-infobar {
10985
max-width: 758px;
11086
margin-top: 25px;

public/css/github-extract.css

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,29 @@
1414
color: #c00;
1515
}
1616
.markdown-body .anchor {
17-
position: absolute;
18-
top: 0;
19-
bottom: 0;
20-
left: 0;
21-
display: block;
22-
padding-right: 6px;
23-
padding-left: 30px;
24-
margin-left: -30px;
17+
display: inline-block;
18+
padding-right: 2px;
19+
margin-left: -18.36px;
2520
}
2621
.markdown-body .anchor:focus {
2722
outline: none;
2823
}
2924
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 {
30-
position: relative;
3125
margin-top: 1em;
3226
margin-bottom: 16px;
3327
font-weight: bold;
3428
line-height: 1.4;
3529
}
3630
.markdown-body h1 .octicon-link, .markdown-body h2 .octicon-link, .markdown-body h3 .octicon-link, .markdown-body h4 .octicon-link, .markdown-body h5 .octicon-link, .markdown-body h6 .octicon-link {
37-
display: none;
3831
color: #000;
3932
vertical-align: middle;
33+
visibility: hidden;
4034
}
4135
.markdown-body h1:hover .anchor, .markdown-body h2:hover .anchor, .markdown-body h3:hover .anchor, .markdown-body h4:hover .anchor, .markdown-body h5:hover .anchor, .markdown-body h6:hover .anchor {
42-
padding-left: 8px;
43-
margin-left: -30px;
44-
line-height: 1;
4536
text-decoration: none;
4637
}
4738
.markdown-body h1:hover .anchor .octicon-link, .markdown-body h2:hover .anchor .octicon-link, .markdown-body h3:hover .anchor .octicon-link, .markdown-body h4:hover .anchor .octicon-link, .markdown-body h5:hover .anchor .octicon-link, .markdown-body h6:hover .anchor .octicon-link {
48-
display: inline-block;
39+
visibility: visible;
4940
}
5041
.markdown-body h1 tt, .markdown-body h1 code, .markdown-body h2 tt, .markdown-body h2 code, .markdown-body h3 tt, .markdown-body h3 code, .markdown-body h4 tt, .markdown-body h4 code, .markdown-body h5 tt, .markdown-body h5 code, .markdown-body h6 tt, .markdown-body h6 code {
5142
font-size: inherit;
@@ -56,26 +47,44 @@
5647
line-height: 1.2;
5748
border-bottom: 1px solid #eee;
5849
}
50+
.markdown-body h1 .anchor {
51+
line-height: 1;
52+
}
5953
.markdown-body h2 {
6054
padding-bottom: 0.3em;
6155
font-size: 1.75em;
6256
line-height: 1.225;
6357
border-bottom: 1px solid #eee;
6458
}
59+
.markdown-body h2 .anchor {
60+
line-height: 1;
61+
}
6562
.markdown-body h3 {
6663
font-size: 1.5em;
6764
line-height: 1.43;
6865
}
66+
.markdown-body h3 .anchor {
67+
line-height: 1.2;
68+
}
6969
.markdown-body h4 {
7070
font-size: 1.25em;
7171
}
72+
.markdown-body h4 .anchor {
73+
line-height: 1.2;
74+
}
7275
.markdown-body h5 {
7376
font-size: 1em;
7477
}
78+
.markdown-body h5 .anchor {
79+
line-height: 1.1;
80+
}
7581
.markdown-body h6 {
7682
font-size: 1em;
7783
color: #777;
7884
}
85+
.markdown-body h6 .anchor {
86+
line-height: 1.1;
87+
}
7988
.markdown-body p, .markdown-body blockquote, .markdown-body ul, .markdown-body ol, .markdown-body dl, .markdown-body table, .markdown-body pre {
8089
margin-top: 0;
8190
margin-bottom: 16px;

public/css/html.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/extra.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,9 @@ function imgPlayiframe(element, src) {
613613

614614
var anchorForId = function (id) {
615615
var anchor = document.createElement("a");
616-
anchor.className = "header-link hidden-xs";
616+
anchor.className = "anchor hidden-xs";
617617
anchor.href = "#" + id;
618-
anchor.innerHTML = "<span class=\"sr-only\"></span><i class=\"fa fa-link\"></i>";
618+
anchor.innerHTML = "<span class=\"octicon octicon-link\"></span>";
619619
anchor.title = id;
620620
return anchor;
621621
};
@@ -624,13 +624,13 @@ var linkifyAnchors = function (level, containingElement) {
624624
var headers = containingElement.getElementsByTagName("h" + level);
625625
for (var h = 0; h < headers.length; h++) {
626626
var header = headers[h];
627-
if (header.getElementsByClassName("header-link").length == 0) {
627+
if (header.getElementsByClassName("anchor").length == 0) {
628628
if (typeof header.id == "undefined" || header.id == "") {
629629
//to escape characters not allow in css and humanize
630630
var id = slugifyWithUTF8(header.innerHTML);
631631
header.id = id;
632632
}
633-
header.appendChild(anchorForId(header.id));
633+
header.insertBefore(anchorForId(header.id), header.firstChild);
634634
}
635635
}
636636
};

public/views/head.ejs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
1515
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
1616
<link rel="stylesheet" href="//cdn.jsdelivr.net/ionicons/2.0.1/css/ionicons.min.css">
17+
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css">
1718
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-social/4.9.0/bootstrap-social.min.css">
1819
<% } else { %>
1920
<link rel="stylesheet" href="<%- url %>/vendor/bootstrap/dist/css/bootstrap.min.css">
2021
<link rel="stylesheet" href="<%- url %>/vendor/font-awesome/css/font-awesome.min.css">
2122
<link rel="stylesheet" href="<%- url %>/vendor/Ionicons/css/ionicons.min.css">
23+
<link rel="stylesheet" href="<%- url %>/vendor/octicons/octicons/octicons.css">
2224
<link rel="stylesheet" href="<%- url %>/css/bootstrap-social.css">
2325
<% } %>
2426
<link rel="stylesheet" href="<%- url %>/vendor/jquery-ui/jquery-ui.min.css">

public/views/html.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
2020
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
2121
<link rel="stylesheet" href="https://cdn.jsdelivr.net/ionicons/2.0.1/css/ionicons.min.css">
22+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css">
2223
<link rel="stylesheet" href="https://cdn.jsdelivr.net/highlight.js/8.8.0/styles/github-gist.min.css">
2324
<style>
2425
{{{css}}}

public/views/pretty.ejs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
1919
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
2020
<link rel="stylesheet" href="https://cdn.jsdelivr.net/ionicons/2.0.1/css/ionicons.min.css">
21+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css">
2122
<% } else { %>
2223
<link rel="stylesheet" href='<%- url %>/vendor/bootstrap/dist/css/bootstrap.min.css'>
2324
<link rel="stylesheet" href='<%- url %>/vendor/font-awesome/css/font-awesome.min.css'>
2425
<link rel="stylesheet" href="<%- url %>/vendor/Ionicons/css/ionicons.min.css">
26+
<link rel="stylesheet" href="<%- url %>/vendor/octicons/octicons/octicons.css">
2527
<% } %>
2628
<link rel="stylesheet" href='<%- url %>/css/github-extract.css'>
2729
<link rel="stylesheet" href='<%- url %>/css/gist.css'>

0 commit comments

Comments
 (0)