Skip to content

Commit

Permalink
Fixed undefined themes causing a runtime error.
Browse files Browse the repository at this point in the history
  • Loading branch information
carloskelly13 committed Jun 8, 2023
1 parent b17967a commit a9a5a73
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/old-chicken-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"prism-react-renderer": patch
---

Fixed bug where an undefined theme would cause a runtime error.
6 changes: 4 additions & 2 deletions packages/prism-react-renderer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import { HighlightProps, PrismLib } from "./types"
*/
const Highlight = (props: HighlightProps) =>
createElement(InternalHighlight, {
prism: Prism as PrismLib,
theme: themes.vsDark,
...props,
prism: props.prism || (Prism as PrismLib),
theme: props.theme || themes.vsDark,
code: props.code,
language: props.language,
})
export { Highlight, Prism, themes }

0 comments on commit a9a5a73

Please sign in to comment.