Optional
ignore[]
const options: RehypeCustomCodeOptions = {
ignoreLangs: ["plaintext", "text"],
}
Optional
langglob pattern to language name associations.
ignore
.{}
const langAssociations = {
// highlight `jsx-like-lang` as `jsx`
"jsx-like-lang": "jsx",
};
Following code block will be highlighted as jsx:
```jsx-like-lang
<div>Hello, World!</div>
```
Optional
metaTransform the parsed meta data.
(meta) => meta
Optional
metaPreprocess the meta string.
(metaString) => metaString
Optional
propsPrefix for props.
"data"
const options: RehypeCustomCodeOptions = {
propsPrefix: "",
}
If this option is given, the following HTML will be output:
<pre lang="javascript" title="Hello, World!" line="1-5">
<!-- Some code... -->
</pre>
propsPrefix: ""
is useful to receive as props in React, etc.
const options: RehypeCustomCodeOptions = {
propsPrefix: "PRE",
}
If this option is given, the following HTML will be output:
<pre pre-lang="javascript" pre-title="Hello, World!" pre-line="1-5">
<!-- Some code... -->
</pre>
given propsPrefix
is converted to lowercase
Optional
shiki?: ShikiOptions<M> & CodeOptionsThemes<BuiltinTheme> | falseOptions for shikiji. If this option is given, the code will be highlighted using shikiji.
Optional
shouldWhether to export the code text as props. This is useful when you want to use the code text in custom components.
options.shiki ? false : true
const options: RehypeCustomCodeOptions = {
shouldExportCodeAsProps: true,
}
If this option is given, the following HTML will be output:
<pre data-code='console.log("Hello, World!");\n' ...>
<!-- Some code... -->
</pre>
List of languages this plugin does not work in.