public static class HtmlRenderer.Builder extends Object
HtmlRenderer. See methods for default configuration.| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
HtmlRenderer.Builder |
attributeProviderFactory(AttributeProviderFactory attributeProviderFactory)
Add a factory for an attribute provider for adding/changing HTML attributes to the rendered tags.
|
HtmlRenderer |
build() |
HtmlRenderer.Builder |
escapeHtml(boolean escapeHtml)
|
HtmlRenderer.Builder |
extensions(Iterable<? extends Extension> extensions) |
HtmlRenderer.Builder |
nodeRendererFactory(HtmlNodeRendererFactory nodeRendererFactory)
Add a factory for instantiating a node renderer (done when rendering).
|
HtmlRenderer.Builder |
percentEncodeUrls(boolean percentEncodeUrls)
Whether URLs of link or images should be percent-encoded, defaults to
false. |
HtmlRenderer.Builder |
sanitizeUrls(boolean sanitizeUrls)
|
HtmlRenderer.Builder |
softbreak(String softbreak)
The HTML to use for rendering a softbreak, defaults to
"\n" (meaning the rendered result doesn't have
a line break). |
HtmlRenderer.Builder |
urlSanitizer(UrlSanitizer urlSanitizer)
UrlSanitizer used to filter URL's if sanitizeUrls is true. |
public HtmlRenderer build()
HtmlRendererpublic HtmlRenderer.Builder softbreak(String softbreak)
"\n" (meaning the rendered result doesn't have
a line break).
Set it to "<br>" (or "<br />" to make them hard breaks.
Set it to " " to ignore line wrapping in the source.
softbreak - HTML for softbreakthispublic HtmlRenderer.Builder escapeHtml(boolean escapeHtml)
HtmlInline and HtmlBlock should be escaped, defaults to false.
Note that HtmlInline is only a tag itself, not the text between an opening tag and a closing tag. So
markup in the text will be parsed as normal and is not affected by this option.
escapeHtml - true for escaping, false for preserving raw HTMLthispublic HtmlRenderer.Builder sanitizeUrls(boolean sanitizeUrls)
sanitizeUrls - true for sanitization, false for preserving raw attributethispublic HtmlRenderer.Builder urlSanitizer(UrlSanitizer urlSanitizer)
UrlSanitizer used to filter URL's if sanitizeUrls is true.public HtmlRenderer.Builder percentEncodeUrls(boolean percentEncodeUrls)
false.
If enabled, the following is done:
percentEncodeUrls - true to percent-encode, false for leaving as-isthispublic HtmlRenderer.Builder attributeProviderFactory(AttributeProviderFactory attributeProviderFactory)
attributeProviderFactory - the attribute provider factory to addthispublic HtmlRenderer.Builder nodeRendererFactory(HtmlNodeRendererFactory nodeRendererFactory)
If multiple node renderers for the same node type are created, the one from the factory that was added first "wins". (This is how the rendering for core node types can be overridden; the default rendering comes last.)
nodeRendererFactory - the factory for creating a node rendererthispublic HtmlRenderer.Builder extensions(Iterable<? extends Extension> extensions)
extensions - extensions to use on this HTML rendererthisCopyright © 2021. All rights reserved.