mirror of
https://github.com/vale981/practical-cl-beautified
synced 2025-03-04 09:11:37 -05:00
Lint + Section Numebering
This commit is contained in:
parent
80961773cb
commit
48e9b292d7
3 changed files with 33 additions and 18 deletions
|
@ -92,7 +92,7 @@ code.hl-highlighted .list.active {
|
|||
font-size: 14px;
|
||||
}
|
||||
.toc li a {
|
||||
text-decoration: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
.toc {
|
||||
overflow-y: auto
|
||||
|
@ -102,7 +102,9 @@ code.hl-highlighted .list.active {
|
|||
position: relative
|
||||
}
|
||||
.toc>.toc-list li {
|
||||
list-style: none
|
||||
list-style: none;
|
||||
padding-left: 1em;
|
||||
text-indent: -1em;
|
||||
}
|
||||
.toc-list {
|
||||
margin: 0;
|
||||
|
@ -145,3 +147,11 @@ a.toc-link {
|
|||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
counter-reset: chapter;
|
||||
}
|
||||
h2::before {
|
||||
counter-increment: chapter; /* Increment the value of section counter by 1 */
|
||||
content: counters(chapter, '.') ' '; /* Display the value of section counter */
|
||||
}
|
||||
|
|
9
js/.eslintrc
Normal file
9
js/.eslintrc
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6,
|
||||
"sourceType": "module",
|
||||
},
|
||||
"rules": {
|
||||
"semi": 2
|
||||
}
|
||||
}
|
28
js/main.js
28
js/main.js
|
@ -37,18 +37,6 @@ function createTOC() {
|
|||
});
|
||||
}
|
||||
|
||||
function wrapInner(parent, wrapper, attribute, attributevalue) {
|
||||
if (typeof wrapper === "string") {
|
||||
wrapper = document.createElement(wrapper);
|
||||
}
|
||||
var div = parent.appendChild(wrapper)
|
||||
.setAttribute(attribute, attributevalue);
|
||||
|
||||
while (parent.firstChild !== wrapper) {
|
||||
wrapper.appendChild(parent.firstChild);
|
||||
}
|
||||
}
|
||||
|
||||
function wrapInner(parent, wrapper, className) {
|
||||
if (typeof wrapper === "string")
|
||||
wrapper = document.createElement(wrapper);
|
||||
|
@ -113,14 +101,22 @@ function setUpNav() {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
loadChapters().then(newChapters => {
|
||||
chapters = newChapters;
|
||||
});
|
||||
function setUpNumbering() {
|
||||
let chapter = findCurrentChapter();
|
||||
if (chapter >= 0) {
|
||||
document.documentElement.style['counter-reset'] = 'chapter ' + (chapter + 1);
|
||||
}
|
||||
};
|
||||
|
||||
// Let's apply that stuff.
|
||||
loadChapters().then(newChapters => {
|
||||
chapters = newChapters;
|
||||
setUpNumbering();
|
||||
});
|
||||
|
||||
wrapPre();
|
||||
HighlightLisp.highlight_auto();
|
||||
HighlightLisp.paren_match();
|
||||
createTOC();
|
||||
setUpNav();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue