codify: only match if preceded by whitespace

(or at the start of the line).

Fixes #1058
update-travis
Lorenz Hübschle-Schneider 6 years ago committed by Lorenz Hübschle-Schneider
parent 6ab4ef7d88
commit fd40cc1593
  1. 6
      js/filters.js

@ -239,9 +239,9 @@ weechat.filter('prefixlimit', function() {
weechat.filter('codify', function() { weechat.filter('codify', function() {
return function(text) { return function(text) {
var re = /`(.+?)`/g; var re = /(^|\s)`(.+?)`/g;
return text.replace(re, function(match, code) { return text.replace(re, function(match, ws, code) {
var rr = '<span class="hidden-bracket">`</span><code>' + code + '</code><span class="hidden-bracket">`</span>'; var rr = ws + '<span class="hidden-bracket">`</span><code>' + code + '</code><span class="hidden-bracket">`</span>';
return rr; return rr;
}); });
}; };

Loading…
Cancel
Save