cudoc-remark 0.3.0 → 0.5.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
@@ -17,13 +17,13 @@ import cudoc from "cudoc-remark"
17
17
  const remarkPlugins = [remarkGfm, [cudoc, { host: "next", syntax: {} }]]
18
18
  ```
19
19
 
20
- Default settings produce component-free output in both `.md` and `.mdx`; `syntax: {}` makes the defaults explicit. Let the host detect the document format. For Next.js Turbopack, use package-name plugin strings and JSON options as shown in the guide. `cudoc-remark/embed` inserts its runtime automatically after collection and preparation.
20
+ Default settings produce component-free output in both `.md` and `.mdx`; `syntax: {}` makes the defaults explicit. Let the host detect the document format. For Next.js Turbopack, use package-name plugin strings and JSON options as shown in the guide. After collection and preparation, `cudoc-remark/embed` splices each prepared embed into the page as it compiles, so embedded components render through the host's own component mapping; `cudoc-remark/loader` keeps a recollection visible to the dev server and the build cache.
21
21
 
22
22
  Choose `host`, `cudoc` or `both` independently for `headingAnchor`, `badge`, `tableCellList`, `callout` and `link`. The representative callout is `> [!NOTE] Title`. Authors do not register cudoc React components in the recommended setup. Syntax-only rendering needs no stored JSON; cross-document embedding requires document collection.
23
23
 
24
- - [Usage guide](https://github.com/cudoment/cudoc/tree/main/docs/next-mdx.md) · [한국어 가이드](https://github.com/cudoment/cudoc/tree/main/docs/next-mdx.ko.md)
24
+ - [Usage guide](https://github.com/cudoment/cudoc/tree/main/docs/next.md) · [한국어 가이드](https://github.com/cudoment/cudoc/tree/main/docs/next.ko.md)
25
25
  - [Markdown syntax](https://github.com/cudoment/cudoc/tree/main/docs/syntax.md)
26
26
  - [Embedding](https://github.com/cudoment/cudoc/tree/main/docs/embedding.md)
27
- - [Standalone HTML alongside a host](https://github.com/cudoment/cudoc/tree/main/docs/html.md#export-alongside-an-existing-site)
27
+ - [Standalone HTML alongside a host](https://github.com/cudoment/cudoc/tree/main/docs/export.md#export-alongside-an-existing-site)
28
28
  - [API reference](https://github.com/cudoment/cudoc/tree/main/docs/api-reference/README.md)
29
29
  - [Runnable examples](https://github.com/cudoment/cudoc/tree/main/examples/README.md)
@@ -1 +1 @@
1
- {"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../src/capture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAEhE,qFAAqF;AACrF,wBAAgB,qBAAqB;;;YAyBzB,gBAAgB;EAQ3B"}
1
+ {"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../src/capture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAGhE,qFAAqF;AACrF,wBAAgB,qBAAqB;;;YAoCzB,gBAAgB;EAQ3B"}
package/dist/capture.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { lowerNativeElements } from "@cudoment/cudoc/document";
2
+ import { importedNames, importedNamesFromSource } from "@cudoment/cudoc/mdx";
2
3
  /** Capture remark's final tree at the start of rehype, after native host plugins. */
3
4
  export function createCompilerCapture() {
4
5
  let current;
@@ -11,6 +12,16 @@ export function createCompilerCapture() {
11
12
  throw new Error("cudoc: install capture.remark before capture.rehype");
12
13
  const tree = structuredClone(current);
13
14
  lowerNativeElements(tree);
15
+ // A host may have hoisted the ESM out of the tree already, so the source
16
+ // is read as well; the two agree when both are present.
17
+ const imports = [
18
+ ...new Set([
19
+ ...importedNames(tree),
20
+ ...(file.extname === ".mdx"
21
+ ? importedNamesFromSource(String(file.value))
22
+ : []),
23
+ ]),
24
+ ];
14
25
  tree.children = tree.children.filter((n) => !["yaml", "mdxjsEsm"].includes(n.type));
15
26
  result = {
16
27
  tree,
@@ -18,6 +29,7 @@ export function createCompilerCapture() {
18
29
  file.data.frontmatter ??
19
30
  {}),
20
31
  diagnostics: [],
32
+ ...(imports.length ? { imports } : {}),
21
33
  };
22
34
  };
23
35
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"capture.js","sourceRoot":"","sources":["../src/capture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAG9D,qFAAqF;AACrF,MAAM,UAAU,qBAAqB;IACnC,IAAI,OAAyB,CAAA;IAC7B,IAAI,MAAoC,CAAA;IACxC,MAAM,MAAM,GAAqB,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE;QAC9C,OAAO,GAAG,IAAI,CAAA;IAChB,CAAC,CAAA;IACD,MAAM,MAAM,GAAW,GAAG,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAC3C,IAAI,CAAC,OAAO;YACV,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAA;QACxE,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;QACrC,mBAAmB,CAAC,IAAI,CAAC,CAAA;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAClC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAC9C,CAAA;QACD,MAAM,GAAG;YACP,IAAI;YACJ,WAAW,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;gBACjC,IAAI,CAAC,IAAI,CAAC,WAAW;gBACrB,EAAE,CAA4B;YAChC,WAAW,EAAE,EAAE;SAChB,CAAA;IACH,CAAC,CAAA;IACD,OAAO;QACL,MAAM;QACN,MAAM;QACN,IAAI;YACF,IAAI,CAAC,MAAM;gBACT,MAAM,IAAI,KAAK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IAAI;YACJ,WAAW,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;gBACjC,IAAI,CAAC,IAAI,CAAC,WAAW;gBACrB,EAAE,CAA4B;YAChC,WAAW,EAAE,EAAE;YACf,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACvC,CAAA;IACH,CAAC,CAAA;IACD,OAAO;QACL,MAAM;QACN,MAAM;QACN,IAAI;YACF,IAAI,CAAC,MAAM;gBACT,MAAM,IAAI,KAAK,CACb,yDAAyD,CAC1D,CAAA;YACH,OAAO,MAAM,CAAA;QACf,CAAC;KACF,CAAA;AACH,CAAC"}
package/dist/embed.d.ts CHANGED
@@ -1,9 +1,43 @@
1
+ /**
2
+ * Prepared embeds, spliced into the document as it compiles.
3
+ *
4
+ * `prepareEmbeds` has already resolved every fence into an mdast block: the
5
+ * selected sections, replacements applied, ids and links rebased, nested
6
+ * embeds expanded, all produced by the host's own compiler. This plugin puts
7
+ * those nodes where the fence was, so the rest of the host's pipeline — its
8
+ * remaining remark plugins, remark-rehype, the component mapping — treats
9
+ * them exactly like the document's own content. A component in an embedded
10
+ * section renders through the host's components; a code block reaches the
11
+ * host's highlighter; nothing is turned into an HTML string first.
12
+ *
13
+ * The stored blocks carry no `estree`: the AST export strips it, because it
14
+ * is compiler state rather than content. The expression text is kept, so the
15
+ * estree is parsed again here for every expression node the block contains.
16
+ */
1
17
  import type { Root } from "mdast";
2
18
  import type { Plugin } from "unified";
3
- /** Render persisted embeds inside the current host compilation. */
4
- declare const embed: Plugin<[{
19
+ import type { DocumentNode } from "@cudoment/cudoc/document";
20
+ import { type SourceRoot } from "@cudoment/cudoc/node/roots";
21
+ export type EmbedPluginOptions = {
22
+ /** The prepared library. Defaults to `.cudoc/documents`. */
5
23
  outDir?: string;
24
+ /** One root at the top of the library. Defaults to `docs` when `roots` is absent. */
6
25
  sourceRoot?: string;
7
- }?], Root>;
26
+ /** The roots collection used, so a file maps to the same id here. */
27
+ roots?: SourceRoot[];
28
+ };
29
+ /**
30
+ * Gives every expression node in a stored block the estree the MDX compiler
31
+ * needs, from the expression text the export preserved.
32
+ *
33
+ * A JSX attribute value expression is parsed as an expression; a spread
34
+ * attribute as the object `{...value}` the MDX parser itself builds; a flow or
35
+ * text expression as an expression, or as an empty program when it holds only
36
+ * a comment. Anything that does not parse names the document and the text, so
37
+ * a block that compiled at collection but not here is not a silent failure.
38
+ */
39
+ export declare function restoreExpressions(node: DocumentNode, documentId: string): void;
40
+ /** Splice prepared embeds into the current host compilation. */
41
+ declare const embed: Plugin<[EmbedPluginOptions?], Root>;
8
42
  export default embed;
9
43
  //# sourceMappingURL=embed.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../src/embed.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AASrC,mEAAmE;AACnE,QAAA,MAAM,KAAK,EAAE,MAAM,CAAC,CAAC;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,EAAE,IAAI,CA6ElE,CAAA;AACH,eAAe,KAAK,CAAA"}
1
+ {"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../src/embed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGrC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAI5D,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,4BAA4B,CAAA;AAQnC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,qEAAqE;IACrE,KAAK,CAAC,EAAE,UAAU,EAAE,CAAA;CACrB,CAAA;AAcD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,YAAY,EAClB,UAAU,EAAE,MAAM,GACjB,IAAI,CA8CN;AAED,gEAAgE;AAChE,QAAA,MAAM,KAAK,EAAE,MAAM,CAAC,CAAC,kBAAkB,CAAC,CAAC,EAAE,IAAI,CAgD5C,CAAA;AACH,eAAe,KAAK,CAAA"}
package/dist/embed.js CHANGED
@@ -1,74 +1,125 @@
1
- import path from "node:path";
2
- import { parse } from "acorn";
1
+ /**
2
+ * Prepared embeds, spliced into the document as it compiles.
3
+ *
4
+ * `prepareEmbeds` has already resolved every fence into an mdast block: the
5
+ * selected sections, replacements applied, ids and links rebased, nested
6
+ * embeds expanded, all produced by the host's own compiler. This plugin puts
7
+ * those nodes where the fence was, so the rest of the host's pipeline — its
8
+ * remaining remark plugins, remark-rehype, the component mapping — treats
9
+ * them exactly like the document's own content. A component in an embedded
10
+ * section renders through the host's components; a code block reaches the
11
+ * host's highlighter; nothing is turned into an HTML string first.
12
+ *
13
+ * The stored blocks carry no `estree`: the AST export strips it, because it
14
+ * is compiler state rather than content. The expression text is kept, so the
15
+ * estree is parsed again here for every expression node the block contains.
16
+ */
17
+ import { Parser } from "acorn";
18
+ import jsx from "acorn-jsx";
19
+ // The roots module alone: a host loads its configuration, and this plugin
20
+ // with it, in a runtime that cannot import the compiler stack behind
21
+ // `node/library`.
22
+ import { documentIdOf, resolveRoots, } from "@cudoment/cudoc/node/roots";
3
23
  import { readPreparedEmbeds, embedKey, } from "@cudoment/cudoc/node/prepare-embeds";
4
- /** Render persisted embeds inside the current host compilation. */
24
+ import { stripLibraryMarker } from "./loader.js";
25
+ const parser = Parser.extend(jsx());
26
+ const parse = (source) => parser.parse(source, {
27
+ ecmaVersion: "latest",
28
+ sourceType: "module",
29
+ locations: false,
30
+ });
31
+ /** A program holding only comments, which is what a commented-out expression compiles to. */
32
+ const commentOnly = (value) => value.replace(/\/\*[\s\S]*?\*\/|\/\/[^\n]*/g, "").trim() === "";
33
+ /**
34
+ * Gives every expression node in a stored block the estree the MDX compiler
35
+ * needs, from the expression text the export preserved.
36
+ *
37
+ * A JSX attribute value expression is parsed as an expression; a spread
38
+ * attribute as the object `{...value}` the MDX parser itself builds; a flow or
39
+ * text expression as an expression, or as an empty program when it holds only
40
+ * a comment. Anything that does not parse names the document and the text, so
41
+ * a block that compiled at collection but not here is not a silent failure.
42
+ */
43
+ export function restoreExpressions(node, documentId) {
44
+ const estreeFor = (value, wrap) => {
45
+ try {
46
+ return parse(wrap(value));
47
+ }
48
+ catch (cause) {
49
+ if (commentOnly(value))
50
+ return { type: "Program", body: [], sourceType: "module", comments: [] };
51
+ throw new Error(`cudoc: embedded expression in ${documentId} does not parse: {${value}}`, { cause });
52
+ }
53
+ };
54
+ const visit = (current) => {
55
+ if ((current.type === "mdxFlowExpression" ||
56
+ current.type === "mdxTextExpression") &&
57
+ typeof current.value === "string")
58
+ current.data = {
59
+ ...current.data,
60
+ estree: estreeFor(current.value, (v) => `(${v})`),
61
+ };
62
+ if (Array.isArray(current.attributes))
63
+ for (const attribute of current.attributes) {
64
+ if (attribute.type === "mdxJsxExpressionAttribute") {
65
+ attribute.data = {
66
+ ...attribute.data,
67
+ estree: estreeFor(String(attribute.value), (v) => `({${v}})`),
68
+ };
69
+ continue;
70
+ }
71
+ const value = attribute.value;
72
+ if (value &&
73
+ typeof value === "object" &&
74
+ value.type === "mdxJsxAttributeValueExpression")
75
+ value.data = {
76
+ ...value.data,
77
+ estree: estreeFor(String(value.value), (v) => `(${v})`),
78
+ };
79
+ }
80
+ current.children?.forEach(visit);
81
+ };
82
+ visit(node);
83
+ }
84
+ /** Splice prepared embeds into the current host compilation. */
5
85
  const embed = (options = {}) => (tree, file) => {
6
86
  let prepared;
7
87
  let index = 0;
8
- let usesEmbeds = false;
9
- // One import per document makes the generated data a real bundler dependency.
10
- // Rebuilding sources updates embeds.json even when the Markdown page is cached.
11
- let relativeData = path
12
- .relative(path.dirname(file.path), path.resolve(options.outDir ?? ".cudoc/documents", "embeds.json"))
13
- .split(path.sep)
14
- .join("/");
15
- if (!relativeData.startsWith("."))
16
- relativeData = `./${relativeData}`;
17
- const documentId = path
18
- .relative(path.resolve(options.sourceRoot ?? "docs"), file.path)
19
- .split(path.sep)
20
- .join("/")
21
- .replace(/\.mdx?$/i, "");
88
+ // Resolved only when a fence is met: a file outside every root is fine as
89
+ // long as it embeds nothing.
90
+ let documentId;
91
+ const idOf = () => {
92
+ if (documentId !== undefined)
93
+ return documentId;
94
+ const roots = resolveRoots(options.roots === undefined && options.sourceRoot === undefined
95
+ ? { sourceRoot: "docs" }
96
+ : options);
97
+ documentId = documentIdOf(roots, file.path);
98
+ if (documentId === undefined)
99
+ throw new Error(`cudoc: ${file.path} is outside every collection root, so its embeds have no prepared data`);
100
+ return documentId;
101
+ };
22
102
  const expand = (node) => {
23
103
  if (!node.children)
24
104
  return;
25
105
  node.children = node.children.flatMap((child) => {
26
106
  if (child.type === "code" && child.lang === "cudoc-embed") {
27
- prepared ??= readPreparedEmbeds(options.outDir ?? ".cudoc/documents", documentId, String(file.value));
28
- const result = prepared.blocks[embedKey(documentId, child.value, ++index)];
107
+ const id = idOf();
108
+ // The loader may have appended its marker line; the snapshot was
109
+ // taken from the file itself.
110
+ prepared ??= readPreparedEmbeds(options.outDir ?? ".cudoc/documents", id, stripLibraryMarker(String(file.value)));
111
+ const result = prepared.blocks[embedKey(id, child.value, ++index)];
29
112
  if (!result)
30
- throw new Error(`cudoc: prepared embed missing in ${documentId}; recollect documents`);
31
- usesEmbeds = true;
32
- const expression = `_cudocData.blocks[${JSON.stringify(embedKey(documentId, child.value, index))}]`;
33
- return [
34
- {
35
- type: "mdxJsxFlowElement",
36
- name: "_CudocEmbed",
37
- attributes: [
38
- {
39
- type: "mdxJsxAttribute",
40
- name: "tree",
41
- value: {
42
- type: "mdxJsxAttributeValueExpression",
43
- value: expression,
44
- data: {
45
- estree: parse(expression, {
46
- ecmaVersion: "latest",
47
- sourceType: "module",
48
- }),
49
- },
50
- },
51
- },
52
- ],
53
- children: [],
54
- },
55
- ];
113
+ throw new Error(`cudoc: prepared embed missing in ${id}; recollect documents`);
114
+ const block = structuredClone(result);
115
+ restoreExpressions(block, id);
116
+ return (block.children ?? []);
56
117
  }
57
118
  expand(child);
58
119
  return [child];
59
120
  });
60
121
  };
61
122
  expand(tree);
62
- if (usesEmbeds) {
63
- const value = `import { EmbeddedDocument as _CudocEmbed } from "cudoc-remark/runtime";\nimport _cudocData from ${JSON.stringify(relativeData)};`;
64
- tree.children.unshift({
65
- type: "mdxjsEsm",
66
- value,
67
- data: {
68
- estree: parse(value, { ecmaVersion: "latest", sourceType: "module" }),
69
- },
70
- });
71
- }
72
123
  };
73
124
  export default embed;
74
125
  //# sourceMappingURL=embed.js.map
package/dist/embed.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"embed.js","sourceRoot":"","sources":["../src/embed.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAG5B,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAE7B,OAAO,EACL,kBAAkB,EAClB,QAAQ,GAET,MAAM,qCAAqC,CAAA;AAE5C,mEAAmE;AACnE,MAAM,KAAK,GACT,CAAC,OAAO,GAAG,EAAE,EAAE,EAAE,CACjB,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;IACb,IAAI,QAAoC,CAAA;IACxC,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,IAAI,UAAU,GAAG,KAAK,CAAA;IACtB,8EAA8E;IAC9E,gFAAgF;IAChF,IAAI,YAAY,GAAG,IAAI;SACpB,QAAQ,CACP,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EACvB,IAAI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AQ,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,KAAM,EAAE,EAAE,KAAK,CAAC,CAAC,CAAA;gBACnE,IAAI,CAAC,MAAM;oBACT,MAAM,IAAI,KAAK,CACb,oCAAoC,EAAE,uBAAuB,CAC9D,CAAA;gBACH,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,CAA4B,CAAA;gBAChE,kBAAkB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;gBAC7B,OAAO,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAmB,CAAA;YACjD,CAAC;YACD,MAAM,CAAC,KAAK,CAAC,CAAA;YACb,OAAO,CAAC,KAAK,CAAC,CAAA;QAChB,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;IACD,MAAM,CAAC,IAA+B,CAAC,CAAA;AACzC,CAAC,CAAA;AACH,eAAe,KAAK,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"host-plugins.d.ts","sourceRoot":"","sources":["../src/host-plugins.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAItE,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,kBAAkB,EAAE,KAAK,CAAC,GAAG;IAChE;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B,CAAA;AA6BD,eAAO,MAAM,iBAAiB,GAC5B,SAAS,iBAAiB,YAAK,EAC/B,SAAS,MAAM,KACd,aAkCF,CAAA"}
1
+ {"version":3,"file":"host-plugins.d.ts","sourceRoot":"","sources":["../src/host-plugins.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAItE,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,kBAAkB,EAAE,KAAK,CAAC,GAAG;IAChE;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B,CAAA;AA+BD,eAAO,MAAM,iBAAiB,GAC5B,SAAS,iBAAiB,YAAK,EAC/B,SAAS,MAAM,KACd,aAkCF,CAAA"}
@@ -18,6 +18,8 @@ const KNOWN_KEYS = new Set([
18
18
  "headingMetadata",
19
19
  "badge",
20
20
  "tableColumnLayout",
21
+ "tableColumnWidths",
22
+ "ignoreDiagnostics",
21
23
  "transforms",
22
24
  "promoteHeadingIds",
23
25
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"host-plugins.js","sourceRoot":"","sources":["../src/host-plugins.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,YAAY,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,cAAc,EAA2B,MAAM,cAAc,CAAA;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAYnD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAS;IACjC,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,cAAc;IACd,YAAY;IACZ,YAAY;IACZ,eAAe;IACf,iBAAiB;IACjB,OAAO;IACP,mBAAmB;IACnB,YAAY;IACZ,mBAAmB;CACkB,CAAC,CAAA;AAExC,iFAAiF;AACjF,MAAM,gBAAgB,GAAG,CACvB,OAA2B,EACF,EAAE;IAC3B,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAA;IAC/C,IAAI,CAAC,eAAe,IAAI,eAAe,KAAK,IAAI;QAAE,OAAO,EAAE,CAAA;IAC3D,OAAO;QACL,UAAU,EAAE,eAAe,CAAC,MAAM,EAAE,IAAI;QACxC,WAAW,EAAE,eAAe,CAAC,MAAM,EAAE,WAAW;KACjD,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,UAA6B,EA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AAQ,CAAC,YAAY,CAAC;QAClE,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,QAAQ,CAAA;IACZ,MAAM,eAAe,GAAG;QACtB,GAAG,aAAa;QAChB,IAAI;QACJ,UAAU,EAAE,MAAe;QAC3B,GAAG,EAAE,KAAK;KACF,CAAA;IAEV,uEAAuE;IACvE,2EAA2E;IAC3E,mEAAmE;IACnE,cAAc,CAAC,eAAe,CAAC,CAAA;IAE/B,MAAM,OAAO,GAAkB,CAAC,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC,CAAA;IAEhE,oEAAoE;IACpE,IAAI,iBAAiB,EAAE,CAAC;QACtB,OAAO,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAA;IACnE,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * A bundler loader that ties every document to the prepared library it is
3
+ * compiled against.
4
+ *
5
+ * The embed plugin splices prepared blocks into a document while it compiles,
6
+ * so the compiled page holds the content of `embeds.json` at that moment. A
7
+ * bundler recompiles a page when the page's own input changes, and knows
8
+ * nothing about a file a remark plugin read; after `cudoc collect` it would
9
+ * keep serving the page it compiled from the previous library. This loader
10
+ * runs before the MDX loader and does three things. It declares `embeds.json`
11
+ * as a dependency of the module, which a dev server and webpack's persistent
12
+ * cache watch. It appends one line to the source — a link reference
13
+ * definition carrying the library's hash, which renders nothing in Markdown
14
+ * and in MDX alike — so the MDX loader's input, and therefore its output,
15
+ * changes whenever the library does; Turbopack caches by comparing outputs,
16
+ * and a loader that leaves the source untouched can never reach the compile
17
+ * downstream of it. And it carries a `fingerprint` of the library in its
18
+ * options, computed when the bundler configuration is evaluated, which is
19
+ * what makes Turbopack's persistent build cache run this loader again at all
20
+ * between two builds. The embed plugin strips the marker before comparing
21
+ * the source with the library's snapshot.
22
+ */
23
+ export type LibraryLoaderOptions = {
24
+ /** The prepared library the embed plugin reads. Defaults to `.cudoc/documents`. */
25
+ outDir?: string;
26
+ /**
27
+ * A value that changes whenever the prepared library does. Read by nothing
28
+ * at compile time; its presence in the loader options is what invalidates a
29
+ * cache entry keyed on them.
30
+ */
31
+ fingerprint?: string;
32
+ };
33
+ /** The loader module's specifier, as a bundler resolves it. */
34
+ export declare const LIBRARY_LOADER = "cudoc-remark/loader";
35
+ /** The label of the reference definition the loader appends. */
36
+ export declare const LIBRARY_MARKER_LABEL = "cudoc-library";
37
+ /** The source as the author wrote it, without the loader's marker line. */
38
+ export declare const stripLibraryMarker: (source: string) => string;
39
+ /**
40
+ * A hash of the prepared embeds, or `""` before the library exists. Reads
41
+ * the file once per change, keyed on its size and modification time.
42
+ */
43
+ export declare function libraryFingerprint(outDir?: string): string;
44
+ /** The rule entry for webpack's `use` and Turbopack's `loaders`, as plain JSON. */
45
+ export declare function libraryLoader(outDir?: string): {
46
+ loader: string;
47
+ options: Required<LibraryLoaderOptions>;
48
+ };
49
+ type LoaderContext = {
50
+ getOptions?: () => LibraryLoaderOptions | undefined;
51
+ rootContext?: string;
52
+ addDependency: (file: string) => void;
53
+ };
54
+ export default function cudocLibraryLoader(this: LoaderContext, source: string | Buffer): string;
55
+ export {};
56
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH,MAAM,MAAM,oBAAoB,GAAG;IACjC,mFAAmF;IACnF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,+DAA+D;AAC/D,eAAO,MAAM,cAAc,wBAAwB,CAAA;AAEnD,gEAAgE;AAChE,eAAO,MAAM,oBAAoB,kBAAkB,CAAA;AAKnD,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB,GAAI,QAAQ,MAAM,KAAG,MACxB,CAAA;AAI5B;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,SAAqB,GAAG,MAAM,CAatE;AAED,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,MAAM,SAAqB,GAAG;IAC1D,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAA;CACxC,CAKA;AAED,KAAK,aAAa,GAAG;IACnB,UAAU,CAAC,EAAE,MAAM,oBAAoB,GAAG,SAAS,CAAA;IACnD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CACtC,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,MAAM,GAAG,MAAM,GACtB,MAAM,CASR"}
package/dist/loader.js ADDED
@@ -0,0 +1,69 @@
1
+ /**
2
+ * A bundler loader that ties every document to the prepared library it is
3
+ * compiled against.
4
+ *
5
+ * The embed plugin splices prepared blocks into a document while it compiles,
6
+ * so the compiled page holds the content of `embeds.json` at that moment. A
7
+ * bundler recompiles a page when the page's own input changes, and knows
8
+ * nothing about a file a remark plugin read; after `cudoc collect` it would
9
+ * keep serving the page it compiled from the previous library. This loader
10
+ * runs before the MDX loader and does three things. It declares `embeds.json`
11
+ * as a dependency of the module, which a dev server and webpack's persistent
12
+ * cache watch. It appends one line to the source — a link reference
13
+ * definition carrying the library's hash, which renders nothing in Markdown
14
+ * and in MDX alike — so the MDX loader's input, and therefore its output,
15
+ * changes whenever the library does; Turbopack caches by comparing outputs,
16
+ * and a loader that leaves the source untouched can never reach the compile
17
+ * downstream of it. And it carries a `fingerprint` of the library in its
18
+ * options, computed when the bundler configuration is evaluated, which is
19
+ * what makes Turbopack's persistent build cache run this loader again at all
20
+ * between two builds. The embed plugin strips the marker before comparing
21
+ * the source with the library's snapshot.
22
+ */
23
+ import crypto from "node:crypto";
24
+ import fs from "node:fs";
25
+ import path from "node:path";
26
+ /** The loader module's specifier, as a bundler resolves it. */
27
+ export const LIBRARY_LOADER = "cudoc-remark/loader";
28
+ /** The label of the reference definition the loader appends. */
29
+ export const LIBRARY_MARKER_LABEL = "cudoc-library";
30
+ /** Exactly what the loader appends, so removing it gives the file back byte for byte. */
31
+ const MARKER = /\n\n\[cudoc-library\]: #[0-9a-f]*\n$/;
32
+ /** The source as the author wrote it, without the loader's marker line. */
33
+ export const stripLibraryMarker = (source) => source.replace(MARKER, "");
34
+ const cache = new Map();
35
+ /**
36
+ * A hash of the prepared embeds, or `""` before the library exists. Reads
37
+ * the file once per change, keyed on its size and modification time.
38
+ */
39
+ export function libraryFingerprint(outDir = ".cudoc/documents") {
40
+ const file = path.resolve(outDir, "embeds.json");
41
+ if (!fs.existsSync(file))
42
+ return "";
43
+ const stat = fs.statSync(file);
44
+ const key = `${stat.size}:${stat.mtimeMs}`;
45
+ const cached = cache.get(file);
46
+ if (cached?.key === key)
47
+ return cached.hash;
48
+ const hash = crypto
49
+ .createHash("sha256")
50
+ .update(fs.readFileSync(file))
51
+ .digest("hex");
52
+ cache.set(file, { key, hash });
53
+ return hash;
54
+ }
55
+ /** The rule entry for webpack's `use` and Turbopack's `loaders`, as plain JSON. */
56
+ export function libraryLoader(outDir = ".cudoc/documents") {
57
+ return {
58
+ loader: LIBRARY_LOADER,
59
+ options: { outDir, fingerprint: libraryFingerprint(outDir) },
60
+ };
61
+ }
62
+ export default function cudocLibraryLoader(source) {
63
+ const options = this.getOptions?.() ?? {};
64
+ const outDir = path.resolve(this.rootContext ?? process.cwd(), options.outDir ?? ".cudoc/documents");
65
+ this.addDependency(path.join(outDir, "embeds.json"));
66
+ const text = typeof source === "string" ? source : source.toString("utf8");
67
+ return `${stripLibraryMarker(text)}\n\n[${LIBRARY_MARKER_LABEL}]: #${libraryFingerprint(outDir)}\n`;
68
+ }
69
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":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MAAM,CAAC,KAAK,CAAC,CAAA;IAChB,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAA;IAC9B,OAAO,IAAI,CAAA;AACb,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,aAAa,CAAC,MAAM,GAAG,kBAAkB;IAIvD,OAAO;QACL,MAAM,EAAE,cAAc;QACtB,OAAO,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,CAAC,MAAM,CAAC,EAAE;KAC7D,CAAA;AACH,CAAC;AAQD,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAExC,MAAuB;IAEvB,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAA;IACzC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CACzB,IAAI,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,EACjC,OAAO,CAAC,MAAM,IAAI,kBAAkB,CACrC,CAAA;IACD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAA;IACpD,MAAM,IAAI,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC1E,OAAO,GAAG,kBAAkB,CAAC,IAAI,CAAC,QAAQ,oBAAoB,OAAO,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAA;AACrG,CAAC"}
package/dist/options.d.ts CHANGED
@@ -11,7 +11,7 @@
11
11
  */
