@nuxtjs/mdc 0.8.2 → 0.9.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.
Files changed (39) hide show
  1. package/dist/config.d.mts +1 -3
  2. package/dist/config.d.ts +1 -3
  3. package/dist/config.mjs +5 -7
  4. package/dist/module.d.mts +14 -77
  5. package/dist/module.d.ts +14 -77
  6. package/dist/module.json +2 -2
  7. package/dist/module.mjs +2 -4
  8. package/dist/runtime/components/MDC.vue +1 -1
  9. package/dist/runtime/components/MDCRenderer.vue.d.ts +309 -6
  10. package/dist/runtime/components/MDCSlot.vue +1 -1
  11. package/dist/runtime/components/MDCSlot.vue.d.ts +6 -6
  12. package/dist/runtime/components/prose/ProseA.vue +3 -3
  13. package/dist/runtime/components/prose/ProseH1.vue +2 -2
  14. package/dist/runtime/components/prose/ProseH2.vue +3 -3
  15. package/dist/runtime/components/prose/ProseH3.vue +3 -3
  16. package/dist/runtime/components/prose/ProseH4.vue +3 -3
  17. package/dist/runtime/components/prose/ProseH5.vue +3 -3
  18. package/dist/runtime/components/prose/ProseH6.vue +3 -3
  19. package/dist/runtime/components/prose/ProseImg.vue +3 -3
  20. package/dist/runtime/highlighter/shiki.js +36 -20
  21. package/dist/runtime/index.d.ts +1 -1
  22. package/dist/runtime/parser/handlers/code.d.ts +1 -1
  23. package/dist/runtime/parser/handlers/containerComponent.d.ts +1 -1
  24. package/dist/runtime/parser/handlers/emphasis.d.ts +1 -1
  25. package/dist/runtime/parser/handlers/html.d.ts +1 -1
  26. package/dist/runtime/parser/handlers/image.d.ts +1 -1
  27. package/dist/runtime/parser/handlers/inlineCode.d.ts +1 -1
  28. package/dist/runtime/parser/handlers/link.d.ts +1 -1
  29. package/dist/runtime/parser/handlers/list.d.ts +1 -1
  30. package/dist/runtime/parser/handlers/paragraph.d.ts +1 -1
  31. package/dist/runtime/parser/handlers/strong.d.ts +1 -1
  32. package/dist/runtime/parser/index.d.ts +1 -1
  33. package/dist/runtime/parser/utils/plugins.d.ts +2 -1
  34. package/dist/runtime/utils/slot.d.ts +1 -1
  35. package/dist/shared/mdc.4762b8bc.d.mts +66 -0
  36. package/dist/shared/mdc.4762b8bc.d.ts +66 -0
  37. package/dist/types.d.mts +1 -17
  38. package/dist/types.d.ts +1 -17
  39. package/package.json +23 -23
@@ -1,2 +1,3 @@
1
+ import type { Processor } from 'remark-rehype/lib';
1
2
  import type { MDCParseOptions } from '@nuxtjs/mdc';
2
- export declare const useProcessorPlugins: (processor: Processor, plugins?: Exclude<MDCParseOptions['rehype'] | MDCParseOptions['remark'], undefined>['plugins']) => Promise<void>;
3
+ export declare const useProcessorPlugins: (processor: Processor, plugins?: Exclude<MDCParseOptions["rehype"] | MDCParseOptions["remark"], undefined>["plugins"]) => Promise<void>;
@@ -1,3 +1,3 @@
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, {
1
+ export declare const renderSlot: (slots: Record<string, any>, name: string, props: any, ...rest: any[]) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
2
2
  [key: string]: any;
3
3
  }>;
@@ -0,0 +1,66 @@
1
+ import { BuiltinTheme, Highlighter as Highlighter$1, ShikiTransformer, HighlighterCore } from 'shiki';
2
+ import { Processor } from 'unified';
3
+ import { ElementContent } from 'hast';
4
+
5
+ type MdcThemeOptions = BuiltinTheme | string | Record<string, BuiltinTheme | string>;
6
+ interface HighlighterOptions {
7
+ highlights?: number[];
8
+ meta?: string;
9
+ }
10
+ interface HighlightResult {
11
+ tree: ElementContent[];
12
+ className?: string;
13
+ style?: string;
14
+ inlineStyle?: string;
15
+ }
16
+ type Highlighter = (code: string, lang: string, theme: MdcThemeOptions, options: Partial<HighlighterOptions>) => Promise<HighlightResult>;
17
+ interface RehypeHighlightOption {
18
+ theme?: MdcThemeOptions;
19
+ highlighter?: Highlighter;
20
+ }
21
+
22
+ type Awaitable<T> = T | Promise<T>;
23
+ interface MdcConfig {
24
+ /**
25
+ * Hooks for the unified markdown pipeline
26
+ */
27
+ unified?: {
28
+ /**
29
+ * Custom setup for unified processor before other plugins
30
+ */
31
+ pre?: (processor: Processor) => Awaitable<void | Processor>;
32
+ /**
33
+ * Custom setup for unified processor after remark but before rehype
34
+ */
35
+ remark?: (processor: Processor) => Awaitable<void | Processor>;
36
+ /**
37
+ * Custom setup for unified processor after rehype
38
+ */
39
+ rehype?: (processor: Processor) => Awaitable<void | Processor>;
40
+ /**
41
+ * Custom setup for unified processor after all plugins
42
+ */
43
+ post?: (processor: Processor) => Awaitable<void | Processor>;
44
+ };
45
+ /**
46
+ * Custom hightlighter, available when `highlighter` is set to `custom`
47
+ */
48
+ highlighter?: Highlighter$1;
49
+ /**
50
+ * Hooks for shiki
51
+ */
52
+ shiki?: {
53
+ /**
54
+ * Get transformers for shiki
55
+ */
56
+ transformers?: ShikiTransformer[] | ((code: string, lang: string, theme: MdcThemeOptions, options: Partial<HighlighterOptions>) => Awaitable<ShikiTransformer[]>);
57
+ /**
58
+ * Custom setup for shiki instance, only called once on server or client
59
+ */
60
+ setup?: (highlighter: HighlighterCore) => Awaitable<void>;
61
+ };
62
+ }
63
+
64
+ declare function defineConfig(config: MdcConfig): MdcConfig;
65
+
66
+ export { type Awaitable as A, type HighlighterOptions as H, type MdcConfig as M, type RehypeHighlightOption as R, type MdcThemeOptions as a, type HighlightResult as b, type Highlighter as c, defineConfig as d };
@@ -0,0 +1,66 @@
1
+ import { BuiltinTheme, Highlighter as Highlighter$1, ShikiTransformer, HighlighterCore } from 'shiki';
2
+ import { Processor } from 'unified';
3
+ import { ElementContent } from 'hast';
4
+
5
+ type MdcThemeOptions = BuiltinTheme | string | Record<string, BuiltinTheme | string>;
6
+ interface HighlighterOptions {
7
+ highlights?: number[];
8
+ meta?: string;
9
+ }
10
+ interface HighlightResult {
11
+ tree: ElementContent[];
12
+ className?: string;
13
+ style?: string;
14
+ inlineStyle?: string;
15
+ }
16
+ type Highlighter = (code: string, lang: string, theme: MdcThemeOptions, options: Partial<HighlighterOptions>) => Promise<HighlightResult>;
17
+ interface RehypeHighlightOption {
18
+ theme?: MdcThemeOptions;
19
+ highlighter?: Highlighter;
20
+ }
21
+
22
+ type Awaitable<T> = T | Promise<T>;
23
+ interface MdcConfig {
24
+ /**
25
+ * Hooks for the unified markdown pipeline
26
+ */
27
+ unified?: {
28
+ /**
29
+ * Custom setup for unified processor before other plugins
30
+ */
31
+ pre?: (processor: Processor) => Awaitable<void | Processor>;
32
+ /**
33
+ * Custom setup for unified processor after remark but before rehype
34
+ */
35
+ remark?: (processor: Processor) => Awaitable<void | Processor>;
36
+ /**
37
+ * Custom setup for unified processor after rehype
38
+ */
39
+ rehype?: (processor: Processor) => Awaitable<void | Processor>;
40
+ /**
41
+ * Custom setup for unified processor after all plugins
42
+ */
43
+ post?: (processor: Processor) => Awaitable<void | Processor>;
44
+ };
45
+ /**
46
+ * Custom hightlighter, available when `highlighter` is set to `custom`
47
+ */
48
+ highlighter?: Highlighter$1;
49
+ /**
50
+ * Hooks for shiki
51
+ */
52
+ shiki?: {
53
+ /**
54
+ * Get transformers for shiki
55
+ */
56
+ transformers?: ShikiTransformer[] | ((code: string, lang: string, theme: MdcThemeOptions, options: Partial<HighlighterOptions>) => Awaitable<ShikiTransformer[]>);
57
+ /**
58
+ * Custom setup for shiki instance, only called once on server or client
59
+ */
60
+ setup?: (highlighter: HighlighterCore) => Awaitable<void>;
61
+ };
62
+ }
63
+
64
+ declare function defineConfig(config: MdcConfig): MdcConfig;
65
+
66
+ export { type Awaitable as A, type HighlighterOptions as H, type MdcConfig as M, type RehypeHighlightOption as R, type MdcThemeOptions as a, type HighlightResult as b, type Highlighter as c, defineConfig as d };
package/dist/types.d.mts CHANGED
@@ -1,17 +1 @@
1
-
2
- import type { ModuleOptions } from './module.js'
3
-
4
-
5
-
6
- declare module '@nuxt/schema' {
7
- interface NuxtConfig { ['mdc']?: Partial<ModuleOptions> }
8
- interface NuxtOptions { ['mdc']?: ModuleOptions }
9
- }
10
-
11
- declare module 'nuxt/schema' {
12
- interface NuxtConfig { ['mdc']?: Partial<ModuleOptions> }
13
- interface NuxtOptions { ['mdc']?: ModuleOptions }
14
- }
15
-
16
-
17
- export type { Awaitable, Comment, CommentData, Content, Data, DefaultHighlightLangs, Doctype, DoctypeData, Element, ElementContent, ElementContentMap, ElementData, HighlightResult, Highlighter, HighlighterOptions, Literal, Literals, MDCComment, MDCData, MDCElement, MDCNode, MDCParseOptions, MDCParserResult, MDCRoot, MDCText, MdcConfig, MdcThemeOptions, ModuleOptions, Node, Nodes, Parent, Parents, Properties, RehypeHighlightOption, RehypePlugin, RemarkPlugin, Root, RootContent, RootContentMap, RootData, Text, TextData, Toc, TocLink, UnistPlugin, default, defineConfig } from './module.js'
1
+ export { type Awaitable, type HighlightResult, type Highlighter, type HighlighterOptions, type defineConfig } from './module.js'
package/dist/types.d.ts CHANGED
@@ -1,17 +1 @@
1
-
2
- import type { ModuleOptions } from './module'
3
-
4
-
5
-
6
- declare module '@nuxt/schema' {
7
- interface NuxtConfig { ['mdc']?: Partial<ModuleOptions> }
8
- interface NuxtOptions { ['mdc']?: ModuleOptions }
9
- }
10
-
11
- declare module 'nuxt/schema' {
12
- interface NuxtConfig { ['mdc']?: Partial<ModuleOptions> }
13
- interface NuxtOptions { ['mdc']?: ModuleOptions }
14
- }
15
-
16
-
17
- export type { Awaitable, Comment, CommentData, Content, Data, DefaultHighlightLangs, Doctype, DoctypeData, Element, ElementContent, ElementContentMap, ElementData, HighlightResult, Highlighter, HighlighterOptions, Literal, Literals, MDCComment, MDCData, MDCElement, MDCNode, MDCParseOptions, MDCParserResult, MDCRoot, MDCText, MdcConfig, MdcThemeOptions, ModuleOptions, Node, Nodes, Parent, Parents, Properties, RehypeHighlightOption, RehypePlugin, RemarkPlugin, Root, RootContent, RootContentMap, RootData, Text, TextData, Toc, TocLink, UnistPlugin, default, defineConfig } from './module'
1
+ export { type Awaitable, type HighlightResult, type Highlighter, type HighlighterOptions, type defineConfig } from './module'
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nuxtjs/mdc",
3
- "version": "0.8.2",
3
+ "version": "0.9.0",
4
4
  "description": "Nuxt MDC module",
5
5
  "repository": "nuxt-modules/mdc",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "exports": {
9
9
  ".": {
10
- "types": "./dist/types.d.ts",
10
+ "types": "./dist/module.d.ts",
11
11
  "import": "./dist/module.mjs",
12
12
  "require": "./dist/module.cjs"
13
13
  },
@@ -71,13 +71,13 @@
71
71
  "test:watch": "vitest watch"
72
72
  },
73
73
  "dependencies": {
74
- "@nuxt/kit": "^3.12.1",
75
- "@shikijs/transformers": "^1.6.4",
74
+ "@nuxt/kit": "^3.13.1",
75
+ "@shikijs/transformers": "^1.17.0",
76
76
  "@types/hast": "^3.0.4",
77
77
  "@types/mdast": "^4.0.4",
78
- "@vue/compiler-core": "^3.4.28",
78
+ "@vue/compiler-core": "^3.5.4",
79
79
  "consola": "^3.2.3",
80
- "debug": "^4.3.5",
80
+ "debug": "^4.3.7",
81
81
  "defu": "^6.1.4",
82
82
  "destr": "^2.0.3",
83
83
  "detab": "^3.0.2",
@@ -94,38 +94,38 @@
94
94
  "rehype-slug": "^6.0.0",
95
95
  "rehype-sort-attribute-values": "^5.0.0",
96
96
  "rehype-sort-attributes": "^5.0.0",
97
- "remark-emoji": "^5.0.0",
97
+ "remark-emoji": "^5.0.1",
98
98
  "remark-gfm": "^4.0.0",
99
99
  "remark-mdc": "^3.2.1",
100
100
  "remark-parse": "^11.0.0",
101
101
  "remark-rehype": "^11.1.0",
102
102
  "scule": "^1.3.0",
103
- "shiki": "^1.6.4",
104
- "ufo": "^1.5.3",
105
- "unified": "^11.0.4",
103
+ "shiki": "^1.17.0",
104
+ "ufo": "^1.5.4",
105
+ "unified": "^11.0.5",
106
106
  "unist-builder": "^4.0.0",
107
107
  "unist-util-visit": "^5.0.0",
108
108
  "unwasm": "^0.3.9"
109
109
  },
