Skip to content

Commit

Permalink
Update fence.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiodxa committed Jan 30, 2024
1 parent 1aca03a commit f1f85be
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/components/md/fence.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,14 @@ export function Fence({ children, language }: FenceProps) {
content = Prism.highlight(children, Prism.languages[language], language);
} catch (error) {
if (error instanceof Error && error.message.includes("has no grammar")) {
content = Prism.highlight(children, Prism.languages.plain, "plain");
try {
content = Prism.highlight(children, Prism.languages.plain, "plain");
} catch {
// ignore any error here
}
}

// ignore other errors
}

return (
Expand Down

0 comments on commit f1f85be

Please sign in to comment.