From ff59610ff1b66d77b1b90bb1a1cfe74a188d6e68 Mon Sep 17 00:00:00 2001 From: Guilherme I F L Weizenmann Date: Wed, 7 Dec 2016 20:32:15 -0200 Subject: [PATCH] Fix del, strike and s handle (#1, #2) * Remark.java - add "del", "strike", "s" tags to whitelisting (line 88-89) otherwise these tags are stripped off by the `cleaner` * DocumentConverter - also add "del,strike,s" tags (on line 88) to inline nodes with `InlineStyle` handler --- src/main/java/com/overzealous/remark/Remark.java | 3 ++- .../java/com/overzealous/remark/convert/DocumentConverter.java | 2 +- src/test/resources/conversions/html/unknownHTML.html | 2 +- src/test/resources/conversions/markdown/unknownHTML-allowed.md | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/overzealous/remark/Remark.java b/src/main/java/com/overzealous/remark/Remark.java index a0697d3..99b162f 100644 --- a/src/main/java/com/overzealous/remark/Remark.java +++ b/src/main/java/com/overzealous/remark/Remark.java @@ -85,7 +85,8 @@ public Remark(Options options) { "h1", "h2", "h3", "h4", "h5", "h6", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "hr", - "span", "font") + "span", "font", + "del", "strike", "s") .addAttributes("th", "colspan", "align", "style") .addAttributes("td", "colspan", "align", "style") .addAttributes(":all", "title", "style"); diff --git a/src/main/java/com/overzealous/remark/convert/DocumentConverter.java b/src/main/java/com/overzealous/remark/convert/DocumentConverter.java index 74cc284..09975a9 100644 --- a/src/main/java/com/overzealous/remark/convert/DocumentConverter.java +++ b/src/main/java/com/overzealous/remark/convert/DocumentConverter.java @@ -85,7 +85,7 @@ public DocumentConverter(Options options) { } private void configureNodes() { - addInlineNode(new InlineStyle(), "i,em,b,strong,font,span"); + addInlineNode(new InlineStyle(), "i,em,b,strong,font,span,del,strike,s"); addInlineNode(new InlineCode(), "code,tt"); addInlineNode(new Image(), "img"); addInlineNode(new Anchor(), "a"); diff --git a/src/test/resources/conversions/html/unknownHTML.html b/src/test/resources/conversions/html/unknownHTML.html index 1dcb4e3..ab49400 100644 --- a/src/test/resources/conversions/html/unknownHTML.html +++ b/src/test/resources/conversions/html/unknownHTML.html @@ -2,6 +2,6 @@ Division -

Foo Bar

+

Foo Bar

Variable

\ No newline at end of file diff --git a/src/test/resources/conversions/markdown/unknownHTML-allowed.md b/src/test/resources/conversions/markdown/unknownHTML-allowed.md index abcecdf..5d1ac67 100644 --- a/src/test/resources/conversions/markdown/unknownHTML-allowed.md +++ b/src/test/resources/conversions/markdown/unknownHTML-allowed.md @@ -1,5 +1,5 @@ Division -Foo Bar +Foo Bar Variable \ No newline at end of file