You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This affects both Prism and Highlight.js, as well as countless third-party dependencies that use this behaviour to change props on a per-line basis.
This is currently making this package, as well as those that rely on it, completely unusable for me, is there any sort of roadmap as to when this issue is going to be resolved?
To Reproduce
Steps to reproduce the behavior:
set className using lineProps
value is always overwritten
Expected behavior
Class names set in lineProps shouldn't be blindly overwritten.
The text was updated successfully, but these errors were encountered:
d-fischer
added a commit
to d-fischer/react-syntax-highlighter
that referenced
this issue
Aug 10, 2021
Describe the bug
lineProps is currently unable to set the className because its always overwritten, regardless of what lineProps does.
var properties = typeof lineProps === 'function' ? lineProps(lineNumber) : lineProps;
properties['className'] = className;
https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/src/highlight.js#L108
A super-simple fix would be to simply change those two lines to this:
var properties = {className: className, ...typeof lineProps === 'function' ? lineProps(lineNumber) : lineProps};
This affects both Prism and Highlight.js, as well as countless third-party dependencies that use this behaviour to change props on a per-line basis.
This is currently making this package, as well as those that rely on it, completely unusable for me, is there any sort of roadmap as to when this issue is going to be resolved?
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Class names set in lineProps shouldn't be blindly overwritten.
The text was updated successfully, but these errors were encountered: