Skip to content

Commit 6c6ac5c

Browse files
committed
Generated id attributes for markdown headings
1 parent f129faf commit 6c6ac5c

3 files changed

Lines changed: 29506 additions & 10615 deletions

File tree

lib/render.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const path = require('path')
33

44
const matter = require('gray-matter')
55
const { marked } = require('marked')
6+
const { gfmHeadingId } = require('marked-gfm-heading-id')
67

78
// Tweak the Markdown renderer
89
const defaultMarkedRenderer = marked.defaults.renderer || new marked.Renderer()
@@ -24,6 +25,8 @@ marked.use({
2425
}
2526
})
2627

28+
marked.use(gfmHeadingId())
29+
2730
exports.findViewName = function (mdDir, name) {
2831
for (const ext of ['.md.njk', '.md']) {
2932
const tryPath = path.join(mdDir, name + ext)

0 commit comments

Comments
 (0)