docs: fix links from TOC to Headings and improve appearance of docs (a little) (#4866)

* docs: fix links from TOC to Headings
* docs: Styling

Just a little modernisation of the appearance of the documentation

* Update src/bin/doc/package.json

Co-authored-by: Richard Hansen <rhansen@rhansen.org>

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
This commit is contained in:
John McLear 2021-02-25 09:01:45 +00:00 committed by GitHub
parent 41ec7fe3fc
commit 4a65acf417
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 62 deletions

View file

@ -137,6 +137,12 @@ const getSection = (lexed) => {
const buildToc = (lexed, filename, cb) => {
let toc = [];
let depth = 0;
marked.setOptions({
headerIds: true,
headerPrefix: `${filename}_`,
});
lexed.forEach((tok) => {
if (tok.type !== 'heading') return;
if (tok.depth - depth > 1) {

View file

@ -1,13 +0,0 @@
{
"name": "node-doc-generator",
"version": "0.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"marked": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/marked/-/marked-1.1.1.tgz",
"integrity": "sha512-mJzT8D2yPxoPh7h0UXkB+dBj4FykPJ2OIfxAWeIHrvoHDkFxukV/29QxoFQoPM6RLEwhIFdJpmKBlqVM3s2ZIw=="
}
}
}

View file

@ -7,7 +7,7 @@
"node": ">=10.17.0"
},
"dependencies": {
"marked": "1.1.1"
"marked": "^2.0.0"
},
"devDependencies": {},
"optionalDependencies": {},