fix: Slugifying non-ascii headers make duplicate permalinks (#264)

This commit is contained in:
Joe Honzawa 2017-05-03 17:01:53 +09:00 committed by Roman Hotsiy
parent 0341db4559
commit 6edbbe7b0c

View File

@ -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 || {};