@immediately-run/sdk 0.28.0 → 0.30.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/dist/components/HeadingAnchor.cjs +45 -0
- package/dist/components/HeadingAnchor.cjs.map +1 -0
- package/dist/components/HeadingAnchor.d.cts +29 -0
- package/dist/components/HeadingAnchor.d.ts +29 -0
- package/dist/components/HeadingAnchor.js +21 -0
- package/dist/components/HeadingAnchor.js.map +1 -0
- package/dist/components/MDXComponents.cjs +5 -0
- package/dist/components/MDXComponents.cjs.map +1 -1
- package/dist/components/MDXComponents.d.cts +1 -0
- package/dist/components/MDXComponents.d.ts +1 -0
- package/dist/components/MDXComponents.js +4 -0
- package/dist/components/MDXComponents.js.map +1 -1
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/safeContent/SafeContent.cjs +54 -0
- package/dist/safeContent/SafeContent.cjs.map +1 -0
- package/dist/safeContent/SafeContent.d.cts +13 -0
- package/dist/safeContent/SafeContent.d.ts +13 -0
- package/dist/safeContent/SafeContent.js +30 -0
- package/dist/safeContent/SafeContent.js.map +1 -0
- package/dist/safeContent/index.cjs +43 -0
- package/dist/safeContent/index.cjs.map +1 -0
- package/dist/safeContent/index.d.cts +6 -0
- package/dist/safeContent/index.d.ts +6 -0
- package/dist/safeContent/index.js +14 -0
- package/dist/safeContent/index.js.map +1 -0
- package/dist/safeContent/parseSafeMdast.cjs +69 -0
- package/dist/safeContent/parseSafeMdast.cjs.map +1 -0
- package/dist/safeContent/parseSafeMdast.d.cts +31 -0
- package/dist/safeContent/parseSafeMdast.d.ts +31 -0
- package/dist/safeContent/parseSafeMdast.js +35 -0
- package/dist/safeContent/parseSafeMdast.js.map +1 -0
- package/dist/safeContent/renderMdast.cjs +138 -0
- package/dist/safeContent/renderMdast.cjs.map +1 -0
- package/dist/safeContent/renderMdast.d.cts +27 -0
- package/dist/safeContent/renderMdast.d.ts +27 -0
- package/dist/safeContent/renderMdast.js +114 -0
- package/dist/safeContent/renderMdast.js.map +1 -0
- package/dist/safeContent/sanitizeUrl.cjs +39 -0
- package/dist/safeContent/sanitizeUrl.cjs.map +1 -0
- package/dist/safeContent/sanitizeUrl.d.cts +9 -0
- package/dist/safeContent/sanitizeUrl.d.ts +9 -0
- package/dist/safeContent/sanitizeUrl.js +15 -0
- package/dist/safeContent/sanitizeUrl.js.map +1 -0
- package/dist/safeContent/wikilink.cjs +63 -0
- package/dist/safeContent/wikilink.cjs.map +1 -0
- package/dist/safeContent/wikilink.d.cts +21 -0
- package/dist/safeContent/wikilink.d.ts +21 -0
- package/dist/safeContent/wikilink.js +38 -0
- package/dist/safeContent/wikilink.js.map +1 -0
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.cts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +9 -3
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var HeadingAnchor_exports = {};
|
|
20
|
+
__export(HeadingAnchor_exports, {
|
|
21
|
+
HeadingAnchor: () => HeadingAnchor
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(HeadingAnchor_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
const HeadingAnchor = ({
|
|
26
|
+
id,
|
|
27
|
+
...rest
|
|
28
|
+
}) => {
|
|
29
|
+
if (!id) return null;
|
|
30
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
31
|
+
"a",
|
|
32
|
+
{
|
|
33
|
+
className: "ir-heading-anchor",
|
|
34
|
+
href: `#${id}`,
|
|
35
|
+
"aria-label": "Permalink to this heading",
|
|
36
|
+
...rest,
|
|
37
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "aria-hidden": "true", children: "#" })
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
HeadingAnchor
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=HeadingAnchor.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/HeadingAnchor.tsx"],"sourcesContent":["import { ReactNode } from 'react';\n\n/**\n * Default MDX `HeadingAnchor` component — the render target for the autolink anchor\n * the transpiler's heading-slug plugin (R3-186, `MARKDOWN_SYNTAX_SPEC §15.4`)\n * prepends to every heading. That plugin sets the heading's own `id` (a text slug,\n * or a `sec-…` section id for a numbered heading, R3-211) and emits\n * `<HeadingAnchor id=\"<that id>\" />` as the heading's first child.\n *\n * It is registered in {@link DEFAULT_MDX_COMPONENTS} so a heading anchor renders\n * even in a plain-markdown repo that never calls `boot({ mdxComponents })` — the\n * MDX missing-reference guard never fires (§11.2 phantom defaults). The markup is\n * semantic and accessible — an `aria`-labelled `<a href=\"#id\">` permalink — but\n * **styling is intentionally minimal** (`§15.4` honesty note): an app supplies CSS\n * targeting the `ir-heading-anchor` class to reveal it on hover / add an icon, or\n * overrides this component via `boot({ mdxComponents: { HeadingAnchor } })` to\n * change the icon, position, or behaviour (e.g. copy-permalink-to-clipboard) of\n * every heading anchor in every content file at once (§15.4 late binding).\n *\n * `id` is the *heading's own* id, so the permalink `#id` is the same URL a reader\n * copies and (for a `sec-…` id) an agent computes from a `§`-citation with zero\n * lookup. A missing/empty `id` (defensive — the plugin always supplies one)\n * renders nothing rather than a dead `#` link.\n */\nexport const HeadingAnchor = ({\n id,\n ...rest\n}: {\n id?: string;\n} & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>): ReactNode => {\n if (!id) return null;\n return (\n <a\n className=\"ir-heading-anchor\"\n href={`#${id}`}\n aria-label=\"Permalink to this heading\"\n {...rest}\n >\n <span aria-hidden=\"true\">#</span>\n </a>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsCM;AAdC,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA,GAAG;AACL,MAE+E;AAC7E,MAAI,CAAC,GAAI,QAAO;AAChB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,MAAM,IAAI,EAAE;AAAA,MACZ,cAAW;AAAA,MACV,GAAG;AAAA,MAEJ,sDAAC,UAAK,eAAY,QAAO,eAAC;AAAA;AAAA,EAC5B;AAEJ;","names":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default MDX `HeadingAnchor` component — the render target for the autolink anchor
|
|
5
|
+
* the transpiler's heading-slug plugin (R3-186, `MARKDOWN_SYNTAX_SPEC §15.4`)
|
|
6
|
+
* prepends to every heading. That plugin sets the heading's own `id` (a text slug,
|
|
7
|
+
* or a `sec-…` section id for a numbered heading, R3-211) and emits
|
|
8
|
+
* `<HeadingAnchor id="<that id>" />` as the heading's first child.
|
|
9
|
+
*
|
|
10
|
+
* It is registered in {@link DEFAULT_MDX_COMPONENTS} so a heading anchor renders
|
|
11
|
+
* even in a plain-markdown repo that never calls `boot({ mdxComponents })` — the
|
|
12
|
+
* MDX missing-reference guard never fires (§11.2 phantom defaults). The markup is
|
|
13
|
+
* semantic and accessible — an `aria`-labelled `<a href="#id">` permalink — but
|
|
14
|
+
* **styling is intentionally minimal** (`§15.4` honesty note): an app supplies CSS
|
|
15
|
+
* targeting the `ir-heading-anchor` class to reveal it on hover / add an icon, or
|
|
16
|
+
* overrides this component via `boot({ mdxComponents: { HeadingAnchor } })` to
|
|
17
|
+
* change the icon, position, or behaviour (e.g. copy-permalink-to-clipboard) of
|
|
18
|
+
* every heading anchor in every content file at once (§15.4 late binding).
|
|
19
|
+
*
|
|
20
|
+
* `id` is the *heading's own* id, so the permalink `#id` is the same URL a reader
|
|
21
|
+
* copies and (for a `sec-…` id) an agent computes from a `§`-citation with zero
|
|
22
|
+
* lookup. A missing/empty `id` (defensive — the plugin always supplies one)
|
|
23
|
+
* renders nothing rather than a dead `#` link.
|
|
24
|
+
*/
|
|
25
|
+
declare const HeadingAnchor: ({ id, ...rest }: {
|
|
26
|
+
id?: string;
|
|
27
|
+
} & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">) => ReactNode;
|
|
28
|
+
|
|
29
|
+
export { HeadingAnchor };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default MDX `HeadingAnchor` component — the render target for the autolink anchor
|
|
5
|
+
* the transpiler's heading-slug plugin (R3-186, `MARKDOWN_SYNTAX_SPEC §15.4`)
|
|
6
|
+
* prepends to every heading. That plugin sets the heading's own `id` (a text slug,
|
|
7
|
+
* or a `sec-…` section id for a numbered heading, R3-211) and emits
|
|
8
|
+
* `<HeadingAnchor id="<that id>" />` as the heading's first child.
|
|
9
|
+
*
|
|
10
|
+
* It is registered in {@link DEFAULT_MDX_COMPONENTS} so a heading anchor renders
|
|
11
|
+
* even in a plain-markdown repo that never calls `boot({ mdxComponents })` — the
|
|
12
|
+
* MDX missing-reference guard never fires (§11.2 phantom defaults). The markup is
|
|
13
|
+
* semantic and accessible — an `aria`-labelled `<a href="#id">` permalink — but
|
|
14
|
+
* **styling is intentionally minimal** (`§15.4` honesty note): an app supplies CSS
|
|
15
|
+
* targeting the `ir-heading-anchor` class to reveal it on hover / add an icon, or
|
|
16
|
+
* overrides this component via `boot({ mdxComponents: { HeadingAnchor } })` to
|
|
17
|
+
* change the icon, position, or behaviour (e.g. copy-permalink-to-clipboard) of
|
|
18
|
+
* every heading anchor in every content file at once (§15.4 late binding).
|
|
19
|
+
*
|
|
20
|
+
* `id` is the *heading's own* id, so the permalink `#id` is the same URL a reader
|
|
21
|
+
* copies and (for a `sec-…` id) an agent computes from a `§`-citation with zero
|
|
22
|
+
* lookup. A missing/empty `id` (defensive — the plugin always supplies one)
|
|
23
|
+
* renders nothing rather than a dead `#` link.
|
|
24
|
+
*/
|
|
25
|
+
declare const HeadingAnchor: ({ id, ...rest }: {
|
|
26
|
+
id?: string;
|
|
27
|
+
} & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">) => ReactNode;
|
|
28
|
+
|
|
29
|
+
export { HeadingAnchor };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
const HeadingAnchor = ({
|
|
3
|
+
id,
|
|
4
|
+
...rest
|
|
5
|
+
}) => {
|
|
6
|
+
if (!id) return null;
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
"a",
|
|
9
|
+
{
|
|
10
|
+
className: "ir-heading-anchor",
|
|
11
|
+
href: `#${id}`,
|
|
12
|
+
"aria-label": "Permalink to this heading",
|
|
13
|
+
...rest,
|
|
14
|
+
children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "#" })
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
HeadingAnchor
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=HeadingAnchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/HeadingAnchor.tsx"],"sourcesContent":["import { ReactNode } from 'react';\n\n/**\n * Default MDX `HeadingAnchor` component — the render target for the autolink anchor\n * the transpiler's heading-slug plugin (R3-186, `MARKDOWN_SYNTAX_SPEC §15.4`)\n * prepends to every heading. That plugin sets the heading's own `id` (a text slug,\n * or a `sec-…` section id for a numbered heading, R3-211) and emits\n * `<HeadingAnchor id=\"<that id>\" />` as the heading's first child.\n *\n * It is registered in {@link DEFAULT_MDX_COMPONENTS} so a heading anchor renders\n * even in a plain-markdown repo that never calls `boot({ mdxComponents })` — the\n * MDX missing-reference guard never fires (§11.2 phantom defaults). The markup is\n * semantic and accessible — an `aria`-labelled `<a href=\"#id\">` permalink — but\n * **styling is intentionally minimal** (`§15.4` honesty note): an app supplies CSS\n * targeting the `ir-heading-anchor` class to reveal it on hover / add an icon, or\n * overrides this component via `boot({ mdxComponents: { HeadingAnchor } })` to\n * change the icon, position, or behaviour (e.g. copy-permalink-to-clipboard) of\n * every heading anchor in every content file at once (§15.4 late binding).\n *\n * `id` is the *heading's own* id, so the permalink `#id` is the same URL a reader\n * copies and (for a `sec-…` id) an agent computes from a `§`-citation with zero\n * lookup. A missing/empty `id` (defensive — the plugin always supplies one)\n * renders nothing rather than a dead `#` link.\n */\nexport const HeadingAnchor = ({\n id,\n ...rest\n}: {\n id?: string;\n} & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>): ReactNode => {\n if (!id) return null;\n return (\n <a\n className=\"ir-heading-anchor\"\n href={`#${id}`}\n aria-label=\"Permalink to this heading\"\n {...rest}\n >\n <span aria-hidden=\"true\">#</span>\n </a>\n );\n};\n"],"mappings":"AAsCM;AAdC,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA,GAAG;AACL,MAE+E;AAC7E,MAAI,CAAC,GAAI,QAAO;AAChB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,MAAM,IAAI,EAAE;AAAA,MACZ,cAAW;AAAA,MACV,GAAG;AAAA,MAEJ,8BAAC,UAAK,eAAY,QAAO,eAAC;AAAA;AAAA,EAC5B;AAEJ;","names":[]}
|
|
@@ -20,6 +20,7 @@ var MDXComponents_exports = {};
|
|
|
20
20
|
__export(MDXComponents_exports, {
|
|
21
21
|
Admonition: () => import_Admonition2.Admonition,
|
|
22
22
|
DEFAULT_MDX_COMPONENTS: () => DEFAULT_MDX_COMPONENTS,
|
|
23
|
+
HeadingAnchor: () => import_HeadingAnchor2.HeadingAnchor,
|
|
23
24
|
InternalLink: () => import_Link2.InternalLink,
|
|
24
25
|
Link: () => import_Link2.Link,
|
|
25
26
|
WikiLink: () => import_WikiLink2.WikiLink
|
|
@@ -27,10 +28,12 @@ __export(MDXComponents_exports, {
|
|
|
27
28
|
module.exports = __toCommonJS(MDXComponents_exports);
|
|
28
29
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
30
|
var import_Admonition = require("./Admonition");
|
|
31
|
+
var import_HeadingAnchor = require("./HeadingAnchor");
|
|
30
32
|
var import_Link = require("./Link");
|
|
31
33
|
var import_WikiLink = require("./WikiLink");
|
|
32
34
|
var import_Link2 = require("./Link");
|
|
33
35
|
var import_Admonition2 = require("./Admonition");
|
|
36
|
+
var import_HeadingAnchor2 = require("./HeadingAnchor");
|
|
34
37
|
var import_WikiLink2 = require("./WikiLink");
|
|
35
38
|
const DEFAULT_MDX_COMPONENTS = {
|
|
36
39
|
a({
|
|
@@ -41,12 +44,14 @@ const DEFAULT_MDX_COMPONENTS = {
|
|
|
41
44
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Link.Link, { href, ...properties, children });
|
|
42
45
|
},
|
|
43
46
|
Admonition: import_Admonition.Admonition,
|
|
47
|
+
HeadingAnchor: import_HeadingAnchor.HeadingAnchor,
|
|
44
48
|
WikiLink: import_WikiLink.WikiLink
|
|
45
49
|
};
|
|
46
50
|
// Annotate the CommonJS export names for ESM import in node:
|
|
47
51
|
0 && (module.exports = {
|
|
48
52
|
Admonition,
|
|
49
53
|
DEFAULT_MDX_COMPONENTS,
|
|
54
|
+
HeadingAnchor,
|
|
50
55
|
InternalLink,
|
|
51
56
|
Link,
|
|
52
57
|
WikiLink
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/MDXComponents.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport { Admonition } from './Admonition';\nimport { Link } from './Link';\nimport { WikiLink } from './WikiLink';\n\n// The link primitives moved to ./Link so WikiLink can reuse Link without a\n// MDXComponents ↔ WikiLink import cycle (check:circular). Re-exported here so the\n// public `Link` / `InternalLink` entry points are unchanged.\nexport { InternalLink, Link } from './Link';\nexport { Admonition } from './Admonition';\nexport type { AdmonitionType } from './Admonition';\nexport { WikiLink } from './WikiLink';\n\n/** Default MDX component overrides passed to {@link MDXProvider} by `boot`. These\n * are the platform's *phantom defaults* (MARKDOWN_SYNTAX_SPEC §11.2): they are\n * always present in the provider — even for a plain-markdown repo that never\n * calls `boot({ mdxComponents })` — so the platform-emitted `Admonition` (§12)\n * and `WikiLink` (§13) components resolve without the MDX missing-reference guard\n * firing, and Markdown links route in-app via {@link Link}. An app overrides any\n * of them by name via `boot({ mdxComponents })`, which *merges* over these\n * defaults (§11.3) — overriding `WikiLink` alone still keeps `a` and `Admonition`. */\nexport const DEFAULT_MDX_COMPONENTS = {\n a({\n href,\n children,\n ...properties\n }: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>) {\n return (\n <Link href={href} {...properties}>\n {children}\n </Link>\n );\n },\n Admonition,\n WikiLink,\n} as Record<string, (props: any) => ReactNode>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../../src/components/MDXComponents.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport { Admonition } from './Admonition';\nimport { HeadingAnchor } from './HeadingAnchor';\nimport { Link } from './Link';\nimport { WikiLink } from './WikiLink';\n\n// The link primitives moved to ./Link so WikiLink can reuse Link without a\n// MDXComponents ↔ WikiLink import cycle (check:circular). Re-exported here so the\n// public `Link` / `InternalLink` entry points are unchanged.\nexport { InternalLink, Link } from './Link';\nexport { Admonition } from './Admonition';\nexport type { AdmonitionType } from './Admonition';\nexport { HeadingAnchor } from './HeadingAnchor';\nexport { WikiLink } from './WikiLink';\n\n/** Default MDX component overrides passed to {@link MDXProvider} by `boot`. These\n * are the platform's *phantom defaults* (MARKDOWN_SYNTAX_SPEC §11.2): they are\n * always present in the provider — even for a plain-markdown repo that never\n * calls `boot({ mdxComponents })` — so the platform-emitted `Admonition` (§12)\n * and `WikiLink` (§13) components resolve without the MDX missing-reference guard\n * firing, and Markdown links route in-app via {@link Link}. An app overrides any\n * of them by name via `boot({ mdxComponents })`, which *merges* over these\n * defaults (§11.3) — overriding `WikiLink` alone still keeps `a` and `Admonition`. */\nexport const DEFAULT_MDX_COMPONENTS = {\n a({\n href,\n children,\n ...properties\n }: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>) {\n return (\n <Link href={href} {...properties}>\n {children}\n </Link>\n );\n },\n Admonition,\n HeadingAnchor,\n WikiLink,\n} as Record<string, (props: any) => ReactNode>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BM;AA7BN,wBAA2B;AAC3B,2BAA8B;AAC9B,kBAAqB;AACrB,sBAAyB;AAKzB,IAAAA,eAAmC;AACnC,IAAAC,qBAA2B;AAE3B,IAAAC,wBAA8B;AAC9B,IAAAC,mBAAyB;AAUlB,MAAM,yBAAyB;AAAA,EACpC,EAAE;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GAA8F;AAC5F,WACE,4CAAC,oBAAK,MAAa,GAAG,YACnB,UACH;AAAA,EAEJ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":["import_Link","import_Admonition","import_HeadingAnchor","import_WikiLink"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export { InternalLink, Link } from './Link.cjs';
|
|
3
3
|
export { Admonition, AdmonitionType } from './Admonition.cjs';
|
|
4
|
+
export { HeadingAnchor } from './HeadingAnchor.cjs';
|
|
4
5
|
export { WikiLink } from './WikiLink.cjs';
|
|
5
6
|
|
|
6
7
|
/** Default MDX component overrides passed to {@link MDXProvider} by `boot`. These
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export { InternalLink, Link } from './Link.js';
|
|
3
3
|
export { Admonition, AdmonitionType } from './Admonition.js';
|
|
4
|
+
export { HeadingAnchor } from './HeadingAnchor.js';
|
|
4
5
|
export { WikiLink } from './WikiLink.js';
|
|
5
6
|
|
|
6
7
|
/** Default MDX component overrides passed to {@link MDXProvider} by `boot`. These
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Admonition } from "./Admonition";
|
|
3
|
+
import { HeadingAnchor } from "./HeadingAnchor";
|
|
3
4
|
import { Link } from "./Link";
|
|
4
5
|
import { WikiLink } from "./WikiLink";
|
|
5
6
|
import { InternalLink, Link as Link2 } from "./Link";
|
|
6
7
|
import { Admonition as Admonition2 } from "./Admonition";
|
|
8
|
+
import { HeadingAnchor as HeadingAnchor2 } from "./HeadingAnchor";
|
|
7
9
|
import { WikiLink as WikiLink2 } from "./WikiLink";
|
|
8
10
|
const DEFAULT_MDX_COMPONENTS = {
|
|
9
11
|
a({
|
|
@@ -14,11 +16,13 @@ const DEFAULT_MDX_COMPONENTS = {
|
|
|
14
16
|
return /* @__PURE__ */ jsx(Link, { href, ...properties, children });
|
|
15
17
|
},
|
|
16
18
|
Admonition,
|
|
19
|
+
HeadingAnchor,
|
|
17
20
|
WikiLink
|
|
18
21
|
};
|
|
19
22
|
export {
|
|
20
23
|
Admonition2 as Admonition,
|
|
21
24
|
DEFAULT_MDX_COMPONENTS,
|
|
25
|
+
HeadingAnchor2 as HeadingAnchor,
|
|
22
26
|
InternalLink,
|
|
23
27
|
Link2 as Link,
|
|
24
28
|
WikiLink2 as WikiLink
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/MDXComponents.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport { Admonition } from './Admonition';\nimport { Link } from './Link';\nimport { WikiLink } from './WikiLink';\n\n// The link primitives moved to ./Link so WikiLink can reuse Link without a\n// MDXComponents ↔ WikiLink import cycle (check:circular). Re-exported here so the\n// public `Link` / `InternalLink` entry points are unchanged.\nexport { InternalLink, Link } from './Link';\nexport { Admonition } from './Admonition';\nexport type { AdmonitionType } from './Admonition';\nexport { WikiLink } from './WikiLink';\n\n/** Default MDX component overrides passed to {@link MDXProvider} by `boot`. These\n * are the platform's *phantom defaults* (MARKDOWN_SYNTAX_SPEC §11.2): they are\n * always present in the provider — even for a plain-markdown repo that never\n * calls `boot({ mdxComponents })` — so the platform-emitted `Admonition` (§12)\n * and `WikiLink` (§13) components resolve without the MDX missing-reference guard\n * firing, and Markdown links route in-app via {@link Link}. An app overrides any\n * of them by name via `boot({ mdxComponents })`, which *merges* over these\n * defaults (§11.3) — overriding `WikiLink` alone still keeps `a` and `Admonition`. */\nexport const DEFAULT_MDX_COMPONENTS = {\n a({\n href,\n children,\n ...properties\n }: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>) {\n return (\n <Link href={href} {...properties}>\n {children}\n </Link>\n );\n },\n Admonition,\n WikiLink,\n} as Record<string, (props: any) => ReactNode>;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/components/MDXComponents.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport { Admonition } from './Admonition';\nimport { HeadingAnchor } from './HeadingAnchor';\nimport { Link } from './Link';\nimport { WikiLink } from './WikiLink';\n\n// The link primitives moved to ./Link so WikiLink can reuse Link without a\n// MDXComponents ↔ WikiLink import cycle (check:circular). Re-exported here so the\n// public `Link` / `InternalLink` entry points are unchanged.\nexport { InternalLink, Link } from './Link';\nexport { Admonition } from './Admonition';\nexport type { AdmonitionType } from './Admonition';\nexport { HeadingAnchor } from './HeadingAnchor';\nexport { WikiLink } from './WikiLink';\n\n/** Default MDX component overrides passed to {@link MDXProvider} by `boot`. These\n * are the platform's *phantom defaults* (MARKDOWN_SYNTAX_SPEC §11.2): they are\n * always present in the provider — even for a plain-markdown repo that never\n * calls `boot({ mdxComponents })` — so the platform-emitted `Admonition` (§12)\n * and `WikiLink` (§13) components resolve without the MDX missing-reference guard\n * firing, and Markdown links route in-app via {@link Link}. An app overrides any\n * of them by name via `boot({ mdxComponents })`, which *merges* over these\n * defaults (§11.3) — overriding `WikiLink` alone still keeps `a` and `Admonition`. */\nexport const DEFAULT_MDX_COMPONENTS = {\n a({\n href,\n children,\n ...properties\n }: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>) {\n return (\n <Link href={href} {...properties}>\n {children}\n </Link>\n );\n },\n Admonition,\n HeadingAnchor,\n WikiLink,\n} as Record<string, (props: any) => ReactNode>;\n"],"mappings":"AA8BM;AA7BN,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AACrB,SAAS,gBAAgB;AAKzB,SAAS,cAAc,QAAAA,aAAY;AACnC,SAAS,cAAAC,mBAAkB;AAE3B,SAAS,iBAAAC,sBAAqB;AAC9B,SAAS,YAAAC,iBAAgB;AAUlB,MAAM,yBAAyB;AAAA,EACpC,EAAE;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GAA8F;AAC5F,WACE,oBAAC,QAAK,MAAa,GAAG,YACnB,UACH;AAAA,EAEJ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":["Link","Admonition","HeadingAnchor","WikiLink"]}
|
package/dist/index.cjs
CHANGED
|
@@ -49,6 +49,7 @@ __reExport(index_exports, require("./ready"), module.exports);
|
|
|
49
49
|
__reExport(index_exports, require("./loading"), module.exports);
|
|
50
50
|
__reExport(index_exports, require("./protocolStream"), module.exports);
|
|
51
51
|
__reExport(index_exports, require("./sandboxTypes"), module.exports);
|
|
52
|
+
__reExport(index_exports, require("./safeContent"), module.exports);
|
|
52
53
|
// Annotate the CommonJS export names for ESM import in node:
|
|
53
54
|
0 && (module.exports = {
|
|
54
55
|
...require("./MDXProvider"),
|
|
@@ -84,6 +85,7 @@ __reExport(index_exports, require("./sandboxTypes"), module.exports);
|
|
|
84
85
|
...require("./ready"),
|
|
85
86
|
...require("./loading"),
|
|
86
87
|
...require("./protocolStream"),
|
|
87
|
-
...require("./sandboxTypes")
|
|
88
|
+
...require("./sandboxTypes"),
|
|
89
|
+
...require("./safeContent")
|
|
88
90
|
});
|
|
89
91
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./MDXProvider\";\nexport * from \"./routing\";\nexport * from \"./boot\";\nexport * from './components/Include';\nexport * from './components/MDXComponents';\nexport * from './components/MountImage';\nexport * from './components/Routes';\nexport * from './hooks'\nexport * from './auth';\nexport * from './theme';\nexport * from './editorContext';\nexport * from './editor';\nexport * from './formFactor';\nexport * from './region';\nexport * from './mounts';\nexport * from './contribute';\nexport * from './catalog';\nexport * from './ipc';\nexport * from './dnd';\nexport * from './netFetch';\nexport * from './secrets';\nexport * from './llm';\nexport * from './diagnostics';\nexport * from './vcs';\nexport * from './onFsChange';\nexport * from './fs';\nexport * from './debug';\nexport * from './tasks';\nexport * from './runtime';\nexport * from './irMarkers';\nexport * from './ready';\nexport * from './loading';\nexport * from './protocolStream';\nexport * from './sandboxTypes';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,0BAAd;AACA,0BAAc,sBADd;AAEA,0BAAc,mBAFd;AAGA,0BAAc,iCAHd;AAIA,0BAAc,uCAJd;AAKA,0BAAc,oCALd;AAMA,0BAAc,gCANd;AAOA,0BAAc,oBAPd;AAQA,0BAAc,mBARd;AASA,0BAAc,oBATd;AAUA,0BAAc,4BAVd;AAWA,0BAAc,qBAXd;AAYA,0BAAc,yBAZd;AAaA,0BAAc,qBAbd;AAcA,0BAAc,qBAdd;AAeA,0BAAc,yBAfd;AAgBA,0BAAc,sBAhBd;AAiBA,0BAAc,kBAjBd;AAkBA,0BAAc,kBAlBd;AAmBA,0BAAc,uBAnBd;AAoBA,0BAAc,sBApBd;AAqBA,0BAAc,kBArBd;AAsBA,0BAAc,0BAtBd;AAuBA,0BAAc,kBAvBd;AAwBA,0BAAc,yBAxBd;AAyBA,0BAAc,iBAzBd;AA0BA,0BAAc,oBA1Bd;AA2BA,0BAAc,oBA3Bd;AA4BA,0BAAc,sBA5Bd;AA6BA,0BAAc,wBA7Bd;AA8BA,0BAAc,oBA9Bd;AA+BA,0BAAc,sBA/Bd;AAgCA,0BAAc,6BAhCd;AAiCA,0BAAc,2BAjCd;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./MDXProvider\";\nexport * from \"./routing\";\nexport * from \"./boot\";\nexport * from './components/Include';\nexport * from './components/MDXComponents';\nexport * from './components/MountImage';\nexport * from './components/Routes';\nexport * from './hooks'\nexport * from './auth';\nexport * from './theme';\nexport * from './editorContext';\nexport * from './editor';\nexport * from './formFactor';\nexport * from './region';\nexport * from './mounts';\nexport * from './contribute';\nexport * from './catalog';\nexport * from './ipc';\nexport * from './dnd';\nexport * from './netFetch';\nexport * from './secrets';\nexport * from './llm';\nexport * from './diagnostics';\nexport * from './vcs';\nexport * from './onFsChange';\nexport * from './fs';\nexport * from './debug';\nexport * from './tasks';\nexport * from './runtime';\nexport * from './irMarkers';\nexport * from './ready';\nexport * from './loading';\nexport * from './protocolStream';\nexport * from './sandboxTypes';\nexport * from './safeContent';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,0BAAd;AACA,0BAAc,sBADd;AAEA,0BAAc,mBAFd;AAGA,0BAAc,iCAHd;AAIA,0BAAc,uCAJd;AAKA,0BAAc,oCALd;AAMA,0BAAc,gCANd;AAOA,0BAAc,oBAPd;AAQA,0BAAc,mBARd;AASA,0BAAc,oBATd;AAUA,0BAAc,4BAVd;AAWA,0BAAc,qBAXd;AAYA,0BAAc,yBAZd;AAaA,0BAAc,qBAbd;AAcA,0BAAc,qBAdd;AAeA,0BAAc,yBAfd;AAgBA,0BAAc,sBAhBd;AAiBA,0BAAc,kBAjBd;AAkBA,0BAAc,kBAlBd;AAmBA,0BAAc,uBAnBd;AAoBA,0BAAc,sBApBd;AAqBA,0BAAc,kBArBd;AAsBA,0BAAc,0BAtBd;AAuBA,0BAAc,kBAvBd;AAwBA,0BAAc,yBAxBd;AAyBA,0BAAc,iBAzBd;AA0BA,0BAAc,oBA1Bd;AA2BA,0BAAc,oBA3Bd;AA4BA,0BAAc,sBA5Bd;AA6BA,0BAAc,wBA7Bd;AA8BA,0BAAc,oBA9Bd;AA+BA,0BAAc,sBA/Bd;AAgCA,0BAAc,6BAhCd;AAiCA,0BAAc,2BAjCd;AAkCA,0BAAc,0BAlCd;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -32,7 +32,13 @@ export { ReadyState, __resetReady, __setReadyDeps, getReadyState, onReady, repor
|
|
|
32
32
|
export { LOADING_TIMINGS, LoadingRegion, Skeleton, SkeletonArchetype, SkeletonRow, Spinner } from './loading.cjs';
|
|
33
33
|
export { StreamError, StreamFrame, StreamTransport, consumeStream, protocolStream } from './protocolStream.cjs';
|
|
34
34
|
export { EvaluationContext, FileQueryResult, FilesMetadata, Metadata, MetadataQueryEntry, MetadataQueryFunction, MetadataQueryResult, ModuleExports } from './sandboxTypes.cjs';
|
|
35
|
+
export { SafeContent, SafeContentProps } from './safeContent/SafeContent.cjs';
|
|
36
|
+
export { RenderMdastOptions, SafeContentComponents, renderMdast } from './safeContent/renderMdast.cjs';
|
|
37
|
+
export { SafeMdastNode, SafeMdxAttribute, parseSafeMdast } from './safeContent/parseSafeMdast.cjs';
|
|
38
|
+
export { sanitizeUrl } from './safeContent/sanitizeUrl.cjs';
|
|
39
|
+
export { WikiLinkToken, WikiPart, parseWikiInner, splitWikiLinks } from './safeContent/wikilink.cjs';
|
|
35
40
|
export { Admonition, AdmonitionType } from './components/Admonition.cjs';
|
|
41
|
+
export { HeadingAnchor } from './components/HeadingAnchor.cjs';
|
|
36
42
|
export { ImmediatelyRunGlobal, getHostRuntime } from './hostRuntime.cjs';
|
|
37
43
|
export { InternalLink, Link } from './components/Link.cjs';
|
|
38
44
|
export { SDK_VERSION } from './version.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -32,7 +32,13 @@ export { ReadyState, __resetReady, __setReadyDeps, getReadyState, onReady, repor
|
|
|
32
32
|
export { LOADING_TIMINGS, LoadingRegion, Skeleton, SkeletonArchetype, SkeletonRow, Spinner } from './loading.js';
|
|
33
33
|
export { StreamError, StreamFrame, StreamTransport, consumeStream, protocolStream } from './protocolStream.js';
|
|
34
34
|
export { EvaluationContext, FileQueryResult, FilesMetadata, Metadata, MetadataQueryEntry, MetadataQueryFunction, MetadataQueryResult, ModuleExports } from './sandboxTypes.js';
|
|
35
|
+
export { SafeContent, SafeContentProps } from './safeContent/SafeContent.js';
|
|
36
|
+
export { RenderMdastOptions, SafeContentComponents, renderMdast } from './safeContent/renderMdast.js';
|
|
37
|
+
export { SafeMdastNode, SafeMdxAttribute, parseSafeMdast } from './safeContent/parseSafeMdast.js';
|
|
38
|
+
export { sanitizeUrl } from './safeContent/sanitizeUrl.js';
|
|
39
|
+
export { WikiLinkToken, WikiPart, parseWikiInner, splitWikiLinks } from './safeContent/wikilink.js';
|
|
35
40
|
export { Admonition, AdmonitionType } from './components/Admonition.js';
|
|
41
|
+
export { HeadingAnchor } from './components/HeadingAnchor.js';
|
|
36
42
|
export { ImmediatelyRunGlobal, getHostRuntime } from './hostRuntime.js';
|
|
37
43
|
export { InternalLink, Link } from './components/Link.js';
|
|
38
44
|
export { SDK_VERSION } from './version.js';
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./MDXProvider\";\nexport * from \"./routing\";\nexport * from \"./boot\";\nexport * from './components/Include';\nexport * from './components/MDXComponents';\nexport * from './components/MountImage';\nexport * from './components/Routes';\nexport * from './hooks'\nexport * from './auth';\nexport * from './theme';\nexport * from './editorContext';\nexport * from './editor';\nexport * from './formFactor';\nexport * from './region';\nexport * from './mounts';\nexport * from './contribute';\nexport * from './catalog';\nexport * from './ipc';\nexport * from './dnd';\nexport * from './netFetch';\nexport * from './secrets';\nexport * from './llm';\nexport * from './diagnostics';\nexport * from './vcs';\nexport * from './onFsChange';\nexport * from './fs';\nexport * from './debug';\nexport * from './tasks';\nexport * from './runtime';\nexport * from './irMarkers';\nexport * from './ready';\nexport * from './loading';\nexport * from './protocolStream';\nexport * from './sandboxTypes';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./MDXProvider\";\nexport * from \"./routing\";\nexport * from \"./boot\";\nexport * from './components/Include';\nexport * from './components/MDXComponents';\nexport * from './components/MountImage';\nexport * from './components/Routes';\nexport * from './hooks'\nexport * from './auth';\nexport * from './theme';\nexport * from './editorContext';\nexport * from './editor';\nexport * from './formFactor';\nexport * from './region';\nexport * from './mounts';\nexport * from './contribute';\nexport * from './catalog';\nexport * from './ipc';\nexport * from './dnd';\nexport * from './netFetch';\nexport * from './secrets';\nexport * from './llm';\nexport * from './diagnostics';\nexport * from './vcs';\nexport * from './onFsChange';\nexport * from './fs';\nexport * from './debug';\nexport * from './tasks';\nexport * from './runtime';\nexport * from './irMarkers';\nexport * from './ready';\nexport * from './loading';\nexport * from './protocolStream';\nexport * from './sandboxTypes';\nexport * from './safeContent';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var SafeContent_exports = {};
|
|
20
|
+
__export(SafeContent_exports, {
|
|
21
|
+
SafeContent: () => SafeContent
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(SafeContent_exports);
|
|
24
|
+
var import_react = require("react");
|
|
25
|
+
var import_parseSafeMdast = require("./parseSafeMdast");
|
|
26
|
+
var import_renderMdast = require("./renderMdast");
|
|
27
|
+
function SafeContent({ source, fallback = null, ...options }) {
|
|
28
|
+
const [tree, setTree] = (0, import_react.useState)(null);
|
|
29
|
+
const runId = (0, import_react.useRef)(0);
|
|
30
|
+
(0, import_react.useEffect)(() => {
|
|
31
|
+
const id = ++runId.current;
|
|
32
|
+
setTree(null);
|
|
33
|
+
let cancelled = false;
|
|
34
|
+
(0, import_parseSafeMdast.parseSafeMdast)(source).then((parsed) => {
|
|
35
|
+
if (!cancelled && runId.current === id) setTree(parsed);
|
|
36
|
+
}).catch(() => {
|
|
37
|
+
if (!cancelled && runId.current === id) setTree(null);
|
|
38
|
+
});
|
|
39
|
+
return () => {
|
|
40
|
+
cancelled = true;
|
|
41
|
+
};
|
|
42
|
+
}, [source]);
|
|
43
|
+
const rendered = (0, import_react.useMemo)(
|
|
44
|
+
() => tree ? (0, import_renderMdast.renderMdast)(tree, options) : null,
|
|
45
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
+
[tree, options.components, options.resolveWikiLink]
|
|
47
|
+
);
|
|
48
|
+
return tree ? rendered : fallback;
|
|
49
|
+
}
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
SafeContent
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=SafeContent.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/safeContent/SafeContent.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react';\nimport { parseSafeMdast } from './parseSafeMdast';\nimport { renderMdast, type RenderMdastOptions } from './renderMdast';\n\n// `<SafeContent>` — the host/SDK-owned safe renderer (TRUST_MODES_SPEC §5.1,\n// AGENT_AUTHORING §10). An interpreter app renders untrusted Markdown/MDX-syntax\n// content — a shared board's body, a multi-writer wiki entry — through THIS component\n// so **no author JavaScript ever executes** while `<Component/>` syntax still reaches\n// the app's own safe components. It is the mandatory terminal for the MDX-from-mount\n// gate: a shared board is a multi-writer (M3) source, and compiled/executable MDX\n// would run board-author code with the app's authority (the WHITEBOARD §8 blast\n// radius this gate bounds).\n//\n// The parse (no-acorn, ESM-only deps) is async, so this renders a small placeholder\n// until the tree is ready, then the pure synchronous `renderMdast`. Parsing is keyed\n// on the source string; a changed source re-parses, and a stale async result is\n// discarded (the ref guard) so a fast source swap can't paint the wrong content.\n\nexport interface SafeContentProps extends RenderMdastOptions {\n /** The untrusted Markdown/MDX-syntax source to render as data. */\n source: string;\n /** Rendered while the async parse is in flight (default: nothing). */\n fallback?: ReactNode;\n}\n\nexport function SafeContent({ source, fallback = null, ...options }: SafeContentProps): ReactNode {\n const [tree, setTree] = useState<Awaited<ReturnType<typeof parseSafeMdast>> | null>(null);\n const runId = useRef(0);\n\n useEffect(() => {\n const id = ++runId.current;\n setTree(null);\n let cancelled = false;\n parseSafeMdast(source)\n .then((parsed) => {\n // Discard a stale result (source changed / unmounted) so we never paint the\n // wrong tree — the render-as-data guarantee also needs the RIGHT data shown.\n if (!cancelled && runId.current === id) setTree(parsed);\n })\n .catch(() => {\n if (!cancelled && runId.current === id) setTree(null);\n });\n return () => {\n cancelled = true;\n };\n }, [source]);\n\n // `renderMdast` is pure; memoise on the tree + the option identities the caller\n // passes. (Callers should memoise `components`/`resolveWikiLink` themselves for a\n // stable identity; changing them re-renders, which is correct.)\n const rendered = useMemo(\n () => (tree ? renderMdast(tree, options) : null),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [tree, options.components, options.resolveWikiLink],\n );\n\n return tree ? rendered : fallback;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAqE;AACrE,4BAA+B;AAC/B,yBAAqD;AAuB9C,SAAS,YAAY,EAAE,QAAQ,WAAW,MAAM,GAAG,QAAQ,GAAgC;AAChG,QAAM,CAAC,MAAM,OAAO,QAAI,uBAA4D,IAAI;AACxF,QAAM,YAAQ,qBAAO,CAAC;AAEtB,8BAAU,MAAM;AACd,UAAM,KAAK,EAAE,MAAM;AACnB,YAAQ,IAAI;AACZ,QAAI,YAAY;AAChB,8CAAe,MAAM,EAClB,KAAK,CAAC,WAAW;AAGhB,UAAI,CAAC,aAAa,MAAM,YAAY,GAAI,SAAQ,MAAM;AAAA,IACxD,CAAC,EACA,MAAM,MAAM;AACX,UAAI,CAAC,aAAa,MAAM,YAAY,GAAI,SAAQ,IAAI;AAAA,IACtD,CAAC;AACH,WAAO,MAAM;AACX,kBAAY;AAAA,IACd;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAKX,QAAM,eAAW;AAAA,IACf,MAAO,WAAO,gCAAY,MAAM,OAAO,IAAI;AAAA;AAAA,IAE3C,CAAC,MAAM,QAAQ,YAAY,QAAQ,eAAe;AAAA,EACpD;AAEA,SAAO,OAAO,WAAW;AAC3B;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { RenderMdastOptions } from './renderMdast.cjs';
|
|
3
|
+
import './parseSafeMdast.cjs';
|
|
4
|
+
|
|
5
|
+
interface SafeContentProps extends RenderMdastOptions {
|
|
6
|
+
/** The untrusted Markdown/MDX-syntax source to render as data. */
|
|
7
|
+
source: string;
|
|
8
|
+
/** Rendered while the async parse is in flight (default: nothing). */
|
|
9
|
+
fallback?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function SafeContent({ source, fallback, ...options }: SafeContentProps): ReactNode;
|
|
12
|
+
|
|
13
|
+
export { SafeContent, type SafeContentProps };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { RenderMdastOptions } from './renderMdast.js';
|
|
3
|
+
import './parseSafeMdast.js';
|
|
4
|
+
|
|
5
|
+
interface SafeContentProps extends RenderMdastOptions {
|
|
6
|
+
/** The untrusted Markdown/MDX-syntax source to render as data. */
|
|
7
|
+
source: string;
|
|
8
|
+
/** Rendered while the async parse is in flight (default: nothing). */
|
|
9
|
+
fallback?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function SafeContent({ source, fallback, ...options }: SafeContentProps): ReactNode;
|
|
12
|
+
|
|
13
|
+
export { SafeContent, type SafeContentProps };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { parseSafeMdast } from "./parseSafeMdast";
|
|
3
|
+
import { renderMdast } from "./renderMdast";
|
|
4
|
+
function SafeContent({ source, fallback = null, ...options }) {
|
|
5
|
+
const [tree, setTree] = useState(null);
|
|
6
|
+
const runId = useRef(0);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const id = ++runId.current;
|
|
9
|
+
setTree(null);
|
|
10
|
+
let cancelled = false;
|
|
11
|
+
parseSafeMdast(source).then((parsed) => {
|
|
12
|
+
if (!cancelled && runId.current === id) setTree(parsed);
|
|
13
|
+
}).catch(() => {
|
|
14
|
+
if (!cancelled && runId.current === id) setTree(null);
|
|
15
|
+
});
|
|
16
|
+
return () => {
|
|
17
|
+
cancelled = true;
|
|
18
|
+
};
|
|
19
|
+
}, [source]);
|
|
20
|
+
const rendered = useMemo(
|
|
21
|
+
() => tree ? renderMdast(tree, options) : null,
|
|
22
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
23
|
+
[tree, options.components, options.resolveWikiLink]
|
|
24
|
+
);
|
|
25
|
+
return tree ? rendered : fallback;
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
SafeContent
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=SafeContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/safeContent/SafeContent.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react';\nimport { parseSafeMdast } from './parseSafeMdast';\nimport { renderMdast, type RenderMdastOptions } from './renderMdast';\n\n// `<SafeContent>` — the host/SDK-owned safe renderer (TRUST_MODES_SPEC §5.1,\n// AGENT_AUTHORING §10). An interpreter app renders untrusted Markdown/MDX-syntax\n// content — a shared board's body, a multi-writer wiki entry — through THIS component\n// so **no author JavaScript ever executes** while `<Component/>` syntax still reaches\n// the app's own safe components. It is the mandatory terminal for the MDX-from-mount\n// gate: a shared board is a multi-writer (M3) source, and compiled/executable MDX\n// would run board-author code with the app's authority (the WHITEBOARD §8 blast\n// radius this gate bounds).\n//\n// The parse (no-acorn, ESM-only deps) is async, so this renders a small placeholder\n// until the tree is ready, then the pure synchronous `renderMdast`. Parsing is keyed\n// on the source string; a changed source re-parses, and a stale async result is\n// discarded (the ref guard) so a fast source swap can't paint the wrong content.\n\nexport interface SafeContentProps extends RenderMdastOptions {\n /** The untrusted Markdown/MDX-syntax source to render as data. */\n source: string;\n /** Rendered while the async parse is in flight (default: nothing). */\n fallback?: ReactNode;\n}\n\nexport function SafeContent({ source, fallback = null, ...options }: SafeContentProps): ReactNode {\n const [tree, setTree] = useState<Awaited<ReturnType<typeof parseSafeMdast>> | null>(null);\n const runId = useRef(0);\n\n useEffect(() => {\n const id = ++runId.current;\n setTree(null);\n let cancelled = false;\n parseSafeMdast(source)\n .then((parsed) => {\n // Discard a stale result (source changed / unmounted) so we never paint the\n // wrong tree — the render-as-data guarantee also needs the RIGHT data shown.\n if (!cancelled && runId.current === id) setTree(parsed);\n })\n .catch(() => {\n if (!cancelled && runId.current === id) setTree(null);\n });\n return () => {\n cancelled = true;\n };\n }, [source]);\n\n // `renderMdast` is pure; memoise on the tree + the option identities the caller\n // passes. (Callers should memoise `components`/`resolveWikiLink` themselves for a\n // stable identity; changing them re-renders, which is correct.)\n const rendered = useMemo(\n () => (tree ? renderMdast(tree, options) : null),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [tree, options.components, options.resolveWikiLink],\n );\n\n return tree ? rendered : fallback;\n}\n"],"mappings":"AAAA,SAAS,WAAW,SAAS,QAAQ,gBAAgC;AACrE,SAAS,sBAAsB;AAC/B,SAAS,mBAA4C;AAuB9C,SAAS,YAAY,EAAE,QAAQ,WAAW,MAAM,GAAG,QAAQ,GAAgC;AAChG,QAAM,CAAC,MAAM,OAAO,IAAI,SAA4D,IAAI;AACxF,QAAM,QAAQ,OAAO,CAAC;AAEtB,YAAU,MAAM;AACd,UAAM,KAAK,EAAE,MAAM;AACnB,YAAQ,IAAI;AACZ,QAAI,YAAY;AAChB,mBAAe,MAAM,EAClB,KAAK,CAAC,WAAW;AAGhB,UAAI,CAAC,aAAa,MAAM,YAAY,GAAI,SAAQ,MAAM;AAAA,IACxD,CAAC,EACA,MAAM,MAAM;AACX,UAAI,CAAC,aAAa,MAAM,YAAY,GAAI,SAAQ,IAAI;AAAA,IACtD,CAAC;AACH,WAAO,MAAM;AACX,kBAAY;AAAA,IACd;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAKX,QAAM,WAAW;AAAA,IACf,MAAO,OAAO,YAAY,MAAM,OAAO,IAAI;AAAA;AAAA,IAE3C,CAAC,MAAM,QAAQ,YAAY,QAAQ,eAAe;AAAA,EACpD;AAEA,SAAO,OAAO,WAAW;AAC3B;","names":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var safeContent_exports = {};
|
|
20
|
+
__export(safeContent_exports, {
|
|
21
|
+
SafeContent: () => import_SafeContent.SafeContent,
|
|
22
|
+
parseSafeMdast: () => import_parseSafeMdast.parseSafeMdast,
|
|
23
|
+
parseWikiInner: () => import_wikilink.parseWikiInner,
|
|
24
|
+
renderMdast: () => import_renderMdast.renderMdast,
|
|
25
|
+
sanitizeUrl: () => import_sanitizeUrl.sanitizeUrl,
|
|
26
|
+
splitWikiLinks: () => import_wikilink.splitWikiLinks
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(safeContent_exports);
|
|
29
|
+
var import_SafeContent = require("./SafeContent");
|
|
30
|
+
var import_renderMdast = require("./renderMdast");
|
|
31
|
+
var import_parseSafeMdast = require("./parseSafeMdast");
|
|
32
|
+
var import_sanitizeUrl = require("./sanitizeUrl");
|
|
33
|
+
var import_wikilink = require("./wikilink");
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
SafeContent,
|
|
37
|
+
parseSafeMdast,
|
|
38
|
+
parseWikiInner,
|
|
39
|
+
renderMdast,
|
|
40
|
+
sanitizeUrl,
|
|
41
|
+
splitWikiLinks
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/safeContent/index.ts"],"sourcesContent":["// Safe content rendering — non-executable MDX (TRUST_MODES_SPEC §5.1, AGENT_AUTHORING\n// §10). The host/SDK-owned renderer an INTERPRETER app uses to render untrusted\n// Markdown/MDX-syntax content as data, with **no evaluator anywhere in the pipeline**.\n// This is the mandatory terminal for the MDX-from-mount gate (§10 delta 1) — a shared\n// (multi-writer / M3) board or wiki entry MUST render through here, never compiled MDX.\n//\n// It is a **T2 tool, not a platform gate**: it stops content executing as code; it does\n// not certify anything to the host, and CO-4 data-fencing is still required for anything\n// that *reads* the content (the agent case).\n\nexport { SafeContent } from './SafeContent';\nexport type { SafeContentProps } from './SafeContent';\nexport { renderMdast } from './renderMdast';\nexport type {\n RenderMdastOptions,\n SafeContentComponents,\n} from './renderMdast';\nexport { parseSafeMdast } from './parseSafeMdast';\nexport type { SafeMdastNode, SafeMdxAttribute } from './parseSafeMdast';\nexport { sanitizeUrl } from './sanitizeUrl';\nexport { splitWikiLinks, parseWikiInner } from './wikilink';\nexport type { WikiLinkToken, WikiPart } from './wikilink';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,yBAA4B;AAE5B,yBAA4B;AAK5B,4BAA+B;AAE/B,yBAA4B;AAC5B,sBAA+C;","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { SafeContent, SafeContentProps } from './SafeContent.cjs';
|
|
2
|
+
export { RenderMdastOptions, SafeContentComponents, renderMdast } from './renderMdast.cjs';
|
|
3
|
+
export { SafeMdastNode, SafeMdxAttribute, parseSafeMdast } from './parseSafeMdast.cjs';
|
|
4
|
+
export { sanitizeUrl } from './sanitizeUrl.cjs';
|
|
5
|
+
export { WikiLinkToken, WikiPart, parseWikiInner, splitWikiLinks } from './wikilink.cjs';
|
|
6
|
+
import 'react';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { SafeContent, SafeContentProps } from './SafeContent.js';
|
|
2
|
+
export { RenderMdastOptions, SafeContentComponents, renderMdast } from './renderMdast.js';
|
|
3
|
+
export { SafeMdastNode, SafeMdxAttribute, parseSafeMdast } from './parseSafeMdast.js';
|
|
4
|
+
export { sanitizeUrl } from './sanitizeUrl.js';
|
|
5
|
+
export { WikiLinkToken, WikiPart, parseWikiInner, splitWikiLinks } from './wikilink.js';
|
|
6
|
+
import 'react';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SafeContent } from "./SafeContent";
|
|
2
|
+
import { renderMdast } from "./renderMdast";
|
|
3
|
+
import { parseSafeMdast } from "./parseSafeMdast";
|
|
4
|
+
import { sanitizeUrl } from "./sanitizeUrl";
|
|
5
|
+
import { splitWikiLinks, parseWikiInner } from "./wikilink";
|
|
6
|
+
export {
|
|
7
|
+
SafeContent,
|
|
8
|
+
parseSafeMdast,
|
|
9
|
+
parseWikiInner,
|
|
10
|
+
renderMdast,
|
|
11
|
+
sanitizeUrl,
|
|
12
|
+
splitWikiLinks
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/safeContent/index.ts"],"sourcesContent":["// Safe content rendering — non-executable MDX (TRUST_MODES_SPEC §5.1, AGENT_AUTHORING\n// §10). The host/SDK-owned renderer an INTERPRETER app uses to render untrusted\n// Markdown/MDX-syntax content as data, with **no evaluator anywhere in the pipeline**.\n// This is the mandatory terminal for the MDX-from-mount gate (§10 delta 1) — a shared\n// (multi-writer / M3) board or wiki entry MUST render through here, never compiled MDX.\n//\n// It is a **T2 tool, not a platform gate**: it stops content executing as code; it does\n// not certify anything to the host, and CO-4 data-fencing is still required for anything\n// that *reads* the content (the agent case).\n\nexport { SafeContent } from './SafeContent';\nexport type { SafeContentProps } from './SafeContent';\nexport { renderMdast } from './renderMdast';\nexport type {\n RenderMdastOptions,\n SafeContentComponents,\n} from './renderMdast';\nexport { parseSafeMdast } from './parseSafeMdast';\nexport type { SafeMdastNode, SafeMdxAttribute } from './parseSafeMdast';\nexport { sanitizeUrl } from './sanitizeUrl';\nexport { splitWikiLinks, parseWikiInner } from './wikilink';\nexport type { WikiLinkToken, WikiPart } from './wikilink';\n"],"mappings":"AAUA,SAAS,mBAAmB;AAE5B,SAAS,mBAAmB;AAK5B,SAAS,sBAAsB;AAE/B,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB,sBAAsB;","names":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var parseSafeMdast_exports = {};
|
|
30
|
+
__export(parseSafeMdast_exports, {
|
|
31
|
+
parseSafeMdast: () => parseSafeMdast
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(parseSafeMdast_exports);
|
|
34
|
+
let depsPromise = null;
|
|
35
|
+
function loadDeps() {
|
|
36
|
+
if (!depsPromise) {
|
|
37
|
+
depsPromise = Promise.all([
|
|
38
|
+
import("mdast-util-from-markdown"),
|
|
39
|
+
import("micromark-extension-mdx-jsx"),
|
|
40
|
+
import("mdast-util-mdx-jsx"),
|
|
41
|
+
import("micromark-extension-gfm"),
|
|
42
|
+
import("mdast-util-gfm")
|
|
43
|
+
]).then(
|
|
44
|
+
([fromMd, mdxJsxExt, mdxJsxMdast, gfmExt, gfmMdast]) => ({
|
|
45
|
+
fromMarkdown: fromMd.fromMarkdown,
|
|
46
|
+
mdxJsx: mdxJsxExt.mdxJsx,
|
|
47
|
+
mdxJsxFromMarkdown: mdxJsxMdast.mdxJsxFromMarkdown,
|
|
48
|
+
gfm: gfmExt.gfm,
|
|
49
|
+
gfmFromMarkdown: gfmMdast.gfmFromMarkdown
|
|
50
|
+
})
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
return depsPromise;
|
|
54
|
+
}
|
|
55
|
+
async function parseSafeMdast(source) {
|
|
56
|
+
const { fromMarkdown, mdxJsx, mdxJsxFromMarkdown, gfm, gfmFromMarkdown } = await loadDeps();
|
|
57
|
+
return fromMarkdown(source, {
|
|
58
|
+
// `mdxJsx()` WITHOUT an acorn option → JSX tags + literal attrs; expressions are
|
|
59
|
+
// raw strings, never estree. The mdx *expression* extension is intentionally
|
|
60
|
+
// absent, so `{…}` in body text stays literal. GFM for tables/task-lists.
|
|
61
|
+
extensions: [mdxJsx(), gfm()],
|
|
62
|
+
mdastExtensions: [mdxJsxFromMarkdown(), gfmFromMarkdown()]
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
parseSafeMdast
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=parseSafeMdast.cjs.map
|