mirror of
https://github.com/vale981/practical-cl-beautified
synced 2025-03-04 17:11:42 -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;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
.toc li a {
|
.toc li a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
.toc {
|
.toc {
|
||||||
overflow-y: auto
|
overflow-y: auto
|
||||||
|
@ -102,7 +102,9 @@ code.hl-highlighted .list.active {
|
||||||
position: relative
|
position: relative
|
||||||
}
|
}
|
||||||
.toc>.toc-list li {
|
.toc>.toc-list li {
|
||||||
list-style: none
|
list-style: none;
|
||||||
|
padding-left: 1em;
|
||||||
|
text-indent: -1em;
|
||||||
}
|
}
|
||||||
.toc-list {
|
.toc-list {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -145,3 +147,11 @@ a.toc-link {
|
||||||
display: none;
|
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) {
|
function wrapInner(parent, wrapper, className) {
|
||||||
if (typeof wrapper === "string")
|
if (typeof wrapper === "string")
|
||||||
wrapper = document.createElement(wrapper);
|
wrapper = document.createElement(wrapper);
|
||||||
|
@ -113,14 +101,22 @@ function setUpNav() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setUpNumbering() {
|
||||||
loadChapters().then(newChapters => {
|
let chapter = findCurrentChapter();
|
||||||
chapters = newChapters;
|
if (chapter >= 0) {
|
||||||
});
|
document.documentElement.style['counter-reset'] = 'chapter ' + (chapter + 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Let's apply that stuff.
|
// Let's apply that stuff.
|
||||||
|
loadChapters().then(newChapters => {
|
||||||
|
chapters = newChapters;
|
||||||
|
setUpNumbering();
|
||||||
|
});
|
||||||
|
|
||||||
wrapPre();
|
wrapPre();
|
||||||
HighlightLisp.highlight_auto();
|
HighlightLisp.highlight_auto();
|
||||||
HighlightLisp.paren_match();
|
HighlightLisp.paren_match();
|
||||||
createTOC();
|
createTOC();
|
||||||
setUpNav();
|
setUpNav();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue