markdown-design-doc-viewer-embed 1.5.3 → 1.5.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markdown-design-doc-viewer-embed",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "description": "The viewer of Markdown Design Doc Viewer to embed in a web app (React or not): design documents in Markdown with their mermaid sequence diagrams, flowcharts, ER and state diagrams and wireframes linked to the steps after them.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -36,6 +36,10 @@
36
36
  "types": "./types/embed/react.d.ts",
37
37
  "default": "./react.js"
38
38
  },
39
+ "./export": {
40
+ "types": "./types/embed/export.d.ts",
41
+ "default": "./export.js"
42
+ },
39
43
  "./viewer.css": "./viewer.css",
40
44
  "./package.json": "./package.json"
41
45
  },
@@ -0,0 +1,4 @@
1
+ import { type ExportOptions } from './viewer.js';
2
+ export type { DiagramLook, ExportOptions } from './viewer.js';
3
+ /** The HTML file of the design document of `options`, as a string. */
4
+ export declare function exportHtml(options: ExportOptions): Promise<string>;
@@ -1,4 +1,4 @@
1
- import type { DiagramLook } from '../src/shared/protocol.js';
1
+ import { type DiagramLook } from '../src/shared/protocol.js';
2
2
  export type { DiagramLook };
3
3
  export interface ViewerOptions {
4
4
  /** The Markdown of the design document. */
@@ -42,7 +42,7 @@ export interface ViewerOptions {
42
42
  headingNumbers?: boolean;
43
43
  /**
44
44
  * Breaks the labels of the arrows of the sequence diagrams into lines at this many characters (a full-width one
45
- * counts as 2). 0 does not break them. 30 by default.
45
+ * counts as 2). 0 does not break them. 40 by default.
46
46
  */
47
47
  messageWrapWidth?: number;
48
48
  /**
@@ -69,3 +69,17 @@ export interface Viewer {
69
69
  export declare function openLinkInNewTab(href: string): void;
70
70
  /** Shows the design document of `options` in `container`, which it fills. */
71
71
  export declare function createViewer(container: HTMLElement, options: ViewerOptions): Viewer;
72
+ /** The options of `exportHtml` (`markdown-design-doc-viewer-embed/export`). */
73
+ export interface ExportOptions extends Pick<ViewerOptions, 'markdown' | 'baseUrl' | 'readFile' | 'diagramLook' | 'splitMinWidth' | 'toc' | 'limitContentWidth' | 'stickyTableHeader' | 'tableTreeHighlight' | 'frontMatter' | 'headingNumbers' | 'messageWrapWidth'> {
74
+ /** The language of the texts of the exported file: `en`, or `ja`. That of the browser by default. */
75
+ lang?: 'en' | 'ja';
76
+ /** The title of the page when the document has none (neither `title` in its front matter nor a `#` heading). */
77
+ title?: string;
78
+ /**
79
+ * What an image of the document (a path, not a URL) becomes in the exported file: a data URI to embed it, or a URL to
80
+ * link it. It is given the `src` of the image without its query and fragment (`icons.svg` of `icons.svg#save`), which
81
+ * are added back to a URL. By default, resolved from `baseUrl` (or left as it is without it). When it fails, the
82
+ * `src` is kept.
83
+ */
84
+ resolveImage?: (path: string) => string | Promise<string>;
85
+ }