diff --git a/app/assets/javascripts/pretty-text/white-lister.js.es6 b/app/assets/javascripts/pretty-text/white-lister.js.es6 index caa0afc828b..0ec00398b06 100644 --- a/app/assets/javascripts/pretty-text/white-lister.js.es6 +++ b/app/assets/javascripts/pretty-text/white-lister.js.es6 @@ -183,5 +183,12 @@ const DEFAULT_LIST = [ "strong", "sub", "sup", - "ul" + "ul", + "ruby", + "ruby[lang]", + "rb", + "rb[lang]", + "rp", + "rt", + "rt[lang]" ]; diff --git a/spec/components/pretty_text_spec.rb b/spec/components/pretty_text_spec.rb index 546eacfe803..5e5ce5fbb7f 100644 --- a/spec/components/pretty_text_spec.rb +++ b/spec/components/pretty_text_spec.rb @@ -1312,4 +1312,21 @@ HTML expect(cooked).to eq("

tester

tester
tester") end + it "whitelists ruby tags" do + # read all about ruby chars at: https://en.wikipedia.org/wiki/Ruby_character + # basically it is super hard to remember every single rare letter when there are + # so many, so ruby tags provide a hint. + # + html = (<<~MD).strip + + X + 漢 ( ㄏㄢˋ ) + + MD + + cooked = PrettyText.cook html + + expect(cooked).to eq(html) + end + end