@nuxtjs/mdc 0.18.0 → 0.18.2

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 CHANGED
@@ -1,4 +1,4 @@
1
- export { d as defineConfig } from './shared/mdc.BkZUOs7X.mjs';
1
+ export { d as defineConfig } from './shared/mdc.CFljHne0.mjs';
2
2
  import 'shiki';
3
3
  import 'unified';
4
4
  import 'hast';
package/dist/module.d.mts CHANGED
@@ -1,10 +1,10 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
  import { BundledLanguage, LanguageRegistration, BundledTheme, ThemeRegistrationAny } from 'shiki';
3
3
  import { Options } from 'remark-rehype';
4
- import { R as RehypeHighlightOption, M as MdcConfig, a as MdcThemeOptions } from './shared/mdc.BkZUOs7X.mjs';
5
- export { A as Awaitable, b as HighlightResult, c as Highlighter, H as HighlighterOptions, d as defineConfig } from './shared/mdc.BkZUOs7X.mjs';
4
+ import { R as RehypeHighlightOption, M as MdcConfig, a as MdcThemeOptions } from './shared/mdc.CFljHne0.mjs';
5
+ export { A as Awaitable, b as HighlightResult, c as Highlighter, H as HighlighterOptions, d as defineConfig } from './shared/mdc.CFljHne0.mjs';
6
6
  import { Options as Options$1 } from 'remark-stringify';
7
- import { RemarkMDCOptions } from 'remark-mdc';
7
+ import { YamlToStringOptions, RemarkMDCOptions } from 'remark-mdc';
8
8
  import 'unified';
9
9
  import 'hast';
10
10
 
@@ -100,6 +100,9 @@ interface MDCParserResult {
100
100
  }
101
101
 
102
102
  interface MDCStringifyOptions {
103
+ frontMatter?: {
104
+ options?: YamlToStringOptions;
105
+ };
103
106
  plugins?: {
104
107
  remarkStringify?: {
105
108
  options?: Options$1;
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxtjs/mdc",
3
3
  "configKey": "mdc",
4
- "version": "0.18.0",
4
+ "version": "0.18.2",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -11,4 +11,4 @@ export interface CreateShikiHighlighterOptions {
11
11
  getMdcConfigs?: () => Promise<MdcConfig[]>;
12
12
  engine?: RegexEngine | Promise<RegexEngine>;
13
13
  }
14
- export declare function createShikiHighlighter({ langs, themes, bundledLangs, bundledThemes, getMdcConfigs, options: shikiOptions, engine }?: CreateShikiHighlighterOptions): Highlighter;
14
+ export declare function createShikiHighlighter({ langs, themes, bundledLangs, bundledThemes, getMdcConfigs, options: shikiOptions, engine, }?: CreateShikiHighlighterOptions): Highlighter;
@@ -23,7 +23,7 @@ export function createMarkdownStringifier(options = {}) {
23
23
  async function stringify2(value, data = {}) {
24
24
  const result = await processor.process({ value: JSON.stringify(value) });
25
25
  if (Object.keys(data).length) {
26
- return stringifyFrontMatter(data, result.value);
26
+ return stringifyFrontMatter(data, result.value, options.frontMatter?.options);
27
27
  }
28
28
  return result.value;
29
29
  }
@@ -119,7 +119,7 @@ const mdcRemarkNodeHandlers = {
119
119
  }
120
120
  };
121
121
  const mdcRemarkHandlers = {
122
- template: (state, node) => {
122
+ "template": (state, node) => {
123
123
  const vSlot = Object.keys(node.properties || {}).find((prop) => prop?.startsWith("v-slot:"))?.replace("v-slot:", "") || "default";
124
124
  const attributes = Object.fromEntries(Object.entries(node.properties || {}).filter(([key]) => !key.startsWith("v-slot:")));
125
125
  return {
@@ -129,7 +129,7 @@ const mdcRemarkHandlers = {
129
129
  children: state.toFlow(state.all(node))
130
130
  };
131
131
  },
132
- div: (state, node) => {
132
+ "div": (state, node) => {
133
133
  return {
134
134
  type: "containerComponent",
135
135
  name: "div",
@@ -137,7 +137,15 @@ const mdcRemarkHandlers = {
137
137
  children: state.toFlow(state.all(node))
138
138
  };
139
139
  },
140
- code: (state, node) => {
140
+ "ul": (state, node, parent) => {
141
+ const result = defaultHandlers.ul(state, node);
142
+ return parent?.tagName === "p" ? result : { type: "paragraph", children: [result] };
143
+ },
144
+ "ol": (state, node, parent) => {
145
+ const result = defaultHandlers.ol(state, node);
146
+ return parent?.tagName === "p" ? result : { type: "paragraph", children: [result] };
147
+ },
148
+ "code": (state, node) => {
141
149
  const attributes = { ...node.properties };
142
150
  if ("style" in attributes && !attributes.style) {
143
151
  delete attributes.style;
@@ -160,7 +168,7 @@ const mdcRemarkHandlers = {
160
168
  state.patch(node, result);
161
169
  return result;
162
170
  },
163
- pre: (_state, node) => {
171
+ "pre": (_state, node) => {
164
172
  const meta = [
165
173
  node.properties.filename ? `[${String(node.properties.filename).replace(/\]/g, "\\]")}]` : "",
166
174
  node.properties.highlights?.length ? `{${computeHighlightRanges(node.properties.highlights)}}` : "",
@@ -174,7 +182,7 @@ const mdcRemarkHandlers = {
174
182
  meta
175
183
  };
176
184
  },
177
- button: (state, node) => {
185
+ "button": (state, node) => {
178
186
  if (
179
187
  // @ts-expect-error: custom type
180
188
  node.children?.find((child) => child.type === mdcRemarkElementType) || node.children?.find((child) => child.type === "text" && child.value.includes("\n"))
@@ -188,14 +196,14 @@ const mdcRemarkHandlers = {
188
196
  }
189
197
  return createTextComponent("button")(state, node);
190
198
  },
191
- span: createTextComponent("span"),
192
- binding: createTextComponent("binding"),
193
- iframe: createTextComponent("iframe"),
194
- video: createTextComponent("video"),
199
+ "span": createTextComponent("span"),
200
+ "binding": createTextComponent("binding"),
201
+ "iframe": createTextComponent("iframe"),
202
+ "video": createTextComponent("video"),
195
203
  "nuxt-img": createTextComponent("nuxt-img"),
196
204
  "nuxt-picture": createTextComponent("nuxt-picture"),
197
- br: createTextComponent("br"),
198
- table: (state, node) => {
205
+ "br": createTextComponent("br"),
206
+ "table": (state, node) => {
199
207
  visit(node, (node2) => {
200
208
  if (node2.type === mdcRemarkElementType) {
201
209
  node2.type = "element";
@@ -210,7 +218,7 @@ const mdcRemarkHandlers = {
210
218
  }
211
219
  return defaultHandlers.table(state, node);
212
220
  },
213
- img: (state, node) => {
221
+ "img": (state, node) => {
214
222
  const { src, title, alt, ...attributes } = node.properties || {};
215
223
  const result = {
216
224
  type: "image",
@@ -222,12 +230,12 @@ const mdcRemarkHandlers = {
222
230
  state.patch(node, result);
223
231
  return result;
224
232
  },
225
- em: (state, node) => {
233
+ "em": (state, node) => {
226
234
  const result = { type: "emphasis", children: state.all(node), attributes: node.properties };
227
235
  state.patch(node, result);
228
236
  return result;
229
237
  },
230
- strong: (state, node) => {
238
+ "strong": (state, node) => {
231
239
  const result = { type: "strong", children: state.all(node), attributes: node.properties };
232
240
  state.patch(node, result);
233
241
  return result;
@@ -28,19 +28,19 @@ interface MdcConfig {
28
28
  /**
29
29
  * Custom setup for unified processor before other plugins
30
30
  */
31
- pre?: (processor: Processor) => Awaitable<void | Processor>;
31
+ pre?: (processor: Processor) => Awaitable<undefined | Processor>;
32
32
  /**
33
33
  * Custom setup for unified processor after remark but before rehype
34
34
  */
35
- remark?: (processor: Processor) => Awaitable<void | Processor>;
35
+ remark?: (processor: Processor) => Awaitable<undefined | Processor>;
36
36
  /**
37
37
  * Custom setup for unified processor after rehype
38
38
  */
39
- rehype?: (processor: Processor) => Awaitable<void | Processor>;
39
+ rehype?: (processor: Processor) => Awaitable<undefined | Processor>;
40
40
  /**
41
41
  * Custom setup for unified processor after all plugins
42
42
  */
43
- post?: (processor: Processor) => Awaitable<void | Processor>;
43
+ post?: (processor: Processor) => Awaitable<undefined | Processor>;
44
44
  };
45
45
  /**
46
46
  * Custom hightlighter, available when `highlighter` is set to `custom`
package/dist/types.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { type Awaitable, type HighlightResult, type Highlighter, type HighlighterOptions, type defineConfig } from './shared/mdc.BkZUOs7X.mjs'
1
+ export { type Awaitable, type HighlightResult, type Highlighter, type HighlighterOptions, type defineConfig } from './shared/mdc.CFljHne0.mjs'
2
2
 
3
3
  export { type DefaultHighlightLangs, type MdcConfig, type MdcThemeOptions, type RehypeHighlightOption, default } from './module.mjs'
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxtjs/mdc",
3
- "version": "0.18.0",
3
+ "version": "0.18.2",
4
4
  "description": "Nuxt MDC module",
5
5
  "repository": "nuxt-content/mdc",
6
6
  "license": "MIT",
@@ -68,11 +68,11 @@
68
68
  "verify": "npm run dev:prepare && npm run lint && npm run test && npm run typecheck"
69
69
  },
70
70
  "dependencies": {
71
- "@nuxt/kit": "^4.1.3",
72
- "@shikijs/core": "^3.13.0",
73
- "@shikijs/langs": "^3.13.0",
74
- "@shikijs/themes": "^3.13.0",
75
- "@shikijs/transformers": "^3.13.0",
71
+ "@nuxt/kit": "^4.2.0",
72
+ "@shikijs/core": "^3.14.0",
73
+ "@shikijs/langs": "^3.14.0",
74
+ "@shikijs/themes": "^3.14.0",
75
+ "@shikijs/transformers": "^3.14.0",
76
76
  "@types/hast": "^3.0.4",
77
77
  "@types/mdast": "^4.0.4",
78
78
  "@vue/compiler-core": "^3.5.22",
@@ -99,40 +99,40 @@
99
99
  "rehype-sort-attributes": "^5.0.1",
100
100
  "remark-emoji": "^5.0.2",
101
101
  "remark-gfm": "^4.0.1",
102
- "remark-mdc": "npm:remark-mdc-edge@3.6.0-29333381.8558577",
102
+ "remark-mdc": "^3.8.1",
103
103
  "remark-parse": "^11.0.0",
104
104
  "remark-rehype": "^11.1.2",
105
105
  "remark-stringify": "^11.0.0",
106
106
  "scule": "^1.3.0",
107
- "shiki": "^3.13.0",
107
+ "shiki": "^3.14.0",
108
108
  "ufo": "^1.6.1",
109
109
  "unified": "^11.0.5",
110
110
  "unist-builder": "^4.0.0",
111
111
  "unist-util-visit": "^5.0.0",
112
- "unwasm": "^0.3.11",
112
+ "unwasm": "^0.4.2",
113
113
  "vfile": "^6.0.3"
114
114
  },
115
115
  "devDependencies": {
116
- "@nuxt/devtools": "^2.6.5",
117
- "@nuxt/eslint-config": "^1.9.0",
116
+ "@nuxt/devtools": "^3.0.1",
117
+ "@nuxt/eslint-config": "^1.10.0",
118
118
  "@nuxt/module-builder": "^1.0.2",
119
- "@nuxt/schema": "^4.1.3",
120
- "@nuxt/test-utils": "^3.19.2",
121
- "@nuxt/ui": "^4.0.1",
119
+ "@nuxt/schema": "^4.2.0",
120
+ "@nuxt/test-utils": "^3.20.1",
121
+ "@nuxt/ui": "^4.1.0",
122
122
  "@nuxtjs/mdc": "link:.",
123
- "@types/node": "^24.7.0",
124
- "eslint": "^9.37.0",
125
- "nuxt": "^4.1.3",
123
+ "@types/node": "^24.10.0",
124
+ "eslint": "^9.39.1",
125
+ "nuxt": "^4.2.0",
126
126
  "rehype": "^13.0.2",
127
127
  "release-it": "^19.0.5",
128
128
  "typescript": "5.9.3",
129
- "vitest": "^3.2.4",
130
- "vue-tsc": "^3.1.1"
129
+ "vitest": "^4.0.6",
130
+ "vue-tsc": "^3.1.3"
131
131
  },
132
132
  "resolutions": {
133
133
  "@nuxtjs/mdc": "workspace:*"
134
134
  },
135
- "packageManager": "pnpm@10.18.1",
135
+ "packageManager": "pnpm@10.20.0",
136
136
  "release-it": {
137
137
  "git": {
138
138
  "commitMessage": "chore(release): release v${version}"