Skip to content

Commit e0c1d16

Browse files
committed
Fix highlighting in search, add highlights in forwarding links
1 parent f179c92 commit e0c1d16

File tree

7 files changed

+78
-21
lines changed

7 files changed

+78
-21
lines changed

docs/_layouts/blog.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
layout: default
33
---
44

5-
<h1 class="title">{{ page.title }}</h1>
65
<h2 class="subtitle">{{ page.subTitle }}</h2>
76

87
<div class="author-container {% if page.authorImg != null %} spaced {% endif %}">
98
{% if page.authorImg != null %}
10-
<img src="{{ site.baseurl }}/{{ page.authorImg }}"/>
9+
<img src="{{ site.baseurl }}{{ page.authorImg }}"/>
1110
{% endif %}
1211
<div class="author-info">
1312
<div>{{ page.author }}</div>

docs/_layouts/default.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ <h1>{{ page.title }}</h1>
2626
</div>
2727
</div>
2828
</body>
29+
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.4.0/mark.min.js"></script>
2930
<script src="{{ site.baseurl }}/js/highlight.pack.js"></script>
3031
<script language="javascript">
3132
hljs.initHighlightingOnLoad();
@@ -35,5 +36,26 @@ <h1>{{ page.title }}</h1>
3536
if (thisHREF.indexOf(window.location.hostname) > -1) thisHREF = thisHREF.replace(".md",".html")
3637
document.links[i].setAttribute('href', thisHREF);
3738
}
39+
40+
function getQueryVariable(variable) {
41+
var query = window.location.search.substring(1);
42+
var vars = query.split('&');
43+
44+
for (var i = 0; i < vars.length; i++) {
45+
var pair = vars[i].split('=');
46+
47+
if (pair[0] === variable) {
48+
return decodeURIComponent(pair[1].replace(/\+/g, '%20'));
49+
}
50+
}
51+
}
52+
53+
54+
var highlight = getQueryVariable("highlight");
55+
if (highlight) {
56+
var context = document.querySelector("#content");
57+
var instance = new Mark(context);
58+
instance.mark(highlight);
59+
}
3860
</script>
3961
</html>

docs/css/main.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ div.author-container {
182182
}
183183

184184
> div.author-info {
185-
color: rgba(0,0,0,0.45);
185+
color: rgba(255,255,255,0.45);
186186
float: left;
187187
}
188188
}

docs/js/elasticlunr.min.js

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

docs/js/lunr.min.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)