@flowdrop/flowdrop 2.15.1 → 2.15.3

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/CHANGELOG.md CHANGED
@@ -5,6 +5,37 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.15.3] - 2026-11-21
9
+
10
+ ### Added
11
+
12
+ - **`renderMarkdown()` in `@flowdrop/flowdrop/display`.** Turns Markdown into HTML for pages that place it
13
+ with `innerHTML` outside a Svelte component, with the same `marked` and `sanitizeHtml()` the message
14
+ views use. HTML in the source is shown as text, links and images keep http(s), root-relative and
15
+ fragment targets without control characters (relative paths, `//host` and other schemes such as
16
+ `mailto:` show their label as text), and links carry `rel="noopener noreferrer"` and keep their title.
17
+ Character references in targets and titles are decoded once. Alt text shows as plain text, and an
18
+ image inside a link shows it within that link; an image without alt text, or a link without a label,
19
+ shows its target as the label when the target is kept. `headingOffset` moves headings down for pages
20
+ that already own the upper levels; it is capped at 5, and anything that does not convert to a finite
21
+ number counts as 0.
22
+ - **`allowedLinkTarget()` in `@flowdrop/flowdrop/display`.** The link rule of `renderMarkdown()` on its own,
23
+ for host pages that build their own links: the trimmed target when it is http(s), root-relative or a
24
+ fragment and holds no control character (the browser drops tab, CR and LF inside a URL), otherwise `null`.
25
+
26
+ ### Fixed
27
+
28
+ - A node's external edit link opens only `http(s)` and relative URLs. A link whose URL has another scheme is not shown, nor are the External Editor buttons, unless the host handles the click itself through `onExternalEdit`. `resolveExternalEditUrl` returns `''` for such a URL.
29
+
30
+ ## [2.15.2] - 2026-10-18
31
+
32
+ ### Fixed
33
+
34
+ - **A config section you opened stays open while you type in it.** A collapsed group such as General
35
+ folded shut again on every keystroke, because the form rebuilds its UI schema on each change and the
36
+ group kept re-applying its `defaultOpen`. `defaultOpen` now only sets where a group starts; after that
37
+ the user's toggle decides.
38
+
8
39
  ## [2.15.1] - 2026-10-17
9
40
 
10
41
  ### Fixed
@@ -392,6 +392,18 @@
392
392
  return out;
393
393
  });
394
394
 
395
+ /** The resolved external edit URL ('' when refused, '#' without a node). */
396
+ const externalEditUrl = $derived(getExternalEditUrl());
397
+
398
+ /**
399
+ * Whether the external edit link can do anything: the host handles the click
400
+ * itself, or the URL resolves (a refused URL resolves to ''). Every external
401
+ * edit affordance reads this, so none shows up only to do nothing.
402
+ */
403
+ const externalEditUsable = $derived(
404
+ !!configEditOptions?.externalEditLink && (!!onExternalEdit || externalEditUrl !== '')
405
+ );
406
+
395
407
  /**
396
408
  * The row naming the workflow a node runs ("Runs Calculator ↗"). The name is
397
409
  * the link's `targetName` when the backend sends one; fddo does not (it sends
@@ -401,7 +413,7 @@
401
413
  */
402
414
  const externalInfo = $derived.by<ExternalLinkInfo | null>(() => {
403
415
  const link = configEditOptions?.externalEditLink;
404
- if (!showExternalEditLink || !link || !node) return null;
416
+ if (!showExternalEditLink || !link || !node || !externalEditUsable) return null;
405
417
  const target =
406
418
  link.targetName ?? /^run workflow:\s*(.+)$/i.exec(node.data.label ?? '')?.[1]?.trim();
407
419
  return {
@@ -409,7 +421,7 @@
409
421
  ? { prefix: 'Runs', name: target }
410
422
  : { name: link.label ?? 'Configure externally' }),
411
423
  title: link.description,
412
- href: getExternalEditUrl(),
424
+ href: externalEditUrl,
413
425
  newTab: link.openInNewTab !== false,
414
426
  ...(onExternalEdit ? { onActivate: handleExternalEditClick } : {})
415
427
  };
@@ -463,6 +475,7 @@
463
475
  }
464
476
 
465
477
  const url = getExternalEditUrl();
