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>
pull/4869/head
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

@ -1,62 +1,35 @@
html {
border-top: solid green 5pt;
}
body.apidoc {
width: 60%;
min-width: 10cm;
body{
border-top: solid #44b492 5pt;
line-height:150%;
font-family: 'Quicksand',sans-serif;
color: #313b4a;
max-width:800px;
margin: 0 auto;
padding: 20px;
}
#header {
padding: 1pc 0;
color: #111;
a{
color: #555;
}
a,
a:active {
color: #272;
}
a:focus,
a:hover {
color: #050;
h1{
color: #44b492;
line-height:100%;
}
#apicontent a.mark,
#apicontent a.mark:active {
float: right;
color: #BBB;
font-size: 0.7cm;
text-decoration: none;
}
#apicontent a.mark:focus,
#apicontent a.mark:hover {
color: #AAA;
a:hover{
color: #44b492;
}
#apicontent code {
padding: 1px;
background-color: #EEE;
border-radius: 4px;
border: 1px solid #DDD;
}
#apicontent pre>code {
display: block;
overflow: auto;
padding: 5px;
pre{
background-color: #e0e0e0;
padding:20px;
}
table, th, td {
text-align: left;
border: 1px solid gray;
border-collapse: collapse;
code{
background-color: #e0e0e0;
}
th {
padding: 0.5em;
background: #EEE;
}
td {
padding: 0.5em;
img {
max-width: 100%;
}

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": {},