@forsakringskassan/docs-generator 1.27.0 → 1.29.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/README.md CHANGED
@@ -228,6 +228,11 @@ Document title used for `<title>` and `<nav>`
228
228
  Set to `false` to hide document from navigation menu.
229
229
  Default `true`.
230
230
 
231
+ #### `include`
232
+
233
+ Set to `false` to not write the document to file or include as a page.
234
+ Default `true`.
235
+
231
236
  ### Inline tags
232
237
 
233
238
  #### `{@link ...}`
@@ -3,21 +3,21 @@
3
3
  var path$1 = require('node:path');
4
4
  var esbuild = require('esbuild');
5
5
  var vue = require('vue');
6
- var vue2 = require('./vue2-DYKDshbg.js');
7
- var vue3 = require('./vue3-CEA3zw16.js');
6
+ var vue2 = require('./vue2-CBDrnmVO.js');
7
+ var vue3 = require('./vue3-xJIC7Aol.js');
8
8
  var path = require('node:path/posix');
9
9
  require('@vue/compiler-sfc');
10
- require('./vendor-Dmnzl4fQ.js');
11
- require('fs');
12
- require('constants');
13
- require('stream');
14
- require('util');
15
- require('assert');
10
+ require('./vendor-uab7h6x-.js');
16
11
  require('path');
17
12
  require('url');
13
+ require('fs');
18
14
  require('fs/promises');
19
15
  require('events');
16
+ require('stream');
20
17
  require('string_decoder');
18
+ require('constants');
19
+ require('util');
20
+ require('assert');
21
21
  require('readline');
22
22
  require('child_process');
23
23
  require('node:buffer');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var vendor = require('./vendor-Dmnzl4fQ.js');
3
+ var vendor = require('./vendor-uab7h6x-.js');
4
4
  var path = require('node:path/posix');
5
5
  require('node:path');
6
6
  require('crypto');
