Package org.commonmark.renderer.html
Interface HtmlNodeRendererContext
-
- All Known Implementing Classes:
HtmlRenderer.RendererContext
public interface HtmlNodeRendererContext
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
encodeUrl(java.lang.String url)
java.util.Map<java.lang.String,java.lang.String>
extendAttributes(Node node, java.lang.String tagName, java.util.Map<java.lang.String,java.lang.String> attributes)
Let extensions modify the HTML tag attributes.java.lang.String
getSoftbreak()
HtmlWriter
getWriter()
void
render(Node node)
Render the specified node and its children using the configured renderers.boolean
shouldEscapeHtml()
boolean
shouldOmitSingleParagraphP()
boolean
shouldSanitizeUrls()
UrlSanitizer
urlSanitizer()
-
-
-
Method Detail
-
encodeUrl
java.lang.String encodeUrl(java.lang.String url)
- Parameters:
url
- to be encoded- Returns:
- an encoded URL (depending on the configuration)
-
extendAttributes
java.util.Map<java.lang.String,java.lang.String> extendAttributes(Node node, java.lang.String tagName, java.util.Map<java.lang.String,java.lang.String> attributes)
Let extensions modify the HTML tag attributes.- Parameters:
node
- the node for which the attributes are appliedtagName
- the HTML tag name that these attributes are for (e.g.h1
,pre
,code
).attributes
- the attributes that were calculated by the renderer- Returns:
- the extended attributes with added/updated/removed entries
-
getWriter
HtmlWriter getWriter()
- Returns:
- the HTML writer to use
-
getSoftbreak
java.lang.String getSoftbreak()
- Returns:
- HTML that should be rendered for a soft line break
-
render
void render(Node node)
Render the specified node and its children using the configured renderers. This should be used to render child nodes; be careful not to pass the node that is being rendered, that would result in an endless loop.- Parameters:
node
- the node to render
-
shouldEscapeHtml
boolean shouldEscapeHtml()
- Returns:
- whether HTML blocks and tags should be escaped or not
-
shouldOmitSingleParagraphP
boolean shouldOmitSingleParagraphP()
- Returns:
- whether documents that only contain a single paragraph should be rendered without the
<p>
tag
-
shouldSanitizeUrls
boolean shouldSanitizeUrls()
- Returns:
- true if the
UrlSanitizer
should be used. - Since:
- 0.14.0
-
urlSanitizer
UrlSanitizer urlSanitizer()
- Returns:
- Sanitizer to use for securing
Link
href andImage
src ifshouldSanitizeUrls()
is true. - Since:
- 0.14.0
-
-