UNPKG

asciidoctor-kroki

Version:

Asciidoctor extension to convert diagrams to images using Kroki

36 lines 2.38 kB
/** * Fetches a rendered diagram from Kroki and returns it as a `data:` URI, * embedding the content directly without writing any file. Shared by data-URI * mode and by the `inline` option, which both need the content carried in the * node (as a standard data-URI image target) rather than referenced by URL or * file path — keeping the extension converter-agnostic. * * @param {import('./kroki-client.js').KrokiDiagram} krokiDiagram - Diagram to render. * @param {import('./kroki-client.js').KrokiClient} krokiClient - Client used to fetch the diagram. * @returns {Promise<string>} A `data:` URI embedding the rendered diagram. */ declare const toDataUri: (krokiDiagram: import('./kroki-client.js').KrokiDiagram, krokiClient: import('./kroki-client.js').KrokiClient) => Promise<string>; declare const _default: { toDataUri: typeof toDataUri; /** * Fetches a rendered diagram from Kroki (or from the local cache) and either * saves it to the virtual filesystem or returns it as a `data:` URI. * * When an explicit name is provided, the file name is the name itself (e.g. * `foo.svg`) so that links stay stable across content changes. Anonymous * diagrams use a content-addressed name (`diag-<sha256>.svg`) so they never * collide and can be reused from disk when unchanged. * * @param {import('./kroki-client.js').KrokiDiagram} krokiDiagram - Diagram to render. * @param {Object} doc - Asciidoctor document whose attributes control output paths * and data-URI mode (`data-uri`, `kroki-data-uri`, `imagesoutdir`, `imagesdir`). * @param {string|undefined} target - Explicit base name for the output file; when omitted a content-addressed name is used. * @param {Object|undefined} vfs - Virtual filesystem implementation; resolved via {@link resolveVfs}. * @param {import('./kroki-client.js').KrokiClient} krokiClient - Client used to fetch the diagram when not cached. * @returns {Promise<string>} The diagram file name (relative to the images output directory) * or a `data:` URI when data-URI mode is active. */ save: (krokiDiagram: import('./kroki-client.js').KrokiDiagram, doc: any, target: string | undefined, vfs: any | undefined, krokiClient: import('./kroki-client.js').KrokiClient) => Promise<string>; }; export default _default; //# sourceMappingURL=fetch.d.ts.map