File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,11 @@ const remarkTableOfContents: Plugin = function plugin(
1616
1717 const mdast = ast as Root
1818
19- const result = toc ( mdast )
19+ // remove the one property that is not a toc option
20+ const { mdx, ...tocOptions } = options
21+
22+ const result = toc ( mdast , tocOptions )
23+
2024 const list = result . map
2125
2226 if ( list === null ) {
@@ -31,7 +35,7 @@ const remarkTableOfContents: Plugin = function plugin(
3135 return
3236 }
3337
34- if ( options . mdx ) {
38+ if ( mdx ) {
3539 mdast . children = Array . prototype . concat (
3640 mdast . children . slice ( 0 , index ) ,
3741 {
@@ -40,7 +44,6 @@ const remarkTableOfContents: Plugin = function plugin(
4044 children : [ result . map ] ,
4145 attributes : [ ]
4246 } ,
43-
4447 mdast . children . slice ( index + 1 )
4548 )
4649 } else {
You can’t perform that action at this time.
0 commit comments