-
-
Notifications
You must be signed in to change notification settings - Fork 896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve README syntax highlight example #736
Conversation
@@ -354,14 +354,14 @@ ReactDom.render( | |||
const match = /language-(\w+)/.exec(className || '') | |||
return !inline && match ? ( | |||
<SyntaxHighlighter | |||
{...props} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to not even pass spread props at all.
Anyway, I'm not necessarily against it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there was something about SyntaxHighlighter
passing all other props through on the div
or so:
spread props pass arbitrary props to pre tag wrapping code.
— https://github.com/react-syntax-highlighter/react-syntax-highlighter/tree/efc3f7b7537d1729193b7a472067bcbe6cbecaf1#props
Could be removed too, okay with me. But that can be a different PR!
/> | ||
) : ( | ||
<code className={className} {...props}> | ||
<code {...props} className={className}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order doesn't matter here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, but its not bad to be consistent with the other example!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dlqqq!
I'd second @remcohaszing's suggestions.
This comment has been minimized.
This comment has been minimized.
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [react-markdown](https://togithub.com/remarkjs/react-markdown) | [`8.0.6` -> `8.0.7`](https://renovatebot.com/diffs/npm/react-markdown/8.0.6/8.0.7) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>remarkjs/react-markdown</summary> ### [`v8.0.7`](https://togithub.com/remarkjs/react-markdown/releases/tag/8.0.7) [Compare Source](https://togithub.com/remarkjs/react-markdown/compare/8.0.6...8.0.7) ##### Perf - [`c289176`](https://togithub.com/remarkjs/react-markdown/commit/c289176) Fix performance for keys by [@​wooorm](https://togithub.com/wooorm) in [https://github.com/remarkjs/react-markdown/pull/738](https://togithub.com/remarkjs/react-markdown/pull/738) ##### Docs - [`9034dbd`](https://togithub.com/remarkjs/react-markdown/commit/9034dbd) Fix types in syntax highlight example by [@​dlqqq](https://togithub.com/dlqqq) in [https://github.com/remarkjs/react-markdown/pull/736](https://togithub.com/remarkjs/react-markdown/pull/736) **Full Changelog**: remarkjs/react-markdown@8.0.6...8.0.7 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/ariakit/ariakit). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS40MC4wIiwidXBkYXRlZEluVmVyIjoiMzUuNDAuMCJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [core-js](https://togithub.com/zloirock/core-js) | [`3.30.0` -> `3.30.1`](https://renovatebot.com/diffs/npm/core-js/3.30.0/3.30.1) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [react-markdown](https://togithub.com/remarkjs/react-markdown) | [`8.0.6` -> `8.0.7`](https://renovatebot.com/diffs/npm/react-markdown/8.0.6/8.0.7) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>zloirock/core-js</summary> ### [`v3.30.1`](https://togithub.com/zloirock/core-js/blob/HEAD/CHANGELOG.md#​3301---20230414-httpsgithubcomzloirockcore-jsreleasestagv3301) [Compare Source](https://togithub.com/zloirock/core-js/compare/v3.30.0...v3.30.1) - Added a fix for a NodeJS 19.9.0 `URL.canParse` [bug](https://togithub.com/nodejs/node/issues/47505) - Compat data improvements: - [`JSON.parse` source text access proposal](https://togithub.com/tc39/proposal-json-parse-with-source) features marked as [supported](https://chromestatus.com/feature/5121582673428480) from V8 ~ Chrome 114 - [`ArrayBuffer.prototype.transfer` and friends proposal](https://togithub.com/tc39/proposal-arraybuffer-transfer) features marked as [supported](https://chromestatus.com/feature/5073244152922112) from V8 ~ Chrome 114 - [`URLSearchParams.prototype.size`](https://togithub.com/whatwg/url/pull/734) marked as supported from V8 ~ Chrome 113 </details> <details> <summary>remarkjs/react-markdown</summary> ### [`v8.0.7`](https://togithub.com/remarkjs/react-markdown/releases/tag/8.0.7) [Compare Source](https://togithub.com/remarkjs/react-markdown/compare/8.0.6...8.0.7) ##### Perf - [`c289176`](https://togithub.com/remarkjs/react-markdown/commit/c289176) Fix performance for keys by [@​wooorm](https://togithub.com/wooorm) in [https://github.com/remarkjs/react-markdown/pull/738](https://togithub.com/remarkjs/react-markdown/pull/738) ##### Docs - [`9034dbd`](https://togithub.com/remarkjs/react-markdown/commit/9034dbd) Fix types in syntax highlight example by [@​dlqqq](https://togithub.com/dlqqq) in [https://github.com/remarkjs/react-markdown/pull/736](https://togithub.com/remarkjs/react-markdown/pull/736) **Full Changelog**: remarkjs/react-markdown@8.0.6...8.0.7 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/tompluess/tompluess). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS40MC4wIiwidXBkYXRlZEluVmVyIjoiMzUuNDAuMCJ9-->
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [react-markdown](https://togithub.com/remarkjs/react-markdown) | [`8.0.4` -> `8.0.7`](https://renovatebot.com/diffs/npm/react-markdown/8.0.4/8.0.7) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>remarkjs/react-markdown</summary> ### [`v8.0.7`](https://togithub.com/remarkjs/react-markdown/releases/tag/8.0.7) [Compare Source](https://togithub.com/remarkjs/react-markdown/compare/8.0.6...8.0.7) ##### Perf - [`c289176`](https://togithub.com/remarkjs/react-markdown/commit/c289176) Fix performance for keys by [@​wooorm](https://togithub.com/wooorm) in [https://github.com/remarkjs/react-markdown/pull/738](https://togithub.com/remarkjs/react-markdown/pull/738) ##### Docs - [`9034dbd`](https://togithub.com/remarkjs/react-markdown/commit/9034dbd) Fix types in syntax highlight example by [@​dlqqq](https://togithub.com/dlqqq) in [https://github.com/remarkjs/react-markdown/pull/736](https://togithub.com/remarkjs/react-markdown/pull/736) **Full Changelog**: remarkjs/react-markdown@8.0.6...8.0.7 ### [`v8.0.6`](https://togithub.com/remarkjs/react-markdown/blob/HEAD/changelog.md#​806---2023-03-20) [Compare Source](https://togithub.com/remarkjs/react-markdown/compare/8.0.5...8.0.6) - [`33ab015`](https://togithub.com/remarkjs/react-markdown/commit/33ab015) Update to TS 5\ by [**@​Methuselah96**](https://togithub.com/Methuselah96) in [#​734](https://togithub.com/remarkjs/react-markdown/issues/734) ### [`v8.0.5`](https://togithub.com/remarkjs/react-markdown/blob/HEAD/changelog.md#​805---2023-01-17) [Compare Source](https://togithub.com/remarkjs/react-markdown/compare/8.0.4...8.0.5) - [`d640d40`](https://togithub.com/remarkjs/react-markdown/commit/d640d40) Update to use `node16` module resolution in `tsconfig.json`\ by [**@​ChristianMurphy**](https://togithub.com/ChristianMurphy) in [#​723](https://togithub.com/remarkjs/react-markdown/pull/723) - [`402fea3`](https://togithub.com/remarkjs/react-markdown/commit/402fea3) Fix typo in `plugins` deprecation message\ by [**@​marc2332**](https://togithub.com/marc2332) in [#​719](https://togithub.com/remarkjs/react-markdown/pull/719) - [`4f98f73`](https://togithub.com/remarkjs/react-markdown/commit/4f98f73) Remove deprecated and unneeded `defaultProps`\ by [**@​Lepozepo**](https://togithub.com/Lepozepo) in [#​718](https://togithub.com/remarkjs/react-markdown/pull/718) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/Unleash/unleash). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS41Ni4wIiwidXBkYXRlZEluVmVyIjoiMzUuNTYuMCJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Initial checklist
Description of changes
Improves README syntax highlighting example. The current example produces a TypeScript error by default. See here: react-syntax-highlighter/react-syntax-highlighter#479 (comment)