这是我的代码
import SyntaxHighlighter from "react-syntax-highlighter";
import { vscDarkPlus } from "react-syntax-highlighter/dist/esm/styles/prism";
const App = () => {
const x = `
for (let i = 0; i < haystack.length; i++) {
if (!haystack[i] === needle) return;
}
`;
return (
<SyntaxHighlighter
language="javascript"
style={vscDarkPlus}
showLineNumbers={true}
codeTagProps={{ style: { fontSize: "inherit" } }}
customStyle={{ fontSize: 18 }}
>
{x}
</SyntaxHighlighter>
);
};当我想使用vscDarkPlus风格时,我得到的图片是这样的

为什么来自react-语法-荧光笔/ dist / esm /style/ prism的样式不能按预期工作?
发布于 2021-04-14 15:18:28
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";https://stackoverflow.com/questions/67086613
复制相似问题