Skip to content

Commit

Permalink
Simplify code highlighting configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
metaboulie committed Dec 27, 2024
1 parent 4c10d56 commit 48d499a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"prettier": "^3.3.2",
"prettier-plugin-svelte": "^3.2.6",
"prettier-plugin-tailwindcss": "^0.6.5",
"shiki": "^0.14.7",
"svelte": "^5.0.0",
"svelte-check": "^4.0.0",
"tailwindcss": "^3.4.9",
Expand Down
10 changes: 3 additions & 7 deletions svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import { mdsvex } from 'mdsvex';
import { getHighlighter } from 'shiki';

const shikiHighlighter = await getHighlighter({
theme: 'nord'
});

/** @type {import('@sveltejs/kit').Config} */
const config = {
Expand All @@ -16,8 +11,9 @@ const config = {
mdsvex({
extensions: ['.md', '.svx'],
highlight: {
highlighter(code, lang) {
return shikiHighlighter.codeToHtml(code, { lang });
highlighter(code, lang = 'text') {
const html = `<pre class="language-${lang}"><code>${code}</code></pre>`;
return html;
}
}
})
Expand Down

0 comments on commit 48d499a

Please sign in to comment.