Skip to content

Commit f2c08b3

Browse files
authored
Static method isn't a thing on this version? (#17580)
1 parent 1bf9367 commit f2c08b3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/render-content/plugins/use-english-headings.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const GithubSlugger = require('github-slugger')
22
const Entities = require('html-entities').XmlEntities
33
const toString = require('hast-util-to-string')
44
const visit = require('unist-util-visit')
5+
const slugger = new GithubSlugger()
56
const entities = new Entities()
67

78
const matcher = node => (
@@ -14,12 +15,13 @@ module.exports = function useEnglishHeadings ({ englishHeadings }) {
1415
if (!englishHeadings) return
1516
return tree => {
1617
visit(tree, matcher, node => {
18+
slugger.reset()
1719
// Get the plain text content of the heading node
1820
const text = toString(node)
1921
// find English heading in the collection
2022
const englishHeading = englishHeadings[entities.encode(text)]
2123
// get English slug
22-
const englishSlug = GithubSlugger.slug(englishHeading)
24+
const englishSlug = slugger.slug(englishHeading)
2325
// use English slug for heading ID and link
2426
node.properties.id = englishSlug
2527
})

0 commit comments

Comments
 (0)