Skip to content

Commit 85212b6

Browse files
Merge pull request #213 from FormidableLabs/fix/child-prop-spreading
Fixed undefined themes causing a runtime error.
2 parents b17967a + a9a5a73 commit 85212b6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.changeset/old-chicken-turn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"prism-react-renderer": patch
3+
---
4+
5+
Fixed bug where an undefined theme would cause a runtime error.

packages/prism-react-renderer/src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import { HighlightProps, PrismLib } from "./types"
1010
*/
1111
const Highlight = (props: HighlightProps) =>
1212
createElement(InternalHighlight, {
13-
prism: Prism as PrismLib,
14-
theme: themes.vsDark,
1513
...props,
14+
prism: props.prism || (Prism as PrismLib),
15+
theme: props.theme || themes.vsDark,
16+
code: props.code,
17+
language: props.language,
1618
})
1719
export { Highlight, Prism, themes }

0 commit comments

Comments
 (0)