@copepod/unified-plugins 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -25,10 +25,11 @@ All headings are automatically given an `id` attribute based on their text conte
25
25
 
26
26
  ### Unwrapping of "loner" elements
27
27
 
28
- Elements that are the only child of a paragraph are unwrapped from the paragraph is they can be block elements. This includes the following elements:
28
+ Elements that are the only child of a paragraph are unwrapped from the paragraph if they can be block elements. This includes the following elements:
29
29
 
30
30
  **HTML (or JSX):**
31
31
 
32
+ * `<iframe>`
32
33
  * `<img>`.
33
34
  * `<figcaption>`
34
35
  * `<picture>`
@@ -41,7 +42,7 @@ Elements that are the only child of a paragraph are unwrapped from the paragraph
41
42
 
42
43
  ### Link transforms
43
44
 
44
- Lone links whose URL is recognized by a registered link transform can be altered or transformed into other elements.
45
+ Lone links whose URL is recognized by a registered link transform can be altered or transformed into another element.
45
46
 
46
47
  A link transform conforms to the following interface:
47
48
 
@@ -69,24 +70,18 @@ In addition to `url` and `title`, captured groups with a corresponding name in `
69
70
 
70
71
  By default, the following link transforms are registered:
71
72
 
72
- * `youtube`: Transforms YouTube video URLs into responsive iframes.
73
+ * `codepen`: Transforms CodePen URLs into responsive iframes loaded lazily.
74
+ Captured groups:
75
+ * `owner`: The pen's owner.
76
+ * `pen`: The pen's id.
77
+ * `youtube`: Transforms YouTube video URLs into responsive iframes loaded lazily.
78
+ Captured groups:
79
+ * `id`: The video ID.
73
80
 
74
81
  You can override the default transforms, or register new ones, by setting the `baseline.links.transforms` option.
75
82
 
76
83
  > [!NOTE]
77
- > Links often don't have titles. Writing a link like this:
78
- >
79
- > ```md
80
- > [A link](https://example.com)
81
- > ```
82
- >
83
- > is more readable than this:
84
- >
85
- > ```md
86
- > [](https://example.com "A link")
87
- > ```
88
- >
89
- > When the `title` attribute is absent, the preset automatically sets it to the element's text content before passing it to the `transform()` function (or the registered MDX component), so that the first syntax is equivalent to the latter one.
84
+ > Markdown links often don't have titles. When a link doesn't have one, the preset automatically sets it to the element's text content before it passes it down to the `transform()` function or an MDX component.
90
85
 
91
86
  ### Asides
92
87
 
@@ -116,7 +111,9 @@ Arbitrary aside types are also supported, for instance:
116
111
  > A tip for cooking.
117
112
  ```
118
113
 
119
- Asides are converted to `<aside>` elements in rehype. They have a class list that includes `aside` and `aside-<type>`, where `<type>` is the aside type in lowercase. The mdast elements also have the `type` attribute set so that it can be picked up by any MDX component responsible for rendering asides.
114
+ Asides are converted to `<aside>` elements in rehype. They have a class list that includes `aside` and `aside-<type>`, where `<type>` is the aside type in lowercase.
115
+
116
+ The aside type is also available in the `data` attribute of the mdast node, as well as in the `data-type` attribute set in the rehype node.
120
117
 
121
118
  A title can be passed as an argument to the aside type:
122
119
 
@@ -124,7 +121,7 @@ A title can be passed as an argument to the aside type:
124
121
  > [!TIP: I bet you didn't know this!]
125
122
  ```
126
123
 
127
- Titles are not inserted into the tree, but are available in the `data` attribute of the mdast node as well as the `data-title` attribute of the rehype node.
124
+ Titles are not inserted into the tree, but are available in the `data` attribute of the mdast node as well as in the `data-title` attribute of the rehype node.
128
125
 
129
126
  ### _"Double blockquotes"_ `>>` syntax for figure captions
130
127
 
package/dist/index.mjs CHANGED
@@ -156,13 +156,14 @@ function asides(parent) {
156
156
  const { data } = parent;
157
157
  parent.data = {
158
158
  ...data,
159
+ type,
160
+ title,
159
161
  hName: "aside",
160
162
  hProperties: {
161
163
  ...data?.hProperties,
162
- className: ["aside", `aside-${type}`],
163
- type,
164
- title,
165
- dataTitle: title
164
+ "className": ["aside", `aside-${type}`],
165
+ "data-type": type,
166
+ "data-title": title
166
167
  }
167
168
  };
168
169
  }
@@ -262,9 +263,41 @@ var youtube = {
262
263
  }
263
264
  };
264
265
 
266
+ // src/remark/transforms/loners/links/codepen.ts
267
+ var codepen = {
268
+ name: "codepen",
269
+ detect: /^https:\/\/codepen\.io\/([^/]+)\/pen\/([^/]+)/,
270
+ groups: ["owner", "pen"],
271
+ transform: function(link, owner, pen) {
272
+ const url = new URL(`https://codepen.io/${owner}/embed/${pen}`);
273
+ url.searchParams.set("default-tab", "html,result");
274
+ const element = {
275
+ type: "image",
276
+ url: url.href,
277
+ title: link.title || "YouTube video player",
278
+ position: link.position,
279
+ children: [],
280
+ data: {
281
+ hName: "iframe",
282
+ hProperties: {
283
+ height: "25vh",
284
+ style: "border:0;width:100%;min-width:20rem;max-width:80rem;min-height:20rem;",
285
+ frameborder: "0",
286
+ scrolling: "no",
287
+ allowfullscreen: null,
288
+ allowtransparency: null,
289
+ loading: "lazy"
290
+ }
291
+ }
292
+ };
293
+ return element;
294
+ }
295
+ };
296
+
265
297
  // src/remark/transforms/loners/links/index.ts
266
298
  var DEFAULT_TRANSFORMS = [
267
- youtube
299
+ youtube,
300
+ codepen
268
301
  ];
269
302
  function processLink(link, options) {
270
303
  for (const { name, detect, transform, groups } of [
@@ -344,6 +377,7 @@ function processLink(link, options) {
344
377
  // src/remark/transforms/loners/index.ts
345
378
  var LONERS_MD = /* @__PURE__ */ new Set(["image"]);
346
379
  var LONERS_MDX = /* @__PURE__ */ new Set([
380
+ "iframe",
347
381
  "img",
348
382
  "figcaption",
349
383
  "picture",
@@ -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/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 { 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\thName: 'aside',\n\t\thProperties: {\n\t\t\t...data?.hProperties,\n\t\t\tclassName: ['aside', `aside-${type}`],\n\t\t\ttype,\n\t\t\ttitle,\n\t\t\tdataTitle: title,\n\t\t},\n\t}\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'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 } from 'mdast'\nimport type { MdxJsxFlowElement, MdxJsxFlowElementData } from 'mdast-util-mdx-jsx'\nimport { nodeToString } from '../../../utils'\nimport type { LinkTransform } from './transform'\nimport { youtube } from './youtube'\n\nexport * from './transform'\nexport * from './youtube'\n\nconst DEFAULT_TRANSFORMS: LinkTransform[] = [\n\tyoutube,\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,UAAU,OAAO,GAAG,GAAG;AAE1B,UAAI,MAAM,SAAS,WAAW,GAAG;AAChC;AAAA,MACD;AAGA,UAAI,OAAO,MAAM,SAAS,CAAC;AAC3B,UAA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AI;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'\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\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\theight: '25vh',\n\t\t\t\t\tstyle: 'border:0;width:100%;min-width:20rem;max-width:80rem;min-height:20rem;',\n\t\t\t\t\tframeborder: '0',\n\t\t\t\t\tscrolling: 'no',\n\t\t\t\t\tallowfullscreen: null,\n\t\t\t\t\tallowtransparency: null,\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 } 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,EAC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CA,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"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@copepod/unified-plugins",
3
3
  "type": "module",
4
- "version": "0.0.1",
4
+ "version": "0.1.0",
5
5
  "description": "A collection of plugins",
6
6
  "author": "Julien Cayzac",
7
7
  "license": "MIT",