summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorMax Wu2018-01-16 15:59:43 +0800
committerGitHub2018-01-16 15:59:43 +0800
commit919b7467d47de34cf917565ef1d1527763f1e459 (patch)
tree2464ab8e8dc78f4f42a3fe8e6d8f900c02fe049f /public
parent4b419f4877a90717d3d639532b6316f8197dc28a (diff)
Fix anchor id to keep uppercase characters
id shouldn’t be converted to lowercase since id attribute is case sensitive
Diffstat (limited to '')
-rw-r--r--public/js/extra.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/public/js/extra.js b/public/js/extra.js
index 13b8924c..75aa29af 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
}