@microflash/rehype-starry-night
Version:
rehype plugin to highlight codeblocks with Starry Night
22 lines (19 loc) • 446 B
JavaScript
function pluginOptions(globalOptions) {
return globalOptions?.metadata?.ins || [];
}
function plugin(globalOptions, lines) {
const ins = pluginOptions(globalOptions);
if (ins.length > 0) {
ins.forEach(lineNumber => {
if (lines.has(lineNumber)) {
const line = lines.get(lineNumber);
line.properties["data-line-added"] = "";
}
});
globalOptions["lineMarkerGutterFactor"] = 1;
}
}
export default {
type: "line",
plugin
}