@@ -277,7 +277,14 @@ function codePreview(options) {
277
277
  const fullscreen = tags.includes("fullscreen");
278
278
  const modifier = getClassModifier(tags);
279
279
  const standalone = Boolean(example.output) && fullscreen;
280
- const testIdAttr = testId ? ` data-test="${testId}"` : "";
280
+ const testIdAttr = testId ? `data-test="${testId}"` : "";
281
+ const filteredTags = tags.filter((it) => {
282
+ if (it.startsWith("test-id=")) {
283
+ return false;
284
+ }
285
+ return true;
286
+ });
287
+ const dataTagsAttr = filteredTags.length > 0 ? `data-tags=${filteredTags.join(" ")}` : "";
281
288
  if (liveExample) {
282
289
  return (
283
290
  /* HTML */
@@ -286,6 +293,8 @@ function codePreview(options) {
286
293
  id="example-${fingerprint}"
287
294
  class="code-preview code-preview--borderless"
288
295
  ${testIdAttr}
296
+ ${dataTagsAttr}
297
+ data-language="${example.language}"
289
298
  >
290
299
  ${example.markup}
291
300
  </div>
@@ -300,6 +309,8 @@ function codePreview(options) {
300
309
  id="example-${fingerprint}"
301
310
  class="code-preview ${modifier}"
302
311
  ${testIdAttr}
312
+ ${dataTagsAttr}
313
+ data-language="${example.language}"
303
314
  >
304
315
  ${example.comments.join("\n")}
305
316
  <pre class="code-preview__markup">${highlightedCode}</pre>
@@ -315,6 +326,8 @@ function codePreview(options) {
315
326
  id="example-${fingerprint}"
316
327
  class="code-preview ${modifier}"
317
328
  ${testIdAttr}
329
+ ${dataTagsAttr}
330
+ data-language="${example.language}"
318
331
  >
319
332
  ${example.comments.join("\n")}
320
333
  <div class="code-preview__preview">${example.markup}</div>
@@ -352,6 +365,8 @@ function codePreview(options) {
352
365
  id="example-${fingerprint}"
353
366
  class="code-preview ${modifier}"
354
367
  ${testIdAttr}
368
+ ${dataTagsAttr}
369
+ data-language="${example.language}"
355
370
  >
356
371
  ${example.comments.join("\n")}
357
372
  <div class="code-preview__preview">${example.markup}</div>
@@ -544,6 +559,15 @@ function include(docs, env, included, handleSoftError) {
544
559
  /* HTML */
545
560
  ` <div>${content}</div> `
546
561
  );
562
+ },
563
+ alt(tokens, index) {
564
+ const token = tokens[index];
565
+ const needle = token.info.split(" ")[1];
566
+ const doc = findDocument(docs, needle);
567
+ if (doc && doc.format === "markdown") {
568
+ return md.render(doc.body, env);
569
+ }
570
+ return md.render(token.content, env);
547
571
  }
548
572
  });
549
573
  };
@@ -26,6 +26,13 @@ export declare interface CompileOptions {
26
26
  attributes: AttributeTable;
27
27
  }
28
28
 
29
+ /**
30
+ * Tiny wrapper to provide type completion for IDE.
31
+ *
32
+ * @public
33
+ */
34
+ export declare function defineSources(sources: SourceFiles[]): SourceFiles[];
35
+
29
36
  /**
30
37
  * @public
31
38
  */
@@ -332,7 +339,7 @@ export declare interface ProcessorContext {
332
339
  * @param id - A unique identifier for this block.
333
340
  * @param renderer - Describes how to render the block content.
334
341
  */
335
- addTemplateBlock(container: string, id: string, renderer: TemplateBlockRenderer): void;
342
+ addTemplateBlock<T>(container: string, id: string, renderer: TemplateBlockRenderer<T>): void;
336
343
  /* Excluded from this release type: getAllTemplateBlocks */
337
344
  setTopNavigation(root: NavigationSection): void;
338
345
  setSideNavigation(root: NavigationSection): void;
@@ -444,9 +451,9 @@ export declare interface SourceFiles {
444
451
  *
445
452
  * @public
446
453
  */
447
- export declare type TemplateBlockRenderer = {
454
+ export declare type TemplateBlockRenderer<T> = {
448
455
  filename: string;
449
- data?: Record<string, unknown>;
456
+ data?: T;
450
457
  } | {
451
458
  render(): string;
452
459
  };
@@ -464,6 +471,26 @@ export declare interface TemplateData {
464
471
  */
465
472
  export declare function themeSelectProcessor(): Processor;
466
473
 
474
+ /**
475
+ * Single entry for a topnav item.
476
+ *
477
+ * @public
478
+ */
479
+ export declare interface TopnavEntry {
480
+ path: string;
481
+ title: string;
482
+ }
483
+
484
+ /**
485
+ * Processor to create a manual topnav:
486
+ *
487
+ * - Custom order.
488
+ * - Custom items.
489
+ *
490
+ * @public
491
+ */
492
+ export declare function topnavProcessor(filename: string, title: string): Processor;
493
+
467
494
  /**
468
495
  * Represents a compiled vendor asset.
469
496
  *
@@ -555,7 +582,21 @@ export declare function versionBannerProcessor(message: string, container: strin
555
582
  export declare function versionProcessor(pkg: {
556
583
  name: string;
557
584
  version: string;
558
- }, container: string): Processor;
585
+ homepage: string;
586
+ }, container: string, options?: VersionProcessorOptions): Processor;
587
+
588
+ /**
589
+ * Options for {@link versionProcessor}.
590
+ *
591
+ * @public
592
+ */
593
+ export declare interface VersionProcessorOptions {
594
+ readonly enabled: boolean;
595
+ readonly scm?: {
596
+ readonly commitUrlFormat: string;
597
+ readonly prUrlFormat: string;
598
+ };
599
+ }
559
600
 
560
601
  /**
561
602
  * Generate API documentation from a Vue SFC.