File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 66
77rehype plugin to generate a table of contents from headings in your markdown.
88
9- You can create the table of contents such below .
9+ You can create the table of contents as follows .
1010
1111![ A table of contents whose each items are anchor link.] ( assets/toc.png )
1212
Original file line number Diff line number Diff line change @@ -68,10 +68,10 @@ const searchSameLevelUlElement = (
6868 return rootLiElement
6969 }
7070
71- if ( rootLiElement . children [ 1 ] === undefined ) {
71+ const childUlElement = assertElementNodeList ( rootLiElement . children ) [ 1 ]
72+ if ( childUlElement === undefined ) {
7273 return
7374 }
74- const childUlElement = assertElementNode ( rootLiElement . children [ 1 ] )
7575
7676 return searchSameLevelUlElement (
7777 assertElementNodeList ( childUlElement . children ) ,
@@ -87,10 +87,10 @@ const getDeepestLiElement = (rootUlElement: Element[]): Element => {
8787 rootUlElement [ rootUlElement . length - 1 ]
8888 )
8989
90- if ( ! rootLiElement . children [ 1 ] ) {
90+ const olElement = assertElementNodeList ( rootLiElement . children ) [ 1 ]
91+ if ( ! olElement ) {
9192 return rootLiElement
9293 }
93- const olElement = assertElementNode ( rootLiElement . children [ 1 ] )
9494
9595 return getDeepestLiElement ( assertElementNodeList ( olElement . children ) )
9696}
You can’t perform that action at this time.
0 commit comments