@carbon/ai-chat-components 1.4.0 → 1.5.0-rc.1

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.
Files changed (100) hide show
  1. package/custom-elements.json +837 -284
  2. package/es/components/chat-history/src/chat-history.scss.js +1 -1
  3. package/es/components/chat-history/src/history-panel-item.d.ts +14 -0
  4. package/es/components/chat-history/src/history-panel-item.js +30 -0
  5. package/es/components/chat-history/src/history-panel-item.js.map +1 -1
  6. package/es/components/code-snippet/src/code-snippet.d.ts +5 -0
  7. package/es/components/code-snippet/src/code-snippet.js +17 -5
  8. package/es/components/code-snippet/src/code-snippet.js.map +1 -1
  9. package/es/components/feedback/src/feedback.d.ts +4 -0
  10. package/es/components/feedback/src/feedback.js +6 -4
  11. package/es/components/feedback/src/feedback.js.map +1 -1
  12. package/es/components/markdown/index.d.ts +3 -1
  13. package/es/components/markdown/index.js +1 -1
  14. package/es/components/markdown/src/markdown-renderer-types.d.ts +100 -0
  15. package/es/components/markdown/src/markdown-renderer-types.js +8 -0
  16. package/es/components/markdown/src/markdown-renderer-types.js.map +1 -0
  17. package/es/components/markdown/src/markdown-renderer.d.ts +14 -64
  18. package/es/components/markdown/src/markdown-renderer.js +120 -134
  19. package/es/components/markdown/src/markdown-renderer.js.map +1 -1
  20. package/es/components/markdown/src/markdown-token-tree.d.ts +50 -5
  21. package/es/components/markdown/src/markdown-token-tree.js +182 -47
  22. package/es/components/markdown/src/markdown-token-tree.js.map +1 -1
  23. package/es/components/markdown/src/markdown.d.ts +49 -1
  24. package/es/components/markdown/src/markdown.js +307 -106
  25. package/es/components/markdown/src/markdown.js.map +1 -1
  26. package/es/components/markdown/src/markdown.scss.js +1 -1
  27. package/es/components/markdown/src/plugins/markdown-it-task-lists.js +2 -5
  28. package/es/components/markdown/src/plugins/markdown-it-task-lists.js.map +1 -1
  29. package/es/components/markdown/src/utils/lit-directives.d.ts +17 -0
  30. package/es/components/markdown/src/utils/lit-directives.js +84 -0
  31. package/es/components/markdown/src/utils/lit-directives.js.map +1 -0
  32. package/es/components/markdown/src/utils/plugin-fallback.d.ts +33 -0
  33. package/es/components/markdown/src/utils/plugin-fallback.js +219 -0
  34. package/es/components/markdown/src/utils/plugin-fallback.js.map +1 -0
  35. package/es/components/markdown/src/utils/streaming-table.d.ts +28 -0
  36. package/es/components/markdown/src/utils/streaming-table.js +86 -0
  37. package/es/components/markdown/src/utils/streaming-table.js.map +1 -0
  38. package/es/components/markdown/src/utils/table-helpers.d.ts +17 -0
  39. package/es/components/markdown/src/utils/table-helpers.js +104 -2
  40. package/es/components/markdown/src/utils/table-helpers.js.map +1 -1
  41. package/es/components/table/src/table.js +4 -1
  42. package/es/components/table/src/table.js.map +1 -1
  43. package/es/components/truncated-text/src/truncated-text.scss.js +1 -1
  44. package/es/components/workspace-shell/src/workspace-shell.scss.js +1 -1
  45. package/es/react/markdown.d.ts +46 -2
  46. package/es/react/markdown.js +177 -20
  47. package/es/react/markdown.js.map +1 -1
  48. package/es-custom/components/chat-history/src/chat-history.scss.js +1 -1
  49. package/es-custom/components/chat-history/src/history-panel-item.d.ts +14 -0
  50. package/es-custom/components/chat-history/src/history-panel-item.js +30 -0
  51. package/es-custom/components/chat-history/src/history-panel-item.js.map +1 -1
  52. package/es-custom/components/code-snippet/src/code-snippet.d.ts +5 -0
  53. package/es-custom/components/code-snippet/src/code-snippet.js +17 -5
  54. package/es-custom/components/code-snippet/src/code-snippet.js.map +1 -1
  55. package/es-custom/components/feedback/src/feedback.d.ts +4 -0
  56. package/es-custom/components/feedback/src/feedback.js +6 -4
  57. package/es-custom/components/feedback/src/feedback.js.map +1 -1
  58. package/es-custom/components/markdown/index.d.ts +3 -1
  59. package/es-custom/components/markdown/index.js +1 -1
  60. package/es-custom/components/markdown/src/markdown-renderer-types.d.ts +100 -0
  61. package/es-custom/components/markdown/src/markdown-renderer-types.js +8 -0
  62. package/es-custom/components/markdown/src/markdown-renderer-types.js.map +1 -0
  63. package/es-custom/components/markdown/src/markdown-renderer.d.ts +14 -64
  64. package/es-custom/components/markdown/src/markdown-renderer.js +120 -134
  65. package/es-custom/components/markdown/src/markdown-renderer.js.map +1 -1
  66. package/es-custom/components/markdown/src/markdown-token-tree.d.ts +50 -5
  67. package/es-custom/components/markdown/src/markdown-token-tree.js +182 -47
  68. package/es-custom/components/markdown/src/markdown-token-tree.js.map +1 -1
  69. package/es-custom/components/markdown/src/markdown.d.ts +49 -1
  70. package/es-custom/components/markdown/src/markdown.js +307 -106
  71. package/es-custom/components/markdown/src/markdown.js.map +1 -1
  72. package/es-custom/components/markdown/src/markdown.scss.js +1 -1
  73. package/es-custom/components/markdown/src/plugins/markdown-it-task-lists.js +2 -5
  74. package/es-custom/components/markdown/src/plugins/markdown-it-task-lists.js.map +1 -1
  75. package/es-custom/components/markdown/src/utils/lit-directives.d.ts +17 -0
  76. package/es-custom/components/markdown/src/utils/lit-directives.js +84 -0
  77. package/es-custom/components/markdown/src/utils/lit-directives.js.map +1 -0
  78. package/es-custom/components/markdown/src/utils/plugin-fallback.d.ts +33 -0
  79. package/es-custom/components/markdown/src/utils/plugin-fallback.js +219 -0
  80. package/es-custom/components/markdown/src/utils/plugin-fallback.js.map +1 -0
  81. package/es-custom/components/markdown/src/utils/streaming-table.d.ts +28 -0
  82. package/es-custom/components/markdown/src/utils/streaming-table.js +86 -0
  83. package/es-custom/components/markdown/src/utils/streaming-table.js.map +1 -0
  84. package/es-custom/components/markdown/src/utils/table-helpers.d.ts +17 -0
  85. package/es-custom/components/markdown/src/utils/table-helpers.js +104 -2
  86. package/es-custom/components/markdown/src/utils/table-helpers.js.map +1 -1
  87. package/es-custom/components/table/src/table.js +4 -1
  88. package/es-custom/components/table/src/table.js.map +1 -1
  89. package/es-custom/components/truncated-text/src/truncated-text.scss.js +1 -1
  90. package/es-custom/components/workspace-shell/src/workspace-shell.scss.js +1 -1
  91. package/es-custom/react/markdown.d.ts +46 -2
  92. package/es-custom/react/markdown.js +177 -20
  93. package/es-custom/react/markdown.js.map +1 -1
  94. package/package.json +5 -4
  95. package/es/components/markdown/src/utils.d.ts +0 -4
  96. package/es/components/markdown/src/utils.js +0 -25
  97. package/es/components/markdown/src/utils.js.map +0 -1
  98. package/es-custom/components/markdown/src/utils.d.ts +0 -4
  99. package/es-custom/components/markdown/src/utils.js +0 -25
  100. package/es-custom/components/markdown/src/utils.js.map +0 -1
