From 6728ed2ccc90ec5aba73309f80ba3788e232b260 Mon Sep 17 00:00:00 2001 From: mattcroat Date: Sat, 10 Feb 2024 16:41:17 +0100 Subject: [PATCH] chore: Format code --- src/routes/[slug]/+page.ts | 2 +- svelte.config.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/routes/[slug]/+page.ts b/src/routes/[slug]/+page.ts index 8d39ab4..cf95295 100644 --- a/src/routes/[slug]/+page.ts +++ b/src/routes/[slug]/+page.ts @@ -9,6 +9,6 @@ export async function load({ params }) { meta: post.metadata } } catch (e) { - throw error(404, `Could not find ${params.slug}`) + error(404, `Could not find ${params.slug}`) } } diff --git a/svelte.config.js b/svelte.config.js index ea1a7a9..18ca672 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -2,7 +2,7 @@ import adapter from '@sveltejs/adapter-vercel' import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' import { mdsvex, escapeSvelte } from 'mdsvex' -import {getHighlighter } from 'shiki' +import { getHighlighter } from 'shiki' import remarkUnwrapImages from 'remark-unwrap-images' import remarkToc from 'remark-toc' import rehypeSlug from 'rehype-slug' @@ -15,13 +15,13 @@ const mdsvexOptions = { }, highlight: { highlighter: async (code, lang = 'text') => { - const highlighter = await getHighlighter({ - themes: ['poimandres'], - langs: ['javascript', 'typescript'] - }); - await highlighter.loadLanguage('javascript', 'typescript'); - const html = escapeSvelte(highlighter.codeToHtml(code, { lang, theme: 'poimandres' })); - return `{@html \`${html}\` }`; + const highlighter = await getHighlighter({ + themes: ['poimandres'], + langs: ['javascript', 'typescript'] + }) + await highlighter.loadLanguage('javascript', 'typescript') + const html = escapeSvelte(highlighter.codeToHtml(code, { lang, theme: 'poimandres' })) + return `{@html \`${html}\` }` } }, remarkPlugins: [remarkUnwrapImages, [remarkToc, { tight: true }]],