From 2e3640ecbb9050405f9bcfefc9ae92ebbffd23cd Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Wed, 17 Apr 2019 14:23:36 +0200 Subject: Accept richer text from remote statuses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Support abbr, del, pre, blockquote, code, strong, b, em, i, and h1…h5 HTML elements in remote statuses, add corresponding CSS. --- app/lib/sanitize_config.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'app/lib/sanitize_config.rb') diff --git a/app/lib/sanitize_config.rb b/app/lib/sanitize_config.rb index 1bba4a5a6..7c376c412 100644 --- a/app/lib/sanitize_config.rb +++ b/app/lib/sanitize_config.rb @@ -20,11 +20,13 @@ class Sanitize end MASTODON_STRICT ||= freeze_config( - elements: %w(p br span a), + elements: %w(p br span a abbr del pre blockquote code b strong i em h1 h2 h3 h4 h5), attributes: { - 'a' => %w(href rel class), - 'span' => %w(class), + 'a' => %w(href rel class title), + 'span' => %w(class), + 'abbr' => %w(title), + 'blockquote' => %w(cite), }, add_attributes: { @@ -35,7 +37,8 @@ class Sanitize }, protocols: { - 'a' => { 'href' => HTTP_PROTOCOLS }, + 'a' => { 'href' => HTTP_PROTOCOLS }, + 'blockquote' => { 'cite' => HTTP_PROTOCOLS }, }, transformers: [ -- cgit From 27e8354914cb9f6725c911d5825399fc265852fe Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Sun, 21 Apr 2019 22:04:19 +0200 Subject: Add support for lists in statuses --- app/javascript/flavours/glitch/styles/components/status.scss | 12 ++++++++++++ app/lib/sanitize_config.rb | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'app/lib/sanitize_config.rb') diff --git a/app/javascript/flavours/glitch/styles/components/status.scss b/app/javascript/flavours/glitch/styles/components/status.scss index 91467c886..c09e3398d 100644 --- a/app/javascript/flavours/glitch/styles/components/status.scss +++ b/app/javascript/flavours/glitch/styles/components/status.scss @@ -58,6 +58,18 @@ em, i { font-style: italic; } + + ul, ol { + margin-left: 1em; + } + + ul { + list-style-type: disc; + } + + ol { + list-style-type: decimal; + } } a { diff --git a/app/lib/sanitize_config.rb b/app/lib/sanitize_config.rb index 7c376c412..0a87bf6df 100644 --- a/app/lib/sanitize_config.rb +++ b/app/lib/sanitize_config.rb @@ -20,7 +20,7 @@ class Sanitize end MASTODON_STRICT ||= freeze_config( - elements: %w(p br span a abbr del pre blockquote code b strong i em h1 h2 h3 h4 h5), + elements: %w(p br span a abbr del pre blockquote code b strong i em h1 h2 h3 h4 h5 ul ol li), attributes: { 'a' => %w(href rel class title), -- cgit From 3e095cab83f3e88c5f5f4ca9d7029379ed5b5b56 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Mon, 29 Apr 2019 19:00:27 +0200 Subject: Add support for missing formatting tags --- app/javascript/flavours/glitch/styles/components/status.scss | 5 +++++ app/lib/sanitize_config.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'app/lib/sanitize_config.rb') diff --git a/app/javascript/flavours/glitch/styles/components/status.scss b/app/javascript/flavours/glitch/styles/components/status.scss index 889bcaec0..b656f0baf 100644 --- a/app/javascript/flavours/glitch/styles/components/status.scss +++ b/app/javascript/flavours/glitch/styles/components/status.scss @@ -69,6 +69,11 @@ font-style: italic; } + sub { + font-size: smaller; + text-align: sub; + } + ul, ol { margin-left: 1em; diff --git a/app/lib/sanitize_config.rb b/app/lib/sanitize_config.rb index 0a87bf6df..23d0a418f 100644 --- a/app/lib/sanitize_config.rb +++ b/app/lib/sanitize_config.rb @@ -20,7 +20,7 @@ class Sanitize end MASTODON_STRICT ||= freeze_config( - elements: %w(p br span a abbr del pre blockquote code b strong i em h1 h2 h3 h4 h5 ul ol li), + elements: %w(p br span a abbr del pre blockquote code b strong u sub i em h1 h2 h3 h4 h5 ul ol li), attributes: { 'a' => %w(href rel class title), -- cgit