summaryrefslogtreecommitdiff
path: root/mdsvex.config.js
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-01-29 23:56:21 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-01-29 23:56:21 +0300
commit35556dca71eafdac4eb5d2fe781ba39687d0b058 (patch)
treed85489336dce549b08d385c45cec6ae0678b211b /mdsvex.config.js
parent292d9dd4241ace94bfaf50827dcedfbd40de8032 (diff)
initial commit
Diffstat (limited to 'mdsvex.config.js')
-rw-r--r--mdsvex.config.js22
1 files changed, 22 insertions, 0 deletions
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;