File tree Expand file tree Collapse file tree
lib/render-content/plugins Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11const GithubSlugger = require ( 'github-slugger' )
22const Entities = require ( 'html-entities' ) . XmlEntities
3+ const toString = require ( 'hast-util-to-string' )
34const visit = require ( 'unist-util-visit' )
45const slugger = new GithubSlugger ( )
56const 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
Original file line number Diff line number Diff line change 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" ,
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" ,
You can’t perform that action at this time.
0 commit comments