зеркало из https://github.com/github/docs.git
Don't use slugger singleton (#17579)
This commit is contained in:
Родитель
53ad15c959
Коммит
653a57aa00
|
@ -2,7 +2,6 @@ const GithubSlugger = require('github-slugger')
|
|||
const Entities = require('html-entities').XmlEntities
|
||||
const toString = require('hast-util-to-string')
|
||||
const visit = require('unist-util-visit')
|
||||
const slugger = new GithubSlugger()
|
||||
const entities = new Entities()
|
||||
|
||||
const matcher = node => (
|
||||
|
@ -20,7 +19,7 @@ module.exports = function useEnglishHeadings ({ englishHeadings }) {
|
|||
// find English heading in the collection
|
||||
const englishHeading = englishHeadings[entities.encode(text)]
|
||||
// get English slug
|
||||
const englishSlug = slugger.slug(englishHeading)
|
||||
const englishSlug = GithubSlugger.slug(englishHeading)
|
||||
// use English slug for heading ID and link
|
||||
node.properties.id = englishSlug
|
||||
})
|
||||
|
|
Загрузка…
Ссылка в новой задаче