web/lukegbcom: install rehype-toc and rehype-slug, and add "nix" syntax highlighting
This commit is contained in:
parent
0991cea3c3
commit
7a74b23304
1 changed files with 13 additions and 6 deletions
|
@ -1,21 +1,28 @@
|
||||||
|
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
import matter from 'gray-matter'
|
import matter from 'gray-matter'
|
||||||
|
|
||||||
import { unified } from 'unified'
|
|
||||||
import remarkParse from 'remark-parse'
|
|
||||||
import remarkGfm from 'remark-gfm'
|
import remarkGfm from 'remark-gfm'
|
||||||
import remarkRehype from 'remark-rehype'
|
|
||||||
import rehypeHighlight from 'rehype-highlight'
|
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 fsPromises = fs.promises
|
||||||
const postsDirectory = path.join(process.cwd(), 'posts')
|
const postsDirectory = path.join(process.cwd(), 'posts')
|
||||||
|
|
||||||
export const mdxOptions = {
|
export const mdxOptions = {
|
||||||
remarkPlugins: [remarkGfm],
|
remarkPlugins: [
|
||||||
rehypePlugins: [rehypeHighlight],
|
remarkGfm,
|
||||||
|
[remarkToc, {tight: true}],
|
||||||
|
],
|
||||||
|
rehypePlugins: [
|
||||||
|
[rehypeHighlight, {languages: {nix}}],
|
||||||
|
rehypeSlug,
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function getPostSlugs() {
|
export async function getPostSlugs() {
|
||||||
|
|
Loading…
Reference in a new issue