Skip to content

Commit

Permalink
feat: enable syntax highlighting for all supported languages
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-2369 committed Feb 12, 2025
1 parent a7bfe67 commit 2dc2541
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/components/markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import RemarkBreaks from "remark-breaks";
import RehypeKatex from "rehype-katex";
import RemarkGfm from "remark-gfm";
import RehypeHighlight from "rehype-highlight";
import hljs from "highlight.js";
import { useRef, useState, RefObject, useEffect, useMemo } from "react";
import { copyToClipboard, useWindowSize } from "../utils";
import mermaid from "mermaid";
Expand Down Expand Up @@ -282,6 +283,14 @@ function _MarkDownContent(props: { content: string }) {
{
detect: false,
ignoreMissing: true,
languages: {
...hljs
.listLanguages()
.reduce((acc: Record<string, any>, lang) => {
acc[lang] = () => hljs.getLanguage(lang);
return acc;
}, {}),
},
},
],
]}
Expand Down

0 comments on commit 2dc2541

Please sign in to comment.