diff --git a/web/lukegbcom/lib/posts.js b/web/lukegbcom/lib/posts.js index add6a4f1a1..996d8f75b1 100644 --- a/web/lukegbcom/lib/posts.js +++ b/web/lukegbcom/lib/posts.js @@ -1,21 +1,28 @@ + import fs from 'fs' import path from 'path' import matter from 'gray-matter' -import { unified } from 'unified' -import remarkParse from 'remark-parse' import remarkGfm from 'remark-gfm' -import remarkRehype from 'remark-rehype' import rehypeHighlight from 'rehype-highlight' -import rehypeStringify from 'rehype-stringify' +import rehypeSlug from 'rehype-slug' +import remarkToc from 'remark-toc' + +import nix from 'highlight.js/lib/languages/nix' const fsPromises = fs.promises const postsDirectory = path.join(process.cwd(), 'posts') export const mdxOptions = { - remarkPlugins: [remarkGfm], - rehypePlugins: [rehypeHighlight], + remarkPlugins: [ + remarkGfm, + [remarkToc, {tight: true}], + ], + rehypePlugins: [ + [rehypeHighlight, {languages: {nix}}], + rehypeSlug, + ], }; export async function getPostSlugs() {