From 32f2f7f744c4ec15fb7b8ba243bf76c8c9970b26 Mon Sep 17 00:00:00 2001 From: Joe-noh Date: Wed, 3 May 2017 13:23:32 +0900 Subject: [PATCH 1/2] use original title if slugified title is empty --- lib/utils/md-renderer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils/md-renderer.ts b/lib/utils/md-renderer.ts index 214da61145..ca1525ad68 100644 --- a/lib/utils/md-renderer.ts +++ b/lib/utils/md-renderer.ts @@ -53,7 +53,7 @@ export class MdRenderer { } saveHeading(title: string, parent:MarkdownHeading = {id:null, children: this.headings}) :MarkdownHeading { - let slug = slugify(title); + let slug = slugify(title) || title; let id = slug; if (parent && parent.id) id = `${parent.id}/${id}`; parent.children = parent.children || {}; From 95f7681fee631772e9f151be0765ac0feaab1395 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Wed, 3 May 2017 11:00:49 +0300 Subject: [PATCH 2/2] chore: add comment --- lib/utils/md-renderer.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/utils/md-renderer.ts b/lib/utils/md-renderer.ts index ca1525ad68..bdb5890f82 100644 --- a/lib/utils/md-renderer.ts +++ b/lib/utils/md-renderer.ts @@ -53,6 +53,7 @@ export class MdRenderer { } saveHeading(title: string, parent:MarkdownHeading = {id:null, children: this.headings}) :MarkdownHeading { + // 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}`;