Skip to content

Instantly share code, notes, and snippets.

@jovianlin
Created November 22, 2017 02:33
Show Gist options
  • Save jovianlin/57ead07b79eb8e3458867612cc87cdaf to your computer and use it in GitHub Desktop.
Save jovianlin/57ead07b79eb8e3458867612cc87cdaf to your computer and use it in GitHub Desktop.
Ghost Injection for Header & Footer
===== BLOG HEADER =====
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/styles/agate.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/highlight.min.js"></script>
<style>
.inner { max-width:50em; }
pre .lines { margin-top:-12px; }
</style>
===== BLOG FOOTER =====
<script>
activateHighlight = function() {
document.querySelectorAll("pre code").forEach(
function(currentValue, currentIndex, listObj) {
hljs.highlightBlock(currentValue);
}
);
}
if (window.attachEvent) {
window.attachEvent('onload', loadHighlight);
} else {
if (window.onload) {
var originalOnload = window.onload;
var newOnload = function(evt) {
originalOnload(evt);
activateHighlight(evt);
};
window.onload = newOnload;
} else {
window.onload = activateHighlight;
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment