nodebook
Version:
Node.js • Apprendre par la pratique. Familiarisez-vous avec JavaScript, Node.js et l'écosystème de modules npm. Apprenez à concevoir et à déployer des *applications web* et des *outils en ligne de commande*.
38 lines (34 loc) • 871 B
JavaScript
'use strict';
module.exports = function hashScrollExtension () {
this.docinfoProcessor(function(){
this.process(({backend}) => {
if (backend !== 'html5') {
return '';
}
return `<script>
(function(d){
d.addEventListener('DOMContentLoaded', function(){
const script = d.createElement('script');
script.src = 'https://wzrd.in/standalone/menuspy';
script.async = true;
script.onload = () => new menuspy(document.querySelector('#toc'), {enableLocationHash: false});
d.body.appendChild(script);
});
})(document);</script>
<style type="text/css">
#toc li.active > a[href^="#"] {
background: #ffc;
font-weight: bold;
}
#toc li.active > a[href^="#"]::before {
content: "▶ ";
display: inline-block;
position: absolute;
margin-left: -1.2em;
font-size: .8em;
margin-top: 3px;
}
</style>`;
});
});
};