const toSlug = require('./toSlug.js'); function anchors(md) { const originalRender = md.renderer.rules.heading_open; md.renderer.rules.heading_open = function(tokens, idx, options, env) { const textToken = tokens[idx + 1]; if (textToken.content) { const anchor = toSlug(textToken.content, env); return ``; } return originalRender(tokens, idx, options, env); }; } module.exports = anchors;