@ox-content/unplugin 3.0.0-beta.9 → 3.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/dist/esbuild.d.mts +1 -1
- package/dist/index.d.mts +72 -2
- package/dist/index2.d.mts +1 -1
- package/dist/rollup.d.mts +1 -1
- package/dist/rspack.d.mts +1 -1
- package/dist/src.mjs +123 -25
- package/dist/vite.d.mts +1 -1
- package/dist/webpack.d.mts +1 -1
- package/package.json +2 -2
package/dist/esbuild.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ResolvedDocsConfig, D as UnifiedPreset, E as TransformResult, S as RemarkPlugin, T as TocEntry, _ as OxContentMdastPlugin, a as
|
|
1
|
+
import { C as ResolvedDocsConfig, D as UnifiedPreset, E as TransformResult, S as RemarkPlugin, T as TocEntry, _ as OxContentMdastPlugin, a as oxContentMdast, b as PluginConfig, c as OxContentMdastOptions, d as MarkdownItPlugin, f as MdastNode, g as MdastTransformer, h as MdastRoot, i as extractTocFromMdast, l as transformMarkdown, m as MdastPluginContext, n as createMdastPluginContext, o as parseMarkdownToMdast, p as MdastPlugin, r as defineMdastPlugin, s as toUnifiedMdastPlugin, t as unplugin, u as DocsConfig, v as OxContentOptions, w as ResolvedOptions, x as RehypePlugin, y as OxContentPlugin } from "./index.mjs";
|
|
2
2
|
//#region src/esbuild.d.ts
|
|
3
3
|
declare const _default: (options?: OxContentOptions | undefined) => import("unplugin").EsbuildPlugin;
|
|
4
4
|
//#endregion
|
package/dist/index.d.mts
CHANGED
|
@@ -46,6 +46,7 @@ interface MdastNode {
|
|
|
46
46
|
align?: Array<"left" | "center" | "right" | null>;
|
|
47
47
|
identifier?: string;
|
|
48
48
|
label?: string;
|
|
49
|
+
data?: Record<string, unknown>;
|
|
49
50
|
[key: string]: unknown;
|
|
50
51
|
}
|
|
51
52
|
/**
|
|
@@ -310,6 +311,26 @@ interface OxContentOptions {
|
|
|
310
311
|
* @default true
|
|
311
312
|
*/
|
|
312
313
|
strikethrough?: boolean;
|
|
314
|
+
/**
|
|
315
|
+
* Enable `^text^` superscript spans.
|
|
316
|
+
* @default false
|
|
317
|
+
*/
|
|
318
|
+
superscript?: boolean;
|
|
319
|
+
/**
|
|
320
|
+
* Enable `~text~` subscript spans.
|
|
321
|
+
* @default false
|
|
322
|
+
*/
|
|
323
|
+
subscript?: boolean;
|
|
324
|
+
/**
|
|
325
|
+
* Enable smart punctuation replacement.
|
|
326
|
+
* @default false
|
|
327
|
+
*/
|
|
328
|
+
smartPunctuation?: boolean;
|
|
329
|
+
/**
|
|
330
|
+
* Enable Pandoc-style heading attribute blocks.
|
|
331
|
+
* @default false
|
|
332
|
+
*/
|
|
333
|
+
headingAttributes?: boolean;
|
|
313
334
|
/**
|
|
314
335
|
* Enable syntax highlighting for code blocks.
|
|
315
336
|
* @default false
|
|
@@ -342,6 +363,13 @@ interface OxContentOptions {
|
|
|
342
363
|
math?: boolean | {
|
|
343
364
|
enabled?: boolean;
|
|
344
365
|
};
|
|
366
|
+
/**
|
|
367
|
+
* Enable definition list blocks.
|
|
368
|
+
* @default false
|
|
369
|
+
*/
|
|
370
|
+
definitionLists?: boolean | {
|
|
371
|
+
enabled?: boolean;
|
|
372
|
+
};
|
|
345
373
|
/**
|
|
346
374
|
* Parse YAML frontmatter.
|
|
347
375
|
* @default true
|
|
@@ -414,10 +442,15 @@ interface ResolvedOptions {
|
|
|
414
442
|
tables: boolean;
|
|
415
443
|
taskLists: boolean;
|
|
416
444
|
strikethrough: boolean;
|
|
445
|
+
superscript: boolean;
|
|
446
|
+
subscript: boolean;
|
|
447
|
+
smartPunctuation: boolean;
|
|
448
|
+
headingAttributes: boolean;
|
|
417
449
|
highlight: boolean;
|
|
418
450
|
codeAnnotations: ResolvedCodeAnnotationsOptions;
|
|
419
451
|
mermaid: boolean;
|
|
420
452
|
math: boolean;
|
|
453
|
+
definitionLists: boolean;
|
|
421
454
|
frontmatter: boolean;
|
|
422
455
|
toc: boolean;
|
|
423
456
|
tocMaxDepth: number;
|
|
@@ -456,7 +489,7 @@ interface TocEntry {
|
|
|
456
489
|
*/
|
|
457
490
|
declare function transformMarkdown(source: string, filePath: string, options: ResolvedOptions): Promise<TransformResult>;
|
|
458
491
|
//#endregion
|
|
459
|
-
//#region src/mdast.d.ts
|
|
492
|
+
//#region src/mdast-options.d.ts
|
|
460
493
|
/**
|
|
461
494
|
* Parser options for the Ox Content mdast unified plugin.
|
|
462
495
|
*/
|
|
@@ -496,7 +529,44 @@ interface OxContentMdastOptions {
|
|
|
496
529
|
* @default true
|
|
497
530
|
*/
|
|
498
531
|
autolinks?: boolean;
|
|
532
|
+
/**
|
|
533
|
+
* Enable `^text^` superscript spans.
|
|
534
|
+
* @default false
|
|
535
|
+
*/
|
|
536
|
+
superscript?: boolean;
|
|
537
|
+
/**
|
|
538
|
+
* Enable `~text~` subscript spans.
|
|
539
|
+
* @default false
|
|
540
|
+
*/
|
|
541
|
+
subscript?: boolean;
|
|
542
|
+
/**
|
|
543
|
+
* Enable smart punctuation replacement.
|
|
544
|
+
* @default false
|
|
545
|
+
*/
|
|
546
|
+
smartPunctuation?: boolean;
|
|
547
|
+
/**
|
|
548
|
+
* Enable `$...$` inline math and `$$...$$` block math.
|
|
549
|
+
* @default false
|
|
550
|
+
*/
|
|
551
|
+
math?: boolean;
|
|
552
|
+
/**
|
|
553
|
+
* Enable definition list blocks.
|
|
554
|
+
* @default false
|
|
555
|
+
*/
|
|
556
|
+
definitionLists?: boolean;
|
|
557
|
+
/**
|
|
558
|
+
* Enable Pandoc-style heading attribute blocks.
|
|
559
|
+
* @default false
|
|
560
|
+
*/
|
|
561
|
+
headingAttributes?: boolean;
|
|
562
|
+
/**
|
|
563
|
+
* Enable Obsidian-style wiki links as link nodes.
|
|
564
|
+
* @default false
|
|
565
|
+
*/
|
|
566
|
+
wikiLinks?: boolean;
|
|
499
567
|
}
|
|
568
|
+
//#endregion
|
|
569
|
+
//#region src/mdast.d.ts
|
|
500
570
|
type ProcessorWithParser = {
|
|
501
571
|
parser?: (document: string) => MdastRoot;
|
|
502
572
|
};
|
|
@@ -534,4 +604,4 @@ declare function createMdastPluginContext(filePath: string, source: string, fron
|
|
|
534
604
|
*/
|
|
535
605
|
declare const unplugin: import("unplugin").UnpluginInstance<OxContentOptions | undefined, boolean>;
|
|
536
606
|
//#endregion
|
|
537
|
-
export { ResolvedDocsConfig as C, UnifiedPreset as D, TransformResult as E, RemarkPlugin as S, TocEntry as T, OxContentMdastPlugin as _,
|
|
607
|
+
export { ResolvedDocsConfig as C, UnifiedPreset as D, TransformResult as E, RemarkPlugin as S, TocEntry as T, OxContentMdastPlugin as _, oxContentMdast as a, PluginConfig as b, OxContentMdastOptions as c, MarkdownItPlugin as d, MdastNode as f, MdastTransformer as g, MdastRoot as h, extractTocFromMdast as i, transformMarkdown as l, MdastPluginContext as m, createMdastPluginContext as n, parseMarkdownToMdast as o, MdastPlugin as p, defineMdastPlugin as r, toUnifiedMdastPlugin as s, unplugin as t, DocsConfig as u, OxContentOptions as v, ResolvedOptions as w, RehypePlugin as x, OxContentPlugin as y };
|
package/dist/index2.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as ResolvedDocsConfig, D as UnifiedPreset, E as TransformResult, S as RemarkPlugin, T as TocEntry, _ as OxContentMdastPlugin, a as
|
|
1
|
+
import { C as ResolvedDocsConfig, D as UnifiedPreset, E as TransformResult, S as RemarkPlugin, T as TocEntry, _ as OxContentMdastPlugin, a as oxContentMdast, b as PluginConfig, c as OxContentMdastOptions, d as MarkdownItPlugin, f as MdastNode, g as MdastTransformer, h as MdastRoot, i as extractTocFromMdast, l as transformMarkdown, m as MdastPluginContext, n as createMdastPluginContext, o as parseMarkdownToMdast, p as MdastPlugin, r as defineMdastPlugin, s as toUnifiedMdastPlugin, t as unplugin, u as DocsConfig, v as OxContentOptions, w as ResolvedOptions, x as RehypePlugin, y as OxContentPlugin } from "./index.mjs";
|
|
2
2
|
export { type DocsConfig, type MarkdownItPlugin, type MdastNode, type MdastPlugin, type MdastPluginContext, type MdastRoot, type MdastTransformer, type OxContentMdastOptions, type OxContentMdastPlugin, type OxContentOptions, type OxContentPlugin, type PluginConfig, type RehypePlugin, type RemarkPlugin, type ResolvedDocsConfig, type ResolvedOptions, type TocEntry, type TransformResult, type UnifiedPreset, createMdastPluginContext, unplugin as default, unplugin, defineMdastPlugin, extractTocFromMdast, oxContentMdast, parseMarkdownToMdast, toUnifiedMdastPlugin, transformMarkdown };
|
package/dist/rollup.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ResolvedDocsConfig, D as UnifiedPreset, E as TransformResult, S as RemarkPlugin, T as TocEntry, _ as OxContentMdastPlugin, a as
|
|
1
|
+
import { C as ResolvedDocsConfig, D as UnifiedPreset, E as TransformResult, S as RemarkPlugin, T as TocEntry, _ as OxContentMdastPlugin, a as oxContentMdast, b as PluginConfig, c as OxContentMdastOptions, d as MarkdownItPlugin, f as MdastNode, g as MdastTransformer, h as MdastRoot, i as extractTocFromMdast, l as transformMarkdown, m as MdastPluginContext, n as createMdastPluginContext, o as parseMarkdownToMdast, p as MdastPlugin, r as defineMdastPlugin, s as toUnifiedMdastPlugin, t as unplugin, u as DocsConfig, v as OxContentOptions, w as ResolvedOptions, x as RehypePlugin, y as OxContentPlugin } from "./index.mjs";
|
|
2
2
|
//#region src/rollup.d.ts
|
|
3
3
|
declare const _default: (options?: OxContentOptions | undefined) => import("unplugin").RollupPlugin<any>[] | import("unplugin").RollupPlugin<any>;
|
|
4
4
|
//#endregion
|
package/dist/rspack.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ResolvedDocsConfig, D as UnifiedPreset, E as TransformResult, S as RemarkPlugin, T as TocEntry, _ as OxContentMdastPlugin, a as
|
|
1
|
+
import { C as ResolvedDocsConfig, D as UnifiedPreset, E as TransformResult, S as RemarkPlugin, T as TocEntry, _ as OxContentMdastPlugin, a as oxContentMdast, b as PluginConfig, c as OxContentMdastOptions, d as MarkdownItPlugin, f as MdastNode, g as MdastTransformer, h as MdastRoot, i as extractTocFromMdast, l as transformMarkdown, m as MdastPluginContext, n as createMdastPluginContext, o as parseMarkdownToMdast, p as MdastPlugin, r as defineMdastPlugin, s as toUnifiedMdastPlugin, t as unplugin, u as DocsConfig, v as OxContentOptions, w as ResolvedOptions, x as RehypePlugin, y as OxContentPlugin } from "./index.mjs";
|
|
2
2
|
//#region src/rspack.d.ts
|
|
3
3
|
declare const _default: (options?: OxContentOptions | undefined) => RspackPluginInstance;
|
|
4
4
|
//#endregion
|
package/dist/src.mjs
CHANGED
|
@@ -91,6 +91,13 @@ const KIND_MDX_JSX_TEXT = 24;
|
|
|
91
91
|
const KIND_MDX_ESM = 25;
|
|
92
92
|
const KIND_MDX_FLOW_EXPRESSION = 26;
|
|
93
93
|
const KIND_MDX_TEXT_EXPRESSION = 27;
|
|
94
|
+
const KIND_MATH = 28;
|
|
95
|
+
const KIND_INLINE_MATH = 29;
|
|
96
|
+
const KIND_DEFINITION_LIST = 30;
|
|
97
|
+
const KIND_DEFINITION_TERM = 31;
|
|
98
|
+
const KIND_DEFINITION_DESCRIPTION = 32;
|
|
99
|
+
const KIND_SUPERSCRIPT = 33;
|
|
100
|
+
const KIND_SUBSCRIPT = 34;
|
|
94
101
|
const FLAG_ORDERED = 1;
|
|
95
102
|
const FLAG_SPREAD = 2;
|
|
96
103
|
const FLAG_CHECKED_PRESENT = 4;
|
|
@@ -168,12 +175,21 @@ function deserializeMdastFromRaw(buffer, source) {
|
|
|
168
175
|
children: children ?? [],
|
|
169
176
|
position
|
|
170
177
|
};
|
|
171
|
-
case KIND_HEADING:
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
178
|
+
case KIND_HEADING: {
|
|
179
|
+
const node = {
|
|
180
|
+
type: "heading",
|
|
181
|
+
depth: num0,
|
|
182
|
+
children: children ?? [],
|
|
183
|
+
position
|
|
184
|
+
};
|
|
185
|
+
if (str0 !== void 0 || str1 !== void 0) {
|
|
186
|
+
const hProperties = {};
|
|
187
|
+
if (str0 !== void 0) hProperties.id = str0;
|
|
188
|
+
if (str1 !== void 0) hProperties.className = str1.split(/\s+/).filter(Boolean);
|
|
189
|
+
node.data = { hProperties };
|
|
190
|
+
}
|
|
191
|
+
return node;
|
|
192
|
+
}
|
|
177
193
|
case KIND_THEMATIC_BREAK: return {
|
|
178
194
|
type: "thematicBreak",
|
|
179
195
|
position
|
|
@@ -214,6 +230,11 @@ function deserializeMdastFromRaw(buffer, source) {
|
|
|
214
230
|
if (str1 !== void 0) node.meta = str1;
|
|
215
231
|
return node;
|
|
216
232
|
}
|
|
233
|
+
case KIND_MATH: return {
|
|
234
|
+
type: "math",
|
|
235
|
+
value: str0 ?? "",
|
|
236
|
+
position
|
|
237
|
+
};
|
|
217
238
|
case KIND_HTML: return {
|
|
218
239
|
type: "html",
|
|
219
240
|
value: str0 ?? "",
|
|
@@ -235,6 +256,21 @@ function deserializeMdastFromRaw(buffer, source) {
|
|
|
235
256
|
children: children ?? [],
|
|
236
257
|
position
|
|
237
258
|
};
|
|
259
|
+
case KIND_DEFINITION_LIST: return {
|
|
260
|
+
type: "definitionList",
|
|
261
|
+
children: children ?? [],
|
|
262
|
+
position
|
|
263
|
+
};
|
|
264
|
+
case KIND_DEFINITION_TERM: return {
|
|
265
|
+
type: "definitionTerm",
|
|
266
|
+
children: children ?? [],
|
|
267
|
+
position
|
|
268
|
+
};
|
|
269
|
+
case KIND_DEFINITION_DESCRIPTION: return {
|
|
270
|
+
type: "definitionDescription",
|
|
271
|
+
children: children ?? [],
|
|
272
|
+
position
|
|
273
|
+
};
|
|
238
274
|
case KIND_TEXT: return {
|
|
239
275
|
type: "text",
|
|
240
276
|
value: str0 ?? "",
|
|
@@ -255,6 +291,11 @@ function deserializeMdastFromRaw(buffer, source) {
|
|
|
255
291
|
value: str0 ?? "",
|
|
256
292
|
position
|
|
257
293
|
};
|
|
294
|
+
case KIND_INLINE_MATH: return {
|
|
295
|
+
type: "inlineMath",
|
|
296
|
+
value: str0 ?? "",
|
|
297
|
+
position
|
|
298
|
+
};
|
|
258
299
|
case KIND_BREAK: return {
|
|
259
300
|
type: "break",
|
|
260
301
|
position
|
|
@@ -284,6 +325,16 @@ function deserializeMdastFromRaw(buffer, source) {
|
|
|
284
325
|
children: children ?? [],
|
|
285
326
|
position
|
|
286
327
|
};
|
|
328
|
+
case KIND_SUPERSCRIPT: return {
|
|
329
|
+
type: "superscript",
|
|
330
|
+
children: children ?? [],
|
|
331
|
+
position
|
|
332
|
+
};
|
|
333
|
+
case KIND_SUBSCRIPT: return {
|
|
334
|
+
type: "subscript",
|
|
335
|
+
children: children ?? [],
|
|
336
|
+
position
|
|
337
|
+
};
|
|
287
338
|
case KIND_FOOTNOTE_REFERENCE: {
|
|
288
339
|
const node = {
|
|
289
340
|
type: "footnoteReference",
|
|
@@ -491,9 +542,7 @@ function utf8ByteLength(character) {
|
|
|
491
542
|
return 4;
|
|
492
543
|
}
|
|
493
544
|
//#endregion
|
|
494
|
-
//#region src/mdast.ts
|
|
495
|
-
const require$1 = createRequire(import.meta.url);
|
|
496
|
-
let cachedNapiBindings$1;
|
|
545
|
+
//#region src/mdast-options.ts
|
|
497
546
|
const DEFAULT_MDAST_OPTIONS = {
|
|
498
547
|
gfm: true,
|
|
499
548
|
mdx: false,
|
|
@@ -501,8 +550,37 @@ const DEFAULT_MDAST_OPTIONS = {
|
|
|
501
550
|
taskLists: true,
|
|
502
551
|
tables: true,
|
|
503
552
|
strikethrough: true,
|
|
504
|
-
autolinks: true
|
|
553
|
+
autolinks: true,
|
|
554
|
+
superscript: false,
|
|
555
|
+
subscript: false,
|
|
556
|
+
smartPunctuation: false,
|
|
557
|
+
math: false,
|
|
558
|
+
definitionLists: false,
|
|
559
|
+
headingAttributes: false,
|
|
560
|
+
wikiLinks: false
|
|
505
561
|
};
|
|
562
|
+
function resolveMdastOptions(options) {
|
|
563
|
+
return {
|
|
564
|
+
gfm: options.gfm ?? DEFAULT_MDAST_OPTIONS.gfm,
|
|
565
|
+
mdx: options.mdx ?? DEFAULT_MDAST_OPTIONS.mdx,
|
|
566
|
+
footnotes: options.footnotes ?? DEFAULT_MDAST_OPTIONS.footnotes,
|
|
567
|
+
taskLists: options.taskLists ?? DEFAULT_MDAST_OPTIONS.taskLists,
|
|
568
|
+
tables: options.tables ?? DEFAULT_MDAST_OPTIONS.tables,
|
|
569
|
+
strikethrough: options.strikethrough ?? DEFAULT_MDAST_OPTIONS.strikethrough,
|
|
570
|
+
autolinks: options.autolinks ?? DEFAULT_MDAST_OPTIONS.autolinks,
|
|
571
|
+
superscript: options.superscript ?? DEFAULT_MDAST_OPTIONS.superscript,
|
|
572
|
+
subscript: options.subscript ?? DEFAULT_MDAST_OPTIONS.subscript,
|
|
573
|
+
smartPunctuation: options.smartPunctuation ?? DEFAULT_MDAST_OPTIONS.smartPunctuation,
|
|
574
|
+
math: options.math ?? DEFAULT_MDAST_OPTIONS.math,
|
|
575
|
+
definitionLists: options.definitionLists ?? DEFAULT_MDAST_OPTIONS.definitionLists,
|
|
576
|
+
headingAttributes: options.headingAttributes ?? DEFAULT_MDAST_OPTIONS.headingAttributes,
|
|
577
|
+
wikiLinks: options.wikiLinks ?? DEFAULT_MDAST_OPTIONS.wikiLinks
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
//#endregion
|
|
581
|
+
//#region src/mdast.ts
|
|
582
|
+
const require$1 = createRequire(import.meta.url);
|
|
583
|
+
let cachedNapiBindings$1;
|
|
506
584
|
/**
|
|
507
585
|
* Unified parser plugin backed by Ox Content's native mdast parser.
|
|
508
586
|
*
|
|
@@ -534,7 +612,14 @@ function parseMarkdownToMdast(source, options = {}) {
|
|
|
534
612
|
taskLists: resolvedOptions.taskLists,
|
|
535
613
|
tables: resolvedOptions.tables,
|
|
536
614
|
strikethrough: resolvedOptions.strikethrough,
|
|
537
|
-
autolinks: resolvedOptions.autolinks
|
|
615
|
+
autolinks: resolvedOptions.autolinks,
|
|
616
|
+
superscript: resolvedOptions.superscript,
|
|
617
|
+
subscript: resolvedOptions.subscript,
|
|
618
|
+
smartPunctuation: resolvedOptions.smartPunctuation,
|
|
619
|
+
math: resolvedOptions.math,
|
|
620
|
+
definitionLists: resolvedOptions.definitionLists,
|
|
621
|
+
headingAttributes: resolvedOptions.headingAttributes,
|
|
622
|
+
wikiLinks: resolvedOptions.wikiLinks
|
|
538
623
|
};
|
|
539
624
|
return deserializeMdastFromRaw(requireNapiMethod$1(napi.parseTransferRaw, "parseTransferRaw")(source, "mdast", parserOptions), source);
|
|
540
625
|
}
|
|
@@ -561,7 +646,7 @@ function extractTocFromMdast(root, maxDepth) {
|
|
|
561
646
|
headings.push({
|
|
562
647
|
depth,
|
|
563
648
|
text,
|
|
564
|
-
slug: slugify$1(text),
|
|
649
|
+
slug: explicitHeadingId(node) ?? slugify$1(text),
|
|
565
650
|
children: []
|
|
566
651
|
});
|
|
567
652
|
});
|
|
@@ -594,17 +679,6 @@ function requireNapiMethod$1(method, name) {
|
|
|
594
679
|
if (typeof method === "function") return method;
|
|
595
680
|
throw new Error(`[ox-content] @ox-content/napi is too old for mdast interop: missing ${name}(). Rebuild the NAPI module with \`vp run build:napi\`.`);
|
|
596
681
|
}
|
|
597
|
-
function resolveMdastOptions(options) {
|
|
598
|
-
return {
|
|
599
|
-
gfm: options.gfm ?? DEFAULT_MDAST_OPTIONS.gfm,
|
|
600
|
-
mdx: options.mdx ?? DEFAULT_MDAST_OPTIONS.mdx,
|
|
601
|
-
footnotes: options.footnotes ?? DEFAULT_MDAST_OPTIONS.footnotes,
|
|
602
|
-
taskLists: options.taskLists ?? DEFAULT_MDAST_OPTIONS.taskLists,
|
|
603
|
-
tables: options.tables ?? DEFAULT_MDAST_OPTIONS.tables,
|
|
604
|
-
strikethrough: options.strikethrough ?? DEFAULT_MDAST_OPTIONS.strikethrough,
|
|
605
|
-
autolinks: options.autolinks ?? DEFAULT_MDAST_OPTIONS.autolinks
|
|
606
|
-
};
|
|
607
|
-
}
|
|
608
682
|
function buildTocTree$1(entries) {
|
|
609
683
|
const result = [];
|
|
610
684
|
const stack = [];
|
|
@@ -634,6 +708,14 @@ function collectMdastText(node) {
|
|
|
634
708
|
if (!Array.isArray(node.children)) return "";
|
|
635
709
|
return node.children.map((child) => collectMdastText(child)).join("");
|
|
636
710
|
}
|
|
711
|
+
function explicitHeadingId(node) {
|
|
712
|
+
const data = node.data;
|
|
713
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) return;
|
|
714
|
+
const hProperties = data.hProperties;
|
|
715
|
+
if (!hProperties || typeof hProperties !== "object" || Array.isArray(hProperties)) return;
|
|
716
|
+
const id = hProperties.id;
|
|
717
|
+
return typeof id === "string" && id.length > 0 ? id : void 0;
|
|
718
|
+
}
|
|
637
719
|
function slugify$1(text) {
|
|
638
720
|
return text.toLowerCase().replace(/[^\p{L}\p{N}\s-]+/gu, " ").trim().split(/\s+/).filter(Boolean).join("-");
|
|
639
721
|
}
|
|
@@ -710,11 +792,16 @@ function createNapiTransformOptions(options, filePath) {
|
|
|
710
792
|
tables: options.tables,
|
|
711
793
|
strikethrough: options.strikethrough,
|
|
712
794
|
autolinks: options.gfm,
|
|
795
|
+
superscript: options.superscript,
|
|
796
|
+
subscript: options.subscript,
|
|
797
|
+
smartPunctuation: options.smartPunctuation,
|
|
798
|
+
headingAttributes: options.headingAttributes,
|
|
713
799
|
frontmatter: options.frontmatter,
|
|
714
800
|
tocMaxDepth: options.tocMaxDepth,
|
|
715
801
|
codeAnnotations: codeAnnotations.enabled,
|
|
716
802
|
codeAnnotationMetaKey: codeAnnotations.metaKey,
|
|
717
|
-
math: options.math
|
|
803
|
+
math: options.math,
|
|
804
|
+
definitionLists: options.definitionLists ? { enabled: true } : void 0
|
|
718
805
|
};
|
|
719
806
|
}
|
|
720
807
|
function parseFrontmatterJson(json) {
|
|
@@ -952,7 +1039,13 @@ function installUnifiedParser(processor, strategy, options, filePath, nativeTree
|
|
|
952
1039
|
taskLists: options.taskLists,
|
|
953
1040
|
tables: options.tables,
|
|
954
1041
|
strikethrough: options.strikethrough,
|
|
955
|
-
autolinks: options.gfm
|
|
1042
|
+
autolinks: options.gfm,
|
|
1043
|
+
superscript: options.superscript,
|
|
1044
|
+
subscript: options.subscript,
|
|
1045
|
+
smartPunctuation: options.smartPunctuation,
|
|
1046
|
+
headingAttributes: options.headingAttributes,
|
|
1047
|
+
math: options.math,
|
|
1048
|
+
definitionLists: options.definitionLists
|
|
956
1049
|
});
|
|
957
1050
|
}
|
|
958
1051
|
function resolveUnifiedParserStrategy(processor) {
|
|
@@ -1295,10 +1388,15 @@ function resolveOptions(options) {
|
|
|
1295
1388
|
tables: options.tables ?? true,
|
|
1296
1389
|
taskLists: options.taskLists ?? true,
|
|
1297
1390
|
strikethrough: options.strikethrough ?? true,
|
|
1391
|
+
superscript: options.superscript ?? false,
|
|
1392
|
+
subscript: options.subscript ?? false,
|
|
1393
|
+
smartPunctuation: options.smartPunctuation ?? false,
|
|
1394
|
+
headingAttributes: options.headingAttributes ?? false,
|
|
1298
1395
|
highlight: options.highlight ?? false,
|
|
1299
1396
|
codeAnnotations: resolveCodeAnnotationsOptions(options.codeAnnotations),
|
|
1300
1397
|
mermaid: options.mermaid ?? false,
|
|
1301
1398
|
math: options.math === true || typeof options.math === "object" && options.math.enabled !== false,
|
|
1399
|
+
definitionLists: options.definitionLists === true || typeof options.definitionLists === "object" && options.definitionLists.enabled !== false,
|
|
1302
1400
|
frontmatter: options.frontmatter ?? true,
|
|
1303
1401
|
toc: options.toc ?? true,
|
|
1304
1402
|
tocMaxDepth: options.tocMaxDepth ?? 3,
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ResolvedDocsConfig, D as UnifiedPreset, E as TransformResult, S as RemarkPlugin, T as TocEntry, _ as OxContentMdastPlugin, a as
|
|
1
|
+
import { C as ResolvedDocsConfig, D as UnifiedPreset, E as TransformResult, S as RemarkPlugin, T as TocEntry, _ as OxContentMdastPlugin, a as oxContentMdast, b as PluginConfig, c as OxContentMdastOptions, d as MarkdownItPlugin, f as MdastNode, g as MdastTransformer, h as MdastRoot, i as extractTocFromMdast, l as transformMarkdown, m as MdastPluginContext, n as createMdastPluginContext, o as parseMarkdownToMdast, p as MdastPlugin, r as defineMdastPlugin, s as toUnifiedMdastPlugin, t as unplugin, u as DocsConfig, v as OxContentOptions, w as ResolvedOptions, x as RehypePlugin, y as OxContentPlugin } from "./index.mjs";
|
|
2
2
|
//#region src/vite.d.ts
|
|
3
3
|
declare const _default: (options?: OxContentOptions | undefined) => import("unplugin").VitePlugin<any>[] | import("unplugin").VitePlugin<any>;
|
|
4
4
|
//#endregion
|
package/dist/webpack.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ResolvedDocsConfig, D as UnifiedPreset, E as TransformResult, S as RemarkPlugin, T as TocEntry, _ as OxContentMdastPlugin, a as
|
|
1
|
+
import { C as ResolvedDocsConfig, D as UnifiedPreset, E as TransformResult, S as RemarkPlugin, T as TocEntry, _ as OxContentMdastPlugin, a as oxContentMdast, b as PluginConfig, c as OxContentMdastOptions, d as MarkdownItPlugin, f as MdastNode, g as MdastTransformer, h as MdastRoot, i as extractTocFromMdast, l as transformMarkdown, m as MdastPluginContext, n as createMdastPluginContext, o as parseMarkdownToMdast, p as MdastPlugin, r as defineMdastPlugin, s as toUnifiedMdastPlugin, t as unplugin, u as DocsConfig, v as OxContentOptions, w as ResolvedOptions, x as RehypePlugin, y as OxContentPlugin } from "./index.mjs";
|
|
2
2
|
//#region src/webpack.d.ts
|
|
3
3
|
declare const _default: (options?: OxContentOptions | undefined) => import("unplugin").WebpackPluginInstance;
|
|
4
4
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ox-content/unplugin",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Universal plugin for Ox Content - Markdown processing for webpack, rollup, esbuild, vite, and more",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"esbuild",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"provenance": true
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@ox-content/napi": "3.
|
|
58
|
+
"@ox-content/napi": "3.1.0",
|
|
59
59
|
"@rollup/pluginutils": "^5.4.0",
|
|
60
60
|
"markdown-it": "^15.0.0",
|
|
61
61
|
"markdown-it-anchor": "^9.2.1",
|