Skip to content

Commit c61beb0

Browse files
authored
repo sync
2 parents 97908d1 + 53ad15c commit c61beb0

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const GithubSlugger = require('github-slugger')
22
const Entities = require('html-entities').XmlEntities
3+
const toString = require('hast-util-to-string')
34
const visit = require('unist-util-visit')
45
const slugger = new GithubSlugger()
56
const entities = new Entities()
@@ -14,7 +15,8 @@ module.exports = function useEnglishHeadings ({ englishHeadings }) {
1415
if (!englishHeadings) return
1516
return tree => {
1617
visit(tree, matcher, node => {
17-
const text = node.children.find(n => n.type === 'text').value
18+
// Get the plain text content of the heading node
19+
const text = toString(node)
1820
// find English heading in the collection
1921
const englishHeading = englishHeadings[entities.encode(text)]
2022
// get English slug

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"hast-util-from-parse5": "^6.0.1",
5252
"hast-util-parse-selector": "^2.2.5",
5353
"hast-util-select": "^4.0.2",
54+
"hast-util-to-string": "^1.0.4",
5455
"hastscript": "^6.0.0",
5556
"helmet": "^3.21.2",
5657
"highlightjs-graphql": "^1.0.2",
@@ -162,7 +163,7 @@
162163
"website-scraper": "^4.2.0"
163164
},
164165
"scripts": {
165-
"start": "cross-env NODE_ENV=development ENABLED_LANGUAGES='en,ja' nodemon server.js",
166+
"start": "cross-env NODE_ENV=development ENABLED_LANGUAGES='en,cn' nodemon server.js",
166167
"dev": "npm start",
167168
"debug": "cross-env NODE_ENV=development ENABLED_LANGUAGES='en,ja' nodemon --inspect server.js",
168169
"rest-dev": "script/rest/update-files.js && npm run dev",

0 commit comments

Comments
 (0)