diff --git a/app/controllers/markdown_controller.rb b/app/controllers/markdown_controller.rb index 60768a170..a4c59cdd9 100644 --- a/app/controllers/markdown_controller.rb +++ b/app/controllers/markdown_controller.rb @@ -3,7 +3,7 @@ class MarkdownController < ApplicationController respond_to :js def preview - markdown_source = params[:source].to_str.gsub(/:([\w+-]+):/) do |match| + markdown_source = params[:source].to_str.gsub(/ :([\w+-]+): /) do |match| %(![add-emoji](https://github.githubassets.com/images/icons/emoji/#{match.to_str.tr(':','')}.png)) end if params[:source] @rendered = MarkdownHelper.render markdown_source diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 97e618d5f..169e46661 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -23,7 +23,7 @@ def active_page_size(page_size, param=nil) end def emojify content - content.to_str.gsub(/:([\w+-]+):/) do |match| + content.to_str.gsub(/ :([\w+-]+): /) do |match| %(![add-emoji](https://github.githubassets.com/images/icons/emoji/#{match.to_str.tr(':','')}.png)) end.html_safe if content.present? end