Skip to content

Commit

Permalink
fix: Slugifying non-ascii headers make duplicate permalinks (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe-noh authored and RomanHotsiy committed May 3, 2017
1 parent 0341db4 commit 6edbbe7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/utils/md-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export class MdRenderer {
}

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

0 comments on commit 6edbbe7

Please sign in to comment.