web-documentation 1.0.23 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/deploy.js +1 -1
- package/package.json +3 -3
- package/source/deploy.ts +20 -9
- package/source/dummyReadme.md +3 -4
- package/source/index.ts +9 -8
- package/source/renderMarkdown.mjs +26 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-documentation",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
4
4
|
"description": "Declarative multilanguage documentation website generator",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"documentation",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@webcomponents/webcomponentsjs": "^2.8.0",
|
|
69
69
|
"archiver": "^8.0.0",
|
|
70
70
|
"bootstrap-icons": "^1.13.1",
|
|
71
|
-
"clientnode": "^4.0.
|
|
71
|
+
"clientnode": "^4.0.1413",
|
|
72
72
|
"css-loader": "^7.1.4",
|
|
73
73
|
"cssnano": "^8.0.1",
|
|
74
74
|
"default-gateway": "^7.2.2",
|
|
@@ -204,7 +204,7 @@
|
|
|
204
204
|
"ejs": {
|
|
205
205
|
"options": {
|
|
206
206
|
"locals": {
|
|
207
|
-
"API_DOCUMENTATION_PATH": "/
|
|
207
|
+
"API_DOCUMENTATION_PATH": "/api/",
|
|
208
208
|
"CONTENT": "source/dummyReadme.md",
|
|
209
209
|
"DISTRIBUTION_BUNDLE_FILE_PATH": "dummyDistributionBundle.zip",
|
|
210
210
|
"LANGUAGES": {
|
package/source/deploy.ts
CHANGED
|
@@ -497,7 +497,11 @@ const tidyUp = async (): Promise<void> => {
|
|
|
497
497
|
HAS_API_DOCUMENTATION &&
|
|
498
498
|
!(await isDirectory(oldAPIDocumentationDirectoryPath))
|
|
499
499
|
)
|
|
500
|
-
|
|
500
|
+
try {
|
|
501
|
+
run(`git checkout '${oldAPIDocumentationDirectoryPath}'`)
|
|
502
|
+
} catch (error) {
|
|
503
|
+
log.warn(error)
|
|
504
|
+
}
|
|
501
505
|
|
|
502
506
|
if (!run('git branch').includes('* main'))
|
|
503
507
|
log.debug(run('git checkout main'))
|
|
@@ -578,8 +582,9 @@ const main = async (): Promise<void> => {
|
|
|
578
582
|
log.info('API documentation creation script detected.')
|
|
579
583
|
try {
|
|
580
584
|
log.debug(run('yarn document'))
|
|
585
|
+
log.info('API documentation created.')
|
|
581
586
|
} catch (error) {
|
|
582
|
-
log.
|
|
587
|
+
log.warn(error)
|
|
583
588
|
HAS_API_DOCUMENTATION = false
|
|
584
589
|
}
|
|
585
590
|
}
|
|
@@ -680,13 +685,19 @@ const main = async (): Promise<void> => {
|
|
|
680
685
|
log.debug(
|
|
681
686
|
run('corepack install', {cwd: temporaryDocumentationFolderPath})
|
|
682
687
|
)
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
688
|
+
|
|
689
|
+
try {
|
|
690
|
+
log.debug(run(
|
|
691
|
+
'yarn install',
|
|
692
|
+
{
|
|
693
|
+
cwd: temporaryDocumentationFolderPath,
|
|
694
|
+
env: {...process.env, NODE_ENV: 'debug'}
|
|
695
|
+
}
|
|
696
|
+
))
|
|
697
|
+
} catch (error) {
|
|
698
|
+
log.warn(error)
|
|
699
|
+
}
|
|
700
|
+
|
|
690
701
|
log.debug(run('yarn clear', {cwd: temporaryDocumentationFolderPath}))
|
|
691
702
|
|
|
692
703
|
await generateAndPushNewDocumentationPage(
|
package/source/dummyReadme.md
CHANGED
|
@@ -60,7 +60,9 @@ You need utilities for:<!--deDE:Sie benötigen Hilfsfunktionen für:-->
|
|
|
60
60
|
- URLs
|
|
61
61
|
|
|
62
62
|
<!--Place for automatic generated table of contents.-->
|
|
63
|
-
|
|
63
|
+
<!--Backend generated one indicator: "# heading"-->
|
|
64
|
+
<!--Clientside generated version indicator:-->
|
|
65
|
+
<div class="doc-toc" style="display: none">
|
|
64
66
|
<!--|deDE:Inhalt-->
|
|
65
67
|
<h2 id="content">Content</h2>
|
|
66
68
|
</div>
|
|
@@ -69,9 +71,6 @@ You need utilities for:<!--deDE:Sie benötigen Hilfsfunktionen für:-->
|
|
|
69
71
|
Installation
|
|
70
72
|
------------
|
|
71
73
|
|
|
72
|
-
<!--|deDE:Klassische Dom-Integration-->
|
|
73
|
-
### Classical dom injection
|
|
74
|
-
|
|
75
74
|
You can install via package manager, simply download the compiled version as
|
|
76
75
|
zip file here and inject or request via cdn in HTML:
|
|
77
76
|
<!--deDE:
|
package/source/index.ts
CHANGED
|
@@ -237,7 +237,8 @@ export class WebDocumentation<
|
|
|
237
237
|
if (!this.tableOfContentDomNode)
|
|
238
238
|
return
|
|
239
239
|
|
|
240
|
-
let
|
|
240
|
+
let listItemsHTML = ''
|
|
241
|
+
|
|
241
242
|
let level = 0
|
|
242
243
|
let firstLevel = 0
|
|
243
244
|
let first = true
|
|
@@ -252,12 +253,14 @@ export class WebDocumentation<
|
|
|
252
253
|
if (first)
|
|
253
254
|
firstLevel = newLevel
|
|
254
255
|
|
|
256
|
+
console.log('A', newLevel)
|
|
257
|
+
|
|
255
258
|
if (newLevel > level)
|
|
256
|
-
|
|
259
|
+
listItemsHTML += '<ul>'
|
|
257
260
|
else if (newLevel < level)
|
|
258
|
-
|
|
261
|
+
listItemsHTML += '</ul>'
|
|
259
262
|
|
|
260
|
-
|
|
263
|
+
listItemsHTML += `
|
|
261
264
|
<li>
|
|
262
265
|
<a href="#${domNode.getAttribute('id') ?? 'unknown'}">
|
|
263
266
|
${domNode.innerText}
|
|
@@ -270,13 +273,11 @@ export class WebDocumentation<
|
|
|
270
273
|
}
|
|
271
274
|
// Close remaining inner lists.
|
|
272
275
|
while (level < firstLevel) {
|
|
273
|
-
|
|
276
|
+
listItemsHTML += '</ul>'
|
|
274
277
|
level += 1
|
|
275
278
|
}
|
|
276
279
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
this.tableOfContentDomNode.append(createDomNodes(listItems))
|
|
280
|
+
this.tableOfContentDomNode.append(createDomNodes(listItemsHTML))
|
|
280
281
|
|
|
281
282
|
this.tableOfContentLinkDomNodes =
|
|
282
283
|
this.tableOfContentDomNode.querySelectorAll<HTMLAnchorElement>(
|
|
@@ -22,8 +22,32 @@ const marked = new Marked(
|
|
|
22
22
|
|
|
23
23
|
export default (options) => {
|
|
24
24
|
marked.setOptions(options)
|
|
25
|
-
// Include an id attribute when emitting headings (h1, h2, h3,
|
|
26
|
-
marked.use(gfmHeadingId(
|
|
25
|
+
// Include an id attribute when emitting headings (h1, h2, h3, ...).
|
|
26
|
+
marked.use(gfmHeadingId(
|
|
27
|
+
{prefix: 'doc-'}/* TODO,
|
|
28
|
+
|
|
29
|
+
{
|
|
30
|
+
hooks: {
|
|
31
|
+
postprocess(html) {
|
|
32
|
+
const headings = getHeadingList()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
NOTE: We do not wrap with an initial UL tag since H1
|
|
36
|
+
should be ignored. It is only existing once for SEO
|
|
37
|
+
purposes.
|
|
38
|
+
* /
|
|
39
|
+
return `
|
|
40
|
+
${headings.map(({
|
|
41
|
+
id,
|
|
42
|
+
raw,
|
|
43
|
+
level
|
|
44
|
+
}) => `<li><a href="#${id}">${raw}</a></li>`)}
|
|
45
|
+
${html}
|
|
46
|
+
`
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}*/
|
|
50
|
+
))
|
|
27
51
|
// Favors self-closing xhtml tags.
|
|
28
52
|
marked.use(markedXhtml())
|
|
29
53
|
|