cudoc-remark 0.4.0 → 0.6.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 +5 -3
- package/dist/capture.d.ts +23 -2
- package/dist/capture.d.ts.map +1 -1
- package/dist/capture.js +55 -3
- package/dist/capture.js.map +1 -1
- package/dist/embed.d.ts +37 -3
- package/dist/embed.d.ts.map +1 -1
- package/dist/embed.js +101 -69
- package/dist/embed.js.map +1 -1
- package/dist/host-plugins.d.ts +7 -2
- package/dist/host-plugins.d.ts.map +1 -1
- package/dist/host-plugins.js +49 -6
- package/dist/host-plugins.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +56 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +69 -0
- package/dist/loader.js.map +1 -0
- package/dist/options.d.ts +5 -2
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +8 -1
- package/dist/options.js.map +1 -1
- package/dist/prepare.d.ts.map +1 -1
- package/dist/prepare.js +13 -2
- package/dist/prepare.js.map +1 -1
- package/dist/transforms/table-cell-list/index.d.ts +1 -1
- package/dist/transforms/table-cell-list/index.d.ts.map +1 -1
- package/dist/transforms/table-cell-list/index.js +3 -2
- package/dist/transforms/table-cell-list/index.js.map +1 -1
- package/dist/transforms/table-column-layout/index.d.ts +1 -1
- package/dist/transforms/table-column-layout/index.d.ts.map +1 -1
- package/dist/transforms/table-column-layout/index.js +3 -2
- package/dist/transforms/table-column-layout/index.js.map +1 -1
- package/package.json +13 -16
- package/dist/runtime.d.ts +0 -11
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js +0 -12
- package/dist/runtime.js.map +0 -1
- package/dist/transforms/table-cell-list/build-table-cell-children.d.ts +0 -2
- package/dist/transforms/table-cell-list/build-table-cell-children.d.ts.map +0 -1
- package/dist/transforms/table-cell-list/build-table-cell-children.js +0 -3
- package/dist/transforms/table-cell-list/build-table-cell-children.js.map +0 -1
- package/dist/transforms/table-cell-list/elements.d.ts +0 -2
- package/dist/transforms/table-cell-list/elements.d.ts.map +0 -1
- package/dist/transforms/table-cell-list/elements.js +0 -3
- package/dist/transforms/table-cell-list/elements.js.map +0 -1
- package/dist/transforms/table-cell-list/nodes.d.ts +0 -2
- package/dist/transforms/table-cell-list/nodes.d.ts.map +0 -1
- package/dist/transforms/table-cell-list/nodes.js +0 -3
- package/dist/transforms/table-cell-list/nodes.js.map +0 -1
- package/dist/transforms/table-cell-list/parse-inline-markdown.d.ts +0 -2
- package/dist/transforms/table-cell-list/parse-inline-markdown.d.ts.map +0 -1
- package/dist/transforms/table-cell-list/parse-inline-markdown.js +0 -3
- package/dist/transforms/table-cell-list/parse-inline-markdown.js.map +0 -1
- package/dist/transforms/table-cell-list/parse-table-cell-list.d.ts +0 -2
- package/dist/transforms/table-cell-list/parse-table-cell-list.d.ts.map +0 -1
- package/dist/transforms/table-cell-list/parse-table-cell-list.js +0 -3
- package/dist/transforms/table-cell-list/parse-table-cell-list.js.map +0 -1
- package/dist/transforms/table-column-layout/create-table.d.ts +0 -2
- package/dist/transforms/table-column-layout/create-table.d.ts.map +0 -1
- package/dist/transforms/table-column-layout/create-table.js +0 -3
- package/dist/transforms/table-column-layout/create-table.js.map +0 -1
- package/dist/transforms/table-column-layout/split-cell.d.ts +0 -2
- package/dist/transforms/table-column-layout/split-cell.d.ts.map +0 -1
- package/dist/transforms/table-column-layout/split-cell.js +0 -3
- package/dist/transforms/table-column-layout/split-cell.js.map +0 -1
package/dist/loader.d.ts
ADDED
|
@@ -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":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAa5B,+DAA+D;AAC/D,MAAM,CAAC,MAAM,cAAc,GAAG,qBAAqB,CAAA;AAEnD,gEAAgE;AAChE,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAA;AAEnD,yFAAyF;AACzF,MAAM,MAAM,GAAG,sCAAsC,CAAA;AAErD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAc,EAAU,EAAE,CAC3D,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AAE5B,MAAM,KAAK,GAAG,IAAI,GAAG,EAAyC,CAAA;AAE9D;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAM,GAAG,kBAAkB;IAC5D,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IAChD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAA;IACnC,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC9B,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,CAAA;IAC1C,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAC9B,IAAI,MAAM,EAA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
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>[];
|
package/dist/options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,8BAA8B,EACnC,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,8BAA8B,EACnC,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAGL,KAAK,gCAAgC,EACrC,KAAK,+BAA+B,EACpC,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC7B,MAAM,2CAA2C,CAAA;AAClD,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,UAAU,EAChB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAA;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E,CAAA;QAC5B,IAAI,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,CAAA;KAC9B,CAAA;CACF,CAAA;AA6CD,eAAO,MAAM,cAAc,GACzB,UAAS,kBAAuB,KAC/B,0BAyDF,CAAA"}
|
package/dist/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 ?? [],
|
package/dist/options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,6BAA6B,GAK9B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,mBAAmB,GAGpB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,+BAA+B,
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,6BAA6B,GAK9B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,mBAAmB,GAGpB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,+BAA+B,EAC/B,8BAA8B,GAK/B,MAAM,2CAA2C,CAAA;AAClD,OAAO,EACL,iBAAiB,GAGlB,MAAM,UAAU,CAAA;AAEjB,OAAO,EAAE,aAAa,EAAwB,MAAM,0BAA0B,CAAA;AAmD9E,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IACzB,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,cAAc;IACd,YAAY;IACZ,YAAY;IACZ,eAAe;IACf,iBAAiB;IACjB,OAAO;IACP,KAAK;IACL,mBAAmB;IACnB,mBAAmB;IACnB,mBAAmB;IACnB,YAAY;CACb,CAAC,CAAA;AAEF,MAAM,eAAe,GAAG,CAAC,OAAe,EAAE,EA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iBAAiB,EAAE,CAAC,OAAO,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,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"}
|
package/dist/prepare.d.ts.map
CHANGED
|
@@ -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;
|
|
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;AAerB;;;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,CAiErD,CAAA;AAED,eAAe,YAAY,CAAA"}
|
package/dist/prepare.js
CHANGED
|
@@ -9,12 +9,14 @@
|
|
|
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";
|
|
16
16
|
import remarkFrontmatter from "remark-frontmatter";
|
|
17
17
|
import { normalizeDocument } from "@cudoment/cudoc/document";
|
|
18
|
+
/** The label of the definition `cudoc-remark/loader` appends; see `loader.ts`. */
|
|
19
|
+
const LIBRARY_MARKER_LABEL = "cudoc-library";
|
|
18
20
|
/**
|
|
19
21
|
* The source text is needed to read list syntax out of table cells, which mdast
|
|
20
22
|
* does not preserve. Without it that transform leaves cells untouched.
|
|
@@ -51,7 +53,12 @@ export const buildTransforms = (options) => {
|
|
|
51
53
|
if (options.badge)
|
|
52
54
|
pre.push(createBadgeTransform(options.badge));
|
|
53
55
|
pre.push(...options.transforms.pre);
|
|
54
|
-
|
|
56
|
+
// Widths before layout: a layout rule rebuilds the header cells it matches
|
|
57
|
+
// and carries their style with it.
|
|
58
|
+
const post = [
|
|
59
|
+
...options.tableColumnWidths.map((rule) => createTableColumnWidthTransform(rule)),
|
|
60
|
+
...options.tableColumnLayout.map((rule) => createTableColumnLayoutTransform(rule)),
|
|
61
|
+
];
|
|
55
62
|
post.push(...options.transforms.post);
|
|
56
63
|
return { pre, post };
|
|
57
64
|
};
|
|
@@ -67,6 +74,10 @@ const cudocPrepare = function (options = {}) {
|
|
|
67
74
|
this.use(remarkDirective);
|
|
68
75
|
const { pre, post } = buildTransforms(resolved);
|
|
69
76
|
return function (tree, file) {
|
|
77
|
+
// The line `cudoc-remark/loader` appends only has to change the compiled
|
|
78
|
+
// input; kept in the tree it would travel into every exported AST and
|
|
79
|
+
// change it with each collection.
|
|
80
|
+
tree.children = tree.children.filter((node) => node.type !== "definition" || node.identifier !== LIBRARY_MARKER_LABEL);
|
|
70
81
|
const format = options.format ?? (file.extname === ".md" ? "md" : "mdx");
|
|
71
82
|
if (portable || format === "md") {
|
|
72
83
|
tree.children = tree.children.filter((node) => node.type !== "yaml");
|
package/dist/prepare.js.map
CHANGED
|
@@ -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,
|
|
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,EA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1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transforms/table-cell-list/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transforms/table-cell-list/index.ts"],"names":[],"mappings":"AAEA,cAAc,4CAA4C,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
1
|
+
// The `cudoc-remark/table-cell-list` entry. The transform lives in the core, where
|
|
2
|
+
// every host shares it.
|
|
3
|
+
export * from "@cudoment/cudoc/transforms/table-cell-list";
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transforms/table-cell-list/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transforms/table-cell-list/index.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,wBAAwB;AACxB,cAAc,4CAA4C,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "@cudoment/cudoc/transforms/table-column-layout
|
|
1
|
+
export * from "@cudoment/cudoc/transforms/table-column-layout";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transforms/table-column-layout/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transforms/table-column-layout/index.ts"],"names":[],"mappings":"AAEA,cAAc,gDAAgD,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
1
|
+
// The `cudoc-remark/table-column-layout` entry. The transform lives in the core, where
|
|
2
|
+
// every host shares it.
|
|
3
|
+
export * from "@cudoment/cudoc/transforms/table-column-layout";
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transforms/table-column-layout/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transforms/table-column-layout/index.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,wBAAwB;AACxB,cAAc,gDAAgD,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cudoc-remark",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Remark
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Remark plugins for cudoc: syntax normalization, heading anchors, badges, callouts, table cell lists and layout, prepared embeds and the library loader.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
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
|
|
11
|
+
"homepage": "https://github.com/cudoment/cudoc#readme",
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/cudoment/cudoc/issues"
|
|
14
14
|
},
|
|
@@ -64,10 +64,11 @@
|
|
|
64
64
|
"types": "./dist/embed.d.ts",
|
|
65
65
|
"default": "./dist/embed.js"
|
|
66
66
|
},
|
|
67
|
-
"./
|
|
68
|
-
"types": "./dist/
|
|
69
|
-
"default": "./dist/
|
|
70
|
-
}
|
|
67
|
+
"./loader": {
|
|
68
|
+
"types": "./dist/loader.d.ts",
|
|
69
|
+
"default": "./dist/loader.js"
|
|
70
|
+
},
|
|
71
|
+
"./package.json": "./package.json"
|
|
71
72
|
},
|
|
72
73
|
"files": [
|
|
73
74
|
"dist",
|
|
@@ -82,26 +83,22 @@
|
|
|
82
83
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
83
84
|
},
|
|
84
85
|
"dependencies": {
|
|
85
|
-
"@
|
|
86
|
+
"@types/mdast": "^4.0.4",
|
|
87
|
+
"@cudoment/cudoc": "0.6.0",
|
|
86
88
|
"estree-util-value-to-estree": "^3.5.0",
|
|
87
89
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
88
|
-
"remark-gfm": "^4.0.1",
|
|
89
|
-
"remark-mdx": "^3.1.0",
|
|
90
|
-
"remark-parse": "^11.0.0",
|
|
91
90
|
"unified": "^11.0.5",
|
|
92
91
|
"unist-util-visit": "^5.0.0",
|
|
93
92
|
"remark-directive": "^4.0.0",
|
|
94
93
|
"acorn": "^8.15.0",
|
|
95
|
-
"
|
|
94
|
+
"acorn-jsx": "^5.3.2",
|
|
95
|
+
"remark-frontmatter": "^5.0.0",
|
|
96
|
+
"vfile": "^6.0.3"
|
|
96
97
|
},
|
|
97
98
|
"peerDependencies": {
|
|
98
|
-
"@types/mdast": "^4.0.4",
|
|
99
99
|
"react": "^18.0.0 || ^19.0.0"
|
|
100
100
|
},
|
|
101
101
|
"peerDependenciesMeta": {
|
|
102
|
-
"@types/mdast": {
|
|
103
|
-
"optional": true
|
|
104
|
-
},
|
|
105
102
|
"react": {
|
|
106
103
|
"optional": true
|
|
107
104
|
}
|
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
|
package/dist/runtime.d.ts.map
DELETED
|
@@ -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
|
package/dist/runtime.js.map
DELETED
|
@@ -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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-table-cell-children.d.ts","sourceRoot":"","sources":["../../../src/transforms/table-cell-list/build-table-cell-children.ts"],"names":[],"mappings":"AACA,cAAc,sEAAsE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-table-cell-children.js","sourceRoot":"","sources":["../../../src/transforms/table-cell-list/build-table-cell-children.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,cAAc,sEAAsE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../../src/transforms/table-cell-list/elements.ts"],"names":[],"mappings":"AACA,cAAc,qDAAqD,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../src/transforms/table-cell-list/elements.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,cAAc,qDAAqD,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../../src/transforms/table-cell-list/nodes.ts"],"names":[],"mappings":"AACA,cAAc,kDAAkD,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../../src/transforms/table-cell-list/nodes.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,cAAc,kDAAkD,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse-inline-markdown.d.ts","sourceRoot":"","sources":["../../../src/transforms/table-cell-list/parse-inline-markdown.ts"],"names":[],"mappings":"AACA,cAAc,kEAAkE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse-inline-markdown.js","sourceRoot":"","sources":["../../../src/transforms/table-cell-list/parse-inline-markdown.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,cAAc,kEAAkE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse-table-cell-list.d.ts","sourceRoot":"","sources":["../../../src/transforms/table-cell-list/parse-table-cell-list.ts"],"names":[],"mappings":"AACA,cAAc,kEAAkE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse-table-cell-list.js","sourceRoot":"","sources":["../../../src/transforms/table-cell-list/parse-table-cell-list.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,cAAc,kEAAkE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-table.d.ts","sourceRoot":"","sources":["../../../src/transforms/table-column-layout/create-table.ts"],"names":[],"mappings":"AACA,cAAc,6DAA6D,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-table.js","sourceRoot":"","sources":["../../../src/transforms/table-column-layout/create-table.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,cAAc,6DAA6D,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"split-cell.d.ts","sourceRoot":"","sources":["../../../src/transforms/table-column-layout/split-cell.ts"],"names":[],"mappings":"AACA,cAAc,2DAA2D,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"split-cell.js","sourceRoot":"","sources":["../../../src/transforms/table-column-layout/split-cell.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,cAAc,2DAA2D,CAAA"}
|