@copepod/unified-plugins 0.1.1-dev.1 → 0.3.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/index.mjs +11 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -267,11 +267,14 @@ var youtube = {
|
|
|
267
267
|
import "mdast-util-to-hast";
|
|
268
268
|
var codepen = {
|
|
269
269
|
name: "codepen",
|
|
270
|
-
detect: /^https:\/\/codepen\.io\/([^/]+)\/pen\/([
|
|
270
|
+
detect: /^https:\/\/codepen\.io\/([^/]+)\/(?:pen|embed|embed\/preview)\/([^?/]+)/,
|
|
271
271
|
groups: ["owner", "pen"],
|
|
272
272
|
transform: function(link, owner, pen) {
|
|
273
|
-
const url = new URL(
|
|
274
|
-
url.
|
|
273
|
+
const url = new URL(link.url);
|
|
274
|
+
url.pathname = `/${owner}/embed/preview/${pen}`;
|
|
275
|
+
if (!url.searchParams.has("default-tab")) {
|
|
276
|
+
url.searchParams.set("default-tab", "html,result");
|
|
277
|
+
}
|
|
275
278
|
return {
|
|
276
279
|
type: "blockquote",
|
|
277
280
|
position: link.position,
|
|
@@ -279,9 +282,7 @@ var codepen = {
|
|
|
279
282
|
data: {
|
|
280
283
|
hName: "div",
|
|
281
284
|
hProperties: {
|
|
282
|
-
|
|
283
|
-
height: "25vh",
|
|
284
|
-
style: "resize:vertical;overflow:auto;display:flex"
|
|
285
|
+
style: "resize:both;overflow:auto;display:flex;min-height:20rem"
|
|
285
286
|
},
|
|
286
287
|
hChildren: [
|
|
287
288
|
{
|
|
@@ -290,13 +291,12 @@ var codepen = {
|
|
|
290
291
|
children: [],
|
|
291
292
|
properties: {
|
|
292
293
|
src: url.href,
|
|
293
|
-
title: link.title || "
|
|
294
|
-
|
|
295
|
-
style: "border:0;width:100%;min-width:20rem;max-width:80rem;min-height:20rem;",
|
|
294
|
+
title: link.title || "CodePen Embed",
|
|
295
|
+
style: "border:0;width:100%;height:100%;min-height:20rem",
|
|
296
296
|
frameborder: "0",
|
|
297
297
|
scrolling: "no",
|
|
298
|
-
allowfullscreen:
|
|
299
|
-
allowtransparency:
|
|
298
|
+
allowfullscreen: true,
|
|
299
|
+
allowtransparency: true,
|
|
300
300
|
loading: "lazy"
|
|
301
301
|
}
|
|
302
302
|
}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rehype/index.ts","../src/rehype/utils.ts","../src/rehype/transforms/paragraphs.ts","../src/rehype/baseline.ts","../src/remark/index.ts","../src/remark/baseline.ts","../src/remark/utils.ts","../src/remark/transforms/asides.ts","../src/remark/transforms/captions.ts","../src/remark/transforms/figures.ts","../src/remark/transforms/headings.ts","../src/remark/transforms/loners/index.ts","../src/remark/transforms/loners/links/youtube.ts","../src/remark/transforms/loners/links/codepen.ts","../src/remark/transforms/loners/links/index.ts"],"sourcesContent":["import type { Root } from 'hast'\nimport katex from 'rehype-katex'\nimport type { Options as KatexOptions } from 'rehype-katex'\nimport { type BaselineOptions, baseline } from './baseline'\n\nexport interface PresetOptions {\n\tbaseline?: BaselineOptions | undefined\n\tkatex?: KatexOptions | undefined\n}\n\ninterface Options { [key: string]: any }\ntype Factory = (options: Options) => (root: Root) => void\n\nexport function plugins(options: PresetOptions = {}) {\n\treturn [\n\t\t[katex, options.katex ?? {}],\n\t\t[baseline, options.baseline ?? {}],\n\t] as [Factory, Options][]\n}\n","import type * as hast from 'hast'\n\nexport function nodeToString(node: hast.Node): string {\n\tif (node.type === 'text') {\n\t\tconst literal = node as hast.Text\n\t\treturn literal.value.trim()\n\t}\n\n\tif (isParent(node)) {\n\t\treturn node.children.map(nodeToString).join(' ').replace(/\\s+/g, ' ')\n\t}\n\n\treturn ''\n}\n\nexport function onlyParents(nodes: hast.Node[]): hast.Parent[] {\n\treturn nodes.filter(node => isParent(node)) as hast.Parent[]\n}\n\nexport function isParent(node: hast.Node): node is hast.Parent {\n\treturn 'children' in node && Array.isArray(node.children) && node.children.length > 0\n}\n\nexport function isElement(node: hast.Node | undefined, withName: string | RegExp | undefined = undefined): node is hast.Element {\n\tconst element = node as hast.Element\n\tconst name = element?.type === 'element' && element.tagName\n\n\tif (typeof name !== 'string') {\n\t\treturn false\n\t}\n\n\tif (withName instanceof RegExp) {\n\t\treturn withName.test(name)\n\t}\n\telse if (typeof withName === 'string') {\n\t\treturn name === withName\n\t}\n\n\treturn true\n}\n","import type { ElementContent, Node, Parent, Text } from 'hast'\nimport { isElement, nodeToString } from '../utils'\n\nexport function paragraphs(parent: Parent) {\n\tconst children: Node[] = []\n\tfor (const child of parent.children) {\n\t\tif (isElement(child, 'p')) {\n\t\t\t// Skip empty paragraphs\n\t\t\tif (child.children.length === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Trim start\n\t\t\tlet text = child.children[0] as Text\n\t\t\tif (text.type === 'text') {\n\t\t\t\ttext.value = text.value.trimStart()\n\t\t\t}\n\n\t\t\t// Trim end\n\t\t\ttext = child.children[child.children.length - 1] as Text\n\t\t\tif (text.type === 'text') {\n\t\t\t\ttext.value = text.value.trimEnd()\n\t\t\t}\n\n\t\t\t// Skip empty text paragraphs\n\t\t\tconst hasNonText = child.children.some(child => child.type !== 'text')\n\t\t\tconst isEmpty = !hasNonText && nodeToString(child).trim() === ''\n\t\t\tif (isEmpty) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\t// Accept node\n\t\tchildren.push(child)\n\t}\n\n\tparent.children = children as ElementContent[]\n}\n","import type { Parent, Root, Text } from 'hast'\nimport { isElement, onlyParents } from './utils'\nimport * as transforms from './transforms'\n\nexport interface BaselineOptions {\n}\n\nexport function baseline(_options: BaselineOptions = {}) {\n\treturn function plugin(root: Root) {\n\t\tconst queue: Array<Parent> = []\n\t\tlet parent: Parent | undefined\n\n\t\t// First pass:\n\t\t// 1. Trim paragraphs.\n\t\t// 2. Remove empty paragraphs.\n\t\tqueue.push(root)\n\t\t// eslint-disable-next-line no-cond-assign\n\t\twhile (parent = queue.shift()) {\n\t\t\ttransforms.paragraphs(parent)\n\n\t\t\tqueue.push(...onlyParents(parent.children))\n\t\t}\n\n\t\t// Second pass:\n\t\t// 1. Remove lone newlines from all nodes that aren't inside `<code>` or `<pre>`.\n\t\tqueue.push(root)\n\t\t// eslint-disable-next-line no-cond-assign\n\t\twhile (parent = queue.shift()) {\n\t\t\tif (isElement(parent, /^code|pre$/)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tparent.children = parent.children.filter(node =>\n\t\t\t\tnode.type !== 'text' || (node as Text).value !== '\\n',\n\t\t\t)\n\n\t\t\tqueue.push(...onlyParents(parent.children))\n\t\t}\n\t}\n}\n","import type { Root } from 'mdast'\nimport math from 'remark-math'\nimport type { Options as MathOptions } from 'remark-math'\nimport { type BaselineOptions, baseline } from './baseline'\n\nexport interface PresetOptions {\n\tbaseline?: BaselineOptions | undefined\n\tmath?: MathOptions | undefined\n}\n\ninterface Options { [key: string]: any }\ntype Factory = (options: Options) => (root: Root) => void\n\nexport function plugins(options: PresetOptions = {}) {\n\treturn [\n\t\t[math, options.math ?? {}],\n\t\t[baseline, options.baseline ?? {}],\n\t] as [Factory, Options][]\n}\n","import type { Parent, Root } from 'mdast'\nimport GithubSlugger from 'github-slugger'\nimport * as utils from './utils'\nimport * as transforms from './transforms'\nimport type { LinkOptions } from './transforms/loners/links'\n\nconst SLUGGER = new GithubSlugger()\n\nexport interface BaselineOptions {\n\tlinks?: LinkOptions | undefined\n}\n\nexport function baseline(options: BaselineOptions = {}) {\n\treturn function plugin(root: Root) {\n\t\tSLUGGER.reset()\n\n\t\tconst queue: Array<Parent> = []\n\t\tlet parent: Parent | undefined\n\n\t\tqueue.push(root)\n\t\t// eslint-disable-next-line no-cond-assign\n\t\twhile (parent = queue.shift()) {\n\t\t\ttransforms.asides(parent)\n\t\t\ttransforms.captions(parent)\n\t\t\ttransforms.headings(parent, SLUGGER)\n\t\t\ttransforms.loners(parent, options.links ?? {})\n\t\t\tqueue.push(...utils.onlyParents(parent.children))\n\t\t}\n\n\t\tqueue.push(root)\n\t\t// eslint-disable-next-line no-cond-assign\n\t\twhile (parent = queue.shift()) {\n\t\t\ttransforms.figures(parent)\n\t\t\tqueue.push(...utils.onlyParents(parent.children))\n\t\t}\n\t}\n}\n","import type * as mdast from 'mdast'\n\nexport interface AnyData { data?: { [key: string]: any } }\n\nexport function nodeToString(node: mdast.Node): string {\n\tif (node.type === 'text') {\n\t\tconst literal = node as mdast.Text\n\t\treturn literal.value.trim()\n\t}\n\n\tif (isParent(node)) {\n\t\treturn node.children.map(nodeToString).join(' ').replace(/\\s+/g, ' ')\n\t}\n\n\treturn ''\n}\n\nexport function onlyParents(nodes: mdast.Node[]): mdast.Parent[] {\n\treturn nodes.filter(node => isParent(node)) as mdast.Parent[]\n}\n\nexport function isParent(node: mdast.Node | undefined | null): node is mdast.Parent {\n\tconst asParent = node ? node as mdast.Parent : node\n\treturn Array.isArray(asParent?.children) && asParent.children[0] !== undefined\n}\n\nexport function isLink(node: mdast.Node | undefined | null): node is mdast.Link {\n\treturn node?.type === 'link'\n}\n\nexport function isParagraph(node: mdast.Node | undefined | null): node is mdast.Paragraph {\n\treturn node?.type === 'paragraph'\n}\n\nexport function isText(node: mdast.Node | undefined | null): node is mdast.Text {\n\treturn node?.type === 'text'\n}\n","import type { Data, Paragraph, Parent, Text } from 'mdast'\nimport type { AnyData } from '../utils'\n\n/**\n * Support for asides.\n *\n * ```md\n * > [!NOTE: This is a note]\n * > This is the content of the note.\n *\n * > [!WARNING]\n * > This is a warning.\n * ```\n */\nexport function asides(parent: Parent) {\n\tif (parent.type !== 'blockquote' || parent.children[0]?.type !== 'paragraph') {\n\t\treturn\n\t}\n\n\tconst paragraph = parent.children[0] as Paragraph\n\tif (paragraph.children[0]?.type !== 'text') {\n\t\treturn\n\t}\n\n\tconst text = paragraph.children[0] as Text\n\n\t// Extract the inner content of [!…]\n\tconst [full, args] = /^\\s*\\[!([^\\]]+)\\]\\s*/.exec(text.value) || []\n\tif (!full || !args) {\n\t\treturn\n\t}\n\n\t// Remove the [!…] from the text\n\t// Note: This has the effect of trimming the start of the paragraph\n\ttext.value = text.value.slice(full.length)\n\n\t// Parse the type and title\n\t// eslint-disable-next-line regexp/no-super-linear-backtracking\n\tconst match = /^\\s*([A-Z][A-Z_]*)(?::\\s+([^\\]]+))?$/.exec(args)\n\tif (!match) {\n\t\treturn\n\t}\n\tconst type = match[1]!.toLowerCase()\n\tconst title = match[2]?.trim() ?? `${match[1]![0]}${type.slice(1).replace(/_/g, ' ')}`\n\tconst { data } = parent as AnyData\n\tparent.data = {\n\t\t...data,\n\t\ttype,\n\t\ttitle,\n\t\thName: 'aside',\n\t\thProperties: {\n\t\t\t...data?.hProperties,\n\t\t\t'className': ['aside', `aside-${type}`],\n\t\t\t'data-type': type,\n\t\t\t'data-title': title,\n\t\t},\n\t} as Data\n}\n","import type { Parent } from 'mdast'\n\n/**\n * Support for captions, using the \"double blockquote\" `>>` syntax.\n */\nexport function captions(parent: Parent) {\n\tif (parent.children[1] || parent.type !== 'blockquote' || parent.children[0]?.type !== 'blockquote') {\n\t\treturn\n\t}\n\n\tparent.data = {\n\t\t...parent.data,\n\t\thName: 'figcaption',\n\t}\n\tparent.children = parent.children[0].children\n}\n","import type { BlockContent, Blockquote, Parent } from 'mdast'\nimport type { MdxJsxFlowElement } from 'mdast-util-mdx-jsx'\nimport type * as utils from '../utils'\n\nexport function figures(parent: Parent) {\n\tconst parentJSX = parent as MdxJsxFlowElement & utils.AnyData\n\n\tlet len = parent.children.length\n\tfor (let i = 0; i < len; i++) {\n\t\tconst child = parent.children[i] as MdxJsxFlowElement & utils.AnyData\n\n\t\t// Wrap <figcaption> elements and their previous sibling in a <figure>\n\t\tif (i > 0\n\t\t\t&& (child.data?.hName === 'figcaption' || (child.type === 'mdxJsxFlowElement' && child.name === 'figcaption'))\n\t\t\t&& !(parentJSX.data?.hName === 'figure' || (parent.type === 'mdxJsxFlowElement' && parentJSX.name === 'figure'))\n\t\t) {\n\t\t\t--len\n\t\t\tconst captioned = parent.children[--i] as BlockContent\n\t\t\tparent.children.splice(i, 2, {\n\t\t\t\ttype: 'blockquote',\n\t\t\t\tdata: {\n\t\t\t\t\thName: 'figure',\n\t\t\t\t},\n\t\t\t\tposition: captioned.position,\n\t\t\t\tchildren: [captioned, child],\n\t\t\t} satisfies Blockquote)\n\t\t}\n\t}\n}\n","import type { Link, Parent, PhrasingContent } from 'mdast'\nimport { nodeToString } from '../utils'\n\nexport interface Slugger {\n\tslug: (value: string) => string\n}\n\nexport function headings(parent: Parent, slugger: Slugger) {\n\tif (parent.type !== 'heading' || !parent.children[0]) {\n\t\treturn\n\t}\n\n\tconst slug = slugger.slug(nodeToString(parent))\n\tparent.data = {\n\t\t...parent.data,\n\t\tid: slug,\n\t} as Parent['data']\n\tparent.children = [\n\t\t{\n\t\t\ttype: 'link',\n\t\t\turl: `#${slug}`,\n\t\t\ttitle: null,\n\t\t\tchildren: parent.children as PhrasingContent[],\n\t\t\tposition: parent.position,\n\t\t} satisfies Link,\n\t]\n}\n","import type { Parent, PhrasingContent, RootContent } from 'mdast'\nimport 'mdast-util-to-hast'\nimport { isLink } from '../../utils'\nimport { type LinkOptions, type LinkTransform, processLink } from './links'\n\nconst LONERS_MD = new Set(['image'])\nconst LONERS_MDX = new Set([\n\t'iframe',\n\t'img',\n\t'figcaption',\n\t'picture',\n\t'video',\n])\n\nexport type { LinkTransform }\n\nexport function loners(parent: Parent, options: LinkOptions = {}): void {\n\tfor (const [index, child] of parent.children.entries()) {\n\t\tif (child.type === 'paragraph' && child.children[0] && !child.children[1]) {\n\t\t\t// This paragraph has only one child\n\t\t\tconst loner = child.children[0] as PhrasingContent & { name?: string }\n\t\t\tlet replacer: Parent | undefined\n\n\t\t\tif (LONERS_MD.has(loner.type)) {\n\t\t\t\t// Unwrap the loner\n\t\t\t\treplacer = loner as Parent\n\t\t\t}\n\t\t\telse if (/^mdxJsx.+Element$/.test(loner.type) && LONERS_MDX.has(loner.name ?? '')) {\n\t\t\t\t// Unwrap the loner and mark it as a flow element\n\t\t\t\treplacer = {\n\t\t\t\t\t...loner,\n\t\t\t\t\ttype: 'mdxJsxFlowElement',\n\t\t\t\t} as Parent\n\t\t\t}\n\t\t\telse if (isLink(loner)) {\n\t\t\t\treplacer = processLink(loner, options)\n\t\t\t}\n\n\t\t\tif (replacer) {\n\t\t\t\tparent.children[index] = replacer as RootContent\n\t\t\t}\n\t\t}\n\t}\n}\n","import type { Link, Parent } from 'mdast'\nimport type { LinkTransform } from './transform'\n\nexport const youtube: LinkTransform = {\n\tname: 'youtube',\n\tdetect: /^https:\\/\\/(?:youtu\\.be\\/|(?:.+\\.)?youtube\\.com\\/watch\\?(?:[^&]+&)*v=)([^?&/]+)/,\n\tgroups: ['id'],\n\ttransform: function (link: Link, id: string): Parent | undefined {\n\t\tconst url = new URL(link.url)\n\t\tconst t = url.searchParams.get('t')\n\t\tif (t) {\n\t\t\turl.searchParams.set('start', t)\n\t\t\turl.searchParams.delete('t')\n\t\t}\n\t\turl.hostname = 'www.youtube-nocookie.com'\n\t\turl.pathname = `/embed/${id}`\n\n\t\tconst element = {\n\t\t\ttype: 'image',\n\t\t\turl: url.href,\n\t\t\ttitle: link.title || 'YouTube video player',\n\t\t\tposition: link.position,\n\t\t\tchildren: [],\n\t\t\tdata: {\n\t\t\t\thName: 'iframe',\n\t\t\t\thProperties: {\n\t\t\t\t\twidth: '560',\n\t\t\t\t\theight: '315',\n\t\t\t\t\tstyle: 'border:0;width:100%;height:auto;aspect-ratio:16/9',\n\t\t\t\t\tframeborder: '0',\n\t\t\t\t\tallow: 'accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share',\n\t\t\t\t\treferrerpolicy: 'strict-origin-when-cross-origin',\n\t\t\t\t\tallowfullscreen: true,\n\t\t\t\t\tloading: 'lazy',\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\treturn element\n\t} as LinkTransform['transform'],\n}\n","import type { Link, Parent } from 'mdast'\nimport type { LinkTransform } from './transform'\nimport 'mdast-util-to-hast'\n\nexport const codepen: LinkTransform = {\n\tname: 'codepen',\n\tdetect: /^https:\\/\\/codepen\\.io\\/([^/]+)\\/pen\\/([^/]+)/,\n\tgroups: ['owner', 'pen'],\n\ttransform: function (link: Link, owner: string, pen: string): Parent | undefined {\n\t\tconst url = new URL(`https://codepen.io/${owner}/embed/${pen}`)\n\t\turl.searchParams.set('default-tab', 'html,result')\n\t\treturn {\n\t\t\ttype: 'blockquote',\n\t\t\tposition: link.position,\n\t\t\tchildren: [],\n\t\t\tdata: {\n\t\t\t\thName: 'div',\n\t\t\t\thProperties: {\n\t\t\t\t\twidth: '100%',\n\t\t\t\t\theight: '25vh',\n\t\t\t\t\tstyle: 'resize:vertical;overflow:auto;display:flex',\n\t\t\t\t},\n\t\t\t\thChildren: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'element',\n\t\t\t\t\t\ttagName: 'iframe',\n\t\t\t\t\t\tchildren: [],\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tsrc: url.href,\n\t\t\t\t\t\t\ttitle: link.title || 'YouTube video player',\n\t\t\t\t\t\t\theight: '25vh',\n\t\t\t\t\t\t\tstyle: 'border:0;width:100%;min-width:20rem;max-width:80rem;min-height:20rem;',\n\t\t\t\t\t\t\tframeborder: '0',\n\t\t\t\t\t\t\tscrolling: 'no',\n\t\t\t\t\t\t\tallowfullscreen: null,\n\t\t\t\t\t\t\tallowtransparency: null,\n\t\t\t\t\t\t\tloading: 'lazy',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t} satisfies Parent\n\t} as LinkTransform['transform'],\n}\n","import type { Link } from 'mdast'\nimport type { MdxJsxFlowElement, MdxJsxFlowElementData } from 'mdast-util-mdx-jsx'\nimport { nodeToString } from '../../../utils'\nimport type { LinkTransform } from './transform'\nimport { youtube } from './youtube'\nimport { codepen } from './codepen'\n\nexport * from './transform'\nexport * from './youtube'\nexport * from './codepen'\n\nconst DEFAULT_TRANSFORMS: LinkTransform[] = [\n\tyoutube,\n\tcodepen,\n]\n\nexport interface LinkOptions {\n\treadonly transforms?: LinkTransform[]\n\treadonly defaultComponent?: string | undefined\n\treadonly componentRoutes?: Record<string, string> | undefined\n}\n\nexport function processLink(link: Link, options: LinkOptions) {\n\tfor (const { name, detect, transform, groups } of [\n\t\t...DEFAULT_TRANSFORMS,\n\t\t...options.transforms ?? [],\n\t]) {\n\t\tconst match = detect.exec(link.url)\n\t\tif (!match) {\n\t\t\tcontinue\n\t\t}\n\n\t\tconst args = match.slice(1) as Array<string | undefined>\n\n\t\t// Links utually don't have a title, only child nodes.\n\t\tif (!link.title) {\n\t\t\tconst title = nodeToString(link).trim()\n\t\t\tif (title) {\n\t\t\t\tlink.title = title\n\t\t\t}\n\t\t}\n\n\t\t// Replace the link with the transformed node\n\t\tconst component = options.componentRoutes?.[name] ?? options.defaultComponent\n\t\tif (!component) {\n\t\t\treturn transform(link, ...args)\n\t\t}\n\n\t\t// Route the loner to an MDX component, passing not only the url and title as props,\n\t\t// but also all the captured groups from the regex.\n\t\tconst mdx = {\n\t\t\ttype: 'mdxJsxFlowElement',\n\t\t\tname: component,\n\t\t\tchildren: link.children,\n\t\t\tposition: link.position,\n\t\t\tdata: { _mdxExplicitJsx: true } as MdxJsxFlowElementData,\n\t\t\tattributes: [\n\t\t\t\t{\n\t\t\t\t\ttype: 'mdxJsxAttribute',\n\t\t\t\t\tname: 'url',\n\t\t\t\t\tvalue: link.url,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: 'mdxJsxAttribute',\n\t\t\t\t\tname: 'args',\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\ttype: 'mdxJsxAttributeValueExpression',\n\t\t\t\t\t\tvalue: `[${args.map(value => value ? JSON.stringify(value) : 'undefined').join(', ')}]`,\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\testree: {\n\t\t\t\t\t\t\t\ttype: 'Program',\n\t\t\t\t\t\t\t\tbody: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'ExpressionStatement',\n\t\t\t\t\t\t\t\t\t\texpression: {\n\t\t\t\t\t\t\t\t\t\t\ttype: 'ArrayExpression',\n\t\t\t\t\t\t\t\t\t\t\telements: args.map(value => value ? { type: 'Literal', value, raw: JSON.stringify(value) } : { type: 'Identifier', name: 'undefined' }),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tsourceType: 'module',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t} as MdxJsxFlowElement\n\n\t\tif (link.title) {\n\t\t\tmdx.attributes.push({\n\t\t\t\ttype: 'mdxJsxAttribute',\n\t\t\t\tname: 'title',\n\t\t\t\tvalue: link.title,\n\t\t\t})\n\t\t}\n\n\t\t// If the transform names any group, pass them as props\n\t\tfor (const [index, name] of groups?.entries() ?? []) {\n\t\t\tconst value = args[index]\n\t\t\tif (typeof name === 'string' && typeof value === 'string') {\n\t\t\t\tmdx.attributes.push({ type: 'mdxJsxAttribute', name, value })\n\t\t\t}\n\t\t}\n\n\t\treturn mdx\n\t}\n\n\treturn undefined\n}\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AACA,OAAO,WAAW;;;ACCX,SAAS,aAAa,MAAyB;AACrD,MAAI,KAAK,SAAS,QAAQ;AACzB,UAAM,UAAU;AAChB,WAAO,QAAQ,MAAM,KAAK;AAAA,EAC3B;AAEA,MAAI,SAAS,IAAI,GAAG;AACnB,WAAO,KAAK,SAAS,IAAI,YAAY,EAAE,KAAK,GAAG,EAAE,QAAQ,QAAQ,GAAG;AAAA,EACrE;AAEA,SAAO;AACR;AAEO,SAAS,YAAY,OAAmC;AAC9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AAW,YAAY,OAAO,OAAO;AAAA,MACtC;AAEA,UAAI,UAAU;AACb,eAAO,SAAS,KAAK,IAAI;AAAA,MAC1B;AAAA,IACD;AAAA,EACD;AACD;;;ANrCA,IAAM,UAAU,IAAI,cAAc;AAM3B,SAASC,UAAS,UAA2B,CAAC,GAAG;AACvD,SAAO,SAAS,OAAO,MAAY;AAClC,YAAQ,MAAM;AAEd,UAAM,QAAuB,CAAC;AAC9B,QAAI;AAEJ,UAAM,KAAK,IAAI;AAEf,WAAO,SAAS,MAAM,MAAM,GAAG;AAC9B,MAAW,OAAO,MAAM;AACxB,MAAW,SAAS,MAAM;AAC1B,MAAW,SAAS,QAAQ,OAAO;AACnC,MAAW,OAAO,QAAQ,QAAQ,SAAS,CAAC,CAAC;AAC7C,YAAM,KAAK,GAASC,aAAY,OAAO,QAAQ,CAAC;AAAA,IACjD;AAEA,UAAM,KAAK,IAAI;AAEf,WAAO,SAAS,MAAM,MAAM,GAAG;AAC9B,MAAW,QAAQ,MAAM;AACzB,YAAM,KAAK,GAASA,aAAY,OAAO,QAAQ,CAAC;AAAA,IACjD;AAAA,EACD;AACD;;;ADvBO,SAASC,SAAQ,UAAyB,CAAC,GAAG;AACpD,SAAO;AAAA,IACN,CAAC,MAAM,QAAQ,QAAQ,CAAC,CAAC;AAAA,IACzB,CAACC,WAAU,QAAQ,YAAY,CAAC,CAAC;AAAA,EAClC;AACD;","names":["child","plugins","nodeToString","isParent","onlyParents","nodeToString","nodeToString","name","baseline","onlyParents","plugins","baseline"]}
|
|
1
|
+
{"version":3,"sources":["../src/rehype/index.ts","../src/rehype/utils.ts","../src/rehype/transforms/paragraphs.ts","../src/rehype/baseline.ts","../src/remark/index.ts","../src/remark/baseline.ts","../src/remark/utils.ts","../src/remark/transforms/asides.ts","../src/remark/transforms/captions.ts","../src/remark/transforms/figures.ts","../src/remark/transforms/headings.ts","../src/remark/transforms/loners/index.ts","../src/remark/transforms/loners/links/youtube.ts","../src/remark/transforms/loners/links/codepen.ts","../src/remark/transforms/loners/links/index.ts"],"sourcesContent":["import type { Root } from 'hast'\nimport katex from 'rehype-katex'\nimport type { Options as KatexOptions } from 'rehype-katex'\nimport { type BaselineOptions, baseline } from './baseline'\n\nexport interface PresetOptions {\n\tbaseline?: BaselineOptions | undefined\n\tkatex?: KatexOptions | undefined\n}\n\ninterface Options { [key: string]: any }\ntype Factory = (options: Options) => (root: Root) => void\n\nexport function plugins(options: PresetOptions = {}) {\n\treturn [\n\t\t[katex, options.katex ?? {}],\n\t\t[baseline, options.baseline ?? {}],\n\t] as [Factory, Options][]\n}\n","import type * as hast from 'hast'\n\nexport function nodeToString(node: hast.Node): string {\n\tif (node.type === 'text') {\n\t\tconst literal = node as hast.Text\n\t\treturn literal.value.trim()\n\t}\n\n\tif (isParent(node)) {\n\t\treturn node.children.map(nodeToString).join(' ').replace(/\\s+/g, ' ')\n\t}\n\n\treturn ''\n}\n\nexport function onlyParents(nodes: hast.Node[]): hast.Parent[] {\n\treturn nodes.filter(node => isParent(node)) as hast.Parent[]\n}\n\nexport function isParent(node: hast.Node): node is hast.Parent {\n\treturn 'children' in node && Array.isArray(node.children) && node.children.length > 0\n}\n\nexport function isElement(node: hast.Node | undefined, withName: string | RegExp | undefined = undefined): node is hast.Element {\n\tconst element = node as hast.Element\n\tconst name = element?.type === 'element' && element.tagName\n\n\tif (typeof name !== 'string') {\n\t\treturn false\n\t}\n\n\tif (withName instanceof RegExp) {\n\t\treturn withName.test(name)\n\t}\n\telse if (typeof withName === 'string') {\n\t\treturn name === withName\n\t}\n\n\treturn true\n}\n","import type { ElementContent, Node, Parent, Text } from 'hast'\nimport { isElement, nodeToString } from '../utils'\n\nexport function paragraphs(parent: Parent) {\n\tconst children: Node[] = []\n\tfor (const child of parent.children) {\n\t\tif (isElement(child, 'p')) {\n\t\t\t// Skip empty paragraphs\n\t\t\tif (child.children.length === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Trim start\n\t\t\tlet text = child.children[0] as Text\n\t\t\tif (text.type === 'text') {\n\t\t\t\ttext.value = text.value.trimStart()\n\t\t\t}\n\n\t\t\t// Trim end\n\t\t\ttext = child.children[child.children.length - 1] as Text\n\t\t\tif (text.type === 'text') {\n\t\t\t\ttext.value = text.value.trimEnd()\n\t\t\t}\n\n\t\t\t// Skip empty text paragraphs\n\t\t\tconst hasNonText = child.children.some(child => child.type !== 'text')\n\t\t\tconst isEmpty = !hasNonText && nodeToString(child).trim() === ''\n\t\t\tif (isEmpty) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\t// Accept node\n\t\tchildren.push(child)\n\t}\n\n\tparent.children = children as ElementContent[]\n}\n","import type { Parent, Root, Text } from 'hast'\nimport { isElement, onlyParents } from './utils'\nimport * as transforms from './transforms'\n\nexport interface BaselineOptions {\n}\n\nexport function baseline(_options: BaselineOptions = {}) {\n\treturn function plugin(root: Root) {\n\t\tconst queue: Array<Parent> = []\n\t\tlet parent: Parent | undefined\n\n\t\t// First pass:\n\t\t// 1. Trim paragraphs.\n\t\t// 2. Remove empty paragraphs.\n\t\tqueue.push(root)\n\t\t// eslint-disable-next-line no-cond-assign\n\t\twhile (parent = queue.shift()) {\n\t\t\ttransforms.paragraphs(parent)\n\n\t\t\tqueue.push(...onlyParents(parent.children))\n\t\t}\n\n\t\t// Second pass:\n\t\t// 1. Remove lone newlines from all nodes that aren't inside `<code>` or `<pre>`.\n\t\tqueue.push(root)\n\t\t// eslint-disable-next-line no-cond-assign\n\t\twhile (parent = queue.shift()) {\n\t\t\tif (isElement(parent, /^code|pre$/)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tparent.children = parent.children.filter(node =>\n\t\t\t\tnode.type !== 'text' || (node as Text).value !== '\\n',\n\t\t\t)\n\n\t\t\tqueue.push(...onlyParents(parent.children))\n\t\t}\n\t}\n}\n","import type { Root } from 'mdast'\nimport math from 'remark-math'\nimport type { Options as MathOptions } from 'remark-math'\nimport { type BaselineOptions, baseline } from './baseline'\n\nexport interface PresetOptions {\n\tbaseline?: BaselineOptions | undefined\n\tmath?: MathOptions | undefined\n}\n\ninterface Options { [key: string]: any }\ntype Factory = (options: Options) => (root: Root) => void\n\nexport function plugins(options: PresetOptions = {}) {\n\treturn [\n\t\t[math, options.math ?? {}],\n\t\t[baseline, options.baseline ?? {}],\n\t] as [Factory, Options][]\n}\n","import type { Parent, Root } from 'mdast'\nimport GithubSlugger from 'github-slugger'\nimport * as utils from './utils'\nimport * as transforms from './transforms'\nimport type { LinkOptions } from './transforms/loners/links'\n\nconst SLUGGER = new GithubSlugger()\n\nexport interface BaselineOptions {\n\tlinks?: LinkOptions | undefined\n}\n\nexport function baseline(options: BaselineOptions = {}) {\n\treturn function plugin(root: Root) {\n\t\tSLUGGER.reset()\n\n\t\tconst queue: Array<Parent> = []\n\t\tlet parent: Parent | undefined\n\n\t\tqueue.push(root)\n\t\t// eslint-disable-next-line no-cond-assign\n\t\twhile (parent = queue.shift()) {\n\t\t\ttransforms.asides(parent)\n\t\t\ttransforms.captions(parent)\n\t\t\ttransforms.headings(parent, SLUGGER)\n\t\t\ttransforms.loners(parent, options.links ?? {})\n\t\t\tqueue.push(...utils.onlyParents(parent.children))\n\t\t}\n\n\t\tqueue.push(root)\n\t\t// eslint-disable-next-line no-cond-assign\n\t\twhile (parent = queue.shift()) {\n\t\t\ttransforms.figures(parent)\n\t\t\tqueue.push(...utils.onlyParents(parent.children))\n\t\t}\n\t}\n}\n","import type * as mdast from 'mdast'\n\nexport interface AnyData { data?: { [key: string]: any } }\n\nexport function nodeToString(node: mdast.Node): string {\n\tif (node.type === 'text') {\n\t\tconst literal = node as mdast.Text\n\t\treturn literal.value.trim()\n\t}\n\n\tif (isParent(node)) {\n\t\treturn node.children.map(nodeToString).join(' ').replace(/\\s+/g, ' ')\n\t}\n\n\treturn ''\n}\n\nexport function onlyParents(nodes: mdast.Node[]): mdast.Parent[] {\n\treturn nodes.filter(node => isParent(node)) as mdast.Parent[]\n}\n\nexport function isParent(node: mdast.Node | undefined | null): node is mdast.Parent {\n\tconst asParent = node ? node as mdast.Parent : node\n\treturn Array.isArray(asParent?.children) && asParent.children[0] !== undefined\n}\n\nexport function isLink(node: mdast.Node | undefined | null): node is mdast.Link {\n\treturn node?.type === 'link'\n}\n\nexport function isParagraph(node: mdast.Node | undefined | null): node is mdast.Paragraph {\n\treturn node?.type === 'paragraph'\n}\n\nexport function isText(node: mdast.Node | undefined | null): node is mdast.Text {\n\treturn node?.type === 'text'\n}\n","import type { Data, Paragraph, Parent, Text } from 'mdast'\nimport type { AnyData } from '../utils'\n\n/**\n * Support for asides.\n *\n * ```md\n * > [!NOTE: This is a note]\n * > This is the content of the note.\n *\n * > [!WARNING]\n * > This is a warning.\n * ```\n */\nexport function asides(parent: Parent) {\n\tif (parent.type !== 'blockquote' || parent.children[0]?.type !== 'paragraph') {\n\t\treturn\n\t}\n\n\tconst paragraph = parent.children[0] as Paragraph\n\tif (paragraph.children[0]?.type !== 'text') {\n\t\treturn\n\t}\n\n\tconst text = paragraph.children[0] as Text\n\n\t// Extract the inner content of [!…]\n\tconst [full, args] = /^\\s*\\[!([^\\]]+)\\]\\s*/.exec(text.value) || []\n\tif (!full || !args) {\n\t\treturn\n\t}\n\n\t// Remove the [!…] from the text\n\t// Note: This has the effect of trimming the start of the paragraph\n\ttext.value = text.value.slice(full.length)\n\n\t// Parse the type and title\n\t// eslint-disable-next-line regexp/no-super-linear-backtracking\n\tconst match = /^\\s*([A-Z][A-Z_]*)(?::\\s+([^\\]]+))?$/.exec(args)\n\tif (!match) {\n\t\treturn\n\t}\n\tconst type = match[1]!.toLowerCase()\n\tconst title = match[2]?.trim() ?? `${match[1]![0]}${type.slice(1).replace(/_/g, ' ')}`\n\tconst { data } = parent as AnyData\n\tparent.data = {\n\t\t...data,\n\t\ttype,\n\t\ttitle,\n\t\thName: 'aside',\n\t\thProperties: {\n\t\t\t...data?.hProperties,\n\t\t\t'className': ['aside', `aside-${type}`],\n\t\t\t'data-type': type,\n\t\t\t'data-title': title,\n\t\t},\n\t} as Data\n}\n","import type { Parent } from 'mdast'\n\n/**\n * Support for captions, using the \"double blockquote\" `>>` syntax.\n */\nexport function captions(parent: Parent) {\n\tif (parent.children[1] || parent.type !== 'blockquote' || parent.children[0]?.type !== 'blockquote') {\n\t\treturn\n\t}\n\n\tparent.data = {\n\t\t...parent.data,\n\t\thName: 'figcaption',\n\t}\n\tparent.children = parent.children[0].children\n}\n","import type { BlockContent, Blockquote, Parent } from 'mdast'\nimport type { MdxJsxFlowElement } from 'mdast-util-mdx-jsx'\nimport type * as utils from '../utils'\n\nexport function figures(parent: Parent) {\n\tconst parentJSX = parent as MdxJsxFlowElement & utils.AnyData\n\n\tlet len = parent.children.length\n\tfor (let i = 0; i < len; i++) {\n\t\tconst child = parent.children[i] as MdxJsxFlowElement & utils.AnyData\n\n\t\t// Wrap <figcaption> elements and their previous sibling in a <figure>\n\t\tif (i > 0\n\t\t\t&& (child.data?.hName === 'figcaption' || (child.type === 'mdxJsxFlowElement' && child.name === 'figcaption'))\n\t\t\t&& !(parentJSX.data?.hName === 'figure' || (parent.type === 'mdxJsxFlowElement' && parentJSX.name === 'figure'))\n\t\t) {\n\t\t\t--len\n\t\t\tconst captioned = parent.children[--i] as BlockContent\n\t\t\tparent.children.splice(i, 2, {\n\t\t\t\ttype: 'blockquote',\n\t\t\t\tdata: {\n\t\t\t\t\thName: 'figure',\n\t\t\t\t},\n\t\t\t\tposition: captioned.position,\n\t\t\t\tchildren: [captioned, child],\n\t\t\t} satisfies Blockquote)\n\t\t}\n\t}\n}\n","import type { Link, Parent, PhrasingContent } from 'mdast'\nimport { nodeToString } from '../utils'\n\nexport interface Slugger {\n\tslug: (value: string) => string\n}\n\nexport function headings(parent: Parent, slugger: Slugger) {\n\tif (parent.type !== 'heading' || !parent.children[0]) {\n\t\treturn\n\t}\n\n\tconst slug = slugger.slug(nodeToString(parent))\n\tparent.data = {\n\t\t...parent.data,\n\t\tid: slug,\n\t} as Parent['data']\n\tparent.children = [\n\t\t{\n\t\t\ttype: 'link',\n\t\t\turl: `#${slug}`,\n\t\t\ttitle: null,\n\t\t\tchildren: parent.children as PhrasingContent[],\n\t\t\tposition: parent.position,\n\t\t} satisfies Link,\n\t]\n}\n","import type { Parent, PhrasingContent, RootContent } from 'mdast'\nimport 'mdast-util-to-hast'\nimport { isLink } from '../../utils'\nimport { type LinkOptions, type LinkTransform, processLink } from './links'\n\nconst LONERS_MD = new Set(['image'])\nconst LONERS_MDX = new Set([\n\t'iframe',\n\t'img',\n\t'figcaption',\n\t'picture',\n\t'video',\n])\n\nexport type { LinkTransform }\n\nexport function loners(parent: Parent, options: LinkOptions = {}): void {\n\tfor (const [index, child] of parent.children.entries()) {\n\t\tif (child.type === 'paragraph' && child.children[0] && !child.children[1]) {\n\t\t\t// This paragraph has only one child\n\t\t\tconst loner = child.children[0] as PhrasingContent & { name?: string }\n\t\t\tlet replacer: Parent | undefined\n\n\t\t\tif (LONERS_MD.has(loner.type)) {\n\t\t\t\t// Unwrap the loner\n\t\t\t\treplacer = loner as Parent\n\t\t\t}\n\t\t\telse if (/^mdxJsx.+Element$/.test(loner.type) && LONERS_MDX.has(loner.name ?? '')) {\n\t\t\t\t// Unwrap the loner and mark it as a flow element\n\t\t\t\treplacer = {\n\t\t\t\t\t...loner,\n\t\t\t\t\ttype: 'mdxJsxFlowElement',\n\t\t\t\t} as Parent\n\t\t\t}\n\t\t\telse if (isLink(loner)) {\n\t\t\t\treplacer = processLink(loner, options)\n\t\t\t}\n\n\t\t\tif (replacer) {\n\t\t\t\tparent.children[index] = replacer as RootContent\n\t\t\t}\n\t\t}\n\t}\n}\n","import type { Link, Parent } from 'mdast'\nimport type { LinkTransform } from './transform'\n\nexport const youtube: LinkTransform = {\n\tname: 'youtube',\n\tdetect: /^https:\\/\\/(?:youtu\\.be\\/|(?:.+\\.)?youtube\\.com\\/watch\\?(?:[^&]+&)*v=)([^?&/]+)/,\n\tgroups: ['id'],\n\ttransform: function (link: Link, id: string): Parent | undefined {\n\t\tconst url = new URL(link.url)\n\t\tconst t = url.searchParams.get('t')\n\t\tif (t) {\n\t\t\turl.searchParams.set('start', t)\n\t\t\turl.searchParams.delete('t')\n\t\t}\n\t\turl.hostname = 'www.youtube-nocookie.com'\n\t\turl.pathname = `/embed/${id}`\n\n\t\tconst element = {\n\t\t\ttype: 'image',\n\t\t\turl: url.href,\n\t\t\ttitle: link.title || 'YouTube video player',\n\t\t\tposition: link.position,\n\t\t\tchildren: [],\n\t\t\tdata: {\n\t\t\t\thName: 'iframe',\n\t\t\t\thProperties: {\n\t\t\t\t\twidth: '560',\n\t\t\t\t\theight: '315',\n\t\t\t\t\tstyle: 'border:0;width:100%;height:auto;aspect-ratio:16/9',\n\t\t\t\t\tframeborder: '0',\n\t\t\t\t\tallow: 'accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share',\n\t\t\t\t\treferrerpolicy: 'strict-origin-when-cross-origin',\n\t\t\t\t\tallowfullscreen: true,\n\t\t\t\t\tloading: 'lazy',\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\treturn element\n\t} as LinkTransform['transform'],\n}\n","import type { Link, Parent } from 'mdast'\nimport type { LinkTransform } from './transform'\nimport 'mdast-util-to-hast'\n\nexport const codepen: LinkTransform = {\n\tname: 'codepen',\n\tdetect: /^https:\\/\\/codepen\\.io\\/([^/]+)\\/(?:pen|embed|embed\\/preview)\\/([^?/]+)/,\n\tgroups: ['owner', 'pen'],\n\ttransform: function (link: Link, owner: string, pen: string): Parent | undefined {\n\t\tconst url = new URL(link.url)\n\t\turl.pathname = `/${owner}/embed/preview/${pen}`\n\t\tif (!url.searchParams.has('default-tab')) {\n\t\t\turl.searchParams.set('default-tab', 'html,result')\n\t\t}\n\t\treturn {\n\t\t\ttype: 'blockquote',\n\t\t\tposition: link.position,\n\t\t\tchildren: [],\n\t\t\tdata: {\n\t\t\t\thName: 'div',\n\t\t\t\thProperties: {\n\t\t\t\t\tstyle: 'resize:both;overflow:auto;display:flex;min-height:20rem',\n\t\t\t\t},\n\t\t\t\thChildren: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'element',\n\t\t\t\t\t\ttagName: 'iframe',\n\t\t\t\t\t\tchildren: [],\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tsrc: url.href,\n\t\t\t\t\t\t\ttitle: link.title || 'CodePen Embed',\n\t\t\t\t\t\t\tstyle: 'border:0;width:100%;height:100%;min-height:20rem',\n\t\t\t\t\t\t\tframeborder: '0',\n\t\t\t\t\t\t\tscrolling: 'no',\n\t\t\t\t\t\t\tallowfullscreen: true,\n\t\t\t\t\t\t\tallowtransparency: true,\n\t\t\t\t\t\t\tloading: 'lazy',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t} satisfies Parent\n\t} as LinkTransform['transform'],\n}\n","import type { Link } from 'mdast'\nimport type { MdxJsxFlowElement, MdxJsxFlowElementData } from 'mdast-util-mdx-jsx'\nimport { nodeToString } from '../../../utils'\nimport type { LinkTransform } from './transform'\nimport { youtube } from './youtube'\nimport { codepen } from './codepen'\n\nexport * from './transform'\nexport * from './youtube'\nexport * from './codepen'\n\nconst DEFAULT_TRANSFORMS: LinkTransform[] = [\n\tyoutube,\n\tcodepen,\n]\n\nexport interface LinkOptions {\n\treadonly transforms?: LinkTransform[]\n\treadonly defaultComponent?: string | undefined\n\treadonly componentRoutes?: Record<string, string> | undefined\n}\n\nexport function processLink(link: Link, options: LinkOptions) {\n\tfor (const { name, detect, transform, groups } of [\n\t\t...DEFAULT_TRANSFORMS,\n\t\t...options.transforms ?? [],\n\t]) {\n\t\tconst match = detect.exec(link.url)\n\t\tif (!match) {\n\t\t\tcontinue\n\t\t}\n\n\t\tconst args = match.slice(1) as Array<string | undefined>\n\n\t\t// Links utually don't have a title, only child nodes.\n\t\tif (!link.title) {\n\t\t\tconst title = nodeToString(link).trim()\n\t\t\tif (title) {\n\t\t\t\tlink.title = title\n\t\t\t}\n\t\t}\n\n\t\t// Replace the link with the transformed node\n\t\tconst component = options.componentRoutes?.[name] ?? options.defaultComponent\n\t\tif (!component) {\n\t\t\treturn transform(link, ...args)\n\t\t}\n\n\t\t// Route the loner to an MDX component, passing not only the url and title as props,\n\t\t// but also all the captured groups from the regex.\n\t\tconst mdx = {\n\t\t\ttype: 'mdxJsxFlowElement',\n\t\t\tname: component,\n\t\t\tchildren: link.children,\n\t\t\tposition: link.position,\n\t\t\tdata: { _mdxExplicitJsx: true } as MdxJsxFlowElementData,\n\t\t\tattributes: [\n\t\t\t\t{\n\t\t\t\t\ttype: 'mdxJsxAttribute',\n\t\t\t\t\tname: 'url',\n\t\t\t\t\tvalue: link.url,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: 'mdxJsxAttribute',\n\t\t\t\t\tname: 'args',\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\ttype: 'mdxJsxAttributeValueExpression',\n\t\t\t\t\t\tvalue: `[${args.map(value => value ? JSON.stringify(value) : 'undefined').join(', ')}]`,\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\testree: {\n\t\t\t\t\t\t\t\ttype: 'Program',\n\t\t\t\t\t\t\t\tbody: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'ExpressionStatement',\n\t\t\t\t\t\t\t\t\t\texpression: {\n\t\t\t\t\t\t\t\t\t\t\ttype: 'ArrayExpression',\n\t\t\t\t\t\t\t\t\t\t\telements: args.map(value => value ? { type: 'Literal', value, raw: JSON.stringify(value) } : { type: 'Identifier', name: 'undefined' }),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tsourceType: 'module',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t} as MdxJsxFlowElement\n\n\t\tif (link.title) {\n\t\t\tmdx.attributes.push({\n\t\t\t\ttype: 'mdxJsxAttribute',\n\t\t\t\tname: 'title',\n\t\t\t\tvalue: link.title,\n\t\t\t})\n\t\t}\n\n\t\t// If the transform names any group, pass them as props\n\t\tfor (const [index, name] of groups?.entries() ?? []) {\n\t\t\tconst value = args[index]\n\t\t\tif (typeof name === 'string' && typeof value === 'string') {\n\t\t\t\tmdx.attributes.push({ type: 'mdxJsxAttribute', name, value })\n\t\t\t}\n\t\t}\n\n\t\treturn mdx\n\t}\n\n\treturn undefined\n}\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AACA,OAAO,WAAW;;;ACCX,SAAS,aAAa,MAAyB;AACrD,MAAI,KAAK,SAAS,QAAQ;AACzB,UAAM,UAAU;AAChB,WAAO,QAAQ,MAAM,KAAK;AAAA,EAC3B;AAEA,MAAI,SAAS,IAAI,GAAG;AACnB,WAAO,KAAK,SAAS,IAAI,YAAY,EAAE,KAAK,GAAG,EAAE,QAAQ,QAAQ,GAAG;AAAA,EACrE;AAEA,SAAO;AACR;AAEO,SAAS,YAAY,OAAmC;AAC9D,SAAO,MAAM,OAAO,UAAQ,SAAS,IAAI,CAAC;AAC3C;AAEO,SAAS,SAAS,MAAsC;AAC9D,SAAO,cAAc,QAAQ,MAAM,QAAQ,KAAK,QAAQ,KAAK,KAAK,SAAS,SAAS;AACrF;AAEO,SAAS,UAAU,MAA6B,WAAwC,QAAiC;AAC/H,QAAM,UAAU;AAChB,QAAM,OAAO,SAAS,SAAS,aAAa,QAAQ;AAEpD,MAAI,OAAO,SAAS,UAAU;AAC7B,WAAO;AAAA,EACR;AAEA,MAAI,oBAAoB,QAAQ;AAC/B,WAAO,SAAS,KAAK,IAAI;AAAA,EAC1B,WACS,OAAO,aAAa,UAAU;AACtC,WAAO,SAAS;AAAA,EACjB;AAEA,SAAO;AACR;;;ACpCO,SAAS,WAAW,QAAgB;AAC1C,QAAM,WAAmB,CAAC;AAC1B,aAAW,SAAS,OAAO,UAAU;AACpC,QAAI,U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A,IACjD;AAEA,UAAM,KAAK,IAAI;AAEf,WAAO,SAAS,MAAM,MAAM,GAAG;AAC9B,MAAW,QAAQ,MAAM;AACzB,YAAM,KAAK,GAASA,aAAY,OAAO,QAAQ,CAAC;AAAA,IACjD;AAAA,EACD;AACD;;;ADvBO,SAASC,SAAQ,UAAyB,CAAC,GAAG;AACpD,SAAO;AAAA,IACN,CAAC,MAAM,QAAQ,QAAQ,CAAC,CAAC;AAAA,IACzB,CAACC,WAAU,QAAQ,YAAY,CAAC,CAAC;AAAA,EAClC;AACD;","names":["child","plugins","nodeToString","isParent","onlyParents","nodeToString","nodeToString","name","baseline","onlyParents","plugins","baseline"]}
|