@object-ui/plugin-markdown 17.5.0 → 17.7.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
@@ -24,9 +24,10 @@ pnpm add @object-ui/plugin-markdown
24
24
  ```typescript
25
25
  // In your app entry point (e.g., App.tsx or main.tsx)
26
26
  import '@object-ui/plugin-markdown';
27
+ import type { MarkdownSchema } from '@object-ui/plugin-markdown';
27
28
 
28
29
  // Now you can use markdown type in your schemas
29
- const schema = {
30
+ const schema: MarkdownSchema = {
30
31
  type: 'markdown',
31
32
  content: '# Hello World\n\nThis is **markdown** text.'
32
33
  };
@@ -40,7 +41,7 @@ import { ComponentRegistry } from '@object-ui/core';
40
41
 
41
42
  // Manually register if needed
42
43
  Object.entries(markdownComponents).forEach(([type, component]) => {
43
- ComponentRegistry.register(type, component);
44
+ ComponentRegistry.register(type, component, { namespace: 'plugin-markdown' });
44
45
  });
45
46
  ```
46
47
 
@@ -59,13 +60,29 @@ const schema: MarkdownSchema = {
59
60
 
60
61
  ## Schema API
61
62
 
62
- ```typescript
63
- {
64
- type: 'markdown',
65
- content?: string, // Markdown content (supports GitHub Flavored Markdown)
66
- className?: string // Tailwind classes
67
- }
68
- ```
63
+ `MarkdownSchema` has one authority — it is declared in `@object-ui/types` and
64
+ re-exported by this package — so the members are listed here rather than
65
+ re-declared as a second copy in a code block.
66
+
67
+ | Member | Type | Required | Default | Read by |
68
+ | --- | --- | --- | --- | --- |
69
+ | `type` | `'markdown'` | yes | none | the registry, to resolve this renderer (registered under the `plugin-markdown` namespace) |
70
+ | `content` | `string` | yes | none — see the note below | `MarkdownRenderer`, which forwards it to the lazy implementation; supports GitHub Flavored Markdown |
71
+ | `className` | `string` | no | none | `MarkdownRenderer`, which puts it on the markdown container as Tailwind classes |
72
+
73
+ Every other member is inherited from `BaseSchema`; this renderer reads none of
74
+ them.
75
+
76
+ > ⚠️ **`content`: what the contract says and what the runtime does.** The type
77
+ > declares `content` REQUIRED and the component's `inputs` manifest declares it
78
+ > `required: true` — but the renderer reads `schema.content || ''`, so a node
79
+ > that omits it renders empty instead of failing. Both statements are true, and
80
+ > neither is widened or narrowed here.
81
+
82
+ `sanitize` and `components` appear on the interface only as ADR-0049 retirement
83
+ tombstones (`?: never`, objectui#6972) — they are not authorable members and
84
+ nothing reads them. Sanitization is unconditional: there is no authored spelling
85
+ that turns it off.
69
86
 
70
87
  ## Supported Markdown Features
71
88
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
- export type { MarkdownSchema } from './types';
3
- export { extractToc, type TocItem } from './toc';
4
- export { Mermaid } from './Mermaid';
2
+ export type { MarkdownSchema } from './types.js';
3
+ export { extractToc, type TocItem } from './toc.js';
4
+ export { Mermaid } from './Mermaid.js';
5
5
  export interface MarkdownRendererProps {
6
6
  schema: {
7
7
  type: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAS5D,CAAC;AA2BF,eAAO,MAAM,kBAAkB;;CAE9B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAS5D,CAAC;AAyBF,eAAO,MAAM,kBAAkB;;CAE9B,CAAC"}
package/dist/index.js CHANGED
@@ -26,13 +26,12 @@ var h = Object.defineProperty, g = (e, t, n) => () => {
26
26
  enumerable: !0
27
27
  });
28
28
  return t || h(n, Symbol.toStringTag, { value: "Module" }), n;
29
- };
30
- //#endregion
31
- //#region src/toc.ts
32
- function v(e) {
33
- return e.replace(/!\[[^\]]*\]\([^)]*\)/g, "").replace(/\[([^\]]+)\]\([^)]*\)/g, "$1").replace(/`([^`]+)`/g, "$1").replace(/(\*\*|__)(.*?)\1/g, "$2").replace(/(\*|_)(.*?)\1/g, "$2").replace(/<[^>]+>/g, "").trim();
29
+ }, v = "", y = "", b = /\uE000(\d+)\uE001/g, x = /[\uE000\uE001]/g, S = /(?<![^\s\p{P}\p{S}])(?<!_)(_+)(?!\s)(.+?)(?<!\s)(_+)(?!_)(?![^\s\p{P}\p{S}])/gu;
30
+ function C(e) {
31
+ let t = [];
32
+ return e.replace(x, "").replace(/`([^`]+)`/g, (e, n) => (t.push(n), `${v}${t.length - 1}${y}`)).replace(/!\[[^\]]*\]\([^)]*\)/g, "").replace(/\[([^\]]+)\]\([^)]*\)/g, "$1").replace(/\*\*(.*?)\*\*/g, "$1").replace(/\*(.*?)\*/g, "$1").replace(S, "$2").replace(/<[^>]+>/g, "").replace(b, (e, n) => t[Number(n)]).trim();
34
33
  }
35
- function y(e, t) {
34
+ function w(e, t) {
36
35
  let n = t?.minDepth ?? 2, r = t?.maxDepth ?? 3, i = new o(), a = [], s = null;
37
36
  for (let t of (e ?? "").split(/\r?\n/)) {
38
37
  let e = t.match(/^\s{0,3}(`{3,}|~{3,})/);
@@ -44,7 +43,7 @@ function y(e, t) {
44
43
  if (s !== null) continue;
45
44
  let o = t.match(/^(#{1,6})\s+(.+?)\s*#*\s*$/);
46
45
  if (!o) continue;
47
- let c = o[1].length, l = v(o[2]);
46
+ let c = o[1].length, l = C(o[2]);
48
47
  if (!l) continue;
49
48
  let u = i.slug(l);
50
49
  c >= n && c <= r && a.push({
@@ -57,17 +56,17 @@ function y(e, t) {
57
56
  }
58
57
  //#endregion
59
58
  //#region src/Mermaid.tsx
60
- function b() {
61
- return C ||= import("mermaid").then((e) => e.default), C;
59
+ function T() {
60
+ return O ||= import("mermaid").then((e) => e.default), O;
62
61
  }
63
- function x() {
62
+ function E() {
64
63
  return typeof document < "u" && document.documentElement.classList.contains("dark");
65
64
  }
66
- function S({ chart: t }) {
67
- let [n, r] = e.useState(""), [i, o] = e.useState(null), [s, c] = e.useState(x);
65
+ function D({ chart: t }) {
66
+ let [n, r] = e.useState(""), [i, o] = e.useState(null), [s, c] = e.useState(E);
68
67
  return e.useEffect(() => {
69
68
  if (typeof document > "u") return;
70
- let e = document.documentElement, t = new MutationObserver(() => c(x()));
69
+ let e = document.documentElement, t = new MutationObserver(() => c(E()));
71
70
  return t.observe(e, {
72
71
  attributes: !0,
73
72
  attributeFilter: ["class"]
@@ -78,13 +77,13 @@ function S({ chart: t }) {
78
77
  r(""), o(null);
79
78
  return;
80
79
  }
81
- return b().then(async (t) => {
80
+ return T().then(async (t) => {
82
81
  t.initialize({
83
82
  startOnLoad: !1,
84
83
  securityLevel: "strict",
85
84
  theme: s ? "dark" : "default"
86
85
  });
87
- let i = `os-mermaid-${w += 1}`, { svg: a } = await t.render(i, n);
86
+ let i = `os-mermaid-${k += 1}`, { svg: a } = await t.render(i, n);
88
87
  e || (r(a), o(null));
89
88
  }).catch((t) => {
90
89
  e || o(t instanceof Error ? t.message : String(t));
@@ -111,23 +110,23 @@ function S({ chart: t }) {
111
110
  })
112
111
  });
113
112
  }
114
- var C, w, T = g((() => {
115
- C = null, w = 0;
113
+ var O, k, A = g((() => {
114
+ O = null, k = 0;
116
115
  }));
117
116
  //#endregion
118
117
  //#region src/markdown-theme.ts
119
- function E() {
120
- if (typeof document > "u" || document.getElementById(D)) return;
118
+ function j() {
119
+ if (typeof document > "u" || document.getElementById(M)) return;
121
120
  let e = document.createElement("style");
122
- e.id = D, e.textContent = O, document.head.appendChild(e);
121
+ e.id = M, e.textContent = N, document.head.appendChild(e);
123
122
  }
124
- var D, O, k = g((() => {
125
- D = "os-markdown-styles", O = "\n.os-markdown .md-anchor {\n margin-left: 0.4ch;\n color: var(--muted-foreground);\n text-decoration: none;\n opacity: 0;\n transition: opacity 0.12s ease-in-out;\n}\n.os-markdown :is(h1,h2,h3,h4,h5,h6):hover .md-anchor { opacity: 0.6; }\n.os-markdown .md-anchor:hover { opacity: 1; }\n\n/* highlight.js tokens — light */\n.os-markdown .hljs-comment,\n.os-markdown .hljs-quote { color: var(--muted-foreground); font-style: italic; }\n.os-markdown .hljs-keyword,\n.os-markdown .hljs-selector-tag,\n.os-markdown .hljs-literal,\n.os-markdown .hljs-doctag { color: #8250df; }\n.os-markdown .hljs-string,\n.os-markdown .hljs-regexp,\n.os-markdown .hljs-addition { color: #0a7d33; }\n.os-markdown .hljs-number,\n.os-markdown .hljs-symbol,\n.os-markdown .hljs-bullet { color: #0550ae; }\n.os-markdown .hljs-title,\n.os-markdown .hljs-section,\n.os-markdown .hljs-name,\n.os-markdown .hljs-built_in { color: #6639ba; }\n.os-markdown .hljs-attr,\n.os-markdown .hljs-attribute,\n.os-markdown .hljs-variable,\n.os-markdown .hljs-template-variable { color: #953800; }\n.os-markdown .hljs-type,\n.os-markdown .hljs-class .hljs-title { color: #0550ae; }\n.os-markdown .hljs-meta { color: var(--muted-foreground); }\n.os-markdown .hljs-deletion { color: #b35900; }\n.os-markdown .hljs-emphasis { font-style: italic; }\n.os-markdown .hljs-strong { font-weight: 600; }\n\n/* highlight.js tokens — dark */\n.dark .os-markdown .hljs-keyword,\n.dark .os-markdown .hljs-selector-tag,\n.dark .os-markdown .hljs-literal,\n.dark .os-markdown .hljs-doctag { color: #d2a8ff; }\n.dark .os-markdown .hljs-string,\n.dark .os-markdown .hljs-regexp,\n.dark .os-markdown .hljs-addition { color: #7ee787; }\n.dark .os-markdown .hljs-number,\n.dark .os-markdown .hljs-symbol,\n.dark .os-markdown .hljs-bullet { color: #79c0ff; }\n.dark .os-markdown .hljs-title,\n.dark .os-markdown .hljs-section,\n.dark .os-markdown .hljs-name,\n.dark .os-markdown .hljs-built_in { color: #d2a8ff; }\n.dark .os-markdown .hljs-attr,\n.dark .os-markdown .hljs-attribute,\n.dark .os-markdown .hljs-variable,\n.dark .os-markdown .hljs-template-variable { color: #ffa657; }\n.dark .os-markdown .hljs-type,\n.dark .os-markdown .hljs-class .hljs-title { color: #79c0ff; }\n.dark .os-markdown .hljs-deletion { color: #ffa198; }\n\n/* GitHub-style alert callouts (icon = CSS pseudo-element, no SVG) */\n.os-markdown .markdown-alert {\n margin: 1em 0;\n padding: 0.6em 1em;\n border-left: 0.25em solid var(--border);\n border-radius: 0.375rem;\n background: color-mix(in srgb, var(--muted) 40%, transparent);\n}\n.os-markdown .markdown-alert > :first-child { margin-top: 0; }\n.os-markdown .markdown-alert > :last-child { margin-bottom: 0; }\n.os-markdown .markdown-alert-title {\n display: flex;\n align-items: center;\n font-weight: 600;\n line-height: 1;\n text-transform: capitalize;\n}\n.os-markdown .markdown-alert-title::before {\n margin-right: 0.5ch;\n font-weight: 700;\n}\n.os-markdown .markdown-alert-note { border-left-color: #0969da; }\n.os-markdown .markdown-alert-note .markdown-alert-title { color: #0969da; }\n.os-markdown .markdown-alert-note .markdown-alert-title::before { content: \"ⓘ\"; }\n.os-markdown .markdown-alert-tip { border-left-color: #1a7f37; }\n.os-markdown .markdown-alert-tip .markdown-alert-title { color: #1a7f37; }\n.os-markdown .markdown-alert-tip .markdown-alert-title::before { content: \"💡\"; }\n.os-markdown .markdown-alert-important { border-left-color: #8250df; }\n.os-markdown .markdown-alert-important .markdown-alert-title { color: #8250df; }\n.os-markdown .markdown-alert-important .markdown-alert-title::before { content: \"❖\"; }\n.os-markdown .markdown-alert-warning { border-left-color: #9a6700; }\n.os-markdown .markdown-alert-warning .markdown-alert-title { color: #9a6700; }\n.os-markdown .markdown-alert-warning .markdown-alert-title::before { content: \"⚠\"; }\n.os-markdown .markdown-alert-caution { border-left-color: var(--destructive); }\n.os-markdown .markdown-alert-caution .markdown-alert-title { color: var(--destructive); }\n.os-markdown .markdown-alert-caution .markdown-alert-title::before { content: \"⛔\"; }\n.dark .os-markdown .markdown-alert-note { border-left-color: #4493f8; }\n.dark .os-markdown .markdown-alert-note .markdown-alert-title { color: #4493f8; }\n.dark .os-markdown .markdown-alert-tip { border-left-color: #3fb950; }\n.dark .os-markdown .markdown-alert-tip .markdown-alert-title { color: #3fb950; }\n.dark .os-markdown .markdown-alert-important { border-left-color: #ab7df8; }\n.dark .os-markdown .markdown-alert-important .markdown-alert-title { color: #ab7df8; }\n.dark .os-markdown .markdown-alert-warning { border-left-color: #d29922; }\n.dark .os-markdown .markdown-alert-warning .markdown-alert-title { color: #d29922; }\n\n/* Bordered tables: @tailwindcss/typography zeroes padding on each row's\n first (inline-start) and last (inline-end) cell because it assumes\n borderless tables. We add cell borders (prose-th/td:border), so restore\n symmetric horizontal padding — otherwise the first column's text sits\n flush against the left border, misaligned with every other column. The\n 0.6666667em matches prose-sm's inner-cell padding. The .os-markdown\n class selector outranks typography's zero-specificity :where() rules. */\n.os-markdown table th:first-child,\n.os-markdown table td:first-child { padding-inline-start: 0.6666667em; }\n.os-markdown table th:last-child,\n.os-markdown table td:last-child { padding-inline-end: 0.6666667em; }\n";
126
- })), A = /* @__PURE__ */ _({
127
- default: () => F,
128
- parseMetadataFence: () => N
123
+ var M, N, P = g((() => {
124
+ M = "os-markdown-styles", N = "\n.os-markdown .md-anchor {\n margin-left: 0.4ch;\n color: var(--muted-foreground);\n text-decoration: none;\n opacity: 0;\n transition: opacity 0.12s ease-in-out;\n}\n.os-markdown :is(h1,h2,h3,h4,h5,h6):hover .md-anchor { opacity: 0.6; }\n.os-markdown .md-anchor:hover { opacity: 1; }\n\n/* highlight.js tokens — light */\n.os-markdown .hljs-comment,\n.os-markdown .hljs-quote { color: var(--muted-foreground); font-style: italic; }\n.os-markdown .hljs-keyword,\n.os-markdown .hljs-selector-tag,\n.os-markdown .hljs-literal,\n.os-markdown .hljs-doctag { color: #8250df; }\n.os-markdown .hljs-string,\n.os-markdown .hljs-regexp,\n.os-markdown .hljs-addition { color: #0a7d33; }\n.os-markdown .hljs-number,\n.os-markdown .hljs-symbol,\n.os-markdown .hljs-bullet { color: #0550ae; }\n.os-markdown .hljs-title,\n.os-markdown .hljs-section,\n.os-markdown .hljs-name,\n.os-markdown .hljs-built_in { color: #6639ba; }\n.os-markdown .hljs-attr,\n.os-markdown .hljs-attribute,\n.os-markdown .hljs-variable,\n.os-markdown .hljs-template-variable { color: #953800; }\n.os-markdown .hljs-type,\n.os-markdown .hljs-class .hljs-title { color: #0550ae; }\n.os-markdown .hljs-meta { color: var(--muted-foreground); }\n.os-markdown .hljs-deletion { color: #b35900; }\n.os-markdown .hljs-emphasis { font-style: italic; }\n.os-markdown .hljs-strong { font-weight: 600; }\n\n/* highlight.js tokens — dark */\n.dark .os-markdown .hljs-keyword,\n.dark .os-markdown .hljs-selector-tag,\n.dark .os-markdown .hljs-literal,\n.dark .os-markdown .hljs-doctag { color: #d2a8ff; }\n.dark .os-markdown .hljs-string,\n.dark .os-markdown .hljs-regexp,\n.dark .os-markdown .hljs-addition { color: #7ee787; }\n.dark .os-markdown .hljs-number,\n.dark .os-markdown .hljs-symbol,\n.dark .os-markdown .hljs-bullet { color: #79c0ff; }\n.dark .os-markdown .hljs-title,\n.dark .os-markdown .hljs-section,\n.dark .os-markdown .hljs-name,\n.dark .os-markdown .hljs-built_in { color: #d2a8ff; }\n.dark .os-markdown .hljs-attr,\n.dark .os-markdown .hljs-attribute,\n.dark .os-markdown .hljs-variable,\n.dark .os-markdown .hljs-template-variable { color: #ffa657; }\n.dark .os-markdown .hljs-type,\n.dark .os-markdown .hljs-class .hljs-title { color: #79c0ff; }\n.dark .os-markdown .hljs-deletion { color: #ffa198; }\n\n/* GitHub-style alert callouts (icon = CSS pseudo-element, no SVG) */\n.os-markdown .markdown-alert {\n margin: 1em 0;\n padding: 0.6em 1em;\n border-left: 0.25em solid var(--border);\n border-radius: 0.375rem;\n background: color-mix(in srgb, var(--muted) 40%, transparent);\n}\n.os-markdown .markdown-alert > :first-child { margin-top: 0; }\n.os-markdown .markdown-alert > :last-child { margin-bottom: 0; }\n.os-markdown .markdown-alert-title {\n display: flex;\n align-items: center;\n font-weight: 600;\n line-height: 1;\n text-transform: capitalize;\n}\n.os-markdown .markdown-alert-title::before {\n margin-right: 0.5ch;\n font-weight: 700;\n}\n.os-markdown .markdown-alert-note { border-left-color: #0969da; }\n.os-markdown .markdown-alert-note .markdown-alert-title { color: #0969da; }\n.os-markdown .markdown-alert-note .markdown-alert-title::before { content: \"ⓘ\"; }\n.os-markdown .markdown-alert-tip { border-left-color: #1a7f37; }\n.os-markdown .markdown-alert-tip .markdown-alert-title { color: #1a7f37; }\n.os-markdown .markdown-alert-tip .markdown-alert-title::before { content: \"💡\"; }\n.os-markdown .markdown-alert-important { border-left-color: #8250df; }\n.os-markdown .markdown-alert-important .markdown-alert-title { color: #8250df; }\n.os-markdown .markdown-alert-important .markdown-alert-title::before { content: \"❖\"; }\n.os-markdown .markdown-alert-warning { border-left-color: #9a6700; }\n.os-markdown .markdown-alert-warning .markdown-alert-title { color: #9a6700; }\n.os-markdown .markdown-alert-warning .markdown-alert-title::before { content: \"⚠\"; }\n.os-markdown .markdown-alert-caution { border-left-color: var(--destructive); }\n.os-markdown .markdown-alert-caution .markdown-alert-title { color: var(--destructive); }\n.os-markdown .markdown-alert-caution .markdown-alert-title::before { content: \"⛔\"; }\n.dark .os-markdown .markdown-alert-note { border-left-color: #4493f8; }\n.dark .os-markdown .markdown-alert-note .markdown-alert-title { color: #4493f8; }\n.dark .os-markdown .markdown-alert-tip { border-left-color: #3fb950; }\n.dark .os-markdown .markdown-alert-tip .markdown-alert-title { color: #3fb950; }\n.dark .os-markdown .markdown-alert-important { border-left-color: #ab7df8; }\n.dark .os-markdown .markdown-alert-important .markdown-alert-title { color: #ab7df8; }\n.dark .os-markdown .markdown-alert-warning { border-left-color: #d29922; }\n.dark .os-markdown .markdown-alert-warning .markdown-alert-title { color: #d29922; }\n\n/* Bordered tables: @tailwindcss/typography zeroes padding on each row's\n first (inline-start) and last (inline-end) cell because it assumes\n borderless tables. We add cell borders (prose-th/td:border), so restore\n symmetric horizontal padding — otherwise the first column's text sits\n flush against the left border, misaligned with every other column. The\n 0.6666667em matches prose-sm's inner-cell padding. The .os-markdown\n class selector outranks typography's zero-specificity :where() rules. */\n.os-markdown table th:first-child,\n.os-markdown table td:first-child { padding-inline-start: 0.6666667em; }\n.os-markdown table th:last-child,\n.os-markdown table td:last-child { padding-inline-end: 0.6666667em; }\n";
125
+ })), F = /* @__PURE__ */ _({
126
+ default: () => B,
127
+ parseMetadataFence: () => R
129
128
  });
130
- function j() {
129
+ function I() {
131
130
  let e = (e) => typeof e == "string" ? e.split(/\s+/).filter(Boolean) : Array.isArray(e) ? e : [], t = (n) => {
132
131
  if (!n || typeof n != "object") return;
133
132
  let r = n.properties;
@@ -135,10 +134,10 @@ function j() {
135
134
  };
136
135
  return (e) => t(e);
137
136
  }
138
- function M(t) {
139
- return typeof t == "string" ? t : typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(M).join("") : e.isValidElement(t) ? M(t.props.children) : "";
137
+ function L(t) {
138
+ return typeof t == "string" ? t : typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(L).join("") : e.isValidElement(t) ? L(t.props.children) : "";
140
139
  }
141
- function N(e) {
140
+ function R(e) {
142
141
  let t = {};
143
142
  for (let n of e.split("\n")) {
144
143
  let e = n.trim();
@@ -150,8 +149,8 @@ function N(e) {
150
149
  }
151
150
  return t;
152
151
  }
153
- function P({ source: t }) {
154
- let n = e.useMemo(() => N(t), [t]), i = r.get("element:metadata_viewer");
152
+ function z({ source: t }) {
153
+ let n = e.useMemo(() => R(t), [t]), i = r.get("element:metadata_viewer");
155
154
  return i ? /* @__PURE__ */ a("div", {
156
155
  className: "not-prose my-4",
157
156
  children: /* @__PURE__ */ a(i, { schema: {
@@ -160,14 +159,14 @@ function P({ source: t }) {
160
159
  } })
161
160
  }) : /* @__PURE__ */ a("pre", { children: /* @__PURE__ */ a("code", { children: t }) });
162
161
  }
163
- function F({ content: e, className: t }) {
164
- return E(), /* @__PURE__ */ a("div", {
162
+ function B({ content: e, className: t }) {
163
+ return j(), /* @__PURE__ */ a("div", {
165
164
  "data-slot": "markdown",
166
165
  className: ((...e) => e.filter(Boolean).join(" "))("prose prose-sm dark:prose-invert max-w-none", "prose-headings:font-semibold prose-headings:tracking-tight", "prose-h1:text-3xl prose-h2:text-2xl prose-h3:text-xl", "prose-p:leading-relaxed prose-p:text-foreground", "prose-a:text-primary prose-a:no-underline hover:prose-a:underline", "prose-code:text-foreground prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:before:content-none prose-code:after:content-none", "prose-pre:bg-muted prose-pre:text-foreground prose-pre:border", "prose-blockquote:border-l-primary prose-blockquote:text-muted-foreground", "prose-strong:text-foreground prose-strong:font-semibold", "prose-ul:list-disc prose-ol:list-decimal", "prose-li:text-foreground prose-li:marker:text-muted-foreground", "prose-table:border prose-th:border prose-th:bg-muted prose-td:border", "prose-img:rounded-md prose-img:border", "os-markdown", t),
167
166
  children: /* @__PURE__ */ a(s, {
168
- remarkPlugins: R,
169
- rehypePlugins: z,
170
- components: B,
167
+ remarkPlugins: U,
168
+ rehypePlugins: W,
169
+ components: G,
171
170
  disallowedElements: [
172
171
  "script",
173
172
  "style",
@@ -180,8 +179,8 @@ function F({ content: e, className: t }) {
180
179
  })
181
180
  });
182
181
  }
183
- var I, L, R, z, B, V = g((() => {
184
- k(), T(), I = (e) => (e ?? []).filter((e) => !(Array.isArray(e) && e[0] === "className")), L = {
182
+ var V, H, U, W, G, K = g((() => {
183
+ P(), A(), V = (e) => (e ?? []).filter((e) => !(Array.isArray(e) && e[0] === "className")), H = {
185
184
  ...d,
186
185
  clobberPrefix: "",
187
186
  tagNames: [
@@ -193,14 +192,14 @@ var I, L, R, z, B, V = g((() => {
193
192
  ...d.attributes,
194
193
  "*": [...d.attributes?.["*"] ?? [], "className"],
195
194
  a: [
196
- ...I(d.attributes?.a),
195
+ ...V(d.attributes?.a),
197
196
  "ariaHidden",
198
197
  "tabIndex"
199
198
  ]
200
199
  }
201
- }, R = [c, l], z = [
200
+ }, U = [c, l], W = [
202
201
  f,
203
- j,
202
+ I,
204
203
  [p, {
205
204
  detect: !0,
206
205
  ignoreMissing: !0,
@@ -218,16 +217,16 @@ var I, L, R, z, B, V = g((() => {
218
217
  value: "#"
219
218
  }
220
219
  }],
221
- [u, L]
222
- ], B = { pre({ node: t, children: n, ...r }) {
220
+ [u, H]
221
+ ], G = { pre({ node: t, children: n, ...r }) {
223
222
  let i = e.Children.toArray(n)[0], o = e.isValidElement(i) && typeof i.props.className == "string" ? i.props.className : "";
224
223
  if (/\blanguage-mermaid\b/.test(o)) {
225
- let e = M(i.props.children);
226
- return /* @__PURE__ */ a(S, { chart: e });
224
+ let e = L(i.props.children);
225
+ return /* @__PURE__ */ a(D, { chart: e });
227
226
  }
228
227
  if (/\blanguage-metadata\b/.test(o)) {
229
- let e = M(i.props.children);
230
- return /* @__PURE__ */ a(P, { source: e });
228
+ let e = L(i.props.children);
229
+ return /* @__PURE__ */ a(z, { source: e });
231
230
  }
232
231
  return /* @__PURE__ */ a("pre", {
233
232
  ...r,
@@ -237,31 +236,28 @@ var I, L, R, z, B, V = g((() => {
237
236
  }));
238
237
  //#endregion
239
238
  //#region src/index.tsx
240
- T();
241
- var H = t.lazy(() => Promise.resolve().then(() => (V(), A))), U = ({ schema: e }) => /* @__PURE__ */ a(n, {
239
+ A();
240
+ var q = t.lazy(() => Promise.resolve().then(() => (K(), F))), J = ({ schema: e }) => /* @__PURE__ */ a(n, {
242
241
  fallback: /* @__PURE__ */ a(i, { className: "w-full h-[200px]" }),
243
- children: /* @__PURE__ */ a(H, {
242
+ children: /* @__PURE__ */ a(q, {
244
243
  content: e.content || "",
245
244
  className: e.className
246
245
  })
247
246
  });
248
- r.register("markdown", U, {
247
+ r.register("markdown", J, {
249
248
  namespace: "plugin-markdown",
250
249
  label: "Markdown",
251
250
  category: "plugin",
252
251
  inputs: [{
253
252
  name: "content",
254
253
  type: "string",
255
- label: "Markdown Content",
256
- required: !0,
257
- inputType: "textarea"
254
+ required: !0
258
255
  }, {
259
256
  name: "className",
260
- type: "string",
261
- label: "CSS Class"
257
+ type: "string"
262
258
  }],
263
259
  defaultProps: { content: "# Hello World\n\nThis is a **markdown** component with *formatting* support.\n\n- Item 1\n- Item 2\n- Item 3" }
264
260
  });
265
- var W = { markdown: U };
261
+ var Y = { markdown: J };
266
262
  //#endregion
267
- export { U as MarkdownRenderer, S as Mermaid, y as extractToc, W as markdownComponents };
263
+ export { J as MarkdownRenderer, D as Mermaid, w as extractToc, Y as markdownComponents };
@@ -1,4 +1,4 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react"),require("@object-ui/core"),require("@object-ui/components"),require("react/jsx-runtime"),require("github-slugger"),require("react-markdown"),require("remark-gfm"),require("remark-github-blockquote-alert"),require("rehype-sanitize"),require("rehype-slug"),require("rehype-highlight"),require("rehype-autolink-headings")):typeof define==`function`&&define.amd?define([`exports`,`react`,`@object-ui/core`,`@object-ui/components`,`react/jsx-runtime`,`github-slugger`,`react-markdown`,`remark-gfm`,`remark-github-blockquote-alert`,`rehype-sanitize`,`rehype-slug`,`rehype-highlight`,`rehype-autolink-headings`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginMarkdown={},e.React,e.ObjectUICore,e.ObjectUIComponents,e.react_jsx_runtime,e.github_slugger,e.ReactMarkdown,e.remarkGfm,e.remarkGithubBlockquoteAlert,e.rehypeSanitize,e.rehypeSlug,e.rehypeHighlight,e.rehypeAutolinkHeadings))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var p=Object.create,m=Object.defineProperty,h=Object.getOwnPropertyDescriptor,g=Object.getOwnPropertyNames,_=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty,y=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},b=(e,t)=>{let n={};for(var r in e)m(n,r,{get:e[r],enumerable:!0});return t||m(n,Symbol.toStringTag,{value:`Module`}),n},x=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=g(t),a=0,o=i.length,s;a<o;a++)s=i[a],!v.call(e,s)&&s!==n&&m(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=h(t,s))||r.enumerable});return e},S=(e,t,n)=>(n=e==null?{}:p(_(e)),x(t||!e||!e.__esModule||!v.call(e,`default`)?m(n,`default`,{value:e,enumerable:!0}):n,e));t=S(t,1),a=S(a,1),o=S(o,1),s=S(s,1),l=S(l,1),u=S(u,1),d=S(d,1),f=S(f,1);function C(e){return e.replace(/!\[[^\]]*\]\([^)]*\)/g,``).replace(/\[([^\]]+)\]\([^)]*\)/g,`$1`).replace(/`([^`]+)`/g,`$1`).replace(/(\*\*|__)(.*?)\1/g,`$2`).replace(/(\*|_)(.*?)\1/g,`$2`).replace(/<[^>]+>/g,``).trim()}function w(e,t){let n=t?.minDepth??2,r=t?.maxDepth??3,i=new a.default,o=[],s=null;for(let t of(e??``).split(/\r?\n/)){let e=t.match(/^\s{0,3}(`{3,}|~{3,})/);if(e){let t=e[1][0];s===null?s=t:t===s&&(s=null);continue}if(s!==null)continue;let a=t.match(/^(#{1,6})\s+(.+?)\s*#*\s*$/);if(!a)continue;let c=a[1].length,l=C(a[2]);if(!l)continue;let u=i.slug(l);c>=n&&c<=r&&o.push({depth:c,text:l,id:u})}return o}function T(){return O||=import(`mermaid`).then(e=>e.default),O}function E(){return typeof document<`u`&&document.documentElement.classList.contains(`dark`)}function D({chart:e}){let[n,r]=t.useState(``),[a,o]=t.useState(null),[s,c]=t.useState(E);return t.useEffect(()=>{if(typeof document>`u`)return;let e=document.documentElement,t=new MutationObserver(()=>c(E()));return t.observe(e,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()},[]),t.useEffect(()=>{let t=!1,n=e.trim();if(!n){r(``),o(null);return}return T().then(async e=>{e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:s?`dark`:`default`});let i=`os-mermaid-${k+=1}`,{svg:a}=await e.render(i,n);t||(r(a),o(null))}).catch(e=>{t||o(e instanceof Error?e.message:String(e))}),()=>{t=!0}},[e,s]),a?(0,i.jsx)(`pre`,{"data-mermaid":!0,"data-mermaid-error":!0,className:`my-4 overflow-auto rounded border border-destructive/40 bg-muted p-3 text-xs`,children:(0,i.jsx)(`code`,{children:e})}):n?(0,i.jsx)(`div`,{"data-mermaid":!0,role:`img`,className:`my-4 flex justify-center overflow-auto [&_svg]:h-auto [&_svg]:max-w-full`,dangerouslySetInnerHTML:{__html:n}}):(0,i.jsx)(`div`,{"data-mermaid":!0,"data-mermaid-pending":!0,className:`my-4 text-sm text-muted-foreground`,children:(0,i.jsx)(`pre`,{className:`sr-only`,children:e})})}var O,k,A=y((()=>{O=null,k=0}));function j(){if(typeof document>`u`||document.getElementById(M))return;let e=document.createElement(`style`);e.id=M,e.textContent=N,document.head.appendChild(e)}var M,N,P=y((()=>{M=`os-markdown-styles`,N=`
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react"),require("@object-ui/core"),require("@object-ui/components"),require("react/jsx-runtime"),require("github-slugger"),require("react-markdown"),require("remark-gfm"),require("remark-github-blockquote-alert"),require("rehype-sanitize"),require("rehype-slug"),require("rehype-highlight"),require("rehype-autolink-headings")):typeof define==`function`&&define.amd?define([`exports`,`react`,`@object-ui/core`,`@object-ui/components`,`react/jsx-runtime`,`github-slugger`,`react-markdown`,`remark-gfm`,`remark-github-blockquote-alert`,`rehype-sanitize`,`rehype-slug`,`rehype-highlight`,`rehype-autolink-headings`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginMarkdown={},e.React,e.ObjectUICore,e.ObjectUIComponents,e.react_jsx_runtime,e.github_slugger,e.ReactMarkdown,e.remarkGfm,e.remarkGithubBlockquoteAlert,e.rehypeSanitize,e.rehypeSlug,e.rehypeHighlight,e.rehypeAutolinkHeadings))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var p=Object.create,m=Object.defineProperty,h=Object.getOwnPropertyDescriptor,g=Object.getOwnPropertyNames,_=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty,y=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},b=(e,t)=>{let n={};for(var r in e)m(n,r,{get:e[r],enumerable:!0});return t||m(n,Symbol.toStringTag,{value:`Module`}),n},x=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=g(t),a=0,o=i.length,s;a<o;a++)s=i[a],!v.call(e,s)&&s!==n&&m(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=h(t,s))||r.enumerable});return e},S=(e,t,n)=>(n=e==null?{}:p(_(e)),x(t||!e||!e.__esModule||!v.call(e,`default`)?m(n,`default`,{value:e,enumerable:!0}):n,e));t=S(t,1),a=S(a,1),o=S(o,1),s=S(s,1),l=S(l,1),u=S(u,1),d=S(d,1),f=S(f,1);var C=``,w=``,T=/\uE000(\d+)\uE001/g,E=/[\uE000\uE001]/g,D=/(?<![^\s\p{P}\p{S}])(?<!_)(_+)(?!\s)(.+?)(?<!\s)(_+)(?!_)(?![^\s\p{P}\p{S}])/gu;function O(e){let t=[];return e.replace(E,``).replace(/`([^`]+)`/g,(e,n)=>(t.push(n),`${C}${t.length-1}${w}`)).replace(/!\[[^\]]*\]\([^)]*\)/g,``).replace(/\[([^\]]+)\]\([^)]*\)/g,`$1`).replace(/\*\*(.*?)\*\*/g,`$1`).replace(/\*(.*?)\*/g,`$1`).replace(D,`$2`).replace(/<[^>]+>/g,``).replace(T,(e,n)=>t[Number(n)]).trim()}function k(e,t){let n=t?.minDepth??2,r=t?.maxDepth??3,i=new a.default,o=[],s=null;for(let t of(e??``).split(/\r?\n/)){let e=t.match(/^\s{0,3}(`{3,}|~{3,})/);if(e){let t=e[1][0];s===null?s=t:t===s&&(s=null);continue}if(s!==null)continue;let a=t.match(/^(#{1,6})\s+(.+?)\s*#*\s*$/);if(!a)continue;let c=a[1].length,l=O(a[2]);if(!l)continue;let u=i.slug(l);c>=n&&c<=r&&o.push({depth:c,text:l,id:u})}return o}function A(){return N||=import(`mermaid`).then(e=>e.default),N}function j(){return typeof document<`u`&&document.documentElement.classList.contains(`dark`)}function M({chart:e}){let[n,r]=t.useState(``),[a,o]=t.useState(null),[s,c]=t.useState(j);return t.useEffect(()=>{if(typeof document>`u`)return;let e=document.documentElement,t=new MutationObserver(()=>c(j()));return t.observe(e,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()},[]),t.useEffect(()=>{let t=!1,n=e.trim();if(!n){r(``),o(null);return}return A().then(async e=>{e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:s?`dark`:`default`});let i=`os-mermaid-${P+=1}`,{svg:a}=await e.render(i,n);t||(r(a),o(null))}).catch(e=>{t||o(e instanceof Error?e.message:String(e))}),()=>{t=!0}},[e,s]),a?(0,i.jsx)(`pre`,{"data-mermaid":!0,"data-mermaid-error":!0,className:`my-4 overflow-auto rounded border border-destructive/40 bg-muted p-3 text-xs`,children:(0,i.jsx)(`code`,{children:e})}):n?(0,i.jsx)(`div`,{"data-mermaid":!0,role:`img`,className:`my-4 flex justify-center overflow-auto [&_svg]:h-auto [&_svg]:max-w-full`,dangerouslySetInnerHTML:{__html:n}}):(0,i.jsx)(`div`,{"data-mermaid":!0,"data-mermaid-pending":!0,className:`my-4 text-sm text-muted-foreground`,children:(0,i.jsx)(`pre`,{className:`sr-only`,children:e})})}var N,P,F=y((()=>{N=null,P=0}));function I(){if(typeof document>`u`||document.getElementById(L))return;let e=document.createElement(`style`);e.id=L,e.textContent=R,document.head.appendChild(e)}var L,R,z=y((()=>{L=`os-markdown-styles`,R=`
2
2
  .os-markdown .md-anchor {
3
3
  margin-left: 0.4ch;
4
4
  color: var(--muted-foreground);
@@ -116,11 +116,11 @@
116
116
  .os-markdown table td:first-child { padding-inline-start: 0.6666667em; }
117
117
  .os-markdown table th:last-child,
118
118
  .os-markdown table td:last-child { padding-inline-end: 0.6666667em; }
119
- `})),F=b({default:()=>B,parseMetadataFence:()=>R});function I(){let e=e=>typeof e==`string`?e.split(/\s+/).filter(Boolean):Array.isArray(e)?e:[],t=n=>{if(!n||typeof n!=`object`)return;let r=n.properties;if(r&&(typeof r.class==`string`||typeof r.className==`string`)&&(r.className=[...e(r.className),...e(r.class)],delete r.class),Array.isArray(n.children))for(let e of n.children)t(e)};return e=>t(e)}function L(e){return typeof e==`string`?e:typeof e==`number`?String(e):Array.isArray(e)?e.map(L).join(``):t.isValidElement(e)?L(e.props.children):``}function R(e){let t={};for(let n of e.split(`
120
- `)){let e=n.trim();if(!e||e.startsWith(`#`))continue;let r=e.indexOf(`:`);if(r<1)continue;let i=e.slice(0,r).trim(),a=e.slice(r+1).trim();(a.startsWith(`"`)&&a.endsWith(`"`)||a.startsWith(`'`)&&a.endsWith(`'`))&&(a=a.slice(1,-1)),i&&(t[i]=a)}return t}function z({source:e}){let r=t.useMemo(()=>R(e),[e]),a=n.ComponentRegistry.get(`element:metadata_viewer`);return a?(0,i.jsx)(`div`,{className:`not-prose my-4`,children:(0,i.jsx)(a,{schema:{type:`element:metadata_viewer`,properties:r}})}):(0,i.jsx)(`pre`,{children:(0,i.jsx)(`code`,{children:e})})}function B({content:e,className:t}){return j(),(0,i.jsx)(`div`,{"data-slot":`markdown`,className:((...e)=>e.filter(Boolean).join(` `))(`prose prose-sm dark:prose-invert max-w-none`,`prose-headings:font-semibold prose-headings:tracking-tight`,`prose-h1:text-3xl prose-h2:text-2xl prose-h3:text-xl`,`prose-p:leading-relaxed prose-p:text-foreground`,`prose-a:text-primary prose-a:no-underline hover:prose-a:underline`,`prose-code:text-foreground prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:before:content-none prose-code:after:content-none`,`prose-pre:bg-muted prose-pre:text-foreground prose-pre:border`,`prose-blockquote:border-l-primary prose-blockquote:text-muted-foreground`,`prose-strong:text-foreground prose-strong:font-semibold`,`prose-ul:list-disc prose-ol:list-decimal`,`prose-li:text-foreground prose-li:marker:text-muted-foreground`,`prose-table:border prose-th:border prose-th:bg-muted prose-td:border`,`prose-img:rounded-md prose-img:border`,`os-markdown`,t),children:(0,i.jsx)(o.default,{remarkPlugins:U,rehypePlugins:W,components:G,disallowedElements:[`script`,`style`,`iframe`,`object`,`embed`],unwrapDisallowed:!0,children:e})})}var V,H,U,W,G,K=y((()=>{P(),A(),V=e=>(e??[]).filter(e=>!(Array.isArray(e)&&e[0]===`className`)),H={...l.defaultSchema,clobberPrefix:``,tagNames:[...l.defaultSchema.tagNames??[],`span`,`div`],attributes:{...l.defaultSchema.attributes,"*":[...l.defaultSchema.attributes?.[`*`]??[],`className`],a:[...V(l.defaultSchema.attributes?.a),`ariaHidden`,`tabIndex`]}},U=[s.default,c.remarkAlert],W=[u.default,I,[d.default,{detect:!0,ignoreMissing:!0,plainText:[`mermaid`,`metadata`]}],[f.default,{behavior:`append`,properties:{className:[`md-anchor`],ariaHidden:!0,tabIndex:-1},content:{type:`text`,value:`#`}}],[l.default,H]],G={pre({node:e,children:n,...r}){let a=t.Children.toArray(n)[0],o=t.isValidElement(a)&&typeof a.props.className==`string`?a.props.className:``;if(/\blanguage-mermaid\b/.test(o)){let e=L(a.props.children);return(0,i.jsx)(D,{chart:e})}if(/\blanguage-metadata\b/.test(o)){let e=L(a.props.children);return(0,i.jsx)(z,{source:e})}return(0,i.jsx)(`pre`,{...r,children:n})}}}));A();var q=t.default.lazy(()=>Promise.resolve().then(()=>(K(),F))),J=({schema:e})=>(0,i.jsx)(t.Suspense,{fallback:(0,i.jsx)(r.Skeleton,{className:`w-full h-[200px]`}),children:(0,i.jsx)(q,{content:e.content||``,className:e.className})});n.ComponentRegistry.register(`markdown`,J,{namespace:`plugin-markdown`,label:`Markdown`,category:`plugin`,inputs:[{name:`content`,type:`string`,label:`Markdown Content`,required:!0,inputType:`textarea`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{content:`# Hello World
119
+ `})),B=b({default:()=>G,parseMetadataFence:()=>U});function V(){let e=e=>typeof e==`string`?e.split(/\s+/).filter(Boolean):Array.isArray(e)?e:[],t=n=>{if(!n||typeof n!=`object`)return;let r=n.properties;if(r&&(typeof r.class==`string`||typeof r.className==`string`)&&(r.className=[...e(r.className),...e(r.class)],delete r.class),Array.isArray(n.children))for(let e of n.children)t(e)};return e=>t(e)}function H(e){return typeof e==`string`?e:typeof e==`number`?String(e):Array.isArray(e)?e.map(H).join(``):t.isValidElement(e)?H(e.props.children):``}function U(e){let t={};for(let n of e.split(`
120
+ `)){let e=n.trim();if(!e||e.startsWith(`#`))continue;let r=e.indexOf(`:`);if(r<1)continue;let i=e.slice(0,r).trim(),a=e.slice(r+1).trim();(a.startsWith(`"`)&&a.endsWith(`"`)||a.startsWith(`'`)&&a.endsWith(`'`))&&(a=a.slice(1,-1)),i&&(t[i]=a)}return t}function W({source:e}){let r=t.useMemo(()=>U(e),[e]),a=n.ComponentRegistry.get(`element:metadata_viewer`);return a?(0,i.jsx)(`div`,{className:`not-prose my-4`,children:(0,i.jsx)(a,{schema:{type:`element:metadata_viewer`,properties:r}})}):(0,i.jsx)(`pre`,{children:(0,i.jsx)(`code`,{children:e})})}function G({content:e,className:t}){return I(),(0,i.jsx)(`div`,{"data-slot":`markdown`,className:((...e)=>e.filter(Boolean).join(` `))(`prose prose-sm dark:prose-invert max-w-none`,`prose-headings:font-semibold prose-headings:tracking-tight`,`prose-h1:text-3xl prose-h2:text-2xl prose-h3:text-xl`,`prose-p:leading-relaxed prose-p:text-foreground`,`prose-a:text-primary prose-a:no-underline hover:prose-a:underline`,`prose-code:text-foreground prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:before:content-none prose-code:after:content-none`,`prose-pre:bg-muted prose-pre:text-foreground prose-pre:border`,`prose-blockquote:border-l-primary prose-blockquote:text-muted-foreground`,`prose-strong:text-foreground prose-strong:font-semibold`,`prose-ul:list-disc prose-ol:list-decimal`,`prose-li:text-foreground prose-li:marker:text-muted-foreground`,`prose-table:border prose-th:border prose-th:bg-muted prose-td:border`,`prose-img:rounded-md prose-img:border`,`os-markdown`,t),children:(0,i.jsx)(o.default,{remarkPlugins:J,rehypePlugins:Y,components:X,disallowedElements:[`script`,`style`,`iframe`,`object`,`embed`],unwrapDisallowed:!0,children:e})})}var K,q,J,Y,X,Z=y((()=>{z(),F(),K=e=>(e??[]).filter(e=>!(Array.isArray(e)&&e[0]===`className`)),q={...l.defaultSchema,clobberPrefix:``,tagNames:[...l.defaultSchema.tagNames??[],`span`,`div`],attributes:{...l.defaultSchema.attributes,"*":[...l.defaultSchema.attributes?.[`*`]??[],`className`],a:[...K(l.defaultSchema.attributes?.a),`ariaHidden`,`tabIndex`]}},J=[s.default,c.remarkAlert],Y=[u.default,V,[d.default,{detect:!0,ignoreMissing:!0,plainText:[`mermaid`,`metadata`]}],[f.default,{behavior:`append`,properties:{className:[`md-anchor`],ariaHidden:!0,tabIndex:-1},content:{type:`text`,value:`#`}}],[l.default,q]],X={pre({node:e,children:n,...r}){let a=t.Children.toArray(n)[0],o=t.isValidElement(a)&&typeof a.props.className==`string`?a.props.className:``;if(/\blanguage-mermaid\b/.test(o)){let e=H(a.props.children);return(0,i.jsx)(M,{chart:e})}if(/\blanguage-metadata\b/.test(o)){let e=H(a.props.children);return(0,i.jsx)(W,{source:e})}return(0,i.jsx)(`pre`,{...r,children:n})}}}));F();var Q=t.default.lazy(()=>Promise.resolve().then(()=>(Z(),B))),$=({schema:e})=>(0,i.jsx)(t.Suspense,{fallback:(0,i.jsx)(r.Skeleton,{className:`w-full h-[200px]`}),children:(0,i.jsx)(Q,{content:e.content||``,className:e.className})});n.ComponentRegistry.register(`markdown`,$,{namespace:`plugin-markdown`,label:`Markdown`,category:`plugin`,inputs:[{name:`content`,type:`string`,required:!0},{name:`className`,type:`string`}],defaultProps:{content:`# Hello World
121
121
 
122
122
  This is a **markdown** component with *formatting* support.
123
123
 
124
124
  - Item 1
125
125
  - Item 2
126
- - Item 3`}});var Y={markdown:J};e.MarkdownRenderer=J,e.Mermaid=D,e.extractToc=w,e.markdownComponents=Y});
126
+ - Item 3`}});var ee={markdown:$};e.MarkdownRenderer=$,e.Mermaid=M,e.extractToc=k,e.markdownComponents=ee});
package/dist/toc.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"toc.d.ts","sourceRoot":"","sources":["../src/toc.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,OAAO;IACtB,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAA;IACZ,6EAA6E;IAC7E,EAAE,EAAE,MAAM,CAAA;CACX;AAcD;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9C,OAAO,EAAE,CA0BX"}
1
+ {"version":3,"file":"toc.d.ts","sourceRoot":"","sources":["../src/toc.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,OAAO;IACtB,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAA;IACZ,6EAA6E;IAC7E,EAAE,EAAE,MAAM,CAAA;CACX;AAsFD;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9C,OAAO,EAAE,CA0BX"}
package/dist/types.d.ts CHANGED
@@ -1,26 +1,40 @@
1
- import { BaseSchema } from '@object-ui/types';
2
1
  /**
3
- * Markdown component schema.
4
- * Renders markdown content with GitHub Flavored Markdown support.
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
5
7
  */
6
- export interface MarkdownSchema extends BaseSchema {
7
- type: 'markdown';
8
- /**
9
- * The markdown content to render. Supports GitHub Flavored Markdown including:
10
- * - Headers (H1-H6)
11
- * - Bold, italic, and inline code
12
- * - Links and images
13
- * - Lists (ordered, unordered, and nested)
14
- * - Tables
15
- * - Blockquotes
16
- * - Code blocks
17
- * - Strikethrough
18
- * - Task lists
19
- */
20
- content?: string;
21
- /**
22
- * Optional CSS class name to apply custom styling to the markdown container.
23
- */
24
- className?: string;
25
- }
8
+ /**
9
+ * `MarkdownSchema` has ONE authority: `@object-ui/types` (objectui#6172, the
10
+ * 2026-08-25 family ruling — every exported schema name has exactly one
11
+ * authority). This package used to declare a second copy of the name, and the
12
+ * two had drifted on exactly one member: `content` was REQUIRED there and
13
+ * optional here.
14
+ *
15
+ * That divergence was measured, not adjudicated by taste, and it was drift
16
+ * rather than a real semantic difference — every other statement this package
17
+ * makes about `content` already says required:
18
+ *
19
+ * - the registration in `./index.tsx` declares the `content` input
20
+ * `required: true`, and `./index.test.ts` pins that;
21
+ * - `MarkdownImplProps.content` in `./MarkdownImpl.tsx` is `content: string`,
22
+ * non-optional — the renderer that actually consumes it;
23
+ * - the Zod mirror `packages/types/src/zod/data-display.zod.ts` spells it
24
+ * `z.string()`, not `.optional()`, and a parity test pins it;
25
+ * - and every authored `type: 'markdown'` NODE in the repository supplies
26
+ * `content`. (The `type: 'markdown'` literals that omit it are rich-text
27
+ * FIELD metadata — `MarkdownFieldMetadata` in
28
+ * `packages/types/src/field-types.ts` — which is a different type.)
29
+ *
30
+ * The lone `content?: string` here was the outlier, so the copies converge onto
31
+ * the required spelling rather than the loose one. `className` is not lost: it
32
+ * is declared by `BaseSchema`, which both copies extend, so it was always
33
+ * inherited rather than added here.
34
+ *
35
+ * ⛔ Do not re-add a local `export interface MarkdownSchema`. A re-export is
36
+ * one declaration with many export sites; a second declaration is a second
37
+ * meaning behind one published name, which is the defect this converged.
38
+ */
39
+ export type { MarkdownSchema } from '@object-ui/types';
26
40
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,IAAI,EAAE,UAAU,CAAC;IAEjB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/plugin-markdown",
3
- "version": "17.5.0",
3
+ "version": "17.7.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Markdown rendering plugin for Object UI, powered by react-markdown",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "github-slugger": "^2.0.0",
28
- "mermaid": "^11.16.1",
28
+ "mermaid": "^11.17.2",
29
29
  "react-markdown": "^10.1.0",
30
30
  "rehype-autolink-headings": "^7.1.0",
31
31
  "rehype-highlight": "^7.0.2",
@@ -33,10 +33,9 @@
33
33
  "rehype-slug": "^6.0.0",
34
34
  "remark-gfm": "^4.0.1",
35
35
  "remark-github-blockquote-alert": "^2.1.0",
36
- "@object-ui/components": "17.5.0",
37
- "@object-ui/core": "17.5.0",
38
- "@object-ui/types": "17.5.0",
39
- "@object-ui/react": "17.5.0"
36
+ "@object-ui/core": "17.7.0",
37
+ "@object-ui/types": "17.7.0",
38
+ "@object-ui/components": "17.7.0"
40
39
  },
41
40
  "peerDependencies": {
42
41
  "react": "^18.0.0 || ^19.0.0",
@@ -75,8 +74,8 @@
75
74
  ],
76
75
  "scripts": {
77
76
  "build": "vite build",
78
- "test": "vitest run",
79
- "test:watch": "vitest",
77
+ "test": "vitest run --root ../.. packages/plugin-markdown/",
78
+ "test:watch": "vitest --root ../.. packages/plugin-markdown/",
80
79
  "type-check": "tsc --noEmit && tsc -p tsconfig.test.json",
81
80
  "lint": "eslint ."
82
81
  }