Avoid formatting matching into code spans/blocks
This won't stop formatting within backticks, but will avoid applying
bold formatting to a message like this:
* Run this find command: `find . -name '*.exe'`
Ref:
@@ -2851,11 +2851,11 @@ def process_emoji_changed(message_json, eventrouter, **kwargs):
###### New module/global methods
def render_formatting(text):
- text = re.sub(r'(^| )\*([^*\n]+)\*([^a-zA-Z0-9_]|$)',
+ text = re.sub(r'(^| )\*([^*\n`]+)\*([^a-zA-Z0-9_]|$)',
r'\1{}*\2*{}\3'.format(w.color(config.render_bold_as),
w.color('-' + config.render_bold_as)),
text)
- text = re.sub(r'(^| )_([^_\n]+)_([^a-zA-Z0-9_]|$)',
+ text = re.sub(r'(^| )_([^_\n`]+)_([^a-zA-Z0-9_]|$)',
r'\1{}_\2_{}\3'.format(w.color(config.render_italic_as),
w.color('-' + config.render_italic_as)),
text)