110
110
  "devDependencies": {
111
111
  "@nuxt/devtools": "latest",
112
- "@nuxt/eslint-config": "^0.3.13",
113
- "@nuxt/module-builder": "^0.7.1",
114
- "@nuxt/schema": "^3.12.1",
115
- "@nuxt/test-utils": "^3.13.1",
116
- "@nuxt/ui": "^2.17.0",
112
+ "@nuxt/eslint-config": "^0.5.7",
113
+ "@nuxt/module-builder": "^0.8.4",
114
+ "@nuxt/schema": "^3.13.1",
115
+ "@nuxt/test-utils": "^3.14.2",
116
+ "@nuxt/ui": "^2.18.4",
117
117
  "@nuxtjs/mdc": "link:.",
118
- "@types/node": "^20.14.2",
118
+ "@types/node": "^22.5.4",
119
119
  "changelogen": "^0.5.5",
120
- "eslint": "^9.4.0",
121
- "nuxt": "^3.12.1",
120
+ "eslint": "^9.10.0",
121
+ "nuxt": "^3.13.1",
122
122
  "rehype": "^13.0.1",
123
- "release-it": "^17.3.0",
124
- "typescript": "^5.4.5",
125
- "vitest": "^1.6.0",
126
- "vue-tsc": "^2.0.19"
123
+ "release-it": "^17.6.0",
124
+ "typescript": "^5.6.2",
125
+ "vitest": "^2.0.5",
126
+ "vue-tsc": "^2.1.6"
127
127
  },
128
- "packageManager": "pnpm@9.3.0",
128
+ "packageManager": "pnpm@9.10.0",
129
129
  "release-it": {
130
130
  "git": {
131
131
  "commitMessage": "chore(release): release v${version}"