From 35556dca71eafdac4eb5d2fe781ba39687d0b058 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Thu, 29 Jan 2026 23:56:21 +0300 Subject: initial commit --- mdsvex.config.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 mdsvex.config.js (limited to 'mdsvex.config.js') diff --git a/mdsvex.config.js b/mdsvex.config.js new file mode 100644 index 0000000..e936267 --- /dev/null +++ b/mdsvex.config.js @@ -0,0 +1,22 @@ +import { createHighlighter } from 'shiki'; + +const highlighter = await createHighlighter({ + themes: ['ayu-dark'], + langs: ['javascript', 'typescript', 'svelte', 'html', 'css', 'bash', 'json', 'yaml', 'markdown'] +}); + +/** @type {import('mdsvex').MdsvexOptions} */ +const mdsvexConfig = { + extensions: ['.svx'], + highlight: { + highlighter: async (code, lang) => { + const html = highlighter.codeToHtml(code, { + lang: lang || 'text', + theme: 'ayu-dark' + }); + return `{@html \`${html.replace(/[{}`]/g, (c) => `&#${c.charCodeAt(0)};`)}\`}`; + } + } +}; + +export default mdsvexConfig; -- cgit v1.2.3