Skip to content

Commit 6edbbe7

Browse files
Joe-nohRomanHotsiy
authored andcommitted
fix: Slugifying non-ascii headers make duplicate permalinks (#264)
1 parent 0341db4 commit 6edbbe7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/utils/md-renderer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ export class MdRenderer {
5353
}
5454

5555
saveHeading(title: string, parent:MarkdownHeading = {id:null, children: this.headings}) :MarkdownHeading {
56-
let slug = slugify(title);
56+
// if title contains some non-ASCII characters (e.g. chinese) slugify returns empty string
57+
let slug = slugify(title) || title;
5758
let id = slug;
5859
if (parent && parent.id) id = `${parent.id}/${id}`;
5960
parent.children = parent.children || {};

0 commit comments

Comments
 (0)