From 3bd230511519f5519e28dbe538d2dd318372e3dc Mon Sep 17 00:00:00 2001 From: Wilfried OLLIVIER Date: Wed, 20 Nov 2019 16:16:38 +0100 Subject: [PATCH] Fix #637 : Markdown footnotes (#700) * Ensure footnotes classes generated are not filtered pulldown-cmark add somes classes when footnotes html is generated. This commit ensure they are not filtered by html sanitizer * Add some footnotes styling --- assets/themes/default/_article.scss | 9 +++++++++ plume-models/src/safe_string.rs | 3 +++ 2 files changed, 12 insertions(+) diff --git a/assets/themes/default/_article.scss b/assets/themes/default/_article.scss index c1191cef..71719e12 100644 --- a/assets/themes/default/_article.scss +++ b/assets/themes/default/_article.scss @@ -481,3 +481,12 @@ input:checked ~ .cw-container > .cw-text { margin: auto $horizontal-margin; } } + +// Footnote related styles +.footnote-definition { + p { + font-size: smaller; + // Make sur the definition is inline with the label-definition + display: inline; + } +} diff --git a/plume-models/src/safe_string.rs b/plume-models/src/safe_string.rs index 7aca88d9..8b809d67 100644 --- a/plume-models/src/safe_string.rs +++ b/plume-models/src/safe_string.rs @@ -31,6 +31,9 @@ lazy_static! { .add_tag_attributes("label", ["for"].iter()) .add_tag_attributes("input", ["type", "checked"].iter()) .add_allowed_classes("input", ["cw-checkbox"].iter()) + // Related to https://github.com/Plume-org/Plume/issues/637 + .add_allowed_classes("sup", ["footnote-reference", "footnote-definition-label"].iter()) + .add_allowed_classes("div", ["footnote-definition"].iter()) .add_allowed_classes("span", ["cw-container", "cw-text"].iter()) .attribute_filter(|elem, att, val| match (elem, att) { ("input", "type") => Some("checkbox".into()),