on master help sign in
add in better tag regex to not interfere with links that have hashtags in them
commitc796add8132cd5cbe60a117431e65d8ac0d2f112 authorckipp01 <ckipp@pm.me> dateSat 3 Aug 2019, 22:38 (7 years ago) parent2bc71c6
1 file changed+2−2
scripts/hallway.js+2−2
scripts/hallway.js+2−2
@@ -2,7 +2,7 @@
22
33const reChannel = /(\s|^)\/([a-zA-Z0-9]+)/g
44const reUser = /((\s|^)@&lt;[a-zA-Z0-9./:\-_+~#= ]*&gt;)/g
5−const reTag = /([^&]|^)#([a-zA-Z0-9]+)/g
5+const reTag = /(^|\s)(#[a-z\d-]+)/ig
66const reUrl = /((https?):\/\/(([-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b)([-a-zA-Z0-9@:%_+.~#?&//=]*)))/g
77
88function Hallway (sites) {
@@ -117,7 +117,7 @@ function Hallway (sites) {
117117 entry.html = entry.body
118118 .replace(reChannel, `$1<span class='channel'>/$2</span>`)
119119 .replace(reUser, this.findMention)
120− .replace(reTag, `$1<span class='tag'>#$2</span>`)
120+ .replace(reTag, '$1<span class="tag">$2</span>')
121121 .replace(reUrl, `<a target="_blank" href='$1'>$1</a>`)
122122
123123 const filter = window.location.hash.substr(1).replace(/\+/g, ' ').toLowerCase()