From e53b4dc0e34750766c2a3ce877e906b5ef362462 Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Tue, 28 Jul 2020 11:15:04 -0500 Subject: [Formatting] Allow formatted account bios --- .../styles/monsterfork/components/formatting.scss | 114 +++++++++++++++++++-- app/lib/formatter.rb | 6 +- 2 files changed, 113 insertions(+), 7 deletions(-) diff --git a/app/javascript/flavours/glitch/styles/monsterfork/components/formatting.scss b/app/javascript/flavours/glitch/styles/monsterfork/components/formatting.scss index 927ade425..1998a7e62 100644 --- a/app/javascript/flavours/glitch/styles/monsterfork/components/formatting.scss +++ b/app/javascript/flavours/glitch/styles/monsterfork/components/formatting.scss @@ -3,18 +3,120 @@ .composer--reply > .content, .account__header__content { - s { text-decoration: line-through; } - del { text-decoration: line-through; } - h6 { font-size: 8px; font-weight: bold; } - hr { border-color: lighten($dark-text-color, 10%); } + .emojione { + width: 20px; + height: 20px; + margin: -3px 0 0; + } + + & > ul, + & > ol { + margin-bottom: 20px; + } + + h1, h2, h3, h4, h5 { + margin-top: 20px; + margin-bottom: 20px; + } + + h1, h2 { + font-weight: 700; + font-size: 1.2em; + } + + h2 { + font-size: 1.1em; + } + + h3, h4, h5 { + font-weight: 500; + } + + blockquote { + padding-left: 10px; + border-left: 3px solid $darker-text-color; + color: $darker-text-color; + white-space: normal; + + p:last-child { + margin-bottom: 0; + } + } + + b, strong { + font-weight: 700; + } + + em, i { + font-style: italic; + } + sub { - vertical-align: sub; font-size: smaller; + text-align: sub; } + sup { - vertical-align: super; font-size: smaller; + vertical-align: super; + } + + ul, ol { + margin-left: 1em; + + p { + margin: 0; + } } + + ul { + list-style-type: disc; + } + + ol { + list-style-type: decimal; + } + + a { + color: $secondary-text-color; + text-decoration: underline; + + &:hover { + text-decoration: none; + + .fa { + color: lighten($dark-text-color, 7%); + } + } + + &.mention { + &:hover { + text-decoration: underline; + + span { + text-decoration: none; + } + } + } + + .fa { + color: $dark-text-color; + } + } + + a.unhandled-link { + color: lighten($ui-highlight-color, 8%); + + .link-origin-tag { + color: $gold-star; + font-size: 0.8em; + } + } + + s { text-decoration: line-through; } + del { text-decoration: line-through; } + h6 { font-size: 8px; font-weight: bold; } + hr { border-color: lighten($dark-text-color, 10%); } pre, code { color: lighten($dark-text-color, 33%); } diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb index 39c42c8db..d85bbf0e0 100644 --- a/app/lib/formatter.rb +++ b/app/lib/formatter.rb @@ -95,7 +95,11 @@ class Formatter end def simplified_format(account, **options) - html = account.local? ? linkify(account.note) : reformat(account.note) + return reformat(account.note) unless account.local? + + html = format_markdown(account.note) + html = encode_and_link_urls(html, keep_html: true) + html = reformat(html, true) html = encode_custom_emojis(html, account.emojis, options[:autoplay]) if options[:custom_emojify] html.html_safe # rubocop:disable Rails/OutputSafety end -- cgit