Skip to content

Commit

Permalink
Merge pull request #213 from FormidableLabs/fix/child-prop-spreading
Browse files Browse the repository at this point in the history
Fixed undefined themes causing a runtime error.
  • Loading branch information
carloskelly13 authored Jun 8, 2023
2 parents b17967a + a9a5a73 commit 85212b6
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 85212b6

Please sign in to comment.