diff --git a/app/lib/quote_formatter.rb b/app/lib/quote_formatter.rb
index 69c5b7456..d51f938b5 100644
--- a/app/lib/quote_formatter.rb
+++ b/app/lib/quote_formatter.rb
@@ -16,4 +16,17 @@ class QuoteFormatter
link = encode_and_link_urls(url)
html.sub(/(<[^>]+>)\z/, "
QT: #{link}\\1")
end
+
+ def format_in_quote(status, **options)
+ # format_in_quoteを定義、引数statusと**options
+ html = format(status)
+ return '' if html.empty?
+ doc = Nokogiri::HTML.parse(html, nil, 'utf-8')
+ html = doc.css('body')[0].inner_html
+ html.sub!(/^
(.+)<\/p>$/, '\1') + html = Sanitize.clean(html).delete("\n").truncate(150) + html = encode_custom_emojis(html, status.emojis) if options[:custom_emojify] + html.html_safe + end + end