Add highlighting of code snippets with numbered lines enabled.
This commit is contained in:
parent
3730b32107
commit
52e734fb3c
3 changed files with 23 additions and 7 deletions
|
@ -8,15 +8,9 @@
|
||||||
</footer>
|
</footer>
|
||||||
<script src="https://cdn.bootcss.com/instantclick/3.0.1/instantclick.min.js" data-no-instant></script>
|
<script src="https://cdn.bootcss.com/instantclick/3.0.1/instantclick.min.js" data-no-instant></script>
|
||||||
<script data-no-instant>InstantClick.init();</script>
|
<script data-no-instant>InstantClick.init();</script>
|
||||||
<script src="https://cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js" data-no-instant></script>
|
|
||||||
<script data-no-instant>
|
<script data-no-instant>
|
||||||
hljs.initHighlightingOnLoad();
|
|
||||||
addMenuListener();
|
addMenuListener();
|
||||||
InstantClick.on('change', function() {
|
InstantClick.on('change', function() {
|
||||||
var blocks = document.querySelectorAll('pre code');
|
|
||||||
for (var i = 0; i < blocks.length; i++) {
|
|
||||||
hljs.highlightBlock(blocks[i]);
|
|
||||||
}
|
|
||||||
addMenuListener();
|
addMenuListener();
|
||||||
});
|
});
|
||||||
function addMenuListener() {
|
function addMenuListener() {
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
<!-- Styles -->
|
<!-- Styles -->
|
||||||
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,700,700i" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,700,700i" rel="stylesheet">
|
||||||
<link href="https://cdn.bootcss.com/highlight.js/9.12.0/styles/atom-one-dark.min.css" rel="stylesheet">
|
|
||||||
<link href="{{.Site.BaseURL}}css/style.css" rel="stylesheet">
|
<link href="{{.Site.BaseURL}}css/style.css" rel="stylesheet">
|
||||||
<!-- Favicons -->
|
<!-- Favicons -->
|
||||||
<link rel="apple-touch-icon" href="{{.Site.BaseURL}}img/apple-touch-icon.png">
|
<link rel="apple-touch-icon" href="{{.Site.BaseURL}}img/apple-touch-icon.png">
|
||||||
|
|
|
@ -488,3 +488,26 @@ pre, code {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Highlight
|
||||||
|
------------------------------ */
|
||||||
|
.post-content pre code {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.post-content table code {
|
||||||
|
padding-top: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
.post-content pre {
|
||||||
|
margin: 30px 0px;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
.post-content table pre {
|
||||||
|
margin: 20px 0px;
|
||||||
|
}
|
||||||
|
.highlight table {
|
||||||
|
margin: 30px 0 !important;
|
||||||
|
}
|
||||||
|
.highlight div {
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue