Skip to content

Commit

Permalink
Add custom highlighter for rehype-pretty-code
Browse files Browse the repository at this point in the history
To make rehype-pretty-code work properly, shiki files need to be
included in production environment on Vercel. By reading shiki files,
Vercel becomes aware that those files should be included.

vercel/next.js#52711 (comment)
  • Loading branch information
momori256 committed Sep 19, 2023
1 parent a411139 commit 421e605
Show file tree
Hide file tree
Showing 205 changed files with 259,974 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/mdToHtml.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import rehypeMermaid from "./rehypeMermaid";
import getHighlighter from "@/lib/shikiHilighter"

import { remark } from "remark";
import remarkGfm from "remark-gfm";
Expand Down Expand Up @@ -28,7 +29,7 @@ const mdToHtml: (md: string) => Promise<string> = async (md) => {
.use(rehypeSlug)
.use(rehypeAutolinkHeadings, { behavior: "wrap" })
.use(rehypeMermaid)
.use(rehypePrettyCode)
.use(rehypePrettyCode, { getHighlighter })
.use(rehypeStringify)
.process(md);
return result.toString();
Expand Down
378 changes: 378 additions & 0 deletions src/lib/shiki/languages/abap.tmLanguage.json

Large diffs are not rendered by default.

Loading

0 comments on commit 421e605

Please sign in to comment.