summaryrefslogtreecommitdiff
path: root/public/js
diff options
context:
space:
mode:
authorChristoph (Sheogorath) Kern2018-01-16 16:31:41 +0700
committerGitHub2018-01-16 16:31:41 +0700
commite38054113ed788121db7598e6860ecb42337f6a8 (patch)
treefcb053a6afa475797fcd21209e268c6de0917c60 /public/js
parent5f84906b2e5bac44379746b25ad2cf66bdee8dda (diff)
parent919b7467d47de34cf917565ef1d1527763f1e459 (diff)
Merge pull request #678 from hackmdio/fix-anchor-id-case-sensitive
Fix anchor id to keep uppercase characters
Diffstat (limited to 'public/js')
-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
}