问题标签 [react-syntax-highlighter]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
35 浏览

javascript - 如何导入名称中带有特殊字符的文件

如何在 ES6 中导入名称中包含特殊字符的文件?

我可以

import { tomorrow} from 'react-syntax-highlighter/dist/esm/styles/hljs';

但我不能:

import { tomorrow-night} from 'react-syntax-highlighter/dist/esm/styles/hljs';

0 投票
2 回答
51 浏览

javascript - 如何在 React 和 JSX 中导入名称中包含特殊字符的 JS 文件?

如何在 React 和 JSX 中导入名称中包含特殊字符的 JS 文件?

我可以

import { tomorrow} from 'react-syntax-highlighter/dist/esm/styles/hljs';

(该文件夹包含明天.js 和 tomrorrow-night.js)

但我不能:

import { tomorrow-night} from 'react-syntax-highlighter/dist/esm/styles/hljs';

我认为解构在这里不起作用,因为它是一个导入语句。

0 投票
1 回答
478 浏览

reactjs - 使用带有 tsx react markdown 的语法高亮

我正在关注 Github https://github.com/remarkjs/react-markdown并尝试将 SyntaxHighlighter 添加到我的降价代码片段中。尝试在用于呈现帖子的函数中使用示例代码时,出现下面提到的错误。Markdown 使用三个反引号,这使用 NextJS。

如果我注释掉该行{...props},红色下划线将被删除,但我没有看到代码在我的帖子中生效

尝试添加如下任何内容,但我仍然没有看到降价的任何效果。

code({ node, inline, className, children, ...props }: any)

错误:

代码:

在此处输入图像描述

0 投票
1 回答
106 浏览

javascript - 在反应语法荧光笔中突出显示 curl 代码片段

我试图在我的反应应用程序中突出显示 curl 代码片段。我正在使用react-syntax-highlighter相同的。

问题是 curl 代码没有正确对齐。在我的代码片段下方。

这是沙盒链接

输出以单行形式出现,而不是垂直对齐。