From 4a89a3fcf81304f28be99a44b2dd7a989191a24f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cst=C3=BCn=20=C3=96zg=C3=BCr?= Date: Wed, 17 May 2023 13:02:40 +0300 Subject: [PATCH 1/4] Fix broken links to supported languages in README.md --- README.md | 50 ++++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-) mode change 100755 => 100644 README.md diff --git a/README.md b/README.md old mode 100755 new mode 100644 index 91d25dd..64efa83 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ This library tokenises code using Prism and provides a small render-props-driven component to quickly render it out into React. This is why it even works with React Native! It's bundled with a modified version of Prism that won't pollute the global namespace and comes with -[a couple of common language syntaxes](./src/vendor/prism/includeLangs.js). +[a couple of common language syntaxes](./packages/generate-prism-languages/index.ts#L9-L23. _(There's also an [escape-hatch](https://github.com/FormidableLabs/prism-react-renderer#prism) to use your own Prism setup, just in case)_ @@ -35,28 +35,30 @@ _(If you just want to use your Prism CSS-file themes, that's also no problem)_ ## Table of Contents - - - -- [Installation](#installation) -- [Usage](#usage) -- [Custom Language Support](#custom-language-support) -- [Basic Props](#basic-props) - - [children](#children) - - [language](#language) - - [code](#code) -- [Advanced Props](#advanced-props) - - [theme](#theme) - - [Prism](#prism) -- [Children Function](#children-function) - - [state](#state) - - [prop getters](#prop-getters) - - [`getLineProps`](#getlineprops) - - [`getTokenProps`](#gettokenprops) -- [Theming](#theming) -- [LICENSE](#license) - - + + + + +- [Installation](#installation) + - [Usage](#usage) + - [Custom Language Support](#custom-language-support) +- [Basic Props](#basic-props) + - [children](#children) + - [language](#language) + - [code](#code) +- [Advanced Props](#advanced-props) + - [theme](#theme) + - [prism](#prism) +- [Children Function](#children-function) + - [state](#state) + - [prop getters](#prop-getters) + - [`getLineProps`](#getlineprops) + - [`getTokenProps`](#gettokenprops) +- [Theming](#theming) +- [LICENSE](#license) +- [Maintenance Status](#maintenance-status) + + ## Installation @@ -154,7 +156,7 @@ the section "[Children Function](#children-function)". > `string` | _required_ This is the language that your code will be highlighted as. You can see a list -of all languages that are supported out of the box [here](./src/vendor/prism/includeLangs.js). Not all languages are included and the list of languages that are currently is a little arbitrary. You can use the [escape-hatch](https://github.com/FormidableLabs/prism-react-renderer#prism) to use your own Prism setup, just in case, or [add more languages to the bundled Prism.](https://github.com/FormidableLabs/prism-react-renderer#faq) +of all languages that are supported out of the box [here](./packages/generate-prism-languages/index.ts#L9-L23). Not all languages are included and the list of languages that are currently is a little arbitrary. You can use the [escape-hatch](https://github.com/FormidableLabs/prism-react-renderer#prism) to use your own Prism setup, just in case, or [add more languages to the bundled Prism.](https://github.com/FormidableLabs/prism-react-renderer#faq) ### code From b9f51a191841e8c5d342346d4fb1fa6b8340cace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cst=C3=BCn=20=C3=96zg=C3=BCr?= Date: Wed, 17 May 2023 17:38:00 +0300 Subject: [PATCH 2/4] Fixup: Update README.md with correct link --- README.md | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 64efa83..e74dc85 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ This library tokenises code using Prism and provides a small render-props-driven component to quickly render it out into React. This is why it even works with React Native! It's bundled with a modified version of Prism that won't pollute the global namespace and comes with -[a couple of common language syntaxes](./packages/generate-prism-languages/index.ts#L9-L23. +[a couple of common language syntaxes](./packages/generate-prism-languages/index.ts#L9-L23). _(There's also an [escape-hatch](https://github.com/FormidableLabs/prism-react-renderer#prism) to use your own Prism setup, just in case)_ @@ -35,30 +35,30 @@ _(If you just want to use your Prism CSS-file themes, that's also no problem)_ ## Table of Contents - - - - -- [Installation](#installation) - - [Usage](#usage) - - [Custom Language Support](#custom-language-support) -- [Basic Props](#basic-props) - - [children](#children) - - [language](#language) - - [code](#code) -- [Advanced Props](#advanced-props) - - [theme](#theme) - - [prism](#prism) -- [Children Function](#children-function) - - [state](#state) - - [prop getters](#prop-getters) - - [`getLineProps`](#getlineprops) - - [`getTokenProps`](#gettokenprops) -- [Theming](#theming) -- [LICENSE](#license) -- [Maintenance Status](#maintenance-status) - - + + + + +- [Installation](#installation) + - [Usage](#usage) + - [Custom Language Support](#custom-language-support) +- [Basic Props](#basic-props) + - [children](#children) + - [language](#language) + - [code](#code) +- [Advanced Props](#advanced-props) + - [theme](#theme) + - [prism](#prism) +- [Children Function](#children-function) + - [state](#state) + - [prop getters](#prop-getters) + - [`getLineProps`](#getlineprops) + - [`getTokenProps`](#gettokenprops) +- [Theming](#theming) +- [LICENSE](#license) +- [Maintenance Status](#maintenance-status) + + ## Installation From a9a5a73d8d1fed02a2c16371a064998e0b387e10 Mon Sep 17 00:00:00 2001 From: Carlos Kelly Date: Thu, 8 Jun 2023 06:36:22 -0500 Subject: [PATCH 3/4] Fixed undefined themes causing a runtime error. --- .changeset/old-chicken-turn.md | 5 +++++ packages/prism-react-renderer/src/index.ts | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 .changeset/old-chicken-turn.md 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 } From 3acfb128cd7ea6801812dd08f07ae571210a2fc2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 8 Jun 2023 13:27:59 +0000 Subject: [PATCH 4/4] Version Packages --- .changeset/old-chicken-turn.md | 5 ----- packages/prism-react-renderer/CHANGELOG.md | 7 +++++++ packages/prism-react-renderer/package.json | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) delete mode 100644 .changeset/old-chicken-turn.md diff --git a/.changeset/old-chicken-turn.md b/.changeset/old-chicken-turn.md deleted file mode 100644 index 624ec6f..0000000 --- a/.changeset/old-chicken-turn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"prism-react-renderer": patch ---- - -Fixed bug where an undefined theme would cause a runtime error. diff --git a/packages/prism-react-renderer/CHANGELOG.md b/packages/prism-react-renderer/CHANGELOG.md index 4055b8c..373882d 100644 --- a/packages/prism-react-renderer/CHANGELOG.md +++ b/packages/prism-react-renderer/CHANGELOG.md @@ -1,5 +1,12 @@ # prism-react-renderer +## 2.0.5 + +### Patch Changes + +- Fixed bug where an undefined theme would cause a runtime error. + ([#213](https://github.com/FormidableLabs/prism-react-renderer/pull/213)) + ## 2.0.4 ### Patch Changes diff --git a/packages/prism-react-renderer/package.json b/packages/prism-react-renderer/package.json index 0d9c9cd..7f84d1e 100755 --- a/packages/prism-react-renderer/package.json +++ b/packages/prism-react-renderer/package.json @@ -1,6 +1,6 @@ { "name": "prism-react-renderer", - "version": "2.0.4", + "version": "2.0.5", "description": "Renders highlighted Prism output using React", "sideEffects": true, "main": "dist/index.js",