@forsakringskassan/docs-generator 2.29.3 → 2.30.1
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/{create-markdown-renderer-Bqm7kdpQ.mjs → create-markdown-renderer-CuJEYJ_W.mjs} +54 -43
- package/dist/create-markdown-renderer-CuJEYJ_W.mjs.map +1 -0
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +68 -47
- package/dist/index.mjs.map +1 -1
- package/dist/markdown.d.mts +8 -8
- package/dist/markdown.mjs +3 -3
- package/dist/processors/selectable-version.mjs +3 -2
- package/dist/runtime.mjs +9450 -10293
- package/dist/style/core.css +1 -1
- package/dist/style/index.css +66 -2
- package/dist/style/site.css +65 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/{vendor-COMHgwYY.mjs → vendor-PyKPmsiH.mjs} +69 -22
- package/dist/vendor-PyKPmsiH.mjs.map +1 -0
- package/dist/{vue3-CRwEnRGE.mjs → vue3-Bvwupe7o.mjs} +9 -4
- package/dist/vue3-Bvwupe7o.mjs.map +1 -0
- package/dist/{worker-DE8HC-uI.mjs → worker-CmH8hTq1.mjs} +2 -2
- package/dist/{worker-DE8HC-uI.mjs.map → worker-CmH8hTq1.mjs.map} +1 -1
- package/package.json +2 -1
- package/dist/create-markdown-renderer-Bqm7kdpQ.mjs.map +0 -1
- package/dist/vendor-COMHgwYY.mjs.map +0 -1
- package/dist/vue3-CRwEnRGE.mjs.map +0 -1
package/dist/{create-markdown-renderer-Bqm7kdpQ.mjs → create-markdown-renderer-CuJEYJ_W.mjs}
RENAMED
|
@@ -2,7 +2,7 @@ import { createRequire as $createRequire } from "node:module";
|
|
|
2
2
|
|
|
3
3
|
const require = $createRequire(import.meta.url);
|
|
4
4
|
|
|
5
|
-
import { d as dedent, H as HighlightJS, c as createTwoFilesPatch, M as MarkdownIt, a as deflist_plugin } from './vendor-
|
|
5
|
+
import { d as dedent, H as HighlightJS, c as createTwoFilesPatch, M as MarkdownIt, a as deflist_plugin } from './vendor-PyKPmsiH.mjs';
|
|
6
6
|
import path from 'node:path/posix';
|
|
7
7
|
import path$1 from 'node:path';
|
|
8
8
|
import 'crypto';
|
|
@@ -10,7 +10,7 @@ import crypto from 'node:crypto';
|
|
|
10
10
|
import 'node:child_process';
|
|
11
11
|
import fs__default from 'node:fs';
|
|
12
12
|
import { version } from 'vue';
|
|
13
|
-
import { g as generateCode } from './vue3-
|
|
13
|
+
import { g as generateCode } from './vue3-Bvwupe7o.mjs';
|
|
14
14
|
|
|
15
15
|
function isDocumentPage(doc) {
|
|
16
16
|
return doc.kind === "page";
|
|
@@ -50,7 +50,7 @@ const replacements = {
|
|
|
50
50
|
\u00F6: "o"
|
|
51
51
|
};
|
|
52
52
|
function findVersion(text) {
|
|
53
|
-
const match =
|
|
53
|
+
const match = /(\d+)\.(\d+)\.(\d+) \(\d+-\d+-\d+\)/.exec(text);
|
|
54
54
|
if (match) {
|
|
55
55
|
return [
|
|
56
56
|
parseInt(match[1], 10),
|
|
@@ -261,10 +261,13 @@ function removeLinesInline(lines, { begin, end }) {
|
|
|
261
261
|
function cutSnippets(code) {
|
|
262
262
|
const lines = code.split(/\n/).map((it, index, lines2) => index < lines2.length - 1 ? `${it}
|
|
263
263
|
` : it);
|
|
264
|
-
const directive =
|
|
264
|
+
const directive = (
|
|
265
|
+
/* eslint-disable-next-line sonarjs/regex-complexity -- not to bad for a regexp */
|
|
266
|
+
/(?:\/\* +--- +cut (?<js>above|below|begin|end) +--- +\*\/|<!---? +cut (?<html>above|below|begin|end) +---?>)/
|
|
267
|
+
);
|
|
265
268
|
let buffer = -1;
|
|
266
269
|
lines.forEach((line, index) => {
|
|
267
|
-
const match =
|
|
270
|
+
const match = directive.exec(line);
|
|
268
271
|
const { js, html } = match?.groups ?? { js: null, html: null };
|
|
269
272
|
const instruction = js ?? html;
|
|
270
273
|
if (!instruction) {
|
|
@@ -349,7 +352,7 @@ function transformCode(code, lang) {
|
|
|
349
352
|
return code;
|
|
350
353
|
}
|
|
351
354
|
|
|
352
|
-
var exampleWorkerUrl = new URL("./worker-
|
|
355
|
+
var exampleWorkerUrl = new URL("./worker-CmH8hTq1.mjs", import.meta.url);
|
|
353
356
|
|
|
354
357
|
class SoftError extends Error {
|
|
355
358
|
code;
|
|
@@ -367,34 +370,37 @@ class SoftError extends Error {
|
|
|
367
370
|
}
|
|
368
371
|
|
|
369
372
|
function processInlineTags(tags, doc, docs, text, handleSoftError) {
|
|
370
|
-
return text.replace(
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
373
|
+
return text.replace(
|
|
374
|
+
/{@(@?)([^{}]+)}/g,
|
|
375
|
+
(_, escape, content) => {
|
|
376
|
+
if (escape) {
|
|
377
|
+
return `{@${content}}`;
|
|
378
|
+
}
|
|
379
|
+
const match = /^(\S+)($|\s[^]+)$/.exec(content);
|
|
380
|
+
if (!match) {
|
|
381
|
+
return `{@${content}}`;
|
|
382
|
+
}
|
|
383
|
+
const [, name, text2] = match;
|
|
384
|
+
const tag = tags.find((it) => it.name === name);
|
|
385
|
+
if (!tag) {
|
|
386
|
+
return handleSoftError(
|
|
387
|
+
new SoftError(
|
|
388
|
+
"ETAGMISSING",
|
|
389
|
+
`No inline tag registered with the name "${name}"`
|
|
390
|
+
)
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
try {
|
|
394
|
+
return tag.handler(doc, docs, text2.trim());
|
|
395
|
+
} catch (err) {
|
|
396
|
+
if (err instanceof SoftError) {
|
|
397
|
+
return handleSoftError(err);
|
|
398
|
+
} else {
|
|
399
|
+
throw err;
|
|
400
|
+
}
|
|
395
401
|
}
|
|
396
402
|
}
|
|
397
|
-
|
|
403
|
+
);
|
|
398
404
|
}
|
|
399
405
|
|
|
400
406
|
function getRelativeUrl(from, to) {
|
|
@@ -419,7 +425,7 @@ function getLinkTitle(doc, key, explicitTitle) {
|
|
|
419
425
|
return explicitTitle.replace(/^[\\|]\s*/, "");
|
|
420
426
|
}
|
|
421
427
|
const { title, component } = doc.attributes;
|
|
422
|
-
if (component
|
|
428
|
+
if (component?.some((it) => it.name === key)) {
|
|
423
429
|
return `<code>${key}</code>`;
|
|
424
430
|
} else {
|
|
425
431
|
return title ?? doc.name;
|
|
@@ -429,14 +435,16 @@ const linkTag = {
|
|
|
429
435
|
name: "link",
|
|
430
436
|
description: "Create a link to another document",
|
|
431
437
|
handler(doc, docs, content) {
|
|
432
|
-
const match =
|
|
438
|
+
const match = /^([^\s#]+)(#\S+)?\s*(.+)?$/.exec(content);
|
|
433
439
|
if (!match) {
|
|
434
440
|
throw new SoftError(
|
|
435
441
|
"ELINKFORMAT",
|
|
436
442
|
`Failed to parse link "${content}"`
|
|
437
443
|
);
|
|
438
444
|
}
|
|
439
|
-
const
|
|
445
|
+
const key = match[1];
|
|
446
|
+
const hash = match[2];
|
|
447
|
+
const explicitTitle = match[3];
|
|
440
448
|
if (key.startsWith("http://") || key.startsWith("https://")) {
|
|
441
449
|
return `<a href="${key}${hash ?? ""}">${explicitTitle ?? key}</a>`;
|
|
442
450
|
}
|
|
@@ -635,7 +643,7 @@ function codePreview(options) {
|
|
|
635
643
|
tags: rawTags
|
|
636
644
|
});
|
|
637
645
|
const { tags } = example;
|
|
638
|
-
const hashContent = `${map?.[0]}:${map?.[1]}:${info}:${rawContent}`;
|
|
646
|
+
const hashContent = `${String(map?.[0])}:${String(map?.[1])}:${info}:${rawContent}`;
|
|
639
647
|
const fingerprint = getFingerprint(hashContent);
|
|
640
648
|
const transformedCode = transformCode(example.source, example.language);
|
|
641
649
|
const highlightedCode = replaceAtLink(
|
|
@@ -724,7 +732,10 @@ function codePreview(options) {
|
|
|
724
732
|
const toggleFullscreen = showFullscreen ? (
|
|
725
733
|
/* HTML */
|
|
726
734
|
`
|
|
727
|
-
<a
|
|
735
|
+
<a
|
|
736
|
+
href="${standalonePath ?? ""}"
|
|
737
|
+
class="code-preview__fullscreen"
|
|
738
|
+
>
|
|
728
739
|
<i class="icon icon--fullscreen"></i>
|
|
729
740
|
Helsk\xE4rm
|
|
730
741
|
</a>
|
|
@@ -770,20 +781,20 @@ function headingLevel(options) {
|
|
|
770
781
|
const title = getTokensText(tokens[idx + 1]?.children ?? []);
|
|
771
782
|
let id = generateId(title);
|
|
772
783
|
if (ids.has(id)) {
|
|
773
|
-
id += `--${counter++}`;
|
|
784
|
+
id += `--${String(counter++)}`;
|
|
774
785
|
}
|
|
775
786
|
ids.add(id);
|
|
776
787
|
return tag.replace(/h(\d)/, (_, n) => {
|
|
777
788
|
const level = parseInt(n, 10) + offset;
|
|
778
789
|
env.currentHeading = level;
|
|
779
|
-
return `<h${level} id="${id}"><a class="header-anchor" href="#${id}">`;
|
|
790
|
+
return `<h${String(level)} id="${id}"><a class="header-anchor" href="#${id}">`;
|
|
780
791
|
});
|
|
781
792
|
};
|
|
782
793
|
md.renderer.rules.heading_close = function(tokens, idx) {
|
|
783
794
|
const { tag } = tokens[idx];
|
|
784
795
|
return tag.replace(/h(\d)/, (_, n) => {
|
|
785
796
|
const level = parseInt(n, 10) + offset;
|
|
786
|
-
return `</a></h${level}>`;
|
|
797
|
+
return `</a></h${String(level)}>`;
|
|
787
798
|
});
|
|
788
799
|
};
|
|
789
800
|
};
|
|
@@ -890,7 +901,7 @@ function detailsContainer(context, options) {
|
|
|
890
901
|
if (customTitle.length > 0) {
|
|
891
902
|
return customTitle.join(" ");
|
|
892
903
|
} else {
|
|
893
|
-
return options.title
|
|
904
|
+
return options.title.details ?? "Details";
|
|
894
905
|
}
|
|
895
906
|
}
|
|
896
907
|
return (tokens, index) => {
|
|
@@ -1017,7 +1028,7 @@ function containerParser(md, options) {
|
|
|
1017
1028
|
len = state.sCount[startLine];
|
|
1018
1029
|
state.line = nextLine + (haveEndMarker ? 1 : 0);
|
|
1019
1030
|
const token = state.push(`doc_${kind}`, "div", 0);
|
|
1020
|
-
token.info = info
|
|
1031
|
+
token.info = info.trim();
|
|
1021
1032
|
token.content = state.getLines(startLine + 1, nextLine, len, true);
|
|
1022
1033
|
token.markup = markup;
|
|
1023
1034
|
token.map = [startLine, state.line];
|
|
@@ -1169,4 +1180,4 @@ function createMarkdownRenderer(options) {
|
|
|
1169
1180
|
}
|
|
1170
1181
|
|
|
1171
1182
|
export { SoftError as S, getFingerprint as a, getOutputFilePath as b, createMarkdownRenderer as c, htmlencode as d, exampleWorkerUrl as e, findTag as f, generateId as g, hasTag as h, isDocumentPage as i, generateExample as j, normalizePath as n, parseInfostring as p };
|
|
1172
|
-
//# sourceMappingURL=create-markdown-renderer-
|
|
1183
|
+
//# sourceMappingURL=create-markdown-renderer-CuJEYJ_W.mjs.map
|