@nuxtjs/mdc 0.7.0 → 0.8.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/config.d.mts +1 -45
- package/dist/config.d.ts +1 -45
- package/dist/module.d.mts +4 -3
- package/dist/module.d.ts +4 -3
- package/dist/module.json +5 -1
- package/dist/module.mjs +1 -2
- package/dist/runtime/components/MDC.vue +9 -0
- package/dist/runtime/components/MDCRenderer.vue +27 -3
- package/dist/runtime/components/MDCRenderer.vue.d.ts +35 -3
- package/dist/runtime/components/MDCSlot.vue.d.ts +52 -1
- package/dist/runtime/components/prose/ProseH1.vue +1 -1
- package/dist/runtime/components/prose/ProseH2.vue +1 -1
- package/dist/runtime/components/prose/ProseH3.vue +1 -1
- package/dist/runtime/components/prose/ProseH4.vue +1 -1
- package/dist/runtime/components/prose/ProseH5.vue +1 -1
- package/dist/runtime/components/prose/ProseH6.vue +1 -1
- package/dist/runtime/highlighter/rehype-nuxt.d.ts +1 -1
- package/dist/runtime/highlighter/{rehype-nuxt.mjs → rehype-nuxt.js} +1 -1
- package/dist/runtime/highlighter/rehype.d.ts +1 -1
- package/dist/runtime/highlighter/shiki.d.ts +2 -2
- package/dist/runtime/index.d.ts +4 -4
- package/dist/runtime/index.js +4 -0
- package/dist/runtime/parser/compiler.d.ts +1 -1
- package/dist/runtime/parser/{compiler.mjs → compiler.js} +2 -1
- package/dist/runtime/parser/handlers/{code.mjs → code.js} +1 -2
- package/dist/runtime/parser/handlers/{html.mjs → html.js} +1 -1
- package/dist/runtime/parser/handlers/index.d.ts +9 -9
- package/dist/runtime/parser/handlers/index.js +22 -0
- package/dist/runtime/parser/handlers/{paragraph.mjs → paragraph.js} +2 -2
- package/dist/runtime/parser/handlers/{utils.mjs → utils.js} +4 -4
- package/dist/runtime/parser/index.d.ts +1 -1
- package/dist/runtime/parser/{index.mjs → index.js} +5 -5
- package/dist/runtime/parser/options.d.ts +1 -1
- package/dist/runtime/parser/{options.mjs → options.js} +1 -1
- package/dist/runtime/parser/toc.d.ts +1 -1
- package/dist/runtime/parser/{toc.mjs → toc.js} +1 -1
- package/dist/runtime/parser/utils/plugins.d.ts +1 -2
- package/dist/runtime/types/config.d.ts +1 -1
- package/dist/runtime/types/hast.d.ts +1 -1
- package/dist/runtime/types/index.d.ts +3 -3
- package/dist/runtime/types/index.js +3 -0
- package/dist/runtime/types/parser.d.ts +4 -4
- package/dist/runtime/utils/ast.d.ts +1 -1
- package/dist/runtime/utils/node.d.ts +1 -1
- package/dist/runtime/utils/slot.d.ts +1 -1
- package/dist/runtime/utils/{slot.mjs → slot.js} +1 -1
- package/dist/runtime/utils/{ssrSlot.mjs → ssrSlot.js} +1 -1
- package/dist/types.d.mts +84 -0
- package/dist/types.d.ts +84 -0
- package/package.json +20 -18
- package/dist/runtime/index.mjs +0 -4
- package/dist/runtime/parser/handlers/index.mjs +0 -22
- package/dist/runtime/types/index.mjs +0 -3
- package/dist/shared/mdc.a6f76af4.d.mts +0 -9
- package/dist/shared/mdc.a6f76af4.d.ts +0 -9
- /package/dist/runtime/highlighter/{event-handler.mjs → event-handler.js} +0 -0
- /package/dist/runtime/highlighter/{rehype.mjs → rehype.js} +0 -0
- /package/dist/runtime/highlighter/{shiki.mjs → shiki.js} +0 -0
- /package/dist/runtime/highlighter/{types.mjs → types.js} +0 -0
- /package/dist/runtime/parser/handlers/{containerComponent.mjs → containerComponent.js} +0 -0
- /package/dist/runtime/parser/handlers/{emphasis.mjs → emphasis.js} +0 -0
- /package/dist/runtime/parser/handlers/{image.mjs → image.js} +0 -0
- /package/dist/runtime/parser/handlers/{inlineCode.mjs → inlineCode.js} +0 -0
- /package/dist/runtime/parser/handlers/{link.mjs → link.js} +0 -0
- /package/dist/runtime/parser/handlers/{list.mjs → list.js} +0 -0
- /package/dist/runtime/parser/handlers/{strong.mjs → strong.js} +0 -0
- /package/dist/runtime/parser/utils/{html-tags-list.mjs → html-tags-list.js} +0 -0
- /package/dist/runtime/parser/utils/{plugins.mjs → plugins.js} +0 -0
- /package/dist/runtime/parser/utils/{props.mjs → props.js} +0 -0
- /package/dist/runtime/types/{config.mjs → config.js} +0 -0
- /package/dist/runtime/types/{hast.mjs → hast.js} +0 -0
- /package/dist/runtime/types/{parser.mjs → parser.js} +0 -0
- /package/dist/runtime/types/{toc.mjs → toc.js} +0 -0
- /package/dist/runtime/types/{tree.mjs → tree.js} +0 -0
- /package/dist/runtime/types/{unist.mjs → unist.js} +0 -0
- /package/dist/runtime/utils/{ast.mjs → ast.js} +0 -0
- /package/dist/runtime/utils/{node.mjs → node.js} +0 -0
package/dist/config.d.mts
CHANGED
|
@@ -1,48 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Processor } from 'unified';
|
|
3
|
-
import { M as MdcThemeOptions, H as HighlighterOptions } from './shared/mdc.a6f76af4.mjs';
|
|
4
|
-
|
|
5
|
-
type Awaitable<T> = T | Promise<T>;
|
|
6
|
-
interface MdcConfig {
|
|
7
|
-
/**
|
|
8
|
-
* Hooks for the unified markdown pipeline
|
|
9
|
-
*/
|
|
10
|
-
unified?: {
|
|
11
|
-
/**
|
|
12
|
-
* Custom setup for unified processor before other plugins
|
|
13
|
-
*/
|
|
14
|
-
pre?: (processor: Processor) => Awaitable<void | Processor>;
|
|
15
|
-
/**
|
|
16
|
-
* Custom setup for unified processor after remark but before rehype
|
|
17
|
-
*/
|
|
18
|
-
remark?: (processor: Processor) => Awaitable<void | Processor>;
|
|
19
|
-
/**
|
|
20
|
-
* Custom setup for unified processor after rehype
|
|
21
|
-
*/
|
|
22
|
-
rehype?: (processor: Processor) => Awaitable<void | Processor>;
|
|
23
|
-
/**
|
|
24
|
-
* Custom setup for unified processor after all plugins
|
|
25
|
-
*/
|
|
26
|
-
post?: (processor: Processor) => Awaitable<void | Processor>;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Custom hightlighter, available when `highlighter` is set to `custom`
|
|
30
|
-
*/
|
|
31
|
-
highlighter?: Highlighter;
|
|
32
|
-
/**
|
|
33
|
-
* Hooks for shiki
|
|
34
|
-
*/
|
|
35
|
-
shiki?: {
|
|
36
|
-
/**
|
|
37
|
-
* Get transformers for shiki
|
|
38
|
-
*/
|
|
39
|
-
transformers?: ShikiTransformer[] | ((code: string, lang: string, theme: MdcThemeOptions, options: Partial<HighlighterOptions>) => Awaitable<ShikiTransformer[]>);
|
|
40
|
-
/**
|
|
41
|
-
* Custom setup for shiki instance, only called once on server or client
|
|
42
|
-
*/
|
|
43
|
-
setup?: (highlighter: HighlighterCore) => Awaitable<void>;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
1
|
+
import { MdcConfig } from '../dist/runtime/types/config.js';
|
|
46
2
|
|
|
47
3
|
declare function defineConfig(config: MdcConfig): MdcConfig;
|
|
48
4
|
|
package/dist/config.d.ts
CHANGED
|
@@ -1,48 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Processor } from 'unified';
|
|
3
|
-
import { M as MdcThemeOptions, H as HighlighterOptions } from './shared/mdc.a6f76af4.js';
|
|
4
|
-
|
|
5
|
-
type Awaitable<T> = T | Promise<T>;
|
|
6
|
-
interface MdcConfig {
|
|
7
|
-
/**
|
|
8
|
-
* Hooks for the unified markdown pipeline
|
|
9
|
-
*/
|
|
10
|
-
unified?: {
|
|
11
|
-
/**
|
|
12
|
-
* Custom setup for unified processor before other plugins
|
|
13
|
-
*/
|
|
14
|
-
pre?: (processor: Processor) => Awaitable<void | Processor>;
|
|
15
|
-
/**
|
|
16
|
-
* Custom setup for unified processor after remark but before rehype
|
|
17
|
-
*/
|
|
18
|
-
remark?: (processor: Processor) => Awaitable<void | Processor>;
|
|
19
|
-
/**
|
|
20
|
-
* Custom setup for unified processor after rehype
|
|
21
|
-
*/
|
|
22
|
-
rehype?: (processor: Processor) => Awaitable<void | Processor>;
|
|
23
|
-
/**
|
|
24
|
-
* Custom setup for unified processor after all plugins
|
|
25
|
-
*/
|
|
26
|
-
post?: (processor: Processor) => Awaitable<void | Processor>;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Custom hightlighter, available when `highlighter` is set to `custom`
|
|
30
|
-
*/
|
|
31
|
-
highlighter?: Highlighter;
|
|
32
|
-
/**
|
|
33
|
-
* Hooks for shiki
|
|
34
|
-
*/
|
|
35
|
-
shiki?: {
|
|
36
|
-
/**
|
|
37
|
-
* Get transformers for shiki
|
|
38
|
-
*/
|
|
39
|
-
transformers?: ShikiTransformer[] | ((code: string, lang: string, theme: MdcThemeOptions, options: Partial<HighlighterOptions>) => Awaitable<ShikiTransformer[]>);
|
|
40
|
-
/**
|
|
41
|
-
* Custom setup for shiki instance, only called once on server or client
|
|
42
|
-
*/
|
|
43
|
-
setup?: (highlighter: HighlighterCore) => Awaitable<void>;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
1
|
+
import { MdcConfig } from '../dist/runtime/types/config.js';
|
|
46
2
|
|
|
47
3
|
declare function defineConfig(config: MdcConfig): MdcConfig;
|
|
48
4
|
|
package/dist/module.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
import { BundledLanguage, LanguageRegistration, BundledTheme, ThemeRegistrationAny } from 'shiki';
|
|
3
|
-
import {
|
|
3
|
+
import { MdcThemeOptions } from '../dist/runtime/highlighter/types.js';
|
|
4
4
|
|
|
5
5
|
interface UnistPlugin {
|
|
6
6
|
src?: string;
|
|
@@ -37,7 +37,7 @@ interface ModuleOptions {
|
|
|
37
37
|
*
|
|
38
38
|
* Unlike the `preload` option, when this option is provided, it will override the default languages.
|
|
39
39
|
*
|
|
40
|
-
* @default ['js','jsx','json','ts','tsx','vue','css','html','
|
|
40
|
+
* @default ['js','jsx','json','ts','tsx','vue','css','html','bash','md','mdc','yaml']
|
|
41
41
|
*/
|
|
42
42
|
langs?: (BundledLanguage | LanguageRegistration)[];
|
|
43
43
|
/**
|
|
@@ -60,7 +60,7 @@ interface ModuleOptions {
|
|
|
60
60
|
headings?: {
|
|
61
61
|
anchorLinks?: {
|
|
62
62
|
[heading in 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6']?: boolean;
|
|
63
|
-
};
|
|
63
|
+
} | boolean;
|
|
64
64
|
};
|
|
65
65
|
keepComments?: boolean;
|
|
66
66
|
components?: {
|
|
@@ -83,6 +83,7 @@ declare module '@nuxt/schema' {
|
|
|
83
83
|
map: Record<string, string>;
|
|
84
84
|
};
|
|
85
85
|
headings: ModuleOptions['headings'];
|
|
86
|
+
useNuxtImage?: boolean;
|
|
86
87
|
};
|
|
87
88
|
}
|
|
88
89
|
interface ConfigSchema {
|
package/dist/module.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
import { BundledLanguage, LanguageRegistration, BundledTheme, ThemeRegistrationAny } from 'shiki';
|
|
3
|
-
import {
|
|
3
|
+
import { MdcThemeOptions } from '../dist/runtime/highlighter/types.js';
|
|
4
4
|
|
|
5
5
|
interface UnistPlugin {
|
|
6
6
|
src?: string;
|
|
@@ -37,7 +37,7 @@ interface ModuleOptions {
|
|
|
37
37
|
*
|
|
38
38
|
* Unlike the `preload` option, when this option is provided, it will override the default languages.
|
|
39
39
|
*
|
|
40
|
-
* @default ['js','jsx','json','ts','tsx','vue','css','html','
|
|
40
|
+
* @default ['js','jsx','json','ts','tsx','vue','css','html','bash','md','mdc','yaml']
|
|
41
41
|
*/
|
|
42
42
|
langs?: (BundledLanguage | LanguageRegistration)[];
|
|
43
43
|
/**
|
|
@@ -60,7 +60,7 @@ interface ModuleOptions {
|
|
|
60
60
|
headings?: {
|
|
61
61
|
anchorLinks?: {
|
|
62
62
|
[heading in 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6']?: boolean;
|
|
63
|
-
};
|
|
63
|
+
} | boolean;
|
|
64
64
|
};
|
|
65
65
|
keepComments?: boolean;
|
|
66
66
|
components?: {
|
|
@@ -83,6 +83,7 @@ declare module '@nuxt/schema' {
|
|
|
83
83
|
map: Record<string, string>;
|
|
84
84
|
};
|
|
85
85
|
headings: ModuleOptions['headings'];
|
|
86
|
+
useNuxtImage?: boolean;
|
|
86
87
|
};
|
|
87
88
|
}
|
|
88
89
|
interface ConfigSchema {
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -204,7 +204,6 @@ const DefaultHighlightLangs = [
|
|
|
204
204
|
"vue",
|
|
205
205
|
"css",
|
|
206
206
|
"html",
|
|
207
|
-
"vue",
|
|
208
207
|
"bash",
|
|
209
208
|
"md",
|
|
210
209
|
"mdc",
|
|
@@ -293,7 +292,7 @@ const module = defineNuxtModule({
|
|
|
293
292
|
options: { configs: mdcConfigs$1 }
|
|
294
293
|
});
|
|
295
294
|
const nitroPreset = nuxt.options.nitro.preset || process.env.NITRO_PRESET || process.env.SERVER_PRESET || "";
|
|
296
|
-
const useWasmAssets = !nuxt.options.dev && (!!nuxt.options.nitro.experimental?.wasm || ["cloudflare-pages", "cloudflare"].includes(nitroPreset));
|
|
295
|
+
const useWasmAssets = !nuxt.options.dev && (!!nuxt.options.nitro.experimental?.wasm || ["cloudflare-pages", "cloudflare-module", "cloudflare"].includes(nitroPreset));
|
|
297
296
|
registerTemplate({
|
|
298
297
|
filename: "mdc-highlighter.mjs",
|
|
299
298
|
getContents: mdcHighlighter,
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
:class="props.class"
|
|
13
13
|
:body="body"
|
|
14
14
|
:data="data?.data"
|
|
15
|
+
:unwrap="props.unwrap"
|
|
15
16
|
/>
|
|
16
17
|
</slot>
|
|
17
18
|
</template>
|
|
@@ -55,6 +56,14 @@ const props = defineProps({
|
|
|
55
56
|
class: {
|
|
56
57
|
type: [String, Array, Object],
|
|
57
58
|
default: ''
|
|
59
|
+
},
|
|
60
|
+
/**
|
|
61
|
+
* Tags to unwrap separated by spaces
|
|
62
|
+
* Example: 'ul li'
|
|
63
|
+
*/
|
|
64
|
+
unwrap: {
|
|
65
|
+
type: [Boolean, String],
|
|
66
|
+
default: false
|
|
58
67
|
}
|
|
59
68
|
})
|
|
60
69
|
|
|
@@ -4,6 +4,7 @@ import destr from "destr";
|
|
|
4
4
|
import { kebabCase, pascalCase } from "scule";
|
|
5
5
|
import { find, html } from "property-information";
|
|
6
6
|
import htmlTags from "../parser/utils/html-tags-list";
|
|
7
|
+
import { flatUnwrap } from "../utils/node";
|
|
7
8
|
const DEFAULT_SLOT = "default";
|
|
8
9
|
const rxOn = /^@|^v-on:/;
|
|
9
10
|
const rxBind = /^:|^v-bind:/;
|
|
@@ -27,6 +28,13 @@ export default defineComponent({
|
|
|
27
28
|
type: Object,
|
|
28
29
|
default: () => ({})
|
|
29
30
|
},
|
|
31
|
+
/**
|
|
32
|
+
* Root tag to use for rendering
|
|
33
|
+
*/
|
|
34
|
+
class: {
|
|
35
|
+
type: [String, Object],
|
|
36
|
+
default: void 0
|
|
37
|
+
},
|
|
30
38
|
/**
|
|
31
39
|
* Root tag to use for rendering
|
|
32
40
|
*/
|
|
@@ -47,6 +55,14 @@ export default defineComponent({
|
|
|
47
55
|
components: {
|
|
48
56
|
type: Object,
|
|
49
57
|
default: () => ({})
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* Tags to unwrap separated by spaces
|
|
61
|
+
* Example: 'ul li'
|
|
62
|
+
*/
|
|
63
|
+
unwrap: {
|
|
64
|
+
type: [Boolean, String],
|
|
65
|
+
default: false
|
|
50
66
|
}
|
|
51
67
|
},
|
|
52
68
|
async setup(props) {
|
|
@@ -67,14 +83,22 @@ export default defineComponent({
|
|
|
67
83
|
return { tags, contentKey, route };
|
|
68
84
|
},
|
|
69
85
|
render(ctx) {
|
|
70
|
-
const { tags, tag, body, data, contentKey, route } = ctx;
|
|
86
|
+
const { tags, tag, body, data, contentKey, route, unwrap } = ctx;
|
|
71
87
|
if (!body) {
|
|
72
88
|
return null;
|
|
73
89
|
}
|
|
74
90
|
const meta = { ...data, tags, $route: route };
|
|
75
91
|
const component = tag !== false ? resolveVueComponent(tag || meta.component?.name || meta.component || "div") : void 0;
|
|
76
|
-
|
|
77
|
-
|
|
92
|
+
return component ? h(component, { ...meta.component?.props, class: ctx.class, ...this.$attrs, key: contentKey }, { default: defaultSlotRenderer }) : defaultSlotRenderer?.();
|
|
93
|
+
function defaultSlotRenderer() {
|
|
94
|
+
if (unwrap) {
|
|
95
|
+
return flatUnwrap(
|
|
96
|
+
renderSlots(body, h, meta, meta).default(),
|
|
97
|
+
typeof unwrap === "string" ? unwrap.split(" ") : ["*"]
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
return renderSlots(body, h, meta, meta).default();
|
|
101
|
+
}
|
|
78
102
|
}
|
|
79
103
|
});
|
|
80
104
|
function renderNode(node, h2, documentMeta, parentScope = {}) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PropType, DefineComponent } from 'vue';
|
|
2
|
-
import type { MDCRoot } from '../types';
|
|
2
|
+
import type { MDCRoot } from '../types.js';
|
|
3
3
|
declare const _default: DefineComponent<{
|
|
4
4
|
/**
|
|
5
5
|
* Content to render
|
|
@@ -15,6 +15,13 @@ declare const _default: DefineComponent<{
|
|
|
15
15
|
type: ObjectConstructor;
|
|
16
16
|
default: () => {};
|
|
17
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Root tag to use for rendering
|
|
20
|
+
*/
|
|
21
|
+
class: {
|
|
22
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
23
|
+
default: undefined;
|
|
24
|
+
};
|
|
18
25
|
/**
|
|
19
26
|
* Root tag to use for rendering
|
|
20
27
|
*/
|
|
@@ -36,10 +43,18 @@ declare const _default: DefineComponent<{
|
|
|
36
43
|
type: PropType<Record<string, string | DefineComponent<any, any, any>>>;
|
|
37
44
|
default: () => {};
|
|
38
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Tags to unwrap separated by spaces
|
|
48
|
+
* Example: 'ul li'
|
|
49
|
+
*/
|
|
50
|
+
unwrap: {
|
|
51
|
+
type: (BooleanConstructor | StringConstructor)[];
|
|
52
|
+
default: boolean;
|
|
53
|
+
};
|
|
39
54
|
}, {
|
|
40
55
|
tags: any;
|
|
41
56
|
contentKey: import("vue").ComputedRef<string>;
|
|
42
|
-
route:
|
|
57
|
+
route: {} | undefined;
|
|
43
58
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
44
59
|
/**
|
|
45
60
|
* Content to render
|
|
@@ -55,6 +70,13 @@ declare const _default: DefineComponent<{
|
|
|
55
70
|
type: ObjectConstructor;
|
|
56
71
|
default: () => {};
|
|
57
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* Root tag to use for rendering
|
|
75
|
+
*/
|
|
76
|
+
class: {
|
|
77
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
78
|
+
default: undefined;
|
|
79
|
+
};
|
|
58
80
|
/**
|
|
59
81
|
* Root tag to use for rendering
|
|
60
82
|
*/
|
|
@@ -76,10 +98,20 @@ declare const _default: DefineComponent<{
|
|
|
76
98
|
type: PropType<Record<string, string | DefineComponent<any, any, any>>>;
|
|
77
99
|
default: () => {};
|
|
78
100
|
};
|
|
101
|
+
/**
|
|
102
|
+
* Tags to unwrap separated by spaces
|
|
103
|
+
* Example: 'ul li'
|
|
104
|
+
*/
|
|
105
|
+
unwrap: {
|
|
106
|
+
type: (BooleanConstructor | StringConstructor)[];
|
|
107
|
+
default: boolean;
|
|
108
|
+
};
|
|
79
109
|
}>>, {
|
|
80
110
|
data: Record<string, any>;
|
|
111
|
+
class: string | Record<string, any>;
|
|
81
112
|
tag: string | boolean;
|
|
82
|
-
components: Record<string, string | DefineComponent<any, any, any>>;
|
|
83
113
|
prose: boolean;
|
|
114
|
+
components: Record<string, string | DefineComponent<any, any, any>>;
|
|
115
|
+
unwrap: string | boolean;
|
|
84
116
|
}, {}>;
|
|
85
117
|
export default _default;
|
|
@@ -1,5 +1,56 @@
|
|
|
1
|
+
import type { Slot } from 'vue';
|
|
1
2
|
/**
|
|
2
3
|
* MDCSlot component
|
|
3
4
|
*/
|
|
4
|
-
declare const _default:
|
|
5
|
+
declare const _default: import("vue").DefineComponent<{
|
|
6
|
+
name: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Tags to unwrap separated by spaces
|
|
12
|
+
* Example: 'ul li'
|
|
13
|
+
*/
|
|
14
|
+
unwrap: {
|
|
15
|
+
type: (BooleanConstructor | StringConstructor)[];
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* VNode to render
|
|
20
|
+
* This is only useful for render functions
|
|
21
|
+
*/
|
|
22
|
+
use: {
|
|
23
|
+
type: FunctionConstructor;
|
|
24
|
+
default: undefined;
|
|
25
|
+
};
|
|
26
|
+
}, {
|
|
27
|
+
fallbackSlot: Slot<any> | undefined;
|
|
28
|
+
tags: import("vue").ComputedRef<string[]>;
|
|
29
|
+
parent: import("vue").ComponentInternalInstance | null;
|
|
30
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
31
|
+
name: {
|
|
32
|
+
type: StringConstructor;
|
|
33
|
+
default: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Tags to unwrap separated by spaces
|
|
37
|
+
* Example: 'ul li'
|
|
38
|
+
*/
|
|
39
|
+
unwrap: {
|
|
40
|
+
type: (BooleanConstructor | StringConstructor)[];
|
|
41
|
+
default: boolean;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* VNode to render
|
|
45
|
+
* This is only useful for render functions
|
|
46
|
+
*/
|
|
47
|
+
use: {
|
|
48
|
+
type: FunctionConstructor;
|
|
49
|
+
default: undefined;
|
|
50
|
+
};
|
|
51
|
+
}>>, {
|
|
52
|
+
name: string;
|
|
53
|
+
unwrap: string | boolean;
|
|
54
|
+
use: Function;
|
|
55
|
+
}, {}>;
|
|
5
56
|
export default _default;
|
|
@@ -16,5 +16,5 @@ import { computed, useRuntimeConfig } from '#imports'
|
|
|
16
16
|
const props = defineProps<{ id?: string }>()
|
|
17
17
|
|
|
18
18
|
const { headings } = useRuntimeConfig().public.mdc
|
|
19
|
-
const generate = computed(() => props.id && headings?.anchorLinks?.h1)
|
|
19
|
+
const generate = computed(() => props.id && (headings?.anchorLinks === true || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h1)))
|
|
20
20
|
</script>
|
|
@@ -16,5 +16,5 @@ import { computed, useRuntimeConfig } from '#imports'
|
|
|
16
16
|
const props = defineProps<{ id?: string }>()
|
|
17
17
|
|
|
18
18
|
const { headings } = useRuntimeConfig().public.mdc
|
|
19
|
-
const generate = computed(() => props.id && headings?.anchorLinks?.h2)
|
|
19
|
+
const generate = computed(() => props.id && (headings?.anchorLinks === true || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h2)))
|
|
20
20
|
</script>
|
|
@@ -16,5 +16,5 @@ import { computed, useRuntimeConfig } from '#imports'
|
|
|
16
16
|
const props = defineProps<{ id?: string }>()
|
|
17
17
|
|
|
18
18
|
const { headings } = useRuntimeConfig().public.mdc
|
|
19
|
-
const generate = computed(() => props.id && headings?.anchorLinks?.h3)
|
|
19
|
+
const generate = computed(() => props.id && (headings?.anchorLinks === true || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h3)))
|
|
20
20
|
</script>
|
|
@@ -16,5 +16,5 @@ import { computed, useRuntimeConfig } from '#imports'
|
|
|
16
16
|
const props = defineProps<{ id?: string }>()
|
|
17
17
|
|
|
18
18
|
const { headings } = useRuntimeConfig().public.mdc
|
|
19
|
-
const generate = computed(() => props.id && headings?.anchorLinks?.h4)
|
|
19
|
+
const generate = computed(() => props.id && (headings?.anchorLinks === true || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h4)))
|
|
20
20
|
</script>
|
|
@@ -16,5 +16,5 @@ import { computed, useRuntimeConfig } from '#imports'
|
|
|
16
16
|
const props = defineProps<{ id?: string }>()
|
|
17
17
|
|
|
18
18
|
const { headings } = useRuntimeConfig().public.mdc
|
|
19
|
-
const generate = computed(() => props.id && headings?.anchorLinks?.h5)
|
|
19
|
+
const generate = computed(() => props.id && (headings?.anchorLinks === true || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h5)))
|
|
20
20
|
</script>
|
|
@@ -16,5 +16,5 @@ import { computed, useRuntimeConfig } from '#imports'
|
|
|
16
16
|
const props = defineProps<{ id?: string }>()
|
|
17
17
|
|
|
18
18
|
const { headings } = useRuntimeConfig().public.mdc
|
|
19
|
-
const generate = computed(() => props.id && headings?.anchorLinks?.h6)
|
|
19
|
+
const generate = computed(() => props.id && (headings?.anchorLinks === true || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h6)))
|
|
20
20
|
</script>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type RehypeHighlightOption } from './rehype';
|
|
1
|
+
import { type RehypeHighlightOption } from './rehype.js';
|
|
2
2
|
export default rehypeHighlight;
|
|
3
3
|
export declare function rehypeHighlight(opts?: Partial<RehypeHighlightOption>): (tree: import("hast").Root) => Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LanguageInput, ThemeInput } from 'shiki';
|
|
2
|
-
import type { MdcConfig } from '../types/config';
|
|
3
|
-
import type { Highlighter } from './types';
|
|
2
|
+
import type { MdcConfig } from '../types/config.js';
|
|
3
|
+
import type { Highlighter } from './types.js';
|
|
4
4
|
export interface CreateShikiHighlighterOptions {
|
|
5
5
|
themes?: ThemeInput[];
|
|
6
6
|
langs?: LanguageInput[];
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { parseMarkdown, createMarkdownParser } from './parser';
|
|
2
|
-
export { rehypeHighlight } from './highlighter/rehype';
|
|
3
|
-
export { createShikiHighlighter } from './highlighter/shiki';
|
|
4
|
-
export * from './utils/node';
|
|
1
|
+
export { parseMarkdown, createMarkdownParser } from './parser.js';
|
|
2
|
+
export { rehypeHighlight } from './highlighter/rehype.js';
|
|
3
|
+
export { createShikiHighlighter } from './highlighter/shiki.js';
|
|
4
|
+
export * from './utils/node.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { MDCParseOptions } from '../types';
|
|
1
|
+
import type { MDCParseOptions } from '../types.js';
|
|
2
2
|
export declare function compileHast(this: any, options?: MDCParseOptions): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toString } from "hast-util-to-string";
|
|
2
2
|
import Slugger from "github-slugger";
|
|
3
|
-
import { validateProps } from "./utils/props.
|
|
3
|
+
import { validateProps } from "./utils/props.js";
|
|
4
4
|
export function compileHast(options = {}) {
|
|
5
5
|
const slugs = new Slugger();
|
|
6
6
|
function compileToJSON(node, parent) {
|
|
@@ -79,6 +79,7 @@ export function compileHast(options = {}) {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
+
body.children = (body.children || []).filter((child) => child.type !== "text");
|
|
82
83
|
return {
|
|
83
84
|
body,
|
|
84
85
|
excerpt
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { detab } from "detab";
|
|
2
|
-
import { parseThematicBlock } from "./utils.
|
|
2
|
+
import { parseThematicBlock } from "./utils.js";
|
|
3
3
|
export default (state, node) => {
|
|
4
4
|
const lang = (node.lang || "") + " " + (node.meta || "");
|
|
5
5
|
const { language, highlights, filename, meta } = parseThematicBlock(lang);
|
|
@@ -12,7 +12,6 @@ export default (state, node) => {
|
|
|
12
12
|
};
|
|
13
13
|
if (meta) {
|
|
14
14
|
result.data = {
|
|
15
|
-
// @ts-expect-error missing types
|
|
16
15
|
meta
|
|
17
16
|
};
|
|
18
17
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import emphasis from './emphasis';
|
|
2
|
-
import html from './html';
|
|
3
|
-
import link from './link';
|
|
4
|
-
import list from './list';
|
|
5
|
-
import paragraph from './paragraph';
|
|
6
|
-
import image from './image';
|
|
7
|
-
import strong from './strong';
|
|
8
|
-
import inlineCode from './inlineCode';
|
|
9
|
-
import containerComponent from './containerComponent';
|
|
1
|
+
import emphasis from './emphasis.js';
|
|
2
|
+
import html from './html.js';
|
|
3
|
+
import link from './link.js';
|
|
4
|
+
import list from './list.js';
|
|
5
|
+
import paragraph from './paragraph.js';
|
|
6
|
+
import image from './image.js';
|
|
7
|
+
import strong from './strong.js';
|
|
8
|
+
import inlineCode from './inlineCode.js';
|
|
9
|
+
import containerComponent from './containerComponent.js';
|
|
10
10
|
declare const _default: {
|
|
11
11
|
emphasis: typeof emphasis;
|
|
12
12
|
code: (state: import("mdast-util-to-hast").State, node: import("mdast").Code) => import("hast").Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import emphasis from "./emphasis.js";
|
|
2
|
+
import code from "./code.js";
|
|
3
|
+
import html from "./html.js";
|
|
4
|
+
import link from "./link.js";
|
|
5
|
+
import list from "./list.js";
|
|
6
|
+
import paragraph from "./paragraph.js";
|
|
7
|
+
import image from "./image.js";
|
|
8
|
+
import strong from "./strong.js";
|
|
9
|
+
import inlineCode from "./inlineCode.js";
|
|
10
|
+
import containerComponent from "./containerComponent.js";
|
|
11
|
+
export default {
|
|
12
|
+
emphasis,
|
|
13
|
+
code,
|
|
14
|
+
link,
|
|
15
|
+
paragraph,
|
|
16
|
+
html,
|
|
17
|
+
list,
|
|
18
|
+
image,
|
|
19
|
+
strong,
|
|
20
|
+
inlineCode,
|
|
21
|
+
containerComponent
|
|
22
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { kebabCase } from "scule";
|
|
2
|
-
import htmlTags from "../utils/html-tags-list.
|
|
3
|
-
import { getTagName } from "./utils.
|
|
2
|
+
import htmlTags from "../utils/html-tags-list.js";
|
|
3
|
+
import { getTagName } from "./utils.js";
|
|
4
4
|
export default function paragraph(state, node) {
|
|
5
5
|
if (node.children && node.children[0] && node.children[0].type === "html") {
|
|
6
6
|
const tagName = kebabCase(getTagName(node.children[0].value) || "div");
|
|
@@ -8,14 +8,14 @@ export function parseThematicBlock(lang) {
|
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
const languageMatches = lang.replace(/[{|[](.+)/, "").match(/^[^ \t]+(?=[ \t]|$)/);
|
|
11
|
-
const highlightTokensMatches = lang.match(
|
|
12
|
-
const filenameMatches = lang.match(/\[((
|
|
11
|
+
const highlightTokensMatches = lang.match(/\{([^}]*)\}/);
|
|
12
|
+
const filenameMatches = lang.match(/\[((\\\]|[^\]])*)\]/);
|
|
13
13
|
const meta = lang.replace(languageMatches?.[0] ?? "", "").replace(highlightTokensMatches?.[0] ?? "", "").replace(filenameMatches?.[0] ?? "", "").trim();
|
|
14
14
|
return {
|
|
15
15
|
language: languageMatches?.[0] || void 0,
|
|
16
16
|
highlights: parseHighlightedLines(highlightTokensMatches?.[1] || void 0),
|
|
17
17
|
// https://github.com/nuxt/content/pull/2169
|
|
18
|
-
filename: filenameMatches?.[1].replace(
|
|
18
|
+
filename: filenameMatches?.[1].replace(/\\\]/g, "]") || void 0,
|
|
19
19
|
meta
|
|
20
20
|
};
|
|
21
21
|
}
|
|
@@ -26,7 +26,7 @@ function parseHighlightedLines(lines) {
|
|
|
26
26
|
});
|
|
27
27
|
return lineArray.length ? lineArray : void 0;
|
|
28
28
|
}
|
|
29
|
-
const TAG_NAME_REGEXP = /^<\/?([
|
|
29
|
+
const TAG_NAME_REGEXP = /^<\/?([\w-]+)(\s[^>]*?)?\/?>/;
|
|
30
30
|
export function getTagName(value) {
|
|
31
31
|
const result = String(value).match(TAG_NAME_REGEXP);
|
|
32
32
|
return result && result[1];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MDCParseOptions, MDCParserResult, MDCRoot } from '../types';
|
|
1
|
+
import type { MDCParseOptions, MDCParserResult, MDCRoot } from '../types.js';
|
|
2
2
|
export declare const createMarkdownParser: (inlineOptions?: MDCParseOptions) => Promise<(md: string) => Promise<MDCParserResult>>;
|
|
3
3
|
export declare const parseMarkdown: (md: string, inlineOptions?: MDCParseOptions) => Promise<MDCParserResult>;
|
|
4
4
|
export declare function contentHeading(body: MDCRoot): {
|
|
@@ -3,11 +3,11 @@ import remarkParse from "remark-parse";
|
|
|
3
3
|
import remark2rehype from "remark-rehype";
|
|
4
4
|
import { parseFrontMatter } from "remark-mdc";
|
|
5
5
|
import { defu } from "defu";
|
|
6
|
-
import { nodeTextContent } from "../utils/node.
|
|
7
|
-
import { useProcessorPlugins } from "./utils/plugins.
|
|
8
|
-
import { defaults } from "./options.
|
|
9
|
-
import { generateToc } from "./toc.
|
|
10
|
-
import { compileHast } from "./compiler.
|
|
6
|
+
import { nodeTextContent } from "../utils/node.js";
|
|
7
|
+
import { useProcessorPlugins } from "./utils/plugins.js";
|
|
8
|
+
import { defaults } from "./options.js";
|
|
9
|
+
import { generateToc } from "./toc.js";
|
|
10
|
+
import { compileHast } from "./compiler.js";
|
|
11
11
|
let moduleOptions;
|
|
12
12
|
let generatedMdcConfigs;
|
|
13
13
|
export const createMarkdownParser = async (inlineOptions = {}) => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { MDCParseOptions } from '../types';
|
|
1
|
+
import type { MDCParseOptions } from '../types.js';
|
|
2
2
|
export declare const defaults: MDCParseOptions;
|
|
@@ -5,7 +5,7 @@ import rehypeExternalLinks from "rehype-external-links";
|
|
|
5
5
|
import rehypeSortAttributeValues from "rehype-sort-attribute-values";
|
|
6
6
|
import rehypeSortAttributes from "rehype-sort-attributes";
|
|
7
7
|
import rehypeRaw from "rehype-raw";
|
|
8
|
-
import handlers from "./handlers/index.
|
|
8
|
+
import handlers from "./handlers/index.js";
|
|
9
9
|
export const defaults = {
|
|
10
10
|
remark: {
|
|
11
11
|
plugins: {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { MDCNode, Toc, MDCElement, MDCRoot } from '../types';
|
|
1
|
+
import type { MDCNode, Toc, MDCElement, MDCRoot } from '../types.js';
|
|
2
2
|
export declare function generateFlatToc(body: MDCNode, options: Toc): Toc;
|
|
3
3
|
export declare function generateToc(body: MDCElement | MDCRoot, options: Toc): Toc;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { flattenNode, flattenNodeText } from "../utils/ast.
|
|
1
|
+
import { flattenNode, flattenNodeText } from "../utils/ast.js";
|
|
2
2
|
const TOC_TAGS = ["h2", "h3", "h4", "h5", "h6"];
|
|
3
3
|
const TOC_TAGS_DEPTH = TOC_TAGS.reduce((tags, tag) => {
|
|
4
4
|
tags[tag] = Number(tag.charAt(tag.length - 1));
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { MDCParseOptions } from '../../types';
|
|
1
|
+
import type { MDCParseOptions } from '../../types.js';
|
|
3
2
|
export declare const useProcessorPlugins: (processor: Processor, plugins?: Exclude<MDCParseOptions['rehype'] | MDCParseOptions['remark'], undefined>['plugins']) => Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Highlighter, HighlighterCore, ShikiTransformer } from 'shiki';
|
|
2
2
|
import type { Processor } from 'unified';
|
|
3
|
-
import type { MdcThemeOptions, HighlighterOptions } from '../highlighter/types';
|
|
3
|
+
import type { MdcThemeOptions, HighlighterOptions } from '../highlighter/types.js';
|
|
4
4
|
export type Awaitable<T> = T | Promise<T>;
|
|
5
5
|
export interface MdcConfig {
|
|
6
6
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Data as UnistData, Literal as UnistLiteral, Node as UnistNode, Parent as UnistParent } from './unist';
|
|
1
|
+
import type { Data as UnistData, Literal as UnistLiteral, Node as UnistNode, Parent as UnistParent } from './unist.js';
|
|
2
2
|
/**
|
|
3
3
|
* Info associated with hast nodes by the ecosystem.
|
|
4
4
|
*
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './tree';
|
|
2
|
-
export * from './parser';
|
|
3
|
-
export * from './toc';
|
|
1
|
+
export * from './tree.js';
|
|
2
|
+
export * from './parser.js';
|
|
3
|
+
export * from './toc.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Options as RehypeOption } from 'remark-rehype';
|
|
2
|
-
import type { RehypeHighlightOption } from '../highlighter/rehype';
|
|
3
|
-
import type { MdcConfig } from './config';
|
|
4
|
-
import type { MDCData, MDCRoot } from './tree';
|
|
5
|
-
import type { Toc } from './toc';
|
|
2
|
+
import type { RehypeHighlightOption } from '../highlighter/rehype.js';
|
|
3
|
+
import type { MdcConfig } from './config.js';
|
|
4
|
+
import type { MDCData, MDCRoot } from './tree.js';
|
|
5
|
+
import type { Toc } from './toc.js';
|
|
6
6
|
export interface RemarkPlugin {
|
|
7
7
|
instance?: any;
|
|
8
8
|
options?: Array<any> | Record<string, any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MDCNode } from '../types';
|
|
1
|
+
import type { MDCNode } from '../types.js';
|
|
2
2
|
export declare function flattenNodeText(node: MDCNode): string;
|
|
3
3
|
export declare function flattenNode(node: MDCNode, maxDepth?: number, _depth?: number): Array<MDCNode>;
|
|
4
4
|
export declare function setNodeData(node: MDCNode & {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const renderSlot: (slots: Record<string, any>, name: string, props: any, ...rest: any[]) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
1
|
+
export declare const renderSlot: (slots: Record<string, any>, name: string, props: any, ...rest: any[]) => import("vue/dist/vue.js").VNode<import("vue/dist/vue.js").RendererNode, import("vue/dist/vue.js").RendererElement, {
|
|
2
2
|
[key: string]: any;
|
|
3
3
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { renderSlot as _renderSlot } from "vue";
|
|
2
|
-
import { flatUnwrap } from "./node.
|
|
2
|
+
import { flatUnwrap } from "./node.js";
|
|
3
3
|
export const renderSlot = (slots, name, props, ...rest) => {
|
|
4
4
|
if (slots[name]) {
|
|
5
5
|
return _renderSlot({ ...slots, [name]: () => flatUnwrap(slots[name](), props?.unwrap) }, name, props, ...rest);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ssrRenderSlot as _ssrRenderSlot } from "vue/server-renderer";
|
|
2
|
-
import { flatUnwrap } from "./node.
|
|
2
|
+
import { flatUnwrap } from "./node.js";
|
|
3
3
|
export const ssrRenderSlot = (slots, name, props, fallbackRenderFn, push, parentComponent, slotScopeId) => {
|
|
4
4
|
if (slots[name]) {
|
|
5
5
|
return _ssrRenderSlot({ ...slots, [name]: () => flatUnwrap(slots[name](), props?.unwrap) }, name, props, fallbackRenderFn, push, parentComponent, slotScopeId);
|
package/dist/types.d.mts
CHANGED
|
@@ -2,7 +2,91 @@
|
|
|
2
2
|
import type { } from './module.js'
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
declare module '@nuxt/schema' {
|
|
6
|
+
export interface ModuleOptions {
|
|
7
|
+
remarkPlugins: any,
|
|
5
8
|
|
|
9
|
+
rehypePlugins: any,
|
|
10
|
+
|
|
11
|
+
/** @default false */
|
|
12
|
+
highlight: boolean,
|
|
13
|
+
|
|
14
|
+
headings: {
|
|
15
|
+
anchorLinks: {
|
|
16
|
+
/** @default false */
|
|
17
|
+
h1: boolean,
|
|
18
|
+
|
|
19
|
+
/** @default true */
|
|
20
|
+
h2: boolean,
|
|
21
|
+
|
|
22
|
+
/** @default true */
|
|
23
|
+
h3: boolean,
|
|
24
|
+
|
|
25
|
+
/** @default true */
|
|
26
|
+
h4: boolean,
|
|
27
|
+
|
|
28
|
+
/** @default false */
|
|
29
|
+
h5: boolean,
|
|
30
|
+
|
|
31
|
+
/** @default false */
|
|
32
|
+
h6: boolean,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
/** @default false */
|
|
37
|
+
keepComments: boolean,
|
|
38
|
+
|
|
39
|
+
components: {
|
|
40
|
+
/** @default true */
|
|
41
|
+
prose: boolean,
|
|
42
|
+
|
|
43
|
+
map: any,
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
declare module 'nuxt/schema' {
|
|
49
|
+
export interface ModuleOptions {
|
|
50
|
+
remarkPlugins: any,
|
|
51
|
+
|
|
52
|
+
rehypePlugins: any,
|
|
53
|
+
|
|
54
|
+
/** @default false */
|
|
55
|
+
highlight: boolean,
|
|
56
|
+
|
|
57
|
+
headings: {
|
|
58
|
+
anchorLinks: {
|
|
59
|
+
/** @default false */
|
|
60
|
+
h1: boolean,
|
|
61
|
+
|
|
62
|
+
/** @default true */
|
|
63
|
+
h2: boolean,
|
|
64
|
+
|
|
65
|
+
/** @default true */
|
|
66
|
+
h3: boolean,
|
|
67
|
+
|
|
68
|
+
/** @default true */
|
|
69
|
+
h4: boolean,
|
|
70
|
+
|
|
71
|
+
/** @default false */
|
|
72
|
+
h5: boolean,
|
|
73
|
+
|
|
74
|
+
/** @default false */
|
|
75
|
+
h6: boolean,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
/** @default false */
|
|
80
|
+
keepComments: boolean,
|
|
81
|
+
|
|
82
|
+
components: {
|
|
83
|
+
/** @default true */
|
|
84
|
+
prose: boolean,
|
|
85
|
+
|
|
86
|
+
map: any,
|
|
87
|
+
},
|
|
88
|
+
}
|
|
89
|
+
}
|
|
6
90
|
|
|
7
91
|
|
|
8
92
|
export type { DefaultHighlightLangs, default } from './module.js'
|
package/dist/types.d.ts
CHANGED
|
@@ -2,7 +2,91 @@
|
|
|
2
2
|
import type { } from './module'
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
declare module '@nuxt/schema' {
|
|
6
|
+
export interface ModuleOptions {
|
|
7
|
+
remarkPlugins: any,
|
|
5
8
|
|
|
9
|
+
rehypePlugins: any,
|
|
10
|
+
|
|
11
|
+
/** @default false */
|
|
12
|
+
highlight: boolean,
|
|
13
|
+
|
|
14
|
+
headings: {
|
|
15
|
+
anchorLinks: {
|
|
16
|
+
/** @default false */
|
|
17
|
+
h1: boolean,
|
|
18
|
+
|
|
19
|
+
/** @default true */
|
|
20
|
+
h2: boolean,
|
|
21
|
+
|
|
22
|
+
/** @default true */
|
|
23
|
+
h3: boolean,
|
|
24
|
+
|
|
25
|
+
/** @default true */
|
|
26
|
+
h4: boolean,
|
|
27
|
+
|
|
28
|
+
/** @default false */
|
|
29
|
+
h5: boolean,
|
|
30
|
+
|
|
31
|
+
/** @default false */
|
|
32
|
+
h6: boolean,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
/** @default false */
|
|
37
|
+
keepComments: boolean,
|
|
38
|
+
|
|
39
|
+
components: {
|
|
40
|
+
/** @default true */
|
|
41
|
+
prose: boolean,
|
|
42
|
+
|
|
43
|
+
map: any,
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
declare module 'nuxt/schema' {
|
|
49
|
+
export interface ModuleOptions {
|
|
50
|
+
remarkPlugins: any,
|
|
51
|
+
|
|
52
|
+
rehypePlugins: any,
|
|
53
|
+
|
|
54
|
+
/** @default false */
|
|
55
|
+
highlight: boolean,
|
|
56
|
+
|
|
57
|
+
headings: {
|
|
58
|
+
anchorLinks: {
|
|
59
|
+
/** @default false */
|
|
60
|
+
h1: boolean,
|
|
61
|
+
|
|
62
|
+
/** @default true */
|
|
63
|
+
h2: boolean,
|
|
64
|
+
|
|
65
|
+
/** @default true */
|
|
66
|
+
h3: boolean,
|
|
67
|
+
|
|
68
|
+
/** @default true */
|
|
69
|
+
h4: boolean,
|
|
70
|
+
|
|
71
|
+
/** @default false */
|
|
72
|
+
h5: boolean,
|
|
73
|
+
|
|
74
|
+
/** @default false */
|
|
75
|
+
h6: boolean,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
/** @default false */
|
|
80
|
+
keepComments: boolean,
|
|
81
|
+
|
|
82
|
+
components: {
|
|
83
|
+
/** @default true */
|
|
84
|
+
prose: boolean,
|
|
85
|
+
|
|
86
|
+
map: any,
|
|
87
|
+
},
|
|
88
|
+
}
|
|
89
|
+
}
|
|
6
90
|
|
|
7
91
|
|
|
8
92
|
export type { DefaultHighlightLangs, default } from './module'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxtjs/mdc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Nuxt MDC module",
|
|
5
5
|
"repository": "nuxt-modules/mdc",
|
|
6
6
|
"license": "MIT",
|
|
@@ -66,23 +66,24 @@
|
|
|
66
66
|
"dev:docs": "nuxi dev docs",
|
|
67
67
|
"release": "release-it",
|
|
68
68
|
"lint": "eslint .",
|
|
69
|
+
"typecheck": "nuxt typecheck",
|
|
69
70
|
"test": "vitest run",
|
|
70
71
|
"test:watch": "vitest watch"
|
|
71
72
|
},
|
|
72
73
|
"dependencies": {
|
|
73
74
|
"@nuxt/kit": "^3.11.2",
|
|
74
|
-
"@shikijs/transformers": "^1.3
|
|
75
|
+
"@shikijs/transformers": "^1.6.3",
|
|
75
76
|
"@types/hast": "^3.0.4",
|
|
76
|
-
"@types/mdast": "^4.0.
|
|
77
|
-
"@vue/compiler-core": "^3.4.
|
|
77
|
+
"@types/mdast": "^4.0.4",
|
|
78
|
+
"@vue/compiler-core": "^3.4.27",
|
|
78
79
|
"consola": "^3.2.3",
|
|
79
|
-
"debug": "^4.3.
|
|
80
|
+
"debug": "^4.3.5",
|
|
80
81
|
"defu": "^6.1.4",
|
|
81
82
|
"destr": "^2.0.3",
|
|
82
83
|
"detab": "^3.0.2",
|
|
83
84
|
"github-slugger": "^2.0.0",
|
|
84
85
|
"hast-util-to-string": "^3.0.0",
|
|
85
|
-
"mdast-util-to-hast": "^13.
|
|
86
|
+
"mdast-util-to-hast": "^13.2.0",
|
|
86
87
|
"micromark-util-sanitize-uri": "^2.0.0",
|
|
87
88
|
"ohash": "^1.1.3",
|
|
88
89
|
"parse5": "^7.1.2",
|
|
@@ -93,13 +94,13 @@
|
|
|
93
94
|
"rehype-slug": "^6.0.0",
|
|
94
95
|
"rehype-sort-attribute-values": "^5.0.0",
|
|
95
96
|
"rehype-sort-attributes": "^5.0.0",
|
|
96
|
-
"remark-emoji": "^
|
|
97
|
+
"remark-emoji": "^5.0.0",
|
|
97
98
|
"remark-gfm": "^4.0.0",
|
|
98
|
-
"remark-mdc": "^3.2.
|
|
99
|
+
"remark-mdc": "^3.2.1",
|
|
99
100
|
"remark-parse": "^11.0.0",
|
|
100
101
|
"remark-rehype": "^11.1.0",
|
|
101
102
|
"scule": "^1.3.0",
|
|
102
|
-
"shiki": "^1.3
|
|
103
|
+
"shiki": "^1.6.3",
|
|
103
104
|
"ufo": "^1.5.3",
|
|
104
105
|
"unified": "^11.0.4",
|
|
105
106
|
"unist-builder": "^4.0.0",
|
|
@@ -108,19 +109,20 @@
|
|
|
108
109
|
},
|
|
109
110
|
"devDependencies": {
|
|
110
111
|
"@nuxt/devtools": "latest",
|
|
111
|
-
"@nuxt/eslint-config": "^0.3.
|
|
112
|
-
"@nuxt/module-builder": "^0.
|
|
112
|
+
"@nuxt/eslint-config": "^0.3.13",
|
|
113
|
+
"@nuxt/module-builder": "^0.7.0",
|
|
113
114
|
"@nuxt/schema": "^3.11.2",
|
|
114
|
-
"@nuxt/test-utils": "^3.
|
|
115
|
-
"@nuxt/ui": "^2.
|
|
116
|
-
"@types/
|
|
117
|
-
"@types/node": "^20.12.7",
|
|
115
|
+
"@nuxt/test-utils": "^3.13.1",
|
|
116
|
+
"@nuxt/ui": "^2.16.0",
|
|
117
|
+
"@types/node": "^20.14.2",
|
|
118
118
|
"changelogen": "^0.5.5",
|
|
119
|
-
"eslint": "^9.
|
|
119
|
+
"eslint": "^9.4.0",
|
|
120
120
|
"nuxt": "^3.11.2",
|
|
121
121
|
"rehype": "^13.0.1",
|
|
122
|
-
"release-it": "^17.
|
|
123
|
-
"
|
|
122
|
+
"release-it": "^17.3.0",
|
|
123
|
+
"typescript": "^5.4.5",
|
|
124
|
+
"vitest": "^1.6.0",
|
|
125
|
+
"vue-tsc": "^2.0.19"
|
|
124
126
|
},
|
|
125
127
|
"release-it": {
|
|
126
128
|
"git": {
|
package/dist/runtime/index.mjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import emphasis from "./emphasis.mjs";
|
|
2
|
-
import code from "./code.mjs";
|
|
3
|
-
import html from "./html.mjs";
|
|
4
|
-
import link from "./link.mjs";
|
|
5
|
-
import list from "./list.mjs";
|
|
6
|
-
import paragraph from "./paragraph.mjs";
|
|
7
|
-
import image from "./image.mjs";
|
|
8
|
-
import strong from "./strong.mjs";
|
|
9
|
-
import inlineCode from "./inlineCode.mjs";
|
|
10
|
-
import containerComponent from "./containerComponent.mjs";
|
|
11
|
-
export default {
|
|
12
|
-
emphasis,
|
|
13
|
-
code,
|
|
14
|
-
link,
|
|
15
|
-
paragraph,
|
|
16
|
-
html,
|
|
17
|
-
list,
|
|
18
|
-
image,
|
|
19
|
-
strong,
|
|
20
|
-
inlineCode,
|
|
21
|
-
containerComponent
|
|
22
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { BuiltinTheme } from 'shiki';
|
|
2
|
-
|
|
3
|
-
type MdcThemeOptions = BuiltinTheme | string | Record<string, BuiltinTheme | string>;
|
|
4
|
-
interface HighlighterOptions {
|
|
5
|
-
highlights?: number[];
|
|
6
|
-
meta?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type { HighlighterOptions as H, MdcThemeOptions as M };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { BuiltinTheme } from 'shiki';
|
|
2
|
-
|
|
3
|
-
type MdcThemeOptions = BuiltinTheme | string | Record<string, BuiltinTheme | string>;
|
|
4
|
-
interface HighlighterOptions {
|
|
5
|
-
highlights?: number[];
|
|
6
|
-
meta?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type { HighlighterOptions as H, MdcThemeOptions as M };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|