-
[x] syntax highlighting with refractor which uses PrismJS under the hood.
-
[x] support
filename
throughmeta
field```js filename=hello-world.js console.log(42); ```
-
[x] support line highlighting through
meta
field```js lines=[1,2-4] var name name = 'hello'; console.log(name); console.log(42) ```
import {remark} from 'remark';
import {remarkCodeBlock} from 'remark-code-block';
import js from 'refractor/lang/javascript.js';
// register any languages you want to apply syntax highlighting first
remarkCodeBlock.register(js);
remark().use(remarkCodeBlock);
Option | Type | Default | Description |
---|---|---|---|
enableLineNumbers |
boolean |
true |
Attach line numbers to span elements so you can show them through CSS |