Last active
March 4, 2021 17:52
-
-
Save josh-hemphill/0489e03a00c7f8d65325a257e1cde3c5 to your computer and use it in GitHub Desktop.
Create GitHub/GitLab anchor link from header text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toAnchor(...text) { | |
let temp = text.join('').toLowerCase(); | |
temp = temp.replace(/[^\w ]+/g,''); | |
temp = temp.replace(/ +/g,'-'); | |
return '#' + temp; | |
} | |
const t = toAnchor; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment