From 919b7467d47de34cf917565ef1d1527763f1e459 Mon Sep 17 00:00:00 2001 From: Max Wu Date: Tue, 16 Jan 2018 15:59:43 +0800 Subject: [PATCH] Fix anchor id to keep uppercase characters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit id shouldn’t be converted to lowercase since id attribute is case sensitive --- public/js/extra.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/js/extra.js b/public/js/extra.js index 13b8924..75aa29a 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -156,7 +156,11 @@ export function renderTags (view) { } function slugifyWithUTF8 (text) { - let newText = S(text.toLowerCase()).trim().stripTags().dasherize().s + // remove html tags and trim spaces + let newText = S(text).trim().stripTags().s + // replace all spaces in between to dashes + newText = newText.replace(/\s+/g, '-') + // slugify string to make it valid for attribute newText = newText.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, '') return newText }