From aeece0158dce335ca795c115f9975a5a7ff2163e Mon Sep 17 00:00:00 2001 From: Leon Sandøy Date: Mon, 6 Jan 2020 13:43:06 +0100 Subject: Adding iframes to HTML whitelist This will allow us to put stuff like YouTube embeds in wiki articles... hopefully. I didn't test it. --- pydis_site/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pydis_site/settings.py') diff --git a/pydis_site/settings.py b/pydis_site/settings.py index 66376c4e..e8b71e76 100644 --- a/pydis_site/settings.py +++ b/pydis_site/settings.py @@ -376,7 +376,7 @@ WIKI_MARKDOWN_HTML_ATTRIBUTES = { } WIKI_MARKDOWN_HTML_WHITELIST = [ - 'article', 'section', 'button' + 'article', 'section', 'button', 'iframe' ] -- cgit v1.2.3 From 86acb429bafc703684aa0bd47b6495c2044d89dd Mon Sep 17 00:00:00 2001 From: Sebastiaan Zeeff <33516116+SebastiaanZ@users.noreply.github.com> Date: Mon, 6 Jan 2020 14:04:41 +0100 Subject: Adding iframe attributes to attribute whitelist To properly show YouTube-embeds, we need to allow some attributes on `iframe` tags. I've added all attributes that are normal for such an embed, including `width` and `height` (which we may not need if we want to make the frame resize to its parent). --- pydis_site/settings.py | 1 + 1 file changed, 1 insertion(+) (limited to 'pydis_site/settings.py') diff --git a/pydis_site/settings.py b/pydis_site/settings.py index e8b71e76..72cc0ab9 100644 --- a/pydis_site/settings.py +++ b/pydis_site/settings.py @@ -373,6 +373,7 @@ WIKI_MARKDOWN_HTML_ATTRIBUTES = { 'img': ['class', 'id', 'src', 'alt', 'width', 'height'], 'section': ['class', 'id'], 'article': ['class', 'id'], + 'iframe': ['width', 'height', 'src', 'frameborder', 'allow', 'allowfullscreen'], } WIKI_MARKDOWN_HTML_WHITELIST = [ -- cgit v1.2.3 From d966231b917357f4e0db901958b30cdd7ef6f4c3 Mon Sep 17 00:00:00 2001 From: scragly <29337040+scragly@users.noreply.github.com> Date: Mon, 3 Feb 2020 23:44:45 +1000 Subject: Unbleach Wiki Disables the sanitisation of HTML in wiki articles. --- pydis_site/settings.py | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'pydis_site/settings.py') diff --git a/pydis_site/settings.py b/pydis_site/settings.py index 72cc0ab9..65ef2463 100644 --- a/pydis_site/settings.py +++ b/pydis_site/settings.py @@ -360,25 +360,7 @@ WIKI_MESSAGE_TAG_CSS_CLASS = { messages.WARNING: "is-warning", } -WIKI_MARKDOWN_HTML_STYLES = [ - 'max-width', - 'min-width', - 'margin', - 'padding', - 'width', - 'height', -] - -WIKI_MARKDOWN_HTML_ATTRIBUTES = { - 'img': ['class', 'id', 'src', 'alt', 'width', 'height'], - 'section': ['class', 'id'], - 'article': ['class', 'id'], - 'iframe': ['width', 'height', 'src', 'frameborder', 'allow', 'allowfullscreen'], -} - -WIKI_MARKDOWN_HTML_WHITELIST = [ - 'article', 'section', 'button', 'iframe' -] +WIKI_MARKDOWN_SANITIZE_HTML = False # Wiki permissions -- cgit v1.2.3