@nuxtjs/mdc 0.7.1 → 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 -1
- package/dist/config.d.ts +1 -1
- package/dist/module.d.mts +2 -2
- package/dist/module.d.ts +2 -2
- package/dist/module.json +2 -2
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/MDCRenderer.vue.d.ts +1 -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} +1 -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 -1
- 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 +16 -13
- 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/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
package/dist/config.d.ts
CHANGED
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 '
|
|
3
|
+
import { MdcThemeOptions } from '../dist/runtime/highlighter/types.js';
|
|
4
4
|
|
|
5
5
|
interface UnistPlugin {
|
|
6
6
|
src?: string;
|
|
@@ -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?: {
|
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 '
|
|
3
|
+
import { MdcThemeOptions } from '../dist/runtime/highlighter/types.js';
|
|
4
4
|
|
|
5
5
|
interface UnistPlugin {
|
|
6
6
|
src?: string;
|
|
@@ -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?: {
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -292,7 +292,7 @@ const module = defineNuxtModule({
|
|
|
292
292
|
options: { configs: mdcConfigs$1 }
|
|
293
293
|
});
|
|
294
294
|
const nitroPreset = nuxt.options.nitro.preset || process.env.NITRO_PRESET || process.env.SERVER_PRESET || "";
|
|
295
|
-
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));
|
|
296
296
|
registerTemplate({
|
|
297
297
|
filename: "mdc-highlighter.mjs",
|
|
298
298
|
getContents: mdcHighlighter,
|
|
@@ -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) {
|
|
@@ -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,2 +1,2 @@
|
|
|
1
|
-
import type { MDCParseOptions } from '../../types';
|
|
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,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.
|
|
75
|
+
"@shikijs/transformers": "^1.6.3",
|
|
75
76
|
"@types/hast": "^3.0.4",
|
|
76
77
|
"@types/mdast": "^4.0.4",
|
|
77
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
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.
|
|
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,18 +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.13.
|
|
115
|
+
"@nuxt/test-utils": "^3.13.1",
|
|
115
116
|
"@nuxt/ui": "^2.16.0",
|
|
116
|
-
"@types/node": "^20.
|
|
117
|
+
"@types/node": "^20.14.2",
|
|
117
118
|
"changelogen": "^0.5.5",
|
|
118
|
-
"eslint": "^9.
|
|
119
|
+
"eslint": "^9.4.0",
|
|
119
120
|
"nuxt": "^3.11.2",
|
|
120
121
|
"rehype": "^13.0.1",
|
|
121
|
-
"release-it": "^17.
|
|
122
|
-
"
|
|
122
|
+
"release-it": "^17.3.0",
|
|
123
|
+
"typescript": "^5.4.5",
|
|
124
|
+
"vitest": "^1.6.0",
|
|
125
|
+
"vue-tsc": "^2.0.19"
|
|
123
126
|
},
|
|
124
127
|
"release-it": {
|
|
125
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
|
-
};
|
|
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
|