Clojure 代码示例中的 react-syntax-highlighter 新行

react-syntax-highlighter new line in Clojure code sample

您好,我找不到关于如何将新行添加到此代码示例的任何地方:

<SyntaxHighlighter language='clojure' style={darcula} showLineNumbers={true} wrapLines={true}> 
  (def a 2) *add a new line break here* 
  (def b 3)
</SyntaxHighlighter>

使用:

从 'react-syntax-highlighter' 导入 SyntaxHighlighter; 从 'react-syntax-highlighter/styles/hljs';

导入 { darcula, docco }

谢谢

我找到的唯一解决方案是这样做:

<SyntaxHighlighter language='clojure' style={darcula} showLineNumbers={true} wrapLines={true}>
        {`first line \nsecond line`}
</SyntaxHighlighter>

您也可以将文本放入 const

const code = `(def a 2) *add a new line break here*
(def b 3)`;