@nuxtjs/mdc 0.8.0 → 0.8.1

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 (45) hide show
  1. package/README.md +1 -1
  2. package/dist/config.d.mts +45 -1
  3. package/dist/config.d.ts +45 -1
  4. package/dist/module.d.mts +2 -2
  5. package/dist/module.d.ts +2 -2
  6. package/dist/module.json +2 -2
  7. package/dist/module.mjs +1 -1
  8. package/dist/runtime/components/MDC.vue +1 -1
  9. package/dist/runtime/components/MDCRenderer.vue.d.ts +1 -1
  10. package/dist/runtime/components/prose/ProseH1.vue +1 -1
  11. package/dist/runtime/components/prose/ProseH2.vue +1 -1
  12. package/dist/runtime/components/prose/ProseH3.vue +1 -1
  13. package/dist/runtime/components/prose/ProseH4.vue +1 -1
  14. package/dist/runtime/components/prose/ProseH5.vue +1 -1
  15. package/dist/runtime/components/prose/ProseH6.vue +1 -1
  16. package/dist/runtime/highlighter/rehype.d.ts +1 -1
  17. package/dist/runtime/highlighter/shiki.d.ts +2 -2
  18. package/dist/runtime/parser/compiler.d.ts +1 -1
  19. package/dist/runtime/parser/index.d.ts +1 -1
  20. package/dist/runtime/parser/options.d.ts +1 -1
  21. package/dist/runtime/parser/toc.d.ts +1 -1
  22. package/dist/runtime/parser/utils/plugins.d.ts +1 -1
  23. package/dist/runtime/utils/ast.d.ts +1 -1
  24. package/dist/runtime/utils/node.d.ts +1 -1
  25. package/dist/shared/mdc.a6f76af4.d.mts +9 -0
  26. package/dist/shared/mdc.a6f76af4.d.ts +9 -0
  27. package/dist/types.d.mts +7 -82
  28. package/dist/types.d.ts +7 -82
  29. package/package.json +12 -11
  30. package/dist/runtime/highlighter/types.d.ts +0 -14
  31. package/dist/runtime/highlighter/types.js +0 -0
  32. package/dist/runtime/types/config.d.ts +0 -44
  33. package/dist/runtime/types/config.js +0 -0
  34. package/dist/runtime/types/hast.d.ts +0 -255
  35. package/dist/runtime/types/hast.js +0 -0
  36. package/dist/runtime/types/index.d.ts +0 -3
  37. package/dist/runtime/types/index.js +0 -3
  38. package/dist/runtime/types/parser.d.ts +0 -41
  39. package/dist/runtime/types/parser.js +0 -0
  40. package/dist/runtime/types/toc.d.ts +0 -12
  41. package/dist/runtime/types/toc.js +0 -0
  42. package/dist/runtime/types/tree.d.ts +0 -23
  43. package/dist/runtime/types/tree.js +0 -0
  44. package/dist/runtime/types/unist.d.ts +0 -107
  45. package/dist/runtime/types/unist.js +0 -0
package/README.md CHANGED
@@ -367,7 +367,7 @@ Now import the `useMarkdownParser` composable we just created along with an expo
367
367
  import { onBeforeMount, ref, watch } from 'vue'
368
368
  // Import package exports
369
369
  import MDCRenderer from '@nuxtjs/mdc/runtime/components/MDCRenderer.vue'
370
- import type { MDCParserResult } from '@nuxtjs/mdc/runtime/types/index'
370
+ import type { MDCParserResult } from '@nuxtjs/mdc'
371
371
  import useMarkdownParser from './composables/useMarkdownParser';
372
372
 