@@ -0,0 +1,100 @@
1
+ import type { Token } from "markdown-it";
2
+ import type { TableCellData } from "./utils/table-helpers.js";
3
+ import type { TokenTree } from "./markdown-token-tree.js";
4
+ /**
5
+ * Data payload describing a markdown table the consumer can render in place
6
+ * of the default `cds-aichat-table`.
7
+ *
8
+ * @category Messaging
9
+ */
10
+ export interface MarkdownRendererTableData {
11
+ /** Cells extracted from the table's `<thead>`, in column order. */
12
+ headers: TableCellData[];
13
+ /** Body rows, each an array of cells in column order. */
14
+ rows: TableCellData[][];
15
+ /**
16
+ * True while the chat is still receiving chunks of the message this table
17
+ * belongs to.
18
+ */
19
+ isStreaming: boolean;
20
+ /**
21
+ * True when the table should render its skeleton/loading state instead of
22
+ * cell data — set by the component while a streaming table sits at the tail
23
+ * of the message and the next chunk may still add rows.
24
+ */
25
+ isLoading: boolean;
26
+ }
27
+ /**
28
+ * Data payload describing a markdown fenced code block the consumer can
29
+ * render in place of the default `cds-aichat-code-snippet`.
30
+ *
31
+ * @category Messaging
32
+ */
33
+ export interface MarkdownRendererCodeBlockData {
34
+ /** Language identifier from the fence info string (empty when unset). */
35
+ language: string;
36
+ /** The raw code text inside the fence. May be incomplete while streaming. */
37
+ code: string;
38
+ /**
39
+ * True while the chat is still receiving chunks of the message this code
40
+ * block belongs to.
41
+ */
42
+ isStreaming: boolean;
43
+ }
44
+ /**
45
+ * Argument passed to a markdown table custom renderer callback.
46
+ *
47
+ * @category Messaging
48
+ */
49
+ export interface MarkdownRendererTableArgs extends MarkdownRendererTableData {
50
+ /**
51
+ * The markdown-it `Token` (a `table_open`) for the matched element — see
52
+ * the `markdown-it` `Token` documentation for the field shape.
53
+ */
54
+ token: Readonly<Token>;
55
+ /** The full token-tree node, including descendants. */
56
+ node: Readonly<TokenTree>;
57
+ /**
58
+ * Stable slot identifier for this rendered element. The same name is
59
+ * reused across renders while the underlying source line stays put — useful
60
+ * as a React key.
61
+ */
62
+ slotName: string;
63
+ }
64
+ /**
65
+ * Argument passed to a markdown fenced code block custom renderer callback.
66
+ *
67
+ * @category Messaging
68
+ */
69
+ export interface MarkdownRendererCodeBlockArgs extends MarkdownRendererCodeBlockData {
70
+ /**
71
+ * The markdown-it `Token` (a `fence`) for the matched element — see the
72
+ * `markdown-it` `Token` documentation for the field shape.
73
+ */
74
+ token: Readonly<Token>;
75
+ /** The full token-tree node. */
76
+ node: Readonly<TokenTree>;
77
+ /**
78
+ * Stable slot identifier for this rendered element. The same name is
79
+ * reused across renders while the underlying source line stays put — useful
80
+ * as a React key.
81
+ */
82
+ slotName: string;
83
+ }
84
+ /**
85
+ * Per-element custom renderer callbacks accepted by the markdown element.
86
+ * Each callback returns an `HTMLElement` to use in place of the default
87
+ * Carbon rendering, or `null` to fall back to the default. Returned elements
88
+ * are adopted as light-DOM children of the markdown element (wrapped in a
89
+ * `<div slot="…">` host so the consumer's element is not mutated) and
90
+ * projected through a named shadow-DOM `<slot>`. External CSS continues to
91
+ * apply normally.
92
+ *
93
+ * @category Messaging
94
+ */
95
+ export interface MarkdownCustomRenderers {
96
+ /** Override the default `cds-aichat-table` rendering. */
97
+ table?: (args: MarkdownRendererTableArgs) => HTMLElement | null;
98
+ /** Override the default `cds-aichat-code-snippet` rendering. */
99
+ codeBlock?: (args: MarkdownRendererCodeBlockArgs) => HTMLElement | null;
100
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ //# sourceMappingURL=markdown-renderer-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-renderer-types.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -4,73 +4,23 @@ import "@carbon/web-components/es/components/checkbox/index.js";
4
4
  import "../../code-snippet/index.js";
5
5
  import "../../card/index.js";
6
6
  import "../../table/index.js";
7
- import type { TokenTree } from "./markdown-token-tree.js";
7
+ import { type TokenTree } from "./markdown-token-tree.js";
8
+ import type { MarkdownRendererSlotDescriptor, RenderTokenTreeOptions } from "./markdown-renderer-types.js";
9
+ export type { MarkdownCustomRenderers, MarkdownRendererCodeBlockArgs, MarkdownRendererCodeBlockData, MarkdownRendererSlotDescriptor, MarkdownRendererTableArgs, MarkdownRendererTableData, RenderTokenTreeOptions, } from "./markdown-renderer-types.js";
8
10
  /**
9
- * Configuration options for rendering TokenTrees into HTML.
11
+ * Top-level entry: renders a markdown token tree to a Lit `TemplateResult`
12
+ * and returns the batch of custom-renderer slot descriptors collected along
13
+ * the way. Callers receive both pieces in one call so the batch can't be
14
+ * accidentally dropped.
10
15
  */
11
- export interface RenderTokenTreeOptions {
12
- /** Whether to sanitize HTML content using DOMPurify */
13
- sanitize: boolean;
14
- /** Whether content is being streamed (affects loading states) */
15
- streaming?: boolean;
16
- /** Context information for nested rendering */
17
- context?: {
18
- /** Whether we're currently inside a table header */
19
- isInThead?: boolean;
20
- /** All children of the parent node */
21
- parentChildren?: TokenTree[];
22
- /** Current index in parent's children array */
23
- currentIndex?: number;
24
- };
25
- /** Whether to enable syntax highlighting in code blocks */
26
- codeSnippetHighlight?: boolean;
27
- /** Feedback text shown after copying */
28
- codeSnippetFeedback?: string;
29
- /** Text for show less button */
30
- codeSnippetShowLessText?: string;
31
- /** Text for show more button */
32
- codeSnippetShowMoreText?: string;
33
- /** Tooltip text for copy button */
34
- codeSnippetCopyButtonTooltipContent?: string;
35
- /** Function to get formatted line count text */
36
- codeSnippetGetLineCountText?: ({ count }: {
37
- count: number;
38
- }) => string;
39
- /** Aria-label for code snippets when in read-only mode */
40
- codeSnippetAriaLabelReadOnly?: string;
41
- /** Aria-label for code snippets when in editable mode */
42
- codeSnippetAriaLabelEditable?: string;
43
- /** Placeholder text for table filter input */
44
- tableFilterPlaceholderText?: string;
45
- /** Text for previous page button tooltip */
46
- tablePreviousPageText?: string;
47
- /** Text for next page button tooltip */
48
- tableNextPageText?: string;
49
- /** Text for items per page label */
50
- tableItemsPerPageText?: string;
51
- /**
52
- * The text used for the download button's accessible label.
53
- */
54
- tableDownloadLabelText?: string;
55
- /** Locale for table sorting and formatting */
56
- tableLocale?: string;
57
- /** Function to get supplemental pagination text */
58
- tableGetPaginationSupplementalText?: ({ count }: {
59
- count: number;
60
- }) => string;
61
- /** Function to get pagination status text */
62
- tableGetPaginationStatusText?: ({ start, end, count, }: {
63
- start: number;
64
- end: number;
65
- count: number;
66
- }) => string;
67
- /**
68
- * Force markdown tables to render in loading mode.
69
- * Useful for freezing streaming table visuals until stream completion.
70
- */
71
- forceTableLoading?: boolean;
72
- }
16
+ export declare function renderMarkdownTree(node: TokenTree, options: RenderTokenTreeOptions): {
17
+ template: TemplateResult;
18
+ batch: MarkdownRendererSlotDescriptor[];
19
+ };
73
20
  /**
74
21
  * Converts TokenTree to Lit TemplateResult.
22
+ *
23
+ * Recursive renderer; external callers should use {@link renderMarkdownTree}
24
+ * which collects the slot-descriptor batch.
75
25
  */
76
26
  export declare function renderTokenTree(node: TokenTree, options: RenderTokenTreeOptions): TemplateResult;
@@ -6,10 +6,9 @@
6
6
  */
7
7
 
8
8
  import DOMPurify from 'dompurify';
9
- import { nothing, render, html } from 'lit';
9
+ import { html } from 'lit';
10
10
  import { repeat } from 'lit/directives/repeat.js';
11
11
  import { unsafeHTML } from 'lit/directives/unsafe-html.js';
12
- import { directive, Directive, PartType } from 'lit/directive.js';
13
12
  import '@carbon/web-components/es/components/list/index.js';
14
13
  import '@carbon/web-components/es/components/checkbox/index.js';
15
14
  import '../../code-snippet/src/code-snippet.js';
@@ -19,8 +18,10 @@ import '../../card/src/card-footer.js';
19
18
  import '../../card/src/card-steps.js';
20
19
  import '../../table/src/table.js';
21
20
  import { defaultLineCountText } from '../../code-snippet/src/formatters.js';
22
- import { extractTableData } from './utils/table-helpers.js';
23
- import { HTML_CONTAINER_SLOT, combineConsecutiveHtmlInline, combineSplitHtmlBlocks } from './utils/html-helpers.js';
21
+ import { renderTable } from './utils/table-helpers.js';
22
+ import { combineConsecutiveHtmlInline, combineSplitHtmlBlocks } from './utils/html-helpers.js';
23
+ import { sanitizeHtmlContent, htmlContainer, spread } from './utils/lit-directives.js';
24
+ import { shouldDelegateToPluginRule, renderFallback, isNativelyHandled } from './utils/plugin-fallback.js';
24
25
 
25
26
  /*
26
27
  * Copyright IBM Corp. 2025, 2026
@@ -30,74 +31,45 @@ import { HTML_CONTAINER_SLOT, combineConsecutiveHtmlInline, combineSplitHtmlBloc
30
31
  *
31
32
  * @license
32
33
  */
33
- // Generic attribute spread for Lit templates
34
- class SpreadAttrs extends Directive {
35
- render(_attrs) {
36
- return nothing;
37
- }
38
- update(part, [attrs]) {
39
- const el = part.element;
40
- for (const [k, v] of Object.entries(attrs ?? {})) {
41
- if (v === false || v === null || v === undefined) {
42
- el.removeAttribute(k);
43
- }
44
- else if (v === true) {
45
- el.setAttribute(k, "");
46
- }
47
- else {
48
- el.setAttribute(k, String(v));
49
- }
50
- }
51
- return nothing;
52
- }
53
- }
54
- const spread = directive(SpreadAttrs);
55
- const sanitizeHtmlContent = (content) => DOMPurify.sanitize(content, {
56
- ADD_ATTR: ["data-aichat-markdown"],
57
- CUSTOM_ELEMENT_HANDLING: {
58
- tagNameCheck: () => true, // Allow custom elements
59
- attributeNameCheck: () => true,
60
- allowCustomizedBuiltInElements: true,
61
- },
62
- });
63
- class HtmlContainer extends Directive {
64
- constructor(partInfo) {
65
- super(partInfo);
66
- this.slotElement = null;
67
- this.lastOpeningHtml = "";
68
- if (partInfo.type !== PartType.ELEMENT) {
69
- throw new Error("HtmlContainer must be used on an element");
70
- }
71
- }
72
- render(_openingHtml, _childTemplate, _sanitize) {
73
- return nothing;
74
- }
75
- update(part, [openingHtml, childTemplate, sanitize]) {
76
- const host = part.element;
77
- if (!this.slotElement || this.lastOpeningHtml !== openingHtml) {
78
- this.lastOpeningHtml = openingHtml;
79
- let content = `${openingHtml}${HTML_CONTAINER_SLOT}`;
80
- if (sanitize && content) {
81
- content = sanitizeHtmlContent(content);
82
- }
83
- const fragment = document.createRange().createContextualFragment(content);
84
- host.replaceChildren(...Array.from(fragment.childNodes));
85
- this.slotElement = host.querySelector("[data-aichat-markdown]");
86
- }
87
- if (this.slotElement) {
88
- render(childTemplate, this.slotElement);
89
- }
90
- return nothing;
91
- }
34
+ /**
35
+ * Walks a `TokenTree` and emits a Lit `TemplateResult` plus a batch of {@link MarkdownRendererSlotDescriptor} records the markdown element consumes during its `updated()` reconcile. External callers should go through {@link renderMarkdownTree} so the batch isn't accidentally dropped.
36
+ *
37
+ * ### Dispatch precedence
38
+ *
39
+ * Per token, in order:
40
+ *
41
+ * 1. **Consumer override** — `options.customRenderers?.[kind]` for `kind` in `{ table, codeBlock }`. The renderer emits a named `<slot>` placeholder and records a descriptor; the markdown element's `updated()` invokes the consumer callback later.
42
+ * 2. **Plugin-overridden rule** — `shouldDelegateToPluginRule(token, md)` is true when a user-supplied markdown-it plugin overrode the renderer rule for one of the curated leaf tokens in `PLUGIN_DELEGABLE_TOKEN_TYPES` (`fence`, `image`, `code_inline`, `html_block`). The token routes through `renderFallback` and surfaces as a `pluginFallback` descriptor.
43
+ * 3. **Native Lit dispatch** — the hand-written `renderWithStaticTag` switch. Kept flat (rather than a tag-to-renderer map) so the per-tag exceptions — task-list passthrough, Carbon `cds-unordered-list` / `cds-ordered-list` wrappers, automatic `target="_blank"` on `<a>`, image plugin delegation — stay easy to grep.
44
+ * 4. **Unknown plugin-introduced token** — anything not natively handled falls through to `renderFallback`, so plugins that register `md.renderer.rules[type]` (footnote, deflist, custom containers, emoji) just work.
45
+ *
46
+ * ### Slot contract
47
+ *
48
+ * {@link MarkdownRendererSlotDescriptor} (defined in `./markdown-renderer-types.ts`) is the bridge between this module and `./markdown.ts`. This module appends descriptors via `recordCustomRender`; the markdown element's `reconcileCustomRendererHosts` consumes them, invokes consumer callbacks (or adopts plugin-fallback HTML) and attaches the result as a light-DOM `<div slot="…">` host (or `<span>` for inline plugin output).
49
+ */
50
+ /**
51
+ * Stable, parent-scoped slot name for an overridable token. Uses `startLine`
52
+ * (not the full `token.map`) so the name doesn't change when the token's
53
+ * `endLine` advances during streaming. The `currentIndex` from the parent
54
+ * context disambiguates siblings on the same start line (rare but possible).
55
+ */
56
+ function slotNameFor(kind, token, options) {
57
+ const startLine = token.map?.[0] ?? 0;
58
+ const index = options.context?.currentIndex ?? 0;
59
+ return `cds-aichat-markdown-renderer-${kind}-${startLine}-${index}`;
92
60
  }
93
- const htmlContainer = directive(HtmlContainer);
94
61
  function renderChildTokenTrees(children, options, childContext) {
95
62
  const normalizedChildren = combineConsecutiveHtmlInline(combineSplitHtmlBlocks(children));
96
63
  // Multiple or complex children: use repeat for stable keying
97
64
  return html `${repeat(normalizedChildren, (child, index) => {
98
- // Generate stable key that doesn't depend on line positions
99
- // This prevents unnecessary re-renders during streaming
100
- const stableKey = `${index}:${child.token.type}:${child.token.tag}`;
65
+ // Key by start line + type + tag rather than array index so blocks keep
66
+ // a stable identity when earlier siblings transiently merge/split during
67
+ // streaming re-parses (which would otherwise re-key and remount later
68
+ // blocks — e.g. remounting a code snippet and reloading its editor). We
69
+ // use `token.map?.[0]` (start line, like `slotNameFor`) rather than the
70
+ // node's `key`/`generateKey`, whose embedded end line advances every tick.
71
+ const startLine = child.token.map?.[0] ?? index;
72
+ const stableKey = `${startLine}:${child.token.type}:${child.token.tag}`;
101
73
  if (child.token.type?.includes("table")) {
102
74
  return `table-${stableKey}`;
103
75
  }
@@ -115,14 +87,40 @@ function renderChildTokenTrees(children, options, childContext) {
115
87
  return result ?? html ``;
116
88
  })}`;
117
89
  }
90
+ /**
91
+ * Top-level entry: renders a markdown token tree to a Lit `TemplateResult`
92
+ * and returns the batch of custom-renderer slot descriptors collected along
93
+ * the way. Callers receive both pieces in one call so the batch can't be
94
+ * accidentally dropped.
95
+ */
96
+ function renderMarkdownTree(node, options) {
97
+ const batch = [];
98
+ let pluginSlotIndex = 0;
99
+ const template = renderTokenTree(node, {
100
+ ...options,
101
+ recordCustomRender: (descriptor) => batch.push(descriptor),
102
+ pluginSlotCounter: { next: () => pluginSlotIndex++ },
103
+ });
104
+ return { template, batch };
105
+ }
118
106
  /**
119
107
  * Converts TokenTree to Lit TemplateResult.
108
+ *
109
+ * Recursive renderer; external callers should use {@link renderMarkdownTree}
110
+ * which collects the slot-descriptor batch.
120
111
  */
121
112
  function renderTokenTree(node, options) {
122
113
  const { token, children } = node;
123
114
  const { context, sanitize } = options;
124
115
  // Handle raw HTML blocks and inline HTML
125
116
  if (token.type === "html_block" || token.type === "html_inline") {
117
+ // Plugin-overridden html_block rules (rare but supported) — route through
118
+ // the plugin's renderer before our default unsafeHTML pass-through.
119
+ if (token.type === "html_block" &&
120
+ shouldDelegateToPluginRule(token, options.md) &&
121
+ options.md) {
122
+ return renderFallback(token, node, options.md, sanitize, options);
123
+ }
126
124
  let content = token.content || "";
127
125
  // Apply HTML sanitization if requested
128
126
  if (sanitize && content) {
@@ -145,18 +143,22 @@ function renderTokenTree(node, options) {
145
143
  }
146
144
  // Handle inline code spans
147
145
  if (token.type === "code_inline") {
146
+ if (shouldDelegateToPluginRule(token, options.md) && options.md) {
147
+ return renderFallback(token, node, options.md, sanitize, options);
148
+ }
148
149
  return html `<code>${token.content}</code>`;
149
150
  }
150
151
  // Handle fenced code blocks
151
152
  if (token.type === "fence") {
152
153
  const language = token.info?.trim() ?? "";
153
154
  const { codeSnippetHighlight = true, codeSnippetShowLessText, codeSnippetShowMoreText, codeSnippetCopyButtonTooltipContent, codeSnippetGetLineCountText = defaultLineCountText, codeSnippetAriaLabelReadOnly, codeSnippetAriaLabelEditable, } = options;
154
- return html `<cds-aichat-card is-flush>
155
+ const defaultTemplate = html `<cds-aichat-card is-flush>
155
156
  <div slot="body">
156
157
  <cds-aichat-code-snippet
157
158
  data-rounded
158
159
  .language=${language}
159
160
  .highlight=${codeSnippetHighlight}
161
+ .detectLanguage=${true}
160
162
  .showLessText=${codeSnippetShowLessText}
161
163
  .showMoreText=${codeSnippetShowMoreText}
162
164
  .copyButtonTooltipContent=${codeSnippetCopyButtonTooltipContent}
@@ -167,6 +169,27 @@ function renderTokenTree(node, options) {
167
169
  ></cds-aichat-code-snippet>
168
170
  </div>
169
171
  </cds-aichat-card>`;
172
+ if (options.customRenderers?.codeBlock) {
173
+ const slotName = slotNameFor("codeBlock", token, options);
174
+ options.recordCustomRender?.({
175
+ slotName,
176
+ kind: "codeBlock",
177
+ token: token,
178
+ node,
179
+ data: {
180
+ language,
181
+ code: token.content ?? "",
182
+ isStreaming: !!options.streaming,
183
+ },
184
+ });
185
+ return html `<slot name=${slotName}>${defaultTemplate}</slot>`;
186
+ }
187
+ // Honor user-plugin `fence` overrides (markdown-it-mermaid, syntax
188
+ // highlighters, etc.). customRenderer slot above wins when set.
189
+ if (shouldDelegateToPluginRule(token, options.md) && options.md) {
190
+ return renderFallback(token, node, options.md, sanitize, options);
191
+ }
192
+ return defaultTemplate;
170
193
  }
171
194
  // Handle structural elements (paragraphs, headings, lists, etc.)
172
195
  const tag = token.tag;
@@ -202,6 +225,12 @@ function renderTokenTree(node, options) {
202
225
  else {
203
226
  content = renderChildTokenTrees(children, options, childContext);
204
227
  }
228
+ // Unknown plugin-introduced tokens (no tag we recognize) — defer to
229
+ // markdown-it's renderer so plugins that register md.renderer.rules[type]
230
+ // (footnote, emoji, deflist, container, etc.) just work.
231
+ if (!tag && options.md && !isNativelyHandled(token)) {
232
+ return renderFallback(token, node, options.md, sanitize, options);
233
+ }
205
234
  // Handle tokens without HTML tags (just return content)
206
235
  if (!tag) {
207
236
  return content;
@@ -232,6 +261,8 @@ function renderWithStaticTag(tag, token, content, attrs, options, _context, node
232
261
  return html `<blockquote ${spread(attrs)}>${content}</blockquote>`;
233
262
  case "pre":
234
263
  return html `<pre ${spread(attrs)}>${content}</pre>`;
264
+ case "hr":
265
+ return html `<hr ${spread(attrs)} />`;
235
266
  // Headings
236
267
  case "h1":
237
268
  return html `<h1 ${spread(attrs)}>${content}</h1>`;
@@ -282,7 +313,7 @@ function renderWithStaticTag(tag, token, content, attrs, options, _context, node
282
313
  case "cds-checkbox": {
283
314
  const { checked, disabled, ...otherAttrs } = attrs;
284
315
  const isChecked = checked === "true";
285
- const isDisabled = disabled === undefined ? true : disabled === "" || disabled === "true";
316
+ const isDisabled = disabled === undefined ? false : disabled === "" || disabled === "true";
286
317
  return html `<cds-checkbox
287
318
  ?checked=${isChecked}
288
319
  ?disabled=${isDisabled}
@@ -339,80 +370,35 @@ function renderWithStaticTag(tag, token, content, attrs, options, _context, node
339
370
  attrs.target = "_blank";
340
371
  }
341
372
  return html `<a ${spread(attrs)}>${content}</a>`;
373
+ // Self-closing image. Plugin-introduced wrappers (e.g. image-figures)
374
+ // route through `shouldDelegateToPluginRule` before falling back to a
375
+ // plain `<img>` element.
376
+ case "img":
377
+ if (node && options.md && shouldDelegateToPluginRule(token, options.md)) {
378
+ return renderFallback(token, node, options.md, options.sanitize, options);
379
+ }
380
+ return html `<img ${spread(attrs)} />`;
342
381
  // Tables with Carbon component and streaming support
343
382
  case "table": {
344
383
  if (!node) {
345
384
  return html `<div>Error: Missing table data</div>`;
346
385
  }
347
- const { streaming, forceTableLoading, context: parentContext, tableFilterPlaceholderText, tablePreviousPageText, tableNextPageText, tableItemsPerPageText, tableDownloadLabelText, tableLocale, tableGetPaginationSupplementalText, tableGetPaginationStatusText, } = options;
348
- // Determine if we should show loading state during streaming
349
- let isLoading = Boolean(forceTableLoading);
350
- if (!isLoading &&
351
- streaming &&
352
- parentContext?.parentChildren &&
353
- parentContext?.currentIndex !== undefined) {
354
- const { parentChildren, currentIndex } = parentContext;
355
- const hasNodesAfterTable = currentIndex < parentChildren.length - 1;
356
- isLoading = !hasNodesAfterTable;
357
- }
358
- const renderCellTokens = (tokens, contextOverrides = {}) => {
359
- // Same as block/inline rendering: merge split raw HTML (e.g. `<a>…</a>`)
360
- // so each cell is not rendered as separate unsafeHTML + text chunks.
361
- const normalizedTokens = combineConsecutiveHtmlInline(tokens);
362
- return html `${repeat(normalizedTokens, (child, index) => `cell-${index}:${child.token.type}:${child.token.tag}`, (child, index) => renderTokenTree(child, {
363
- ...options,
364
- context: {
365
- ...options.context,
366
- ...contextOverrides,
367
- parentChildren: normalizedTokens,
368
- currentIndex: index,
369
- },
370
- }))}`;
371
- };
372
- const createCellContent = (cell, contextOverrides) => ({
373
- text: cell.text,
374
- template: cell.tokens
375
- ? renderCellTokens(cell.tokens, contextOverrides)
376
- : null,
377
- });
378
- // Only extract and process table data when not loading to avoid unnecessary work.
379
- // During loading, the table shows a skeleton and doesn't need the actual data.
380
- let headers = [];
381
- let tableRows = [];
382
- if (!isLoading) {
383
- const extractedData = extractTableData(node);
384
- headers = extractedData.headers.map((cell) => createCellContent(cell, { isInThead: true }));
385
- tableRows = extractedData.rows.map((row) => ({
386
- cells: row.map((cell) => createCellContent(cell)),
387
- }));
388
- }
389
- // Always return the same structure to allow Lit to reuse the table element.
390
- // When isLoading is true, the table component will show a skeleton state.
391
- // When isLoading is false, it will show the actual data.
392
- // This prevents recreating the table element and preserves its internal state.
393
- return html `<div class="cds-aichat-table--square">
394
- <cds-aichat-table
395
- data-rounded
396
- .headers=${headers}
397
- .rows=${tableRows}
398
- .loading=${isLoading}
399
- .filterPlaceholderText=${tableFilterPlaceholderText}
400
- .previousPageText=${tablePreviousPageText}
401
- .nextPageText=${tableNextPageText}
402
- .itemsPerPageText=${tableItemsPerPageText}
403
- .downloadLabelText=${tableDownloadLabelText}
404
- .locale=${tableLocale}
405
- .getPaginationSupplementalText=${tableGetPaginationSupplementalText}
406
- .getPaginationStatusText=${tableGetPaginationStatusText}
407
- ...=${attrs}
408
- ></cds-aichat-table>
409
- </div>`;
386
+ const slotName = options.customRenderers?.table
387
+ ? slotNameFor("table", token, options)
388
+ : undefined;
389
+ return renderTable(token, node, attrs, options, renderTokenTree, slotName);
410
390
  }
411
- // Fallback for unknown tags
391
+ // Fallback for unknown tags. If we have the markdown-it instance available,
392
+ // defer to its renderer for plugin-introduced container tags (footnote_block,
393
+ // dl/dt/dd from deflist, custom containers, etc.). Otherwise fall back to
394
+ // a generic <div>.
412
395
  default:
396
+ if (options.md && node && !isNativelyHandled(token)) {
397
+ return renderFallback(token, node, options.md, options.sanitize, options);
398
+ }
413
399
  return html `<div ${spread(attrs)}>${content}</div>`;
414
400
  }
415
401
  }
416
402
 
417
- export { renderTokenTree };
403
+ export { renderMarkdownTree, renderTokenTree };
418
404
  //# sourceMappingURL=markdown-renderer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-renderer.js","sources":["../../../../src/components/markdown/src/markdown-renderer.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAmCH;AACA,MAAM,WAAY,SAAQ,SAAS,CAAA;AACjC,IAAA,MAAM,CAAC,MAA+B,EAAA;AACpC,QAAA,OAAO,OAAO;IAChB;AACA,IAAA,MAAM,CAAC,IAAS,EAAE,CAAC,KAAK,CAA4B,EAAA;AAClD,QAAA,MAAM,EAAE,GAAG,IAAI,CAAC,OAAkB;AAClC,QAAA,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE;AAChD,YAAA,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS,EAAE;AAChD,gBAAA,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;YACvB;AAAO,iBAAA,IAAI,CAAC,KAAK,IAAI,EAAE;AACrB,gBAAA,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE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C,CACL,EAAE;AACL,YAAA,CAAC;YAED,MAAM,iBAAiB,GAAG,CACxB,IAAmB,EACnB,gBAA0C,MACpB;gBACtB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,QAAQ,EAAE,IAAI,CAAC;sBACX,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,gBAAgB;AAChD,sBAAE,IAAI;AACT,aAAA,CAAC;;;YAIF,IAAI,OAAO,GAAuB,EAAE;YACpC,IAAI,SAAS,GAAsB,EAAE;YAErC,IAAI,CAAC,SAAS,EAAE;AACd,gBAAA,MAAM,aAAa,GAAG,gBAAgB,CAAC,IAAI,CAAC;gBAC5C,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,KACvC,iBAAiB,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAC7C;AACD,gBAAA,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM;AAC3C,oBAAA,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,iBAAiB,CAAC,IAAI,CAAC,CAAC;AAClD,iBAAA,CAAC,CAAC;YACL;;;;;AAMA,YAAA,OAAO,IAAI,CAAA,CAAA;;;qBAGI,OAAO;kBACV,SAAS;qBACN,SAAS;mCACK,0BAA0B;8BAC/B,qBAAqB;0BACzB,iBAAiB;8BACb,qBAAqB;+BACpB,sBAAsB;oBACjC,WAAW;2CACY,kCAAkC;qCACxC,4BAA4B;gBACjD,KAAK;;aAER;QACT;;AAGA,QAAA;YACE,OAAO,IAAI,CAAA,CAAA,KAAA,EAAQ,MAAM,CAAC,KAAK,CAAC,CAAA,CAAA,EAAI,OAAO,CAAA,MAAA,CAAQ;;AAEzD;;;;"}
1
+ {"version":3,"file":"markdown-renderer.js","sources":["../../../../src/components/markdown/src/markdown-renderer.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;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