File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
packages/pliny/src/mdx-plugins Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' pliny ' : patch
3
+ ---
4
+
5
+ fix toc slugs are tracked across documents
Original file line number Diff line number Diff line change @@ -6,8 +6,6 @@ import GithubSlugger from 'github-slugger'
6
6
import { toString } from 'mdast-util-to-string'
7
7
import { remark } from 'remark'
8
8
9
- const slugger = new GithubSlugger ( )
10
-
11
9
export type TocItem = {
12
10
value : string
13
11
url : string
@@ -20,6 +18,7 @@ export type Toc = TocItem[]
20
18
* Extracts TOC headings from markdown file and adds it to the file's data object.
21
19
*/
22
20
export function remarkTocHeadings ( ) {
21
+ const slugger = new GithubSlugger ( )
23
22
return ( tree : Parent , file : VFile ) => {
24
23
const toc : Toc = [ ]
25
24
visit ( tree , 'heading' , ( node : Heading ) => {
You can’t perform that action at this time.
0 commit comments