Skip to content

Commit 64b65e3

Browse files
committed
Merge pull request #212 from milmazz/highlightjs
Highlight.js improvements
2 parents ce39e21 + da5e5a0 commit 64b65e3

File tree

5 files changed

+43
-25
lines changed

5 files changed

+43
-25
lines changed

lib/ex_doc/formatter/html/templates/css/elixir.css

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
/*
2+
23
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
4+
5+
Source: https://github.com/isagalaev/highlight.js/blob/master/src/styles/github.css
6+
37
*/
48

59
.hljs {
10+
display: block;
611
overflow-x: auto;
7-
color: #333;
812
padding: 0.5em;
9-
border: #ffe0bb dotted 1px;
10-
background: #fffde8;
11-
display: block;
13+
color: #333;
14+
background: #f8f8f8;
1215
-webkit-text-size-adjust: none;
1316
}
1417

1518
.hljs-comment,
16-
.diff .hljs-header,
17-
.hljs-javadoc {
19+
.diff .hljs-header {
1820
color: #998;
1921
font-style: italic;
2022
}
@@ -38,8 +40,7 @@ github.com style (c) Vasily Polovnyov <vast@whiteants.net>
3840

3941
.hljs-string,
4042
.hljs-tag .hljs-value,
41-
.hljs-phpdoc,
42-
.hljs-dartdoc,
43+
.hljs-doctag,
4344
.tex .hljs-formula {
4445
color: #d14;
4546
}
@@ -60,21 +61,22 @@ github.com style (c) Vasily Polovnyov <vast@whiteants.net>
6061
.hljs-type,
6162
.vhdl .hljs-literal,
6263
.tex .hljs-command {
63-
color: #445588;
64+
color: #458;
6465
font-weight: bold;
6566
}
6667

6768
.hljs-tag,
6869
.hljs-tag .hljs-title,
69-
.hljs-rules .hljs-property,
70+
.hljs-rule .hljs-property,
7071
.django .hljs-tag .hljs-keyword {
7172
color: #000080;
7273
font-weight: normal;
7374
}
7475

7576
.hljs-attribute,
7677
.hljs-variable,
77-
.lisp .hljs-body {
78+
.lisp .hljs-body,
79+
.hljs-name {
7880
color: #008080;
7981
}
8082

lib/ex_doc/formatter/html/templates/css/style.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,9 @@ span.detail_type {
231231
a.detail_link {
232232
padding-left: 0.3em;
233233
}
234+
235+
/* CUSTOMIZATION FOR elixir.css */
236+
.hljs {
237+
background: #fffde8;
238+
border: #ffe0bb dotted 1px;
239+
}
Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1-
function fixOutsideWorldLinks() {
2-
$('a').each(function() {
3-
if (window.location.host != this.host) this.target = '_parent';
4-
});
5-
}
1+
;$(function () {
2+
// Fix outside world links
3+
function fixOutsideWorldLinks() {
4+
$('a').each(function() {
5+
if (window.location.host != this.host) this.target = '_parent';
6+
});
7+
}
68

7-
$(fixOutsideWorldLinks);
9+
fixOutsideWorldLinks();
10+
11+
// Setup Highlight.js
12+
hljs.configure({
13+
tabReplace: ' ', // 4 spaces
14+
languages: [] // disable auto-detect
15+
});
16+
17+
hljs.initHighlighting();
18+
});

lib/ex_doc/formatter/html/templates/js/highlight.pack.js

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ex_doc/formatter/html/templates/module_template.eex

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<head>
44
<title><%= module.id %></title>
55
<meta charset="utf-8" />
6-
<link rel="stylesheet" href="css/style.css">
76
<link rel="stylesheet" href="css/elixir.css">
7+
<link rel="stylesheet" href="css/style.css">
88
</head>
99
<body>
1010
<section id="content">
@@ -88,11 +88,9 @@
8888

8989
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
9090
<script>window.jQuery || document.write('<script src="js/jquery.js"><\/script>')</script>
91-
<script src="js/app.js"></script>
9291
<script src="js/highlight.pack.js"></script>
92+
<script src="js/app.js"></script>
9393
<script>
94-
hljs.initHighlightingOnLoad();
95-
hljs.configure({languages: []}); //disable autodetect
9694
if (window.top.frames.main) { document.body.className = 'frames'; }
9795
</script>
9896
</body>

0 commit comments

Comments
 (0)