12
12
  import { type HeadingMetadataOptions, type ResolvedHeadingMetadataOptions, type Transform, type TransformState } from "@cudoment/cudoc";
13
13
  import { type BadgeOptions, type ResolvedBadgeOptions } from "./transforms/badge.js";
14
- import { type ResolvedTableColumnLayoutOptions, type TableColumnLayoutOptions } from "./transforms/table-column-layout/index.js";
14
+ import { type ResolvedTableColumnLayoutOptions, type ResolvedTableColumnWidthOptions, type TableColumnLayoutOptions, type TableColumnWidthOptions } from "./transforms/table-column-layout/index.js";
15
15
  import { type ResolvedTocOptions, type TocOptions } from "./toc.js";
16
16
  import type { Toc } from "./toc.js";
17
17
  import { type DocumentOptions } from "@cudoment/cudoc/document";
@@ -20,7 +20,7 @@ export type CudocState = TransformState & {
20
20
  };
21
21
  /** A feature is off when `false`, on with defaults when `true` or omitted. */
22
22
  export type FeatureOption<Options> = boolean | Options | undefined;
23
- export type CudocRemarkOptions = Pick<DocumentOptions, "syntax" | "host" | "format" | "calloutTypes" | "components" | "headingIds"> & {
23
+ export type CudocRemarkOptions = Pick<DocumentOptions, "syntax" | "host" | "format" | "calloutTypes" | "components" | "headingIds" | "ignoreDiagnostics"> & {
24
24
  /** List syntax inside table cells. */
25
25
  tableCellList?: boolean;
26
26
  /** Anchor id and badge written in a heading. */
@@ -31,6 +31,8 @@ export type CudocRemarkOptions = Pick<DocumentOptions, "syntax" | "host" | "form
31
31
  toc?: FeatureOption<TocOptions>;
32
32
  /** Column layout rules, applied in order. Empty by default. */
33
33
  tableColumnLayout?: TableColumnLayoutOptions[];
34
+ /** Minimum column widths by header text, applied before the layout rules. */
35
+ tableColumnWidths?: TableColumnWidthOptions[];
34
36
  /** Extra transforms, run alongside the built-in ones. */
35
37
  transforms?: {
36
38
  pre?: Transform<CudocState>[];
@@ -43,6 +45,7 @@ export type ResolvedCudocRemarkOptions = {
43
45
  badge: ResolvedBadgeOptions | null;
44
46
  toc: ResolvedTocOptions | null;
45
47
  tableColumnLayout: ResolvedTableColumnLayoutOptions[];
48
+ tableColumnWidths: ResolvedTableColumnWidthOptions[];
46
49
  transforms: {
47
50
  pre: Transform<CudocState>[];
48
51
  post: Transform<CudocState>[];
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAEL,KAAK,sBAAs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options.js CHANGED
@@ -11,7 +11,7 @@
11
11
  */
12
12
  import { resolveHeadingMetadataOptions, } from "@cudoment/cudoc";
13
13
  import { resolveBadgeOptions, } from "./transforms/badge.js";
14
- import { resolveTableColumnLayoutOptions, } from "./transforms/table-column-layout/index.js";
14
+ import { resolveTableColumnLayoutOptions, resolveTableColumnWidthOptions, } from "./transforms/table-column-layout/index.js";
15
15
  import { resolveTocOptions, } from "./toc.js";
16
16
  import { resolveSyntax } from "@cudoment/cudoc/document";
17
17
  const KNOWN_KEYS = new Set([
@@ -26,6 +26,8 @@ const KNOWN_KEYS = new Set([
26
26
  "badge",
27
27
  "toc",
28
28
  "tableColumnLayout",
29
+ "tableColumnWidths",
30
+ "ignoreDiagnostics",
29
31
  "transforms",
30
32
  ]);
31
33
  const assertKnownKeys = (options) => {
@@ -69,6 +71,10 @@ export const resolveOptions = (options = {}) => {
69
71
  !Array.isArray(options.tableColumnLayout)) {
70
72
  throw new TypeError("tableColumnLayout must be an array of rules");
71
73
  }
74
+ if (options.tableColumnWidths !== undefined &&
75
+ !Array.isArray(options.tableColumnWidths)) {
76
+ throw new TypeError("tableColumnWidths must be an array of rules");
77
+ }
72
78
  return {
73
79
  tableCellList: options.tableCellList !== false,
74
80
  headingMetadata: resolveFeature(options.headingMetadata, resolveHeadingMetadataOptions),
@@ -79,6 +85,7 @@ export const resolveOptions = (options = {}) => {
79
85
  ? null
80
86
  : resolveFeature(options.toc, resolveTocOptions),
81
87
  tableColumnLayout: (options.tableColumnLayout ?? []).map((rule, index) => resolveTableColumnLayoutOptions(rule, `tableColumnLayout[${index}]`)),
88
+ tableColumnWidths: (options.tableColumnWidths ?? []).map((rule, index) => resolveTableColumnWidthOptions(rule, `tableColumnWidths[${index}]`)),
82
89
  transforms: {
83
90
  pre: options.transforms?.pre ?? [],
84
91
  post: options.transforms?.post ?? [],
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;;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AAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACvE,8BAA8B,CAAC,IAAI,EAAE,qBAAqB,KAAK,GAAG,CAAC,CACpE;QACD,UAAU,EAAE;YACV,GAAG,EAAE,OAAO,CAAC,UAAU,EAAE,GAAG,IAAI,EAAE;YAClC,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,IAAI,IAAI,EAAE;SACrC;KACF,CAAA;AACH,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../src/prepare.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC9E,OAAO,EACL,cAAc,EACd,KAAK,kBAAkB,EACvB,KAAK,UAAU,EAChB,MAAM,cAAc,CAAA;AASrB;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,KAAK,KAAG,MAAM,GAAG,IAIpD,CAAA;AAED,eAAO,MAAM,eAAe,GAC1B,SAAS,UAAU,CAAC,OAAO,cAAc,CAAC,KACzC;IAAE,GAAG,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,CAAA;CA+B/D,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,CAAC,kBAAkB,CAAC,CAAC,EAAE,IAAI,CA0DrD,CAAA;AAED,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../src/prepare.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC9E,OAAO,EACL,cAAc,EACd,KAAK,kBAAkB,EACvB,KAAK,UAAU,EAChB,MAAM,cAAc,CAAA;AAYrB;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,KAAK,KAAG,MAAM,GAAG,IAIpD,CAAA;AAED,eAAO,MAAM,eAAe,GAC1B,SAAS,UAAU,CAAC,OAAO,cAAc,CAAC,KACzC;IAAE,GAAG,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,CAAA;CAsC/D,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,CAAC,kBAAkB,CAAC,CAAC,EAAE,IAAI,CA0DrD,CAAA;AAED,eAAe,YAAY,CAAA"}
package/dist/prepare.js CHANGED
@@ -9,7 +9,7 @@
9
9
  import { transformHeadingAnchor, walk } from "@cudoment/cudoc";
10
10
  import { resolveOptions, } from "./options.js";
11
11
  import { createBadgeTransform } from "./transforms/badge.js";
12
- import { createTableColumnLayoutTransform } from "./transforms/table-column-layout/index.js";
12
+ import { createTableColumnLayoutTransform, createTableColumnWidthTransform, } from "./transforms/table-column-layout/index.js";
13
13
  import { transformTableCellList } from "./transforms/table-cell-list/index.js";
14
14
  import { addTocExport, collectHeadingToc, createToc } from "./toc.js";
15
15
  import remarkDirective from "remark-directive";
@@ -51,7 +51,12 @@ export const buildTransforms = (options) => {
51
51
  if (options.badge)
52
52
  pre.push(createBadgeTransform(options.badge));
53
53
  pre.push(...options.transforms.pre);
54
- const post = options.tableColumnLayout.map((rule) => createTableColumnLayoutTransform(rule));
54
+ // Widths before layout: a layout rule rebuilds the header cells it matches
55
+ // and carries their style with it.
56
+ const post = [
57
+ ...options.tableColumnWidths.map((rule) => createTableColumnWidthTransform(rule)),
58
+ ...options.tableColumnLayout.map((rule) => createTableColumnLayoutTransform(rule)),
59
+ ];
55
60
  post.push(...options.transforms.post);
56
61
  return { pre, post };
57
62
  };
@@ -1 +1 @@
1
- {"version":3,"file":"prepare.js","sourceRoot":"","sources":["../src/prepare.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,EAAE,sBAAsB,EAAE,IAAI,EAAkB,MAAM,iBAAiB,CAAA;AAC9E,OAAO,EACL,cAAc,GAGf,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,gCAAgC,EAAE,MAAM,2CAA2C,CAAA;AAC5F,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,eAAe,MAAM,kBAAkB,CAAA;AAC9C,OAAO,iBAAiB,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAW,EAAiB,EAAE;IAC1D,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,KAAK,CAAA;IACrD,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAA;IAC/D,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,OAA0C,EACuB,EAAE;IACnE,MAAM,GAAG,GAA4B,EAAE,CAAA;IAEvC,wEAAwE;IACxE,WAAW;IACX,IAAI,OAAO,CAAC,aAAa;QAAE,GAAG,CAAC,IAAI,CAAC,sBAAsB,CAAC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AI,QAAQ,CAAC,GAAG,EAAE,CAAC;gBACjB,MAAM,GAAG,GAAG,SAAS,EAAE,CAAA;gBACvB,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ;oBACjC,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS;wBAC5B,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAA;gBACjD,IAAI,MAAM,KAAK,IAAI;oBAAE,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAA;YAC5D,CAAC;YACD,OAAM;QACR,CAAC;QACD,MAAM,KAAK,GAAe;YACxB,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC;YAC3B,GAAG,EAAE,SAAS,EAAE;SACjB,CAAA;QAED,IAAI,CAAC;YACH,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,GAAG;YAClB,KAAK;YACL,IAAI;SACL,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,GAAG;YAAE,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAA;IAC/D,CAAC,CAAA;AACH,CAAC,CAAA;AAED,eAAe,YAAY,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cudoc-remark",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Remark plugin for cudoc: heading anchors, badges, table cell lists and table column layout, each configurable.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -8,7 +8,7 @@
8
8
  "url": "git+https://github.com/cudoment/cudoc.git",
9
9
  "directory": "packages/cudoc-remark"
10
10
  },
11
- "homepage": "https://github.com/cudoment/cudoc/tree/main/packages/cudoc-remark#readme",
11
+ "homepage": "https://github.com/cudoment/cudoc#readme",
12
12
  "bugs": {
13
13
  "url": "https://github.com/cudoment/cudoc/issues"
14
14
  },
@@ -64,9 +64,9 @@
64
64
  "types": "./dist/embed.d.ts",
65
65
  "default": "./dist/embed.js"
66
66
  },
67
- "./runtime": {
68
- "types": "./dist/runtime.d.ts",
69
- "default": "./dist/runtime.js"
67
+ "./loader": {
68
+ "types": "./dist/loader.d.ts",
69
+ "default": "./dist/loader.js"
70
70
  }
71
71
  },
72
72
  "files": [
@@ -82,7 +82,7 @@
82
82
  "clean": "rm -rf dist *.tsbuildinfo"
83
83
  },
84
84
  "dependencies": {
85
- "@cudoment/cudoc": "0.3.0",
85
+ "@cudoment/cudoc": "0.5.0",
86
86
  "estree-util-value-to-estree": "^3.5.0",
87
87
  "mdast-util-mdx-jsx": "^3.2.0",
88
88
  "remark-gfm": "^4.0.1",
@@ -92,6 +92,7 @@
92
92
  "unist-util-visit": "^5.0.0",
93
93
  "remark-directive": "^4.0.0",
94
94
  "acorn": "^8.15.0",
95
+ "acorn-jsx": "^5.3.2",
95
96
  "remark-frontmatter": "^5.0.0"
96
97
  },
97
98
  "peerDependencies": {
package/dist/runtime.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import type { Root } from "mdast";
2
- /** Automatically imported by the embed plugin; authors never register this component. */
3
- export declare function EmbeddedDocument({ tree }: {
4
- tree: Root;
5
- }): import("react").DetailedReactHTMLElement<{
6
- className: string;
7
- dangerouslySetInnerHTML: {
8
- __html: string;
9
- };
10
- }, HTMLElement>;
11
- //# sourceMappingURL=runtime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAGjC,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE;;;;;gBAOxD"}
package/dist/runtime.js DELETED
@@ -1,12 +0,0 @@
1
- import { createElement } from "react";
2
- import { renderDocument } from "@cudoment/cudoc/render";
3
- /** Automatically imported by the embed plugin; authors never register this component. */
4
- export function EmbeddedDocument({ tree }) {
5
- if (!tree)
6
- throw new Error("cudoc: prepared embed missing; recollect documents");
7
- return createElement("div", {
8
- className: "cudoc-embed",
9
- dangerouslySetInnerHTML: { __html: renderDocument(tree) },
10
- });
11
- }
12
- //# sourceMappingURL=runtime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAEvD,yFAAyF;AACzF,MAAM,UAAU,gBAAgB,CAAC,EAAE,IAAI,EAAkB;IACvD,IAAI,CAAC,IAAI;QACP,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;IACvE,OAAO,aAAa,CAAC,KAAK,EAAE;QAC1B,SAAS,EAAE,aAAa;QACxB,uBAAuB,EAAE,EAAE,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE;KAC1D,CAAC,CAAA;AACJ,CAAC"}