From 6edbbe7b0c899484a718c88f050d48e75ddc2492 Mon Sep 17 00:00:00 2001 From: Joe Honzawa Date: Wed, 3 May 2017 17:01:53 +0900 Subject: [PATCH] fix: Slugifying non-ascii headers make duplicate permalinks (#264) --- lib/utils/md-renderer.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/utils/md-renderer.ts b/lib/utils/md-renderer.ts index 214da61145..bdb5890f82 100644 --- a/lib/utils/md-renderer.ts +++ b/lib/utils/md-renderer.ts @@ -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 || {};