@forsakringskassan/docs-generator 2.17.0 → 2.17.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.
|
@@ -85,6 +85,19 @@ function hasTag(tags, tag) {
|
|
|
85
85
|
return Boolean(match);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
const replacement = {
|
|
89
|
+
"<": `<`,
|
|
90
|
+
">": `>`,
|
|
91
|
+
"&": `&`,
|
|
92
|
+
'"': `"`,
|
|
93
|
+
"'": `'`
|
|
94
|
+
};
|
|
95
|
+
function htmlencode(text) {
|
|
96
|
+
return text.replace(/[<>&"']/g, (m) => {
|
|
97
|
+
return replacement[m];
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
88
101
|
function parseImport(raw) {
|
|
89
102
|
const comments = [];
|
|
90
103
|
const stripped = raw.replace(/<!--.*?-->/gms, (match) => {
|
|
@@ -502,19 +515,6 @@ function highlight({
|
|
|
502
515
|
}
|
|
503
516
|
}
|
|
504
517
|
|
|
505
|
-
const replacement = {
|
|
506
|
-
"<": `<`,
|
|
507
|
-
">": `>`,
|
|
508
|
-
"&": `&`,
|
|
509
|
-
'"': `"`,
|
|
510
|
-
"'": `'`
|
|
511
|
-
};
|
|
512
|
-
function htmlencode(text) {
|
|
513
|
-
return text.replace(/[<>&"']/g, (m) => {
|
|
514
|
-
return replacement[m];
|
|
515
|
-
});
|
|
516
|
-
}
|
|
517
|
-
|
|
518
518
|
function replaceAtLink(text) {
|
|
519
519
|
return text.replace(
|
|
520
520
|
/{@link [^}]+[$}]/g,
|
|
@@ -1092,5 +1092,6 @@ exports.generateId = generateId;
|
|
|
1092
1092
|
exports.getFingerprint = getFingerprint;
|
|
1093
1093
|
exports.getOutputFilePath = getOutputFilePath;
|
|
1094
1094
|
exports.hasTag = hasTag;
|
|
1095
|
+
exports.htmlencode = htmlencode;
|
|
1095
1096
|
exports.normalizePath = normalizePath;
|
|
1096
1097
|
exports.parseInfostring = parseInfostring;
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var vendor = require('./vendor-BeoVq2Sv.js');
|
|
|
6
6
|
var path$1 = require('node:path');
|
|
7
7
|
var require$$1 = require('crypto');
|
|
8
8
|
require('node:crypto');
|
|
9
|
-
var createMarkdownRenderer = require('./create-markdown-renderer-
|
|
9
|
+
var createMarkdownRenderer = require('./create-markdown-renderer-2ejm6Tub.js');
|
|
10
10
|
var node_child_process = require('node:child_process');
|
|
11
11
|
var util = require('node:util');
|
|
12
12
|
var codeFrame = require('@babel/code-frame');
|
|
@@ -1231,15 +1231,16 @@ function generatePropTable(slug, props) {
|
|
|
1231
1231
|
<dl class="docs-api docs-api--slots">
|
|
1232
1232
|
${props.map((prop) => {
|
|
1233
1233
|
const { name } = prop;
|
|
1234
|
-
const id = `${slug}-
|
|
1234
|
+
const id = `${slug}-prop-${slugify(name)}`;
|
|
1235
1235
|
return (
|
|
1236
1236
|
/* HTML */
|
|
1237
1237
|
`
|
|
1238
1238
|
<dt>
|
|
1239
1239
|
<code id="${id}"
|
|
1240
1240
|
><a class="docs-api__anchor" href="#${id}"
|
|
1241
|
-
><span class="docs-api__name"
|
|
1242
|
-
|
|
1241
|
+
><span class="docs-api__name"
|
|
1242
|
+
>${createMarkdownRenderer.htmlencode(name)}</span
|
|
1243
|
+
>: ${createMarkdownRenderer.htmlencode(prop.type ?? "unknown")}</a
|
|
1243
1244
|
></code
|
|
1244
1245
|
>
|
|
1245
1246
|
${prop.required ? "" : `<span class="docs-tag docs-tag--default">Optional</span>`}
|
|
@@ -1247,7 +1248,7 @@ function generatePropTable(slug, props) {
|
|
|
1247
1248
|
</dt>
|
|
1248
1249
|
<dd>
|
|
1249
1250
|
${render$3(prop.description)}
|
|
1250
|
-
${prop.default ? `<p class="doc-api__item">Default: <code>${prop.default.value}</code></p>` : ""}
|
|
1251
|
+
${prop.default ? `<p class="doc-api__item">Default: <code>${createMarkdownRenderer.htmlencode(prop.default.value)}</code></p>` : ""}
|
|
1251
1252
|
${prop.deprecated ? `<p class="doc-api__item docs-deprecated">Deprecated: ${renderInline$2(prop.deprecated)}</p>` : ""}
|
|
1252
1253
|
</dd>
|
|
1253
1254
|
`
|
|
@@ -1277,7 +1278,7 @@ function generateEventTable(slug, events) {
|
|
|
1277
1278
|
<dl class="docs-api docs-api--events">
|
|
1278
1279
|
${events.map((event) => {
|
|
1279
1280
|
const { name } = event;
|
|
1280
|
-
const id = `${slug}-event-${name}`;
|
|
1281
|
+
const id = `${slug}-event-${slugify(name)}`;
|
|
1281
1282
|
const haveProperties = event.properties.length > 0;
|
|
1282
1283
|
return (
|
|
1283
1284
|
/* HTML */
|
|
@@ -1286,7 +1287,7 @@ function generateEventTable(slug, events) {
|
|
|
1286
1287
|
<code id="${id}"
|
|
1287
1288
|
><a class="docs-api__anchor" href="#${id}"
|
|
1288
1289
|
><span class="docs-api__name"
|
|
1289
|
-
>${name}</span
|
|
1290
|
+
>${createMarkdownRenderer.htmlencode(name)}</span
|
|
1290
1291
|
></a
|
|
1291
1292
|
></code
|
|
1292
1293
|
>
|
|
@@ -1297,9 +1298,9 @@ function generateEventTable(slug, events) {
|
|
|
1297
1298
|
${haveProperties ? `<p class="docs-api__list-title">Arguments:</p><ul class="docs-api__list">` : ""}
|
|
1298
1299
|
${event.properties.map((it) => {
|
|
1299
1300
|
if (it.description) {
|
|
1300
|
-
return `<li><code>${it.name}: ${it.type}</code> ${EM_DASH$1} ${it.description}</li>`;
|
|
1301
|
+
return `<li><code>${createMarkdownRenderer.htmlencode(it.name)}: ${createMarkdownRenderer.htmlencode(it.type ?? "unknown")}</code> ${EM_DASH$1} ${renderInline$1(it.description)}</li>`;
|
|
1301
1302
|
} else {
|
|
1302
|
-
return `<li><code>${it.name}: ${it.type}</code></li>`;
|
|
1303
|
+
return `<li><code>${createMarkdownRenderer.htmlencode(it.name)}: ${createMarkdownRenderer.htmlencode(it.type ?? "unknown")}</code></li>`;
|
|
1303
1304
|
}
|
|
1304
1305
|
}).join("")}
|
|
1305
1306
|
${haveProperties ? `</ul>` : ""}
|
|
@@ -1332,7 +1333,7 @@ function generateSlotTable(slug, slots) {
|
|
|
1332
1333
|
<dl class="docs-api docs-api--slots">
|
|
1333
1334
|
${slots.map((slot) => {
|
|
1334
1335
|
const { name } = slot;
|
|
1335
|
-
const id = `${slug}-slot-${name}`;
|
|
1336
|
+
const id = `${slug}-slot-${slugify(name)}`;
|
|
1336
1337
|
const haveBindings = slot.bindings.length > 0;
|
|
1337
1338
|
return (
|
|
1338
1339
|
/* HTML */
|
|
@@ -1341,7 +1342,7 @@ function generateSlotTable(slug, slots) {
|
|
|
1341
1342
|
<code id="${id}"
|
|
1342
1343
|
><a class="docs-api__anchor" href="#${id}"
|
|
1343
1344
|
><span class="docs-api__name"
|
|
1344
|
-
>${name}</span
|
|
1345
|
+
>${createMarkdownRenderer.htmlencode(name)}</span
|
|
1345
1346
|
></a
|
|
1346
1347
|
></code
|
|
1347
1348
|
>
|
|
@@ -1352,9 +1353,9 @@ function generateSlotTable(slug, slots) {
|
|
|
1352
1353
|
${haveBindings ? `<p class="docs-api__list-title">Bindings:</p><ul class="docs-api__list">` : ""}
|
|
1353
1354
|
${slot.bindings.map((it) => {
|
|
1354
1355
|
if (it.description) {
|
|
1355
|
-
return `<li><code>${it.name}: ${it.type}</code> ${EM_DASH} ${it.description}</li>`;
|
|
1356
|
+
return `<li><code>${createMarkdownRenderer.htmlencode(it.name)}: ${createMarkdownRenderer.htmlencode(it.type ?? "unknown")}</code> ${EM_DASH} ${renderInline(it.description)}</li>`;
|
|
1356
1357
|
} else {
|
|
1357
|
-
return `<li><code>${it.name}: ${it.type}</code></li>`;
|
|
1358
|
+
return `<li><code>${createMarkdownRenderer.htmlencode(it.name)}: ${createMarkdownRenderer.htmlencode(it.type ?? "unknown")}</code></li>`;
|
|
1358
1359
|
}
|
|
1359
1360
|
}).join("")}
|
|
1360
1361
|
${haveBindings ? `</ul>` : ""}
|
package/dist/markdown.js
CHANGED