File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,8 @@ function genGlobalVars(site, zconf) {
242242 } ;
243243}
244244
245+ const customIdRegex = / { # (?< id > .+ ) } $ / ;
246+
245247enablePages . forEach ( ( page ) => {
246248 const conf = loadConf ( page , language ) ;
247249 const mdContent = [ ] ;
@@ -408,6 +410,18 @@ enablePages.forEach((page) => {
408410 node . position = null ;
409411 return visitor . SKIP ;
410412 } ) ;
413+ visitor . visit ( mdast , "heading" , ( node ) => {
414+ const lastChild = node . children [ node . children . length - 1 ] ;
415+ let id = null ;
416+ if ( lastChild && lastChild . type === "text" ) {
417+ const match = customIdRegex . exec ( lastChild . value ) ;
418+ if ( match ) {
419+ id = match . groups . id ;
420+ lastChild . value = lastChild . value . replace ( customIdRegex , "" ) ;
421+ }
422+ }
423+ // TODO: handle id
424+ } ) ;
411425 const modifiedContent = toMarkdown ( mdast ) ;
412426 mdContent . push ( modifiedContent ) ;
413427 } ) ;
You can’t perform that action at this time.
0 commit comments