diff --git a/index.js b/index.js index cdcca93..c83c6e4 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,8 @@ var defaultOptions = { className: 'anchor', // shamelessly borrowed from GitHub, thanks y'all linkIcon: '', - resetSlugger: true + resetSlugger: true, + headingLinksHref: slug => `#${slug}` } function plugin (md, _opts) { @@ -58,7 +59,7 @@ function plugin (md, _opts) { // add some link attributes linkOpen.attrSet('id', options.prefix + postfix) linkOpen.attrSet('class', options.className) - linkOpen.attrSet('href', '#' + postfix) + linkOpen.attrSet('href', options.headingLinksHref(postfix)) linkOpen.attrSet('aria-hidden', 'true') // add new token objects as children of heading