1
0
Fork 0
forked from gitea/nas

Add markdown selection support

This commit is contained in:
KMY 2023-04-12 10:16:46 +09:00
parent d4e0ef254d
commit 25c3915728
15 changed files with 76 additions and 7 deletions

View file

@ -11,6 +11,7 @@ class TextFormatter
DEFAULT_OPTIONS = {
multiline: true,
markdown: false,
}.freeze
attr_reader :text, :options
@ -44,7 +45,7 @@ class TextFormatter
end
# line first letter for blockquote
html = markdownify(html.gsub(/^>/, '>'))
html = markdownify(html.gsub(/^>/, '>')) if markdown?
# html = simple_format(html, {}, sanitize: false).delete("\n") if multiline?
html = html.delete("\n")
@ -152,6 +153,10 @@ class TextFormatter
options[:with_rel_me]
end
def markdown?
options[:markdown]
end
def preloaded_accounts
options[:preloaded_accounts]
end