diff --git a/mdsvex.config.js b/mdsvex.config.js index 1b19727f..7ef7a621 100644 --- a/mdsvex.config.js +++ b/mdsvex.config.js @@ -7,31 +7,34 @@ import { visit } from 'unist-util-visit' import { toString } from 'mdast-util-to-string' import { parse, join } from 'path' -const highlighter = async (code, lang) => `{@html \`${await shiki.getHighlighter({ theme: 'material-default' }).then(highlighter => - highlighter - .codeToHtml(code, { lang }) - .replace(/[{}`]/g, c => ({ '{': '{', '}': '}', '`': '`' }[c])) - .replace(/\\([trn])/g, '\$1') -)}\` }` +const highlighter = async (code, lang) => + `{@html \`${await shiki.getHighlighter({ theme: 'material-default' }).then(highlighter => + highlighter + .codeToHtml(code, { lang }) + .replace(/[{}`]/g, c => ({ '{': '{', '}': '}', '`': '`' }[c])) + .replace(/\\([trn])/g, '\$1') + )}\` }` -const remarkUraraFm = () => (tree, { data, filename }) => { - const filepath = filename.split('/src/routes')[1] - let { dir, name } = parse(filepath) - if (!data.fm) data.fm = {} - data.fm.slug = filepath - data.fm.path = join(dir, `/${name}`.replace('\/index', '').replace('\.svelte', '')) - if (data.fm?.toc !== false) { - let [slugs, toc] = [new Slugger(), []] - visit(tree, 'heading', node => { - toc.push({ - depth: node.depth, - title: toString(node), - slug: slugs.slug(toString(node)) +const remarkUraraFm = + () => + (tree, { data, filename }) => { + const filepath = filename.split('/src/routes')[1] + let { dir, name } = parse(filepath) + if (!data.fm) data.fm = {} + data.fm.slug = filepath + data.fm.path = join(dir, `/${name}`.replace('/index', '').replace('.svelte', '')) + if (data.fm?.toc !== false) { + let [slugs, toc] = [new Slugger(), []] + visit(tree, 'heading', node => { + toc.push({ + depth: node.depth, + title: toString(node), + slug: slugs.slug(toString(node)) + }) }) - }) - data.fm.toc = toc + data.fm.toc = toc + } } -} const remarkUraraSpoiler = () => tree => visit(tree, 'paragraph', node => { diff --git a/src/lib/components/footer.svelte b/src/lib/components/footer.svelte index b8b09b83..cf1e9308 100644 --- a/src/lib/components/footer.svelte +++ b/src/lib/components/footer.svelte @@ -5,7 +5,9 @@ export { className as class } -