@nuxtjs/mdc
Version:
Nuxt MDC module
9 lines (8 loc) • 415 B
JavaScript
import { eventHandler, getQuery } from "h3";
export default eventHandler(async (event) => {
const { code, lang, theme: themeString, options: optionsStr } = getQuery(event);
const theme = JSON.parse(themeString);
const options = optionsStr ? JSON.parse(optionsStr) : {};
const highlighter = await import("#mdc-highlighter").then((m) => m.default);
return await highlighter(code, lang, theme, options);
});