Fix the broken header links

This commit is contained in:
Jocelyn Badgley (Twipped) 2021-08-27 11:53:38 -07:00
parent 69c003d008
commit d542e8b23d
2 changed files with 5 additions and 3 deletions

View File

@ -31,10 +31,11 @@ const markdownEngines = {
}, },
}) })
.use(mAnchor, { .use(mAnchor, {
permalink: mAnchor.permalink.ariaHidden({ permalink: mAnchor.permalink.linkInsideHeader({
class: 'header-link', class: 'header-link',
symbol: '<img src="/images/svg/paragraph.svg">', symbol: '<img src="/images/svg/paragraph.svg">',
renderHref: slugify, renderHref: (input) => '#' + slugify(decodeURIComponent(input)),
ariaHidden: true,
}), }),
}) })
.use(require('./lib/markdown-raw-html'), { debug: false }), .use(require('./lib/markdown-raw-html'), { debug: false }),

View File

@ -1,5 +1,6 @@
const slugs = require('slugify'); const slugs = require('slugify');
module.exports = exports = function slugify (s) { module.exports = exports = function slugify (s) {
return slugs(s, { remove: /[*+~.,()'"!?:@/\\]/g }).toLowerCase(); const result = slugs(s, { remove: /[*+~.,()'"!?:@/\\]/g }).toLowerCase();
return result;
}; };