478
+ if (!url) return;
466
479
  const openInNewTab = configEditOptions.externalEditLink.openInNewTab !== false;
467
480
 
468
481
  if (openInNewTab) {
@@ -731,7 +744,7 @@
731
744
  <Icon icon="heroicons:arrow-path" />
732
745
  <span>Retry</span>
733
746
  </button>
734
- {#if configEditOptions?.externalEditLink}
747
+ {#if configEditOptions?.externalEditLink && externalEditUsable}
735
748
  <button
736
749
  type="button"
737
750
  class="config-form__button config-form__button--external"
@@ -767,7 +780,7 @@
767
780
  <Icon icon="heroicons:arrow-path" />
768
781
  <span>Refresh Schema</span>
769
782
  </button>
770
- {#if configEditOptions?.externalEditLink}
783
+ {#if configEditOptions?.externalEditLink && externalEditUsable}
771
784
  <button
772
785
  type="button"
773
786
  class="config-form__schema-external"
@@ -902,13 +915,13 @@
902
915
  </div>
903
916
  {/if}
904
917
  </form>
905
- {:else if !dynamicSchemaLoading && !showExternalEditLink}
918
+ {:else if !dynamicSchemaLoading && (!showExternalEditLink || !externalEditUsable)}
906
919
  <div class="flowdrop-scope config-form__empty">
907
920
  <div class="config-form__empty-icon">
908
921
  <Icon icon="heroicons:cog-6-tooth" />
909
922
  </div>
910
923
  <p class="config-form__empty-text">No configuration options available for this node.</p>
911
- {#if configEditOptions?.externalEditLink}
924
+ {#if configEditOptions?.externalEditLink && externalEditUsable}
912
925
  <button
913
926
  type="button"
914
927
  class="config-form__button config-form__button--external config-form__empty-button"
@@ -6,6 +6,7 @@
6
6
 
7
7
  <script lang="ts">
8
8
  import Icon from '@iconify/svelte';
9
+ import Button from './primitives/Button.svelte';
9
10
 
10
11
  interface Props {
11
12
  /** Muted lead-in, e.g. "Runs"; absent for a plain labelled link */
@@ -20,6 +21,9 @@
20
21
  /**
21
22
  * Handle a plain left click instead of following the link. The href stays,
22
23
  * so middle-click, modified clicks and "copy link" work as for any link.
24
+ * With an empty `href` there is nothing to follow: the row renders as a
25
+ * button and every click goes to `onActivate`. With neither an `href` nor
26
+ * `onActivate` the row renders nothing.
23
27
  */
24
28
  onActivate?: () => void;
25
29
  }
@@ -36,21 +40,40 @@
36
40
  }
37
41
  </script>
38
42
 
39
- <div class="external-link-row">
40
- {#if prefix}<span class="external-link-row__prefix">{prefix}</span>{/if}
41
- <a
42
- class="external-link-row__link"
43
- {href}
44
- target={newTab ? '_blank' : undefined}
45
- rel={newTab ? 'noopener noreferrer' : undefined}
46
- title={title ?? name}
47
- onclick={handleClick}
48
- data-testid="external-config-link"
49
- >
50
- <span class="external-link-row__name">{name}</span>
51
- <Icon icon="mdi:arrow-top-right" aria-hidden="true" />
52
- </a>
53
- </div>
43
+ {#snippet content()}
44
+ <span class="external-link-row__name">{name}</span>
45
+ <Icon icon="mdi:arrow-top-right" aria-hidden="true" />
46
+ {/snippet}
47
+
48
+ {#if href || onActivate}
49
+ <div class="external-link-row">
50
+ {#if prefix}<span class="external-link-row__prefix">{prefix}</span>{/if}
51
+ {#if href}
52
+ <a
53
+ class="external-link-row__link"
54
+ {href}
55
+ target={newTab ? '_blank' : undefined}
56
+ rel={newTab ? 'noopener noreferrer' : undefined}
57
+ title={title ?? name}
58
+ onclick={handleClick}
59
+ data-testid="external-config-link"
60
+ >
61
+ {@render content()}
62
+ </a>
63
+ {:else if onActivate}
64
+ <Button
65
+ variant="ghost"
66
+ size="sm"
67
+ class="external-link-row__link external-link-row__link--button"
68
+ title={title ?? name}
69
+ onclick={() => onActivate()}
70
+ data-testid="external-config-link"
71
+ >
72
+ {@render content()}
73
+ </Button>
74
+ {/if}
75
+ </div>
76
+ {/if}
54
77
 
55
78
  <style>
56
79
  .external-link-row {
@@ -79,7 +102,21 @@
79
102
  cursor: pointer;
80
103
  }
81
104
 
82
- .external-link-row__link:hover .external-link-row__name {
105
+ /* The Button primitive, dressed as the link it stands in for. */
106
+ .external-link-row :global(.external-link-row__link--button),
107
+ .external-link-row :global(.external-link-row__link--button:hover:not(:disabled)) {
108
+ height: auto;
109
+ min-height: 0;
110
+ padding: 0;
111
+ border: none;
112
+ background: none;
113
+ color: var(--fd-inspector-link-color);
114
+ font: inherit;
115
+ font-weight: 500;
116
+ }
117
+
118
+ .external-link-row__link:hover .external-link-row__name,
119
+ .external-link-row :global(.external-link-row__link--button:hover .external-link-row__name) {
83
120
  text-decoration: underline;
84
121
  }
85
122
 
@@ -11,6 +11,9 @@ interface Props {
11
11
  /**
12
12
  * Handle a plain left click instead of following the link. The href stays,
13
13
  * so middle-click, modified clicks and "copy link" work as for any link.
14
+ * With an empty `href` there is nothing to follow: the row renders as a
15
+ * button and every click goes to `onActivate`. With neither an `href` nor
16
+ * `onActivate` the row renders nothing.
14
17
  */
15
18
  onActivate?: () => void;
16
19
  }
@@ -8,7 +8,7 @@
8
8
  -->
9
9
 
10
10
  <script lang="ts">
11
- import type { Snippet } from 'svelte';
11
+ import { untrack, type Snippet } from 'svelte';
12
12
  import type { UISchemaGroup } from '../../types/uischema.js';
13
13
  import Icon from '@iconify/svelte';
14
14
 
@@ -22,11 +22,13 @@
22
22
  let { group, children }: Props = $props();
23
23
 
24
24
  const isCollapsible = $derived(group.collapsible !== false);
25
- const isDefaultOpen = $derived(group.defaultOpen !== false);
25
+ // `defaultOpen` seeds the fold once; after that the user's toggle owns it. The host rebuilds the
26
+ // UI schema on every value change, so a reactive `open` would snap the group shut on each keystroke.
27
+ let isOpen = $state(untrack(() => group.defaultOpen !== false));
26
28
  </script>
27
29
 
28
30
  {#if isCollapsible}
29
- <details class="flowdrop-details form-fieldset" open={isDefaultOpen}>
31
+ <details class="flowdrop-details form-fieldset" bind:open={isOpen}>
30
32
  <summary class="flowdrop-details__summary form-fieldset__summary">
31
33
  <span class="form-fieldset__label">
32
34
  <span class="form-fieldset__title">{group.label}</span>
@@ -1,4 +1,4 @@
1
- import type { Snippet } from 'svelte';
1
+ import { type Snippet } from 'svelte';
2
2
  import type { UISchemaGroup } from '../../types/uischema.js';
3
3
  interface Props {
4
4
  /** The UISchema Group element to render */
@@ -30,3 +30,5 @@
30
30
  */
31
31
  export { default as MarkdownDisplay } from '../components/MarkdownDisplay.svelte';
32
32
  export { sanitizeHtml } from '../utils/sanitize.js';
33
+ export { allowedLinkTarget, renderMarkdown } from '../utils/renderMarkdown.js';
34
+ export type { RenderMarkdownOptions } from '../utils/renderMarkdown.js';
@@ -36,3 +36,7 @@ export { default as MarkdownDisplay } from '../components/MarkdownDisplay.svelte
36
36
  // HTML Sanitization (DOMPurify-backed — lives here, not in core)
37
37
  // ============================================================================
38
38
  export { sanitizeHtml } from '../utils/sanitize.js';
39
+ // ============================================================================
40
+ // Markdown to HTML for host pages (marked + DOMPurify)
41
+ // ============================================================================
42
+ export { allowedLinkTarget, renderMarkdown } from '../utils/renderMarkdown.js';
@@ -72,7 +72,9 @@ export declare function fetchDynamicSchema(endpointConfig: EndpointConfig | null
72
72
  * @param node - The workflow node instance
73
73
  * @param workflowId - Optional workflow ID for context
74
74
  * @param callbackUrl - Optional callback URL to append
75
- * @returns The resolved URL string
75
+ * @returns The resolved URL string, or `''` when the URL is neither http(s) nor
76
+ * relative (another scheme is never opened). Unlike `allowedLinkTarget()`, any
77
+ * relative URL is kept here (paths, `?query`, `//host`).
76
78
  *
77
79
  * @example
78
80
  * ```typescript
@@ -83,6 +85,10 @@ export declare function fetchDynamicSchema(endpointConfig: EndpointConfig | null
83
85
  *
84
86
  * const url = resolveExternalEditUrl(link, node, workflowId);
85
87
  * // Returns "https://admin.example.com/nodes/llm-node/edit/node-1"
88
+ *
89
+ * if (url === '') {
90
+ * // No link: the URL was neither http(s) nor relative.
91
+ * }
86
92
  * ```
87
93
  */
88
94
  export declare function resolveExternalEditUrl(link: ExternalEditLink, node: WorkflowNode, workflowId?: string, callbackUrl?: string): string;
@@ -311,7 +311,9 @@ export async function fetchDynamicSchema(endpointConfig, endpoint, node, workflo
311
311
  * @param node - The workflow node instance
312
312
  * @param workflowId - Optional workflow ID for context
313
313
  * @param callbackUrl - Optional callback URL to append
314
- * @returns The resolved URL string
314
+ * @returns The resolved URL string, or `''` when the URL is neither http(s) nor
315
+ * relative (another scheme is never opened). Unlike `allowedLinkTarget()`, any
316
+ * relative URL is kept here (paths, `?query`, `//host`).
315
317
  *
316
318
  * @example
317
319
  * ```typescript
@@ -322,6 +324,10 @@ export async function fetchDynamicSchema(endpointConfig, endpoint, node, workflo
322
324
  *
323
325
  * const url = resolveExternalEditUrl(link, node, workflowId);
324
326
  * // Returns "https://admin.example.com/nodes/llm-node/edit/node-1"
327
+ *
328
+ * if (url === '') {
329
+ * // No link: the URL was neither http(s) nor relative.
330
+ * }
325
331
  * ```
326
332
  */
327
333
  export function resolveExternalEditUrl(link, node, workflowId, callbackUrl) {
@@ -334,7 +340,17 @@ export function resolveExternalEditUrl(link, node, workflowId, callbackUrl) {
334
340
  const separator = url.includes('?') ? '&' : '?';
335
341
  url = `${url}${separator}${link.callbackUrlParam}=${encodeURIComponent(callbackUrl)}`;
336
342
  }
337
- return url;
343
+ return isWebOrRelativeUrl(url) ? url : '';
344
+ }
345
+ /**
346
+ * True when the URL is http(s) or relative (no scheme of its own).
347
+ * Leading whitespace and the control characters browsers drop while parsing are ignored.
348
+ */
349
+ function isWebOrRelativeUrl(url) {
350
+ // eslint-disable-next-line no-control-regex
351
+ const compact = url.replace(/[\u0000-\u0020]/g, '');
352
+ const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(compact);
353
+ return scheme === null || /^https?$/i.test(scheme[1]);
338
354
  }
339
355
  /**
340
356
  * Gets the effective config edit options for a node.
@@ -0,0 +1,39 @@
1
+ /** Options for {@link renderMarkdown}. */
2
+ export interface RenderMarkdownOptions {
3
+ /** Added to each heading level; the result is capped at 6. Anything that does not convert to a finite number counts as 0. Default: 0. */
4
+ headingOffset?: number;
5
+ }
6
+ /**
7
+ * The link rule of {@link renderMarkdown}, for host pages that build their own
8
+ * links: returns the trimmed target when it is http(s), root-relative or a
9
+ * fragment and holds no control character, otherwise null. Relative paths
10
+ * (`docs/page`, `./x`, `?q=1`), protocol-relative `//host` and other schemes
11
+ * such as `mailto:` are not kept; the label shows as text.
12
+ *
13
+ * @param href - The candidate target.
14
+ * @returns The trimmed target, or null.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * import { allowedLinkTarget } from '@flowdrop/flowdrop/display';
19
+ *
20
+ * const href = allowedLinkTarget(url);
21
+ * if (href !== null) anchor.href = href;
22
+ * ```
23
+ */
24
+ export declare function allowedLinkTarget(href: string | null | undefined): string | null;
25
+ /**
26
+ * Renders Markdown to sanitized HTML.
27
+ *
28
+ * @param source - The Markdown text.
29
+ * @param options - Rendering options.
30
+ * @returns HTML that can be assigned to `innerHTML`.
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * import { renderMarkdown } from '@flowdrop/flowdrop/display';
35
+ *
36
+ * element.innerHTML = renderMarkdown(text, { headingOffset: 3 });
37
+ * ```
38
+ */
39
+ export declare function renderMarkdown(source: string, options?: RenderMarkdownOptions): string;
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Markdown to HTML for host pages
3
+ *
4
+ * Renders Markdown with the same `marked` + `sanitizeHtml()` (DOMPurify) pair that the display
5
+ * components use, for pages that place the result with `innerHTML` outside a
6
+ * Svelte component (for example a Drupal behavior).
7
+ *
8
+ * - HTML written in the source is shown as text.
9
+ * - Links and images keep only http(s), root-relative and fragment targets;
10
+ * for any other target the label is shown as text. Relative paths
11
+ * (`docs/page`, `./x`, `?q=1`), protocol-relative `//host` and other schemes
12
+ * such as `mailto:` are not kept. Images are shown as a link to their source;
13
+ * an image inside a link shows its alt text within that link.
14
+ * - Links carry `rel="noopener noreferrer"`.
15
+ * - `headingOffset` moves headings down, up to h6, for pages that already own
16
+ * the upper levels.
17
+ *
18
+ * @module utils/renderMarkdown
19
+ */
20
+ import { Marked, TextRenderer } from 'marked';
21
+ import { sanitizeHtml } from './sanitize.js';
22
+ /** Link targets that are kept: http(s), root-relative and fragment. */
23
+ const ALLOWED_TARGET = /^(?:https?:\/\/|\/(?![/\\])|#)/i;
24
+ /**
25
+ * Control characters. The browser's URL parser drops tab, CR and LF inside a
26
+ * URL, so a target with any of them is not the target the rule sees.
27
+ */
28
+ // eslint-disable-next-line no-control-regex
29
+ const CONTROL_CHARACTER = /[\u0000-\u001f\u007f]/;
30
+ const escapeText = (s) => s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
31
+ const escapeAttribute = (s) => escapeText(s).replace(/"/g, '&quot;').replace(/'/g, '&#39;');
32
+ const BASIC_ENTITIES = { amp: '&', lt: '<', gt: '>', quot: '"', apos: "'" };
33
+ /**
34
+ * Decodes the character references Markdown leaves in link targets, titles and
35
+ * alt text (`&amp;`, `&#x2f;`, `&ouml;`), so each is escaped exactly once on
36
+ * output and the link rule sees the URL the browser will follow. Uses the DOM
37
+ * when there is one (every named reference); otherwise numeric references and
38
+ * the five basic names.
39
+ */
40
+ function decodeEntities(s) {
41
+ if (!s.includes('&'))
42
+ return s;
43
+ if (typeof document !== 'undefined') {
44
+ const textarea = document.createElement('textarea');
45
+ textarea.innerHTML = s;
46
+ return textarea.value;
47
+ }
48
+ return s.replace(/&(?:#(\d+)|#x([0-9a-f]+)|([a-z]+));/gi, (match, dec, hex, name) => {
49
+ if (name)
50
+ return BASIC_ENTITIES[name.toLowerCase()] ?? match;
51
+ const code = dec ? parseInt(dec, 10) : parseInt(hex, 16);
52
+ return code > 0 && code <= 0x10ffff ? String.fromCodePoint(code) : '\uFFFD';
53
+ });
54
+ }
55
+ /**
56
+ * The link rule of {@link renderMarkdown}, for host pages that build their own
57
+ * links: returns the trimmed target when it is http(s), root-relative or a
58
+ * fragment and holds no control character, otherwise null. Relative paths
59
+ * (`docs/page`, `./x`, `?q=1`), protocol-relative `//host` and other schemes
60
+ * such as `mailto:` are not kept; the label shows as text.
61
+ *
62
+ * @param href - The candidate target.
63
+ * @returns The trimmed target, or null.
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * import { allowedLinkTarget } from '@flowdrop/flowdrop/display';
68
+ *
69
+ * const href = allowedLinkTarget(url);
70
+ * if (href !== null) anchor.href = href;
71
+ * ```
72
+ */
73
+ export function allowedLinkTarget(href) {
74
+ const target = String(href ?? '').trim();
75
+ return ALLOWED_TARGET.test(target) && !CONTROL_CHARACTER.test(target) ? target : null;
76
+ }
77
+ /**
78
+ * Builds a parser for one heading offset. Each call gets its own `Marked`
79
+ * instance, so the shared `marked` export keeps its defaults.
80
+ */
81
+ function createParser(headingOffset) {
82
+ const parser = new Marked({ gfm: true, breaks: false, async: false });
83
+ /** Greater than 0 while the label of a link is being rendered. */
84
+ let linkDepth = 0;
85
+ const anchor = (target, label, title) => {
86
+ const titleText = title ? decodeEntities(title) : '';
87
+ const titleAttribute = titleText ? ` title="${escapeAttribute(titleText)}"` : '';
88
+ const text = label === '' ? escapeText(target) : label;
89
+ return `<a href="${escapeAttribute(target)}"${titleAttribute} rel="noopener noreferrer">${text}</a>`;
90
+ };
91
+ parser.use({
92
+ renderer: {
93
+ html(token) {
94
+ return escapeText(token.text);
95
+ },
96
+ heading(token) {
97
+ const level = Math.min(Math.max(token.depth + headingOffset, 1), 6);
98
+ return `<h${level}>${this.parser.parseInline(token.tokens)}</h${level}>\n`;
99
+ },
100
+ link(token) {
101
+ let label;
102
+ linkDepth++;
103
+ try {
104
+ label = this.parser.parseInline(token.tokens);
105
+ }
106
+ finally {
107
+ linkDepth--;
108
+ }
109
+ const target = allowedLinkTarget(decodeEntities(token.href));
110
+ if (target === null) {
111
+ return label;
112
+ }
113
+ return anchor(target, label, token.title);
114
+ },
115
+ image(token) {
116
+ // The alt text as plain text: Markdown and HTML markers dropped, references decoded.
117
+ const label = escapeText(decodeEntities(this.parser.parseInline(token.tokens ?? [], new TextRenderer())));
118
+ if (linkDepth > 0) {
119
+ return label;
120
+ }
121
+ const target = allowedLinkTarget(decodeEntities(token.href));
122
+ if (target === null) {
123
+ return label;
124
+ }
125
+ return anchor(target, label, token.title);
126
+ }
127
+ }
128
+ });
129
+ return parser;
130
+ }
131
+ const parsers = new Map();
132
+ /**
133
+ * Renders Markdown to sanitized HTML.
134
+ *
135
+ * @param source - The Markdown text.
136
+ * @param options - Rendering options.
137
+ * @returns HTML that can be assigned to `innerHTML`.
138
+ *
139
+ * @example
140
+ * ```typescript
141
+ * import { renderMarkdown } from '@flowdrop/flowdrop/display';
142
+ *
143
+ * element.innerHTML = renderMarkdown(text, { headingOffset: 3 });
144
+ * ```
145
+ */
146
+ export function renderMarkdown(source, options = {}) {
147
+ const text = String(source ?? '');
148
+ if (text === '') {
149
+ return '';
150
+ }
151
+ const n = Number(options.headingOffset ?? 0);
152
+ const offset = Number.isFinite(n) ? Math.min(Math.max(Math.trunc(n), 0), 5) : 0;
153
+ let parser = parsers.get(offset);
154
+ if (!parser) {
155
+ parser = createParser(offset);
156
+ parsers.set(offset, parser);
157
+ }
158
+ const html = parser.parse(text);
159
+ return sanitizeHtml(html);
160
+ }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A drop-in visual workflow editor for any web application. You own the backend. You own the data. You own the orchestration.",
4
4
  "license": "MIT",
5
5
  "private": false,
6
- "version": "2.15.1",
6
+ "version": "2.15.3",
7
7
  "author": "Shibin Das (D34dMan)",
8
8
  "bugs": {
9
9
  "url": "https://github.com/flowdrop-io/flowdrop/issues"