diff --git a/include/js/markdown.js b/include/js/markdown.js index 873c03d..9ee3cb9 100644 --- a/include/js/markdown.js +++ b/include/js/markdown.js @@ -12,9 +12,11 @@ function postProcess(...callbacks) { function linkSanitize() { $('.markdown-body a').each((_i, e) => { - href = (e.getAttribute('href')) ? _.unescape(e.getAttribute('href').toLowerCase()) : ""; + href = (e.href) ? _.unescape(e.href.toLowerCase()) : ""; if (href.indexOf('javascript:') != -1) { - e.setAttribute('href', '#'); + e.href = '#'; + } else { + e.href = e.href.replace(/%40/, '@'); } }); } diff --git a/include/notification.php b/include/notification.php index 4c62efe..2b07f00 100644 --- a/include/notification.php +++ b/include/notification.php @@ -9,10 +9,12 @@ function parse_user_tag($markdown) { $regex = array( "code_block" => "/(`{1,3}[^`]*`{1,3})/", "email" => "/[^@\s]*@[^@\s]*\.[^@\s]*/", + "url" => "/https?\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]+(\/\S*)/", "username" => "/@(\w+)/" ); $tmp = preg_replace($regex["code_block"], " ", $markdown); + $tmp = preg_replace($regex['url'], " ", $tmp); $tmp = preg_replace($regex["email"], " ", $tmp); preg_match_all($regex["username"], $tmp, $username_list);