diff --git a/.changeset/old-chicken-turn.md b/.changeset/old-chicken-turn.md new file mode 100644 index 0000000..624ec6f --- /dev/null +++ b/.changeset/old-chicken-turn.md @@ -0,0 +1,5 @@ +--- +"prism-react-renderer": patch +--- + +Fixed bug where an undefined theme would cause a runtime error. diff --git a/packages/prism-react-renderer/src/index.ts b/packages/prism-react-renderer/src/index.ts index 16f4486..b1ef889 100644 --- a/packages/prism-react-renderer/src/index.ts +++ b/packages/prism-react-renderer/src/index.ts @@ -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 }