about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-07-28 11:15:04 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:45:16 -0500
commite53b4dc0e34750766c2a3ce877e906b5ef362462 (patch)
treea28c19b63270c002b6df3b3ae2d0e79195ac2098
parent67cacb5ef8e198ad3f361399df69aa38971d0c26 (diff)
[Formatting] Allow formatted account bios
-rw-r--r--app/javascript/flavours/glitch/styles/monsterfork/components/formatting.scss114
-rw-r--r--app/lib/formatter.rb6
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