@alauda/doom
Version:
Doctor Doom making docs.
22 lines (21 loc) • 550 B
JavaScript
/**
* Fully-configured extension to add Heading ID nodes to Markdown.
**/
export function mdastAttributes() {
return {
enter: {
attrs(token) {
this.enter({ type: 'attrs', value: null }, token);
this.buffer();
},
},
exit: {
attrs(token) {
const attrs = this.resume();
const node = this.stack[this.stack.length - 1];
this.exit(token);
node.value = attrs;
},
},
};
}