373
373
  const md = ref(`
package/dist/config.d.mts CHANGED
@@ -1,4 +1,48 @@
1
- import { MdcConfig } from '../dist/runtime/types/config.js';
1
+ import { Highlighter, ShikiTransformer, HighlighterCore } from 'shiki';
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
+ }
2
46
 
3
47
  declare function defineConfig(config: MdcConfig): MdcConfig;
4
48
 
package/dist/config.d.ts CHANGED
@@ -1,4 +1,48 @@
1
- import { MdcConfig } from '../dist/runtime/types/config.js';
1
+ import { Highlighter, ShikiTransformer, HighlighterCore } from 'shiki';
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
+ }
2
46
 
3
47
  declare function defineConfig(config: MdcConfig): MdcConfig;
4
48
 
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 { MdcThemeOptions } from '../dist/runtime/highlighter/types.js';
3
+ import { M as MdcThemeOptions } from './shared/mdc.a6f76af4.mjs';
4
4
 
5
5
  interface UnistPlugin {
6
6
  src?: string;
@@ -101,4 +101,4 @@ declare module '@nuxt/schema' {
101
101
  }
102
102
  }
103
103
 
104
- export { DefaultHighlightLangs, _default as default };
104
+ export { DefaultHighlightLangs, type ModuleOptions, type UnistPlugin, _default as default };
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 { MdcThemeOptions } from '../dist/runtime/highlighter/types.js';
3
+ import { M as MdcThemeOptions } from './shared/mdc.a6f76af4.js';
4
4
 
5
5
  interface UnistPlugin {
6
6
  src?: string;
@@ -101,4 +101,4 @@ declare module '@nuxt/schema' {
101
101
  }
102
102
  }
103
103
 
104
- export { DefaultHighlightLangs, _default as default };
104
+ export { DefaultHighlightLangs, type ModuleOptions, type UnistPlugin, _default as default };
package/dist/module.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@nuxtjs/mdc",
3
3
  "configKey": "mdc",
4
- "version": "0.8.0",
4
+ "version": "0.8.1",
5
5
  "builder": {
6
- "@nuxt/module-builder": "0.7.0",
6
+ "@nuxt/module-builder": "0.7.1",
7
7
  "unbuild": "2.0.0"
8
8
  }
9
9
  }
package/dist/module.mjs CHANGED
@@ -297,7 +297,7 @@ const module = defineNuxtModule({
297
297
  filename: "mdc-highlighter.mjs",
298
298
  getContents: mdcHighlighter,
299
299
  options: {
300
- shikiPath: resolver.resolve("../dist/runtime/highlighter/shiki"),
300
+ shikiPath: resolver.resolve("../dist/runtime/highlighter/shiki.js"),
301
301
  options: options.highlight,
302
302
  useWasmAssets
303
303
  }
@@ -22,7 +22,7 @@ import { hash } from 'ohash'
22
22
  import { useAsyncData } from 'nuxt/app'
23
23
  import { watch, computed, type PropType } from 'vue'
24
24
  import { parseMarkdown } from '../parser'
25
- import type { MDCParseOptions } from '../types'
25
+ import type { MDCParseOptions } from '../../types'
26
26
 
27
27
  const props = defineProps({
28
28
  tag: {
@@ -1,5 +1,5 @@
1
1
  import type { PropType, DefineComponent } from 'vue';
2
- import type { MDCRoot } from '../types.js';
2
+ import type { MDCRoot } from '../../types.js';
3
3
  declare const _default: DefineComponent<{
4
4
  /**
5
5
  * Content to render
@@ -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 === true || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h1)))
19
+ const generate = computed(() => props.id && ((typeof headings?.anchorLinks === 'boolean' && 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 === true || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h2)))
19
+ const generate = computed(() => props.id && ((typeof headings?.anchorLinks === 'boolean' && 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 === true || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h3)))
19
+ const generate = computed(() => props.id && ((typeof headings?.anchorLinks === 'boolean' && 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 === true || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h4)))
19
+ const generate = computed(() => props.id && ((typeof headings?.anchorLinks === 'boolean' && 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 === true || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h5)))
19
+ const generate = computed(() => props.id && ((typeof headings?.anchorLinks === 'boolean' && 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 === true || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h6)))
19
+ const generate = computed(() => props.id && ((typeof headings?.anchorLinks === 'boolean' && headings?.anchorLinks === true) || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h6)))
20
20
  </script>
@@ -1,5 +1,5 @@
1
1
  import type { Root } from 'hast';
2
- import type { Highlighter, MdcThemeOptions } from './types.js';
2
+ import type { Highlighter, MdcThemeOptions } from '../../types/highlighter.js';
3
3
  export interface RehypeHighlightOption {
4
4
  theme?: MdcThemeOptions;
5
5
  highlighter?: Highlighter;
@@ -1,6 +1,6 @@
1
1
  import type { LanguageInput, ThemeInput } from 'shiki';
2
- import type { MdcConfig } from '../types/config.js';
3
- import type { Highlighter } from './types.js';
2
+ import type { MdcConfig } from '../../types/config.js';
3
+ import type { Highlighter } from '../../types/highlighter.js';
4
4
  export interface CreateShikiHighlighterOptions {
5
5
  themes?: ThemeInput[];
6
6
  langs?: LanguageInput[];
@@ -1,2 +1,2 @@
1
- import type { MDCParseOptions } from '../types.js';
1
+ import type { MDCParseOptions } from '../../types.js';
2
2
  export declare function compileHast(this: any, options?: MDCParseOptions): void;
@@ -1,4 +1,4 @@
1
- import type { MDCParseOptions, MDCParserResult, MDCRoot } from '../types.js';
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): {
@@ -1,2 +1,2 @@
1
- import type { MDCParseOptions } from '../types.js';
1
+ import type { MDCParseOptions } from '../../types.js';
2
2
  export declare const defaults: MDCParseOptions;
@@ -1,3 +1,3 @@
1
- import type { MDCNode, Toc, MDCElement, MDCRoot } from '../types.js';
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,2 +1,2 @@
1
- import type { MDCParseOptions } from '../../types.js';
1
+ import type { MDCParseOptions } from '../../../types.js';
2
2
  export declare const useProcessorPlugins: (processor: Processor, plugins?: Exclude<MDCParseOptions['rehype'] | MDCParseOptions['remark'], undefined>['plugins']) => Promise<void>;
@@ -1,4 +1,4 @@
1
- import type { MDCNode } from '../types.js';
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,5 +1,5 @@
1
1
  import type { VNode } from 'vue';
2
- import type { MDCElement, MDCNode } from '../types.js';
2
+ import type { MDCElement, MDCNode } from '../../types.js';
3
3
  /**
4
4
  * List of text nodes
5
5
  */
@@ -0,0 +1,9 @@
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 };
@@ -0,0 +1,9 @@
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 };
package/dist/types.d.mts CHANGED
@@ -1,92 +1,17 @@
1
1
 
2
- import type { } from './module.js'
2
+ import type { ModuleOptions } from './module.js'
3
3
 
4
4
 
5
- declare module '@nuxt/schema' {
6
- export interface ModuleOptions {
7
- remarkPlugins: any,
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
5
 
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
- }
6
+ declare module '@nuxt/schema' {
7
+ interface NuxtConfig { ['mdc']?: Partial<ModuleOptions> }
8
+ interface NuxtOptions { ['mdc']?: ModuleOptions }
46
9
  }
47
10
 
48
11
  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
- }
12
+ interface NuxtConfig { ['mdc']?: Partial<ModuleOptions> }
13
+ interface NuxtOptions { ['mdc']?: ModuleOptions }
89
14
  }
90
15
 
91
16
 
92
- export type { DefaultHighlightLangs, default } from './module.js'
17
+ export type { DefaultHighlightLangs, ModuleOptions, UnistPlugin, default } from './module.js'
package/dist/types.d.ts CHANGED
@@ -1,92 +1,17 @@
1
1
 
2
- import type { } from './module'
2
+ import type { ModuleOptions } from './module'
3
3
 
4
4
 
5
- declare module '@nuxt/schema' {
6
- export interface ModuleOptions {
7
- remarkPlugins: any,
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
5
 
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
- }
6
+ declare module '@nuxt/schema' {
7
+ interface NuxtConfig { ['mdc']?: Partial<ModuleOptions> }
8
+ interface NuxtOptions { ['mdc']?: ModuleOptions }
46
9
  }
47
10
 
48
11
  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
- }
12
+ interface NuxtConfig { ['mdc']?: Partial<ModuleOptions> }
13
+ interface NuxtOptions { ['mdc']?: ModuleOptions }
89
14
  }
90
15
 
91
16
 
92
- export type { DefaultHighlightLangs, default } from './module'
17
+ export type { DefaultHighlightLangs, ModuleOptions, UnistPlugin, default } from './module'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxtjs/mdc",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Nuxt MDC module",
5
5
  "repository": "nuxt-modules/mdc",
6
6
  "license": "MIT",
@@ -18,11 +18,11 @@
18
18
  },
19
19
  "./runtime": {
20
20
  "types": "./dist/runtime/index.d.ts",
21
- "import": "./dist/runtime/index.mjs"
21
+ "import": "./dist/runtime/index.js"
22
22
  },
23
23
  "./dist/runtime": {
24
24
  "types": "./dist/runtime/index.d.ts",
25
- "import": "./dist/runtime/index.mjs"
25
+ "import": "./dist/runtime/index.js"
26
26
  },
27
27
  "./runtime/components/*": {
28
28
  "types": "./dist/runtime/components/*.d.ts",
@@ -34,11 +34,11 @@
34
34
  },
35
35
  "./runtime/*": {
36
36
  "types": "./dist/runtime/*.d.ts",
37
- "import": "./dist/runtime/*.mjs"
37
+ "import": "./dist/runtime/*.js"
38
38
  },
39
39
  "./dist/runtime/*": {
40
40
  "types": "./dist/runtime/*.d.ts",
41
- "import": "./dist/runtime/*.mjs"
41
+ "import": "./dist/runtime/*.js"
42
42
  }
43
43
  },
44
44
  "main": "./dist/module.cjs",
@@ -71,8 +71,8 @@
71
71
  "test:watch": "vitest watch"
72
72
  },
73
73
  "dependencies": {
74
- "@nuxt/kit": "^3.11.2",
75
- "@shikijs/transformers": "^1.6.3",
74
+ "@nuxt/kit": "^3.12.1",
75
+ "@shikijs/transformers": "^1.6.4",
76
76
  "@types/hast": "^3.0.4",
77
77
  "@types/mdast": "^4.0.4",
78
78
  "@vue/compiler-core": "^3.4.27",
@@ -100,7 +100,7 @@
100
100
  "remark-parse": "^11.0.0",
101
101
  "remark-rehype": "^11.1.0",
102
102
  "scule": "^1.3.0",
103
- "shiki": "^1.6.3",
103
+ "shiki": "^1.6.4",
104
104
  "ufo": "^1.5.3",
105
105
  "unified": "^11.0.4",
106
106
  "unist-builder": "^4.0.0",
@@ -110,20 +110,21 @@
110
110
  "devDependencies": {
111
111
  "@nuxt/devtools": "latest",
112
112
  "@nuxt/eslint-config": "^0.3.13",
113
- "@nuxt/module-builder": "^0.7.0",
114
- "@nuxt/schema": "^3.11.2",
113
+ "@nuxt/module-builder": "^0.7.1",
114
+ "@nuxt/schema": "^3.12.1",
115
115
  "@nuxt/test-utils": "^3.13.1",
116
116
  "@nuxt/ui": "^2.16.0",
117
117
  "@types/node": "^20.14.2",
118
118
  "changelogen": "^0.5.5",
119
119
  "eslint": "^9.4.0",
120
- "nuxt": "^3.11.2",
120
+ "nuxt": "^3.12.1",
121
121
  "rehype": "^13.0.1",
122
122
  "release-it": "^17.3.0",
123
123
  "typescript": "^5.4.5",
124
124
  "vitest": "^1.6.0",
125
125
  "vue-tsc": "^2.0.19"
126
126
  },
127
+ "packageManager": "pnpm@9.3.0",
127
128
  "release-it": {
128
129
  "git": {
129
130
  "commitMessage": "chore(release): release v${version}"
@@ -1,14 +0,0 @@
1
- import type { ElementContent } from 'hast';
2
- import type { BuiltinTheme } from 'shiki';
3
- export type MdcThemeOptions = BuiltinTheme | string | Record<string, BuiltinTheme | string>;
4
- export interface HighlighterOptions {
5
- highlights?: number[];
6
- meta?: string;
7
- }
8
- export interface HighlightResult {
9
- tree: ElementContent[];
10
- className?: string;
11
- style?: string;
12
- inlineStyle?: string;
13
- }
14
- export type Highlighter = (code: string, lang: string, theme: MdcThemeOptions, options: Partial<HighlighterOptions>) => Promise<HighlightResult>;
File without changes
@@ -1,44 +0,0 @@
1
- import type { Highlighter, HighlighterCore, ShikiTransformer } from 'shiki';
2
- import type { Processor } from 'unified';
3
- import type { MdcThemeOptions, HighlighterOptions } from '../highlighter/types.js';
4
- export type Awaitable<T> = T | Promise<T>;
5
- export interface MdcConfig {
6
- /**
7
- * Hooks for the unified markdown pipeline
8
- */
9
- unified?: {
10
- /**
11
- * Custom setup for unified processor before other plugins
12
- */
13
- pre?: (processor: Processor) => Awaitable<void | Processor>;
14
- /**
15
- * Custom setup for unified processor after remark but before rehype
16
- */
17
- remark?: (processor: Processor) => Awaitable<void | Processor>;
18
- /**
19
- * Custom setup for unified processor after rehype
20
- */
21
- rehype?: (processor: Processor) => Awaitable<void | Processor>;
22
- /**
23
- * Custom setup for unified processor after all plugins
24
- */
25
- post?: (processor: Processor) => Awaitable<void | Processor>;
26
- };
27
- /**
28
- * Custom hightlighter, available when `highlighter` is set to `custom`
29
- */
30
- highlighter?: Highlighter;
31
- /**
32
- * Hooks for shiki
33
- */
34
- shiki?: {
35
- /**
36
- * Get transformers for shiki
37
- */
38
- transformers?: ShikiTransformer[] | ((code: string, lang: string, theme: MdcThemeOptions, options: Partial<HighlighterOptions>) => Awaitable<ShikiTransformer[]>);
39
- /**
40
- * Custom setup for shiki instance, only called once on server or client
41
- */
42
- setup?: (highlighter: HighlighterCore) => Awaitable<void>;
43
- };
44
- }
File without changes
@@ -1,255 +0,0 @@
1
- import type { Data as UnistData, Literal as UnistLiteral, Node as UnistNode, Parent as UnistParent } from './unist.js';
2
- /**
3
- * Info associated with hast nodes by the ecosystem.
4
- *
5
- * This space is guaranteed to never be specified by unist or hast.
6
- * But you can use it in utilities and plugins to store data.
7
- *
8
- * This type can be augmented to register custom data.
9
- * For example:
10
- *
11
- * ```ts
12
- * declare module 'hast' {
13
- * interface Data {
14
- * // `someNode.data.myId` is typed as `number | undefined`
15
- * myId?: number | undefined
16
- * }
17
- * }
18
- * ```
19
- */
20
- export interface Data extends UnistData {
21
- }
22
- /**
23
- * Info associated with an element.
24
- */
25
- export interface Properties {
26
- [PropertyName: string]: boolean | number | string | null | undefined | Array<string | number>;
27
- }
28
- /**
29
- * Union of registered hast nodes that can occur in {@link Element}.
30
- *
31
- * To register mote custom hast nodes, add them to {@link ElementContentMap}.
32
- * They will be automatically added here.
33
- */
34
- export type ElementContent = ElementContentMap[keyof ElementContentMap];
35
- /**
36
- * Registry of all hast nodes that can occur as children of {@link Element}.
37
- *
38
- * For a union of all {@link Element} children, see {@link ElementContent}.
39
- */
40
- export interface ElementContentMap {
41
- comment: Comment;
42
- element: Element;
43
- text: Text;
44
- }
45
- /**
46
- * Union of registered hast nodes that can occur in {@link Root}.
47
- *
48
- * To register custom hast nodes, add them to {@link RootContentMap}.
49
- * They will be automatically added here.
50
- */
51
- export type RootContent = RootContentMap[keyof RootContentMap];
52
- /**
53
- * Registry of all hast nodes that can occur as children of {@link Root}.
54
- *
55
- * > 👉 **Note**: {@link Root} does not need to be an entire document.
56
- * > it can also be a fragment.
57
- *
58
- * For a union of all {@link Root} children, see {@link RootContent}.
59
- */
60
- export interface RootContentMap {
61
- comment: Comment;
62
- doctype: Doctype;
63
- element: Element;
64
- text: Text;
65
- }
66
- /**
67
- * Union of registered hast nodes that can occur in {@link Root}.
68
- *
69
- * @deprecated Use {@link RootContent} instead.
70
- */
71
- export type Content = RootContent;
72
- /**
73
- * Union of registered hast literals.
74
- *
75
- * To register custom hast nodes, add them to {@link RootContentMap} and other
76
- * places where relevant.
77
- * They will be automatically added here.
78
- */
79
- export type Literals = Extract<Nodes, UnistLiteral>;
80
- /**
81
- * Union of registered hast nodes.
82
- *
83
- * To register custom hast nodes, add them to {@link RootContentMap} and other
84
- * places where relevant.
85
- * They will be automatically added here.
86
- */
87
- export type Nodes = Root | RootContent;
88
- /**
89
- * Union of registered hast parents.
90
- *
91
- * To register custom hast nodes, add them to {@link RootContentMap} and other
92
- * places where relevant.
93
- * They will be automatically added here.
94
- */
95
- export type Parents = Extract<Nodes, UnistParent>;
96
- /**
97
- * Abstract hast node.
98
- *
99
- * This interface is supposed to be extended.
100
- * If you can use {@link Literal} or {@link Parent}, you should.
101
- * But for example in HTML, a `Doctype` is neither literal nor parent, but
102
- * still a node.
103
- *
104
- * To register custom hast nodes, add them to {@link RootContentMap} and other
105
- * places where relevant (such as {@link ElementContentMap}).
106
- *
107
- * For a union of all registered hast nodes, see {@link Nodes}.
108
- */
109
- export interface Node extends UnistNode {
110
- /**
111
- * Info from the ecosystem.
112
- */
113
- data?: Data | undefined;
114
- }
115
- /**
116
- * Abstract hast node that contains the smallest possible value.
117
- *
118
- * This interface is supposed to be extended if you make custom hast nodes.
119
- *
120
- * For a union of all registered hast literals, see {@link Literals}.
121
- */
122
- export interface Literal extends Node {
123
- /**
124
- * Plain-text value.
125
- */
126
- value: string;
127
- }
128
- /**
129
- * Abstract hast node that contains other hast nodes (*children*).
130
- *
131
- * This interface is supposed to be extended if you make custom hast nodes.
132
- *
133
- * For a union of all registered hast parents, see {@link Parents}.
134
- */
135
- export interface Parent extends Node {
136
- /**
137
- * List of children.
138
- */
139
- children: RootContent[];
140
- }
141
- /**
142
- * HTML comment.
143
- */
144
- export interface Comment extends Literal {
145
- /**
146
- * Node type of HTML comments in hast.
147
- */
148
- type: 'comment';
149
- /**
150
- * Data associated with the comment.
151
- */
152
- data?: CommentData | undefined;
153
- }
154
- /**
155
- * Info associated with hast comments by the ecosystem.
156
- */
157
- export interface CommentData extends Data {
158
- }
159
- /**
160
- * HTML document type.
161
- */
162
- export interface Doctype extends UnistNode {
163
- /**
164
- * Node type of HTML document types in hast.
165
- */
166
- type: 'doctype';
167
- /**
168
- * Data associated with the doctype.
169
- */
170
- data?: DoctypeData | undefined;
171
- }
172
- /**
173
- * Info associated with hast doctypes by the ecosystem.
174
- */
175
- export interface DoctypeData extends Data {
176
- }
177
- /**
178
- * HTML element.
179
- */
180
- export interface Element extends Parent {
181
- /**
182
- * Node type of elements.
183
- */
184
- type: 'element';
185
- /**
186
- * Tag name (such as `'body'`) of the element.
187
- */
188
- tagName: string;
189
- /**
190
- * Info associated with the element.
191
- */
192
- properties: Properties;
193
- /**
194
- * Children of element.
195
- */
196
- children: ElementContent[];
197
- /**
198
- * When the `tagName` field is `'template'`, a `content` field can be
199
- * present.
200
- */
201
- content?: Root | undefined;
202
- /**
203
- * Data associated with the element.
204
- */
205
- data?: ElementData | undefined;
206
- }
207
- /**
208
- * Info associated with hast elements by the ecosystem.
209
- */
210
- export interface ElementData extends Data {
211
- }
212
- /**
213
- * Document fragment or a whole document.
214
- *
215
- * Should be used as the root of a tree and must not be used as a child.
216
- *
217
- * Can also be used as the value for the content field on a `'template'` element.
218
- */
219
- export interface Root extends Parent {
220
- /**
221
- * Node type of hast root.
222
- */
223
- type: 'root';
224
- /**
225
- * Children of root.
226
- */
227
- children: RootContent[];
228
- /**
229
- * Data associated with the hast root.
230
- */
231
- data?: RootData | undefined;
232
- }
233
- /**
234
- * Info associated with hast root nodes by the ecosystem.
235
- */
236
- export interface RootData extends Data {
237
- }
238
- /**
239
- * HTML character data (plain text).
240
- */
241
- export interface Text extends Literal {
242
- /**
243
- * Node type of HTML character data (plain text) in hast.
244
- */
245
- type: 'text';
246
- /**
247
- * Data associated with the text.
248
- */
249
- data?: TextData | undefined;
250
- }
251
- /**
252
- * Info associated with hast texts by the ecosystem.
253
- */
254
- export interface TextData extends Data {
255
- }
File without changes
@@ -1,3 +0,0 @@
1
- export * from './tree.js';
2
- export * from './parser.js';
3
- export * from './toc.js';
@@ -1,3 +0,0 @@
1
- export * from "./tree.js";
2
- export * from "./parser.js";
3
- export * from "./toc.js";
@@ -1,41 +0,0 @@
1
- import type { Options as RehypeOption } from 'remark-rehype';
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
- export interface RemarkPlugin {
7
- instance?: any;
8
- options?: Array<any> | Record<string, any>;
9
- }
10
- export interface RehypePlugin {
11
- instance?: any;
12
- options?: Array<any> | Record<string, any>;
13
- }
14
- export interface MDCParseOptions {
15
- remark?: {
16
- plugins?: Record<string, false | RemarkPlugin>;
17
- };
18
- rehype?: {
19
- options?: RehypeOption;
20
- plugins?: Record<string, false | RehypePlugin>;
21
- };
22
- highlight?: RehypeHighlightOption | false;
23
- toc?: {
24
- /**
25
- * Maximum heading depth to include in the table of contents.
26
- */
27
- depth?: number;
28
- searchDepth?: number;
29
- };
30
- keepComments?: boolean;
31
- /**
32
- * Inline mdc.config.ts
33
- */
34
- configs?: MdcConfig[];
35
- }
36
- export interface MDCParserResult {
37
- data: MDCData;
38
- body: MDCRoot;
39
- excerpt: MDCRoot | undefined;
40
- toc: Toc | undefined;
41
- }
File without changes
@@ -1,12 +0,0 @@
1
- export interface TocLink {
2
- id: string;
3
- text: string;
4
- depth: number;
5
- children?: TocLink[];
6
- }
7
- export interface Toc {
8
- title: string;
9
- depth: number;
10
- searchDepth: number;
11
- links: TocLink[];
12
- }
File without changes
@@ -1,23 +0,0 @@
1
- export type MDCText = {
2
- type: 'text';
3
- value: string;
4
- };
5
- export type MDCComment = {
6
- type: 'comment';
7
- value: string;
8
- };
9
- export type MDCElement = {
10
- type: 'element';
11
- tag: string;
12
- props: Record<string, any> | undefined;
13
- children: Array<MDCElement | MDCText | MDCComment>;
14
- };
15
- export type MDCNode = MDCElement | MDCText | MDCComment;
16
- export type MDCRoot = {
17
- type: 'root';
18
- children: Array<MDCNode>;
19
- };
20
- export interface MDCData extends Record<string, any> {
21
- title: string;
22
- description: string;
23
- }
File without changes
@@ -1,107 +0,0 @@
1
- /**
2
- * Info associated with nodes by the ecosystem.
3
- *
4
- * This space is guaranteed to never be specified by unist or specifications
5
- * implementing unist.
6
- * But you can use it in utilities and plugins to store data.
7
- *
8
- * This type can be augmented to register custom data.
9
- * For example:
10
- *
11
- * ```ts
12
- * declare module 'unist' {
13
- * interface Data {
14
- * // `someNode.data.myId` is typed as `number | undefined`
15
- * myId?: number | undefined
16
- * }
17
- * }
18
- * ```
19
- */
20
- export interface Data {
21
- }
22
- /**
23
- * One place in a source file.
24
- */
25
- export interface Point {
26
- /**
27
- * Line in a source file (1-indexed integer).
28
- */
29
- line: number;
30
- /**
31
- * Column in a source file (1-indexed integer).
32
- */
33
- column: number;
34
- /**
35
- * Character in a source file (0-indexed integer).
36
- */
37
- offset?: number | undefined;
38
- }
39
- /**
40
- * Position of a node in a source document.
41
- *
42
- * A position is a range between two points.
43
- */
44
- export interface Position {
45
- /**
46
- * Place of the first character of the parsed source region.
47
- */
48
- start: Point;
49
- /**
50
- * Place of the first character after the parsed source region.
51
- */
52
- end: Point;
53
- }
54
- /**
55
- * Abstract unist node that contains the smallest possible value.
56
- *
57
- * This interface is supposed to be extended.
58
- *
59
- * For example, in HTML, a `text` node is a leaf that contains text.
60
- */
61
- export interface Literal extends Node {
62
- /**
63
- * Plain value.
64
- */
65
- value: unknown;
66
- }
67
- /**
68
- * Abstract unist node.
69
- *
70
- * The syntactic unit in unist syntax trees are called nodes.
71
- *
72
- * This interface is supposed to be extended.
73
- * If you can use {@link Literal} or {@link Parent}, you should.
74
- * But for example in markdown, a `thematicBreak` (`***`), is neither literal
75
- * nor parent, but still a node.
76
- */
77
- export interface Node {
78
- /**
79
- * Node type.
80
- */
81
- type: string;
82
- /**
83
- * Info from the ecosystem.
84
- */
85
- data?: Data | undefined;
86
- /**
87
- * Position of a node in a source document.
88
- *
89
- * Nodes that are generated (not in the original source document) must not
90
- * have a position.
91
- */
92
- position?: Position | undefined;
93
- }
94
- /**
95
- * Abstract unist node that contains other nodes (*children*).
96
- *
97
- * This interface is supposed to be extended.
98
- *
99
- * For example, in XML, an element is a parent of different things, such as
100
- * comments, text, and further elements.
101
- */
102
- export interface Parent extends Node {
103
- /**
104
- * List of children.
105
- */
106
- children: Node[];
107
- }
File without changes