Restore the blog. Now fully working.

This commit is contained in:
2023-12-29 16:14:25 +01:00
parent 8654f2d00a
commit 7a3eaca067
21 changed files with 886 additions and 235 deletions

View File

@@ -1,12 +1,39 @@
// import adapter from '@sveltejs/adapter-auto';
import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/kit/vite';
import { mdsvex, escapeSvelte } from 'mdsvex';
import shiki from 'shiki';
import math from 'remark-math';
import rehype from 'remark-rehype';
//import rehypeMathjax from 'rehype-mathjax';
import rehypeKatex from 'rehype-katex';
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: vitePreprocess(),
preprocess: [
vitePreprocess(),
mdsvex({
extensions: ['.md', 'svx'],
layout: 'src/lib/blog/+post.svelte',
highlight: {
highlighter: async (code, lang = 'text') => {
const highlighter = await shiki.getHighlighter({ theme: 'dracula' });
const html = escapeSvelte(highlighter.codeToHtml(code, { lang }));
return `{@html \`${html}\` }`;
},
alias: {
js: 'javascript',
sh: 'bash',
glsl: 'glsl'
}
},
remarkPlugins: [[math, rehype]],
rehypePlugins: [[rehypeKatex]]
})
],
extensions: ['.svelte', '.md', '.svx'],
kit: {
adapter: adapter({