@forsakringskassan/docs-generator 3.1.1 → 3.2.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.
@@ -209,6 +209,54 @@ export declare interface FileInfo {
209
209
  outputName: string | false;
210
210
  }
211
211
 
212
+ /**
213
+ * Resolve a link from a `{@link ...}` tag.
214
+ *
215
+ * Link resolvers are processed in order, the first resolver returning a result
216
+ * is used. If your resolver cannot resolve the link it must return `null` or
217
+ * `undefined`.
218
+ *
219
+ * If the key matches a document (by id, name or alias) the document is passed
220
+ * in as a parameter.
221
+ *
222
+ * @example
223
+ * ```ts
224
+ * const linkResolver: LinkResolver = ({ key, title }) => {
225
+ * if (key === "foo") {
226
+ * return {
227
+ * href: "https://example.net/foo",
228
+ * title,
229
+ * rel: "external",
230
+ * };
231
+ * }
232
+ * return null;
233
+ * };
234
+ * ```
235
+ *
236
+ * @public
237
+ * @since %version%
238
+ * @param link - Link data
239
+ * @returns A resolved link or `null` or `undefined` if this resolver cannot
240
+ * handle this link
241
+ */
242
+ export declare type LinkResolver = (this: void, link: {
243
+ /** Key (without hash) referenced by user */
244
+ readonly key: string;
245
+ /** Optional hash from key (includes the `#` prefix) */
246
+ readonly hash: string | null;
247
+ /** Optional explicit title requested by user */
248
+ readonly title: string | null;
249
+ /** Matching document if one was found */
250
+ readonly doc: Document_2 | null;
251
+ }) => {
252
+ /** Link target (href attribute of the `<a>` element) */
253
+ readonly href: string;
254
+ /** Link text */
255
+ readonly title: string;
256
+ /** If given, the `rel` attribute is set with this value on the `<a>` element */
257
+ readonly rel?: "external";
258
+ } | undefined | null;
259
+
212
260
  /**
213
261
  * Options for [[createMarkdownRenderer]].
214
262
  *
@@ -247,6 +295,8 @@ export declare interface MarkdownOptions {
247
295
  /** Default titles for messageboxes */
248
296
  title?: Record<string, string>;
249
297
  };
298
+ /** List of link resolvers to use */
299
+ readonly linkResolvers?: LinkResolver[] | undefined;
250
300
  }
251
301
 
252
302
  /**
package/dist/markdown.mjs CHANGED
@@ -2,8 +2,8 @@ import { createRequire as $createRequire } from "node:module";
2
2
 
3
3
  const require = $createRequire(import.meta.url);
4
4
 
5
- export { S as SoftError, c as createMarkdownRenderer } from './create-markdown-renderer-castrIfY.mjs';
6
- import './vendor-DO1GigtJ.mjs';
5
+ export { S as SoftError, c as createMarkdownRenderer } from './create-markdown-renderer-p3FAbLe1.mjs';
6
+ import './vendor-DR1Vkbzf.mjs';
7
7
  import 'node:url';
8
8
  import 'node:path';
9
9
  import 'fs';
@@ -39,6 +39,6 @@ import 'v8';
39
39
  import 'node:path/posix';
40
40
  import 'node:child_process';
41
41
  import 'vue';
42
- import './vue3-CnvFixWY.mjs';
42
+ import './vue3-B3-18vX3.mjs';
43
43
  import 'vue/compiler-sfc';
44
44
  //# sourceMappingURL=markdown.mjs.map
@@ -5,7 +5,11 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
8
+ try {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ } catch (e) {
11
+ throw mod = 0, e;
12
+ }
9
13
  };
10
14
  var __copyProps = (to, from, except, desc) => {
11
15
  if (from && typeof from === "object" || typeof from === "function") {
@@ -1137,6 +1141,7 @@ var require_range = __commonJS({
1137
1141
  return comp;
1138
1142
  };
1139
1143
  var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
1144
+ var invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
1140
1145
  var replaceTildes = (comp, options) => {
1141
1146
  return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
1142
1147
  };
@@ -1196,9 +1201,9 @@ var require_range = __commonJS({
1196
1201
  debug("no pr");
1197
1202
  if (M === "0") {
1198
1203
  if (m === "0") {
1199
- ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
1204
+ ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
1200
1205
  } else {
1201
- ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
1206
+ ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
1202
1207
  }
1203
1208
  } else {
1204
1209
  ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
@@ -1217,6 +1222,9 @@ var require_range = __commonJS({
1217
1222
  const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
1218
1223
  return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
1219
1224
  debug("xRange", comp, ret, gtlt, M, m, p, pr);
1225
+ if (invalidXRangeOrder(M, m, p)) {
1226
+ return comp;
1227
+ }
1220
1228
  const xM = isX(M);
1221
1229
  const xm = xM || isX(m);
1222
1230
  const xp = xm || isX(p);