我想突出显示使用三个反引号(```)编写的markdown代码块中的一部分。 下面是我想要的效果的图片。 code block with highlighting-imgur
我想复制在书中用荧光笔/标记器突出显示句子的方式。
我已经使用了<pre></pre>
和<mark></mark>
,但这些标签在代码块中不起作用,如下所示;
```
<pre>
<b>some bold text</b>
<pre/>
```
我想突出显示使用三个反引号(```)编写的markdown代码块中的一部分。 下面是我想要的效果的图片。 code block with highlighting-imgur
我想复制在书中用荧光笔/标记器突出显示句子的方式。
我已经使用了<pre></pre>
和<mark></mark>
,但这些标签在代码块中不起作用,如下所示;
```
<pre>
<b>some bold text</b>
<pre/>
```
rehype-prism-plus
是一个rehype插件,用于通过Prism(通过refractor)在HTML中突出显示代码块,并提供了额外的行高亮和行号功能。
使用next-mdx-remote
非常简单:
import { serialize } from "next-mdx-remote/serialize";
import rehypePrism from "rehype-prism-plus"
const mdxSource = await serialize(markdownContent, {
mdxOptions: {
remarkPlugins: [],
rehypePlugins: [rehypePrism], // here it is
},
});
\
``标记,只需使用
<pre><code>...</code></pre>`即可。 - Chris