Reputation: 897
I am using the package "react-syntax-highlighter" to beautify code in react project, but somehow it still doesn't work as expected. I tried to search similar issues, but couldn't found any solution. Below {codeString}
is generated by using blockly (by google).
<SyntaxHighlighter language="javascript" style={docco} showLineNumbers>
{codeString}
</SyntaxHighlighter>
Upvotes: 3
Views: 3694
Reputation: 45
Upvotes: -3
Reputation: 373
As I investigated, react-syntax-highlighter
works as intented, it never says about formatting at all, it's only a highlighter or colorizer.
You have to use a separate library, i.e. prettier
. They will not conflict since prettier
is just putting tabs, spaces and breaks right into the string.
Upvotes: 1
Reputation: 49182
a few things to consider:
Make sure backticks are gonna be on the left edge. do not tab it. and use the language shorthand right after the first ```js as above.
Upvotes: 1