@nuxtjs/mdc
Advanced tools
Comparing version 0.9.0 to 0.9.1
@@ -126,2 +126,11 @@ import * as _nuxt_schema from '@nuxt/schema'; | ||
/** | ||
* Engine to be used for Shiki | ||
* | ||
* Note that the `javascript` engine still in experimental, use with caution. | ||
* | ||
* @see https://shiki.style/guide/regex-engines | ||
* @default 'oniguruma' | ||
*/ | ||
shikiEngine?: 'oniguruma' | 'javascript'; | ||
/** | ||
* Preloaded languages that will be available for highlighting code blocks. | ||
@@ -138,2 +147,3 @@ * | ||
wrapperStyle?: boolean | string; | ||
noApiRoute?: boolean; | ||
} | false; | ||
@@ -524,3 +534,2 @@ headings?: { | ||
headings: ModuleOptions['headings']; | ||
useNuxtImage?: boolean; | ||
}; | ||
@@ -527,0 +536,0 @@ } |
{ | ||
"name": "@nuxtjs/mdc", | ||
"configKey": "mdc", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"builder": { | ||
@@ -6,0 +6,0 @@ "@nuxt/module-builder": "0.8.4", |
@@ -19,3 +19,3 @@ import type { PropType, DefineComponent } from 'vue'; | ||
/** | ||
* Root tag to use for rendering | ||
* Class(es) to bind to the component | ||
*/ | ||
@@ -75,3 +75,3 @@ class: { | ||
/** | ||
* Root tag to use for rendering | ||
* Class(es) to bind to the component | ||
*/ | ||
@@ -78,0 +78,0 @@ class: { |
import { eventHandler, getQuery } from "h3"; | ||
import highlighter from "#mdc-highlighter"; | ||
export default eventHandler(async (event) => { | ||
@@ -7,3 +6,4 @@ const { code, lang, theme: themeString, options: optionsStr } = getQuery(event); | ||
const options = optionsStr ? JSON.parse(optionsStr) : {}; | ||
const highlighter = await import("#mdc-highlighter").then((m) => m.default); | ||
return await highlighter(code, lang, theme, options); | ||
}); |
@@ -1,2 +0,2 @@ | ||
import type { LanguageInput, ThemeInput } from 'shiki'; | ||
import type { LanguageInput, ThemeInput, RegexEngine } from 'shiki'; | ||
import type { MdcConfig, Highlighter } from '@nuxtjs/mdc'; | ||
@@ -12,3 +12,4 @@ export interface CreateShikiHighlighterOptions { | ||
getMdcConfigs?: () => Promise<MdcConfig[]>; | ||
engine?: RegexEngine | Promise<RegexEngine>; | ||
} | ||
export declare function createShikiHighlighter({ langs, themes, bundledLangs, bundledThemes, getMdcConfigs, options: shikiOptions }?: CreateShikiHighlighterOptions): Highlighter; | ||
export declare function createShikiHighlighter({ langs, themes, bundledLangs, bundledThemes, getMdcConfigs, options: shikiOptions, engine }?: CreateShikiHighlighterOptions): Highlighter; |
@@ -7,3 +7,4 @@ export function createShikiHighlighter({ | ||
getMdcConfigs, | ||
options: shikiOptions | ||
options: shikiOptions, | ||
engine | ||
} = {}) { | ||
@@ -18,3 +19,3 @@ let shiki; | ||
themes, | ||
loadWasm: () => import("shiki/wasm") | ||
engine | ||
}); | ||
@@ -70,3 +71,3 @@ for await (const config of await getConfigs()) { | ||
} | ||
const themesObject = typeof theme === "string" ? { default: theme } : theme || {}; | ||
const themesObject = { ...typeof theme === "string" ? { default: theme } : theme || {} }; | ||
const loadedThemes = shiki2.getLoadedThemes(); | ||
@@ -78,3 +79,3 @@ const loadedLanguages = shiki2.getLoadedLanguages(); | ||
} else { | ||
if (import.meta.dev) { | ||
if (process.dev) { | ||
console.warn(`[@nuxtjs/mdc] Language "${lang}" is not loaded to the Shiki highlighter, fallback to plain text. Add the language to "mdc.highlight.langs" to fix this.`); | ||
@@ -90,3 +91,3 @@ } | ||
} else { | ||
if (import.meta.dev) { | ||
if (process.dev) { | ||
console.warn(`[@nuxtjs/mdc] Theme "${theme2}" is not loaded to the Shiki highlighter. Add the theme to "mdc.highlight.themes" to fix this.`); | ||
@@ -93,0 +94,0 @@ } |
@@ -31,3 +31,3 @@ import { unified } from "unified"; | ||
if (inlineOptions.highlight != null && inlineOptions.highlight != false && inlineOptions.highlight.highlighter !== void 0 && typeof inlineOptions.highlight.highlighter !== "function") { | ||
if (import.meta.dev) | ||
if (process.dev) | ||
console.warn("[@nuxtjs/mdc] `highlighter` passed to `parseMarkdown` is should be a function, but got " + JSON.stringify(inlineOptions.highlight.highlighter) + ", ignored."); | ||
@@ -34,0 +34,0 @@ inlineOptions = { |
{ | ||
"name": "@nuxtjs/mdc", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "Nuxt MDC module", | ||
@@ -74,7 +74,7 @@ "repository": "nuxt-modules/mdc", | ||
"dependencies": { | ||
"@nuxt/kit": "^3.13.1", | ||
"@shikijs/transformers": "^1.17.0", | ||
"@nuxt/kit": "^3.13.2", | ||
"@shikijs/transformers": "^1.22.0", | ||
"@types/hast": "^3.0.4", | ||
"@types/mdast": "^4.0.4", | ||
"@vue/compiler-core": "^3.5.4", | ||
"@vue/compiler-core": "^3.5.12", | ||
"consola": "^3.2.3", | ||
@@ -86,7 +86,7 @@ "debug": "^4.3.7", | ||
"github-slugger": "^2.0.0", | ||
"hast-util-to-string": "^3.0.0", | ||
"hast-util-to-string": "^3.0.1", | ||
"mdast-util-to-hast": "^13.2.0", | ||
"micromark-util-sanitize-uri": "^2.0.0", | ||
"ohash": "^1.1.3", | ||
"parse5": "^7.1.2", | ||
"ohash": "^1.1.4", | ||
"parse5": "^7.2.0", | ||
"pathe": "^1.1.2", | ||
@@ -97,4 +97,4 @@ "property-information": "^6.5.0", | ||
"rehype-slug": "^6.0.0", | ||
"rehype-sort-attribute-values": "^5.0.0", | ||
"rehype-sort-attributes": "^5.0.0", | ||
"rehype-sort-attribute-values": "^5.0.1", | ||
"rehype-sort-attributes": "^5.0.1", | ||
"remark-emoji": "^5.0.1", | ||
@@ -104,5 +104,5 @@ "remark-gfm": "^4.0.0", | ||
"remark-parse": "^11.0.0", | ||
"remark-rehype": "^11.1.0", | ||
"remark-rehype": "^11.1.1", | ||
"scule": "^1.3.0", | ||
"shiki": "^1.17.0", | ||
"shiki": "^1.22.0", | ||
"ufo": "^1.5.4", | ||
@@ -116,19 +116,19 @@ "unified": "^11.0.5", | ||
"@nuxt/devtools": "latest", | ||
"@nuxt/eslint-config": "^0.5.7", | ||
"@nuxt/eslint-config": "^0.6.0", | ||
"@nuxt/module-builder": "^0.8.4", | ||
"@nuxt/schema": "^3.13.1", | ||
"@nuxt/test-utils": "^3.14.2", | ||
"@nuxt/ui": "^2.18.4", | ||
"@nuxt/schema": "^3.13.2", | ||
"@nuxt/test-utils": "^3.14.3", | ||
"@nuxt/ui": "^2.18.7", | ||
"@nuxtjs/mdc": "link:.", | ||
"@types/node": "^22.5.4", | ||
"changelogen": "^0.5.5", | ||
"eslint": "^9.10.0", | ||
"nuxt": "^3.13.1", | ||
"rehype": "^13.0.1", | ||
"release-it": "^17.6.0", | ||
"typescript": "^5.6.2", | ||
"vitest": "^2.0.5", | ||
"@types/node": "^22.7.5", | ||
"changelogen": "^0.5.7", | ||
"eslint": "^9.12.0", | ||
"nuxt": "^3.13.2", | ||
"rehype": "^13.0.2", | ||
"release-it": "^17.9.0", | ||
"typescript": "^5.6.3", | ||
"vitest": "^2.1.3", | ||
"vue-tsc": "^2.1.6" | ||
}, | ||
"packageManager": "pnpm@9.10.0", | ||
"packageManager": "pnpm@9.12.1", | ||
"release-it": { | ||
@@ -135,0 +135,0 @@ "git": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
150282
2809
Updated@nuxt/kit@^3.13.2
Updated@vue/compiler-core@^3.5.12
Updatedhast-util-to-string@^3.0.1
Updatedohash@^1.1.4
Updatedparse5@^7.2.0
Updatedremark-rehype@^11.1.1
Updatedshiki@^1.22.0