FEATURE: do not replace ↔ with an emoji

FEATURE: do not replace :left_right_arrow: with an emoji

:left_right_arrow: technically can be an emoji, but usually will not be used in that way

diff --git a/app/models/emoji.rb b/app/models/emoji.rb
index 3307c46..5b8774c 100644
--- a/app/models/emoji.rb
+++ b/app/models/emoji.rb
@@ -149,9 +149,10 @@ class Emoji
         name = e['name']
 
         # special cased as we prefer to keep these as symbols
-        next if name == 'registered'.freeze
-        next if name == 'copyright'.freeze
-        next if name == 'tm'.freeze
+        next if name == 'registered'
+        next if name == 'copyright'
+        next if name == 'tm'
+        next if name == 'left_right_arrow'
 
         code = replacement_code(e['code'])
         next unless code
diff --git a/lib/pretty_text.rb b/lib/pretty_text.rb
index a5591e9..787d455 100644
--- a/lib/pretty_text.rb
+++ b/lib/pretty_text.rb
@@ -187,19 +187,6 @@ module PrettyText
       baked = context.eval("__pt.cook(#{text.inspect})")
     end
 
-    # if baked.blank? && !(opts || {})[:skip_blank_test]
-    #   # we may have a js engine issue
-    #   test = markdown("a", skip_blank_test: true)
-    #   if test.blank?
-    #     Rails.logger.warn("Markdown engine appears to have crashed, resetting context")
-    #     reset_context
-    #     opts ||= {}
-    #     opts = opts.dup
-    #     opts[:skip_blank_test] = true
-    #     baked = markdown(text, opts)
-    #   end
-    # end
-
     baked
   end
 
diff --git a/spec/components/pretty_text_spec.rb b/spec/components/pretty_text_spec.rb
index 1da6653..dc14832 100644
--- a/spec/components/pretty_text_spec.rb
+++ b/spec/components/pretty_text_spec.rb
@@ -869,6 +869,10 @@ describe PrettyText do
       expect(PrettyText.cook("💣")).to match(/\:bomb\:/)
     end
 
+    it "does not replace left right arrow" do
+      expect(PrettyText.cook("&harr;")).to eq('<p>↔</p>')
+    end
+
     it "doesn't replace emoji in inline code blocks with our emoji sets if emoji is enabled" do
       expect(PrettyText.cook("`💣`")).not_to match(/\:bomb\:/)
     end

GitHub sha: e9cf0de5

1 Like

This commit has been mentioned on Discourse Meta. There might be relevant details there: