diff --git a/markwon/src/main/java/ru/noties/markwon/renderer/html2/MarkwonHtmlRenderer.java b/markwon/src/main/java/ru/noties/markwon/renderer/html2/MarkwonHtmlRenderer.java index 8405854b..338ab211 100644 --- a/markwon/src/main/java/ru/noties/markwon/renderer/html2/MarkwonHtmlRenderer.java +++ b/markwon/src/main/java/ru/noties/markwon/renderer/html2/MarkwonHtmlRenderer.java @@ -11,6 +11,7 @@ import java.util.Map; import ru.noties.markwon.SpannableBuilder; import ru.noties.markwon.SpannableConfiguration; import ru.noties.markwon.html.api.MarkwonHtmlParser; +import ru.noties.markwon.renderer.html2.tag.BlockquoteHandler; import ru.noties.markwon.renderer.html2.tag.EmphasisHandler; import ru.noties.markwon.renderer.html2.tag.ImageHandler; import ru.noties.markwon.renderer.html2.tag.LinkHandler; @@ -67,7 +68,8 @@ public abstract class MarkwonHtmlRenderer { .handler("a", new LinkHandler()) .handler("ul", listHandler) .handler("ol", listHandler) - .handler("img", ImageHandler.create()); + .handler("img", ImageHandler.create()) + .handler("blockquote", new BlockquoteHandler()); } @NonNull diff --git a/markwon/src/main/java/ru/noties/markwon/renderer/html2/tag/BlockquoteHandler.java b/markwon/src/main/java/ru/noties/markwon/renderer/html2/tag/BlockquoteHandler.java new file mode 100644 index 00000000..99ddf153 --- /dev/null +++ b/markwon/src/main/java/ru/noties/markwon/renderer/html2/tag/BlockquoteHandler.java @@ -0,0 +1,28 @@ +package ru.noties.markwon.renderer.html2.tag; + +import android.support.annotation.NonNull; + +import ru.noties.markwon.SpannableBuilder; +import ru.noties.markwon.SpannableConfiguration; +import ru.noties.markwon.html.api.HtmlTag; + +public class BlockquoteHandler extends TagHandler { + + @Override + public void handle( + @NonNull SpannableConfiguration configuration, + @NonNull SpannableBuilder builder, + @NonNull HtmlTag tag) { + + if (tag.isBlock()) { + visitChildren(configuration, builder, tag.getAsBlock()); + } + + SpannableBuilder.setSpans( + builder, + configuration.factory().blockQuote(configuration.theme()), + tag.start(), + tag.end() + ); + } +}