@forsakringskassan/docs-generator 1.25.2 → 1.26.0
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/dist/generator.d.ts +56 -1
- package/dist/generator.js +490 -353
- package/dist/markdown.d.ts +7 -1
- package/dist/markdown.js +27 -7
- package/dist/style/core.css +5 -2
- package/dist/style/index.css +14 -5
- package/dist/style/site.css +9 -3
- package/package.json +1 -1
package/dist/markdown.d.ts
CHANGED
|
@@ -135,7 +135,13 @@ export declare interface FileInfo {
|
|
|
135
135
|
name: string;
|
|
136
136
|
/** path relative to project root */
|
|
137
137
|
fullPath: string;
|
|
138
|
-
/**
|
|
138
|
+
/**
|
|
139
|
+
* Output filename or `false` to disable writing result to a file.
|
|
140
|
+
*
|
|
141
|
+
* When passing a filename these optional placeholders can be used:
|
|
142
|
+
*
|
|
143
|
+
* - `[hash]` - replaced with the hash of the content body.
|
|
144
|
+
*/
|
|
139
145
|
outputName: string | false;
|
|
140
146
|
}
|
|
141
147
|
|
package/dist/markdown.js
CHANGED
|
@@ -18825,6 +18825,12 @@ function generateId(text2) {
|
|
|
18825
18825
|
return text2.toLowerCase().trim().replace(/[åäö]/g, (m) => replacements[m]).replace(/[^a-z0-9]+/g, "_").replace(/^_+/, "").replace(/_+$/, "");
|
|
18826
18826
|
}
|
|
18827
18827
|
|
|
18828
|
+
// src/utils/get-fingerprint.ts
|
|
18829
|
+
var import_node_crypto = __toESM(require("node:crypto"));
|
|
18830
|
+
function getFingerprint(source) {
|
|
18831
|
+
return import_node_crypto.default.createHash("md5").update(source).digest("hex").slice(0, 6);
|
|
18832
|
+
}
|
|
18833
|
+
|
|
18828
18834
|
// src/utils/normalize-path.ts
|
|
18829
18835
|
var import_posix = __toESM(require("node:path/posix"));
|
|
18830
18836
|
function normalizePath(...pathSegments) {
|
|
@@ -19002,8 +19008,7 @@ function codePreview(options) {
|
|
|
19002
19008
|
};
|
|
19003
19009
|
function fence2(_md, tokens, idx, _options, env) {
|
|
19004
19010
|
const { fileInfo } = env;
|
|
19005
|
-
const { content: source } = tokens[idx];
|
|
19006
|
-
const { info } = tokens[idx];
|
|
19011
|
+
const { content: source, info, map } = tokens[idx];
|
|
19007
19012
|
const [language, ...rawTags] = info.split(/\s+/);
|
|
19008
19013
|
if (language === "mermaid") {
|
|
19009
19014
|
return (
|
|
@@ -19020,6 +19025,8 @@ function codePreview(options) {
|
|
|
19020
19025
|
tags: rawTags
|
|
19021
19026
|
});
|
|
19022
19027
|
const { tags } = example;
|
|
19028
|
+
const hashContent = `${map == null ? void 0 : map[0]}:${map == null ? void 0 : map[1]}:${info}:${source}`;
|
|
19029
|
+
const fingerprint = getFingerprint(hashContent);
|
|
19023
19030
|
const highlightedCode = replaceAtLink(highlight(example));
|
|
19024
19031
|
const testId = findTestId(tags);
|
|
19025
19032
|
const liveExample = tags.includes("live-example");
|
|
@@ -19034,6 +19041,7 @@ function codePreview(options) {
|
|
|
19034
19041
|
/* HTML */
|
|
19035
19042
|
`
|
|
19036
19043
|
<div
|
|
19044
|
+
id="example-${fingerprint}"
|
|
19037
19045
|
class="code-preview code-preview--borderless"
|
|
19038
19046
|
${testIdAttr}
|
|
19039
19047
|
>
|
|
@@ -19046,7 +19054,11 @@ function codePreview(options) {
|
|
|
19046
19054
|
return (
|
|
19047
19055
|
/* HTML */
|
|
19048
19056
|
`
|
|
19049
|
-
<div
|
|
19057
|
+
<div
|
|
19058
|
+
id="example-${fingerprint}"
|
|
19059
|
+
class="code-preview ${modifier}"
|
|
19060
|
+
${testIdAttr}
|
|
19061
|
+
>
|
|
19050
19062
|
${example.comments.join("\n")}
|
|
19051
19063
|
<pre class="code-preview__markup">${highlightedCode}</pre>
|
|
19052
19064
|
</div>
|
|
@@ -19057,7 +19069,11 @@ function codePreview(options) {
|
|
|
19057
19069
|
return (
|
|
19058
19070
|
/* HTML */
|
|
19059
19071
|
`
|
|
19060
|
-
<div
|
|
19072
|
+
<div
|
|
19073
|
+
id="example-${fingerprint}"
|
|
19074
|
+
class="code-preview ${modifier}"
|
|
19075
|
+
${testIdAttr}
|
|
19076
|
+
>
|
|
19061
19077
|
${example.comments.join("\n")}
|
|
19062
19078
|
<div class="code-preview__preview">${example.markup}</div>
|
|
19063
19079
|
</div>
|
|
@@ -19090,7 +19106,11 @@ function codePreview(options) {
|
|
|
19090
19106
|
return (
|
|
19091
19107
|
/* HTML */
|
|
19092
19108
|
`
|
|
19093
|
-
<div
|
|
19109
|
+
<div
|
|
19110
|
+
id="example-${fingerprint}"
|
|
19111
|
+
class="code-preview ${modifier}"
|
|
19112
|
+
${testIdAttr}
|
|
19113
|
+
>
|
|
19094
19114
|
${example.comments.join("\n")}
|
|
19095
19115
|
<div class="code-preview__preview">${example.markup}</div>
|
|
19096
19116
|
<div>${toggleMarkup} ${toggleFullscreen}</div>
|
|
@@ -19143,9 +19163,9 @@ function headingLevel(options) {
|
|
|
19143
19163
|
|
|
19144
19164
|
// src/render/markdown/image-resources.ts
|
|
19145
19165
|
var import_posix3 = __toESM(require("node:path/posix"));
|
|
19146
|
-
var
|
|
19166
|
+
var import_node_crypto2 = __toESM(require("node:crypto"));
|
|
19147
19167
|
function computeHash(source) {
|
|
19148
|
-
return
|
|
19168
|
+
return import_node_crypto2.default.createHash("md5").update(source).digest("hex");
|
|
19149
19169
|
}
|
|
19150
19170
|
function getFilename(fileInfo, src) {
|
|
19151
19171
|
const key = [fileInfo.fullPath, src].join("-");
|
package/dist/style/core.css
CHANGED
|
@@ -5,10 +5,13 @@ h3,
|
|
|
5
5
|
h4,
|
|
6
6
|
h5,
|
|
7
7
|
h6 {
|
|
8
|
-
font-
|
|
9
|
-
|
|
8
|
+
font-family: var(--docs-heading-font-family);
|
|
9
|
+
font-weight: var(--docs-heading-font-weight);
|
|
10
|
+
line-height: var(--docs-heading-line-height);
|
|
10
11
|
margin-top: 0;
|
|
11
12
|
margin-bottom: 0.25rem;
|
|
13
|
+
text-wrap: balance;
|
|
14
|
+
text-wrap: pretty;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
h1 {
|
package/dist/style/index.css
CHANGED
|
@@ -5,10 +5,13 @@ h3,
|
|
|
5
5
|
h4,
|
|
6
6
|
h5,
|
|
7
7
|
h6 {
|
|
8
|
-
font-
|
|
9
|
-
|
|
8
|
+
font-family: var(--docs-heading-font-family);
|
|
9
|
+
font-weight: var(--docs-heading-font-weight);
|
|
10
|
+
line-height: var(--docs-heading-line-height);
|
|
10
11
|
margin-top: 0;
|
|
11
12
|
margin-bottom: 0.25rem;
|
|
13
|
+
text-wrap: balance;
|
|
14
|
+
text-wrap: pretty;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
h1 {
|
|
@@ -836,6 +839,15 @@ kbd {
|
|
|
836
839
|
background-color: #f4f4f4;
|
|
837
840
|
}
|
|
838
841
|
|
|
842
|
+
:root {
|
|
843
|
+
--docs-font-family: arial, "Helvetica Neue", sans-serif;
|
|
844
|
+
--docs-font-weight: normal;
|
|
845
|
+
--docs-heading-font-family: arial, "Helvetica Neue", sans-serif;
|
|
846
|
+
--docs-heading-font-weight: normal;
|
|
847
|
+
--docs-heading-line-height: 1.4;
|
|
848
|
+
--docs-menu-width-expanded: 230px;
|
|
849
|
+
}
|
|
850
|
+
|
|
839
851
|
*,
|
|
840
852
|
*::before,
|
|
841
853
|
*::after {
|
|
@@ -897,9 +909,6 @@ textarea {
|
|
|
897
909
|
}
|
|
898
910
|
|
|
899
911
|
html {
|
|
900
|
-
--docs-font-family: arial, "Helvetica Neue", sans-serif;
|
|
901
|
-
--docs-font-weight: normal;
|
|
902
|
-
--docs-menu-width-expanded: 230px;
|
|
903
912
|
scroll-behavior: smooth;
|
|
904
913
|
}
|
|
905
914
|
|
package/dist/style/site.css
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--docs-font-family: arial, "Helvetica Neue", sans-serif;
|
|
3
|
+
--docs-font-weight: normal;
|
|
4
|
+
--docs-heading-font-family: arial, "Helvetica Neue", sans-serif;
|
|
5
|
+
--docs-heading-font-weight: normal;
|
|
6
|
+
--docs-heading-line-height: 1.4;
|
|
7
|
+
--docs-menu-width-expanded: 230px;
|
|
8
|
+
}
|
|
9
|
+
|
|
1
10
|
*,
|
|
2
11
|
*::before,
|
|
3
12
|
*::after {
|
|
@@ -59,9 +68,6 @@ textarea {
|
|
|
59
68
|
}
|
|
60
69
|
|
|
61
70
|
html {
|
|
62
|
-
--docs-font-family: arial, "Helvetica Neue", sans-serif;
|
|
63
|
-
--docs-font-weight: normal;
|
|
64
|
-
--docs-menu-width-expanded: 230px;
|
|
65
71
|
scroll-behavior: smooth;
|
|
66
72
|
}
|
|
67
73
|
|