Class HtmlRenderer.Builder

    • Constructor Detail

      • Builder

        public Builder()
      • Builder

        public Builder​(@Nullable
                       DataHolder options)
    • Method Detail

      • removeApiPoint

        protected void removeApiPoint​(@NotNull
                                      java.lang.Object apiPoint)
        Description copied from class: BuilderBase
        Remove apiPoint from state information
        Specified by:
        removeApiPoint in class BuilderBase<HtmlRenderer.Builder>
        Parameters:
        apiPoint - api point object
      • preloadExtension

        protected void preloadExtension​(@NotNull
                                        Extension extension)
        Description copied from class: BuilderBase
        Preload operation for extension, perform any data config and other operation needed for loading extension
        Specified by:
        preloadExtension in class BuilderBase<HtmlRenderer.Builder>
        Parameters:
        extension - to preload
      • softBreak

        @NotNull
        public HtmlRenderer.Builder softBreak​(@NotNull
                                              java.lang.String softBreak)
        The HTML to use for rendering a softbreak, defaults to "\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.

        Parameters:
        softBreak - HTML for softbreak
        Returns:
        this
      • indentSize

        @NotNull
        public HtmlRenderer.Builder indentSize​(int indentSize)
        The size of the indent to use for hierarchical elements, default 0, means no indent, also fastest rendering
        Parameters:
        indentSize - number of spaces per indent
        Returns:
        this
      • escapeHtml

        @NotNull
        public HtmlRenderer.Builder escapeHtml​(boolean escapeHtml)
        Whether 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.

        Parameters:
        escapeHtml - true for escaping, false for preserving raw HTML
        Returns:
        this
      • isRendererType

        public boolean isRendererType​(@NotNull
                                      java.lang.String supportedRendererType)
      • percentEncodeUrls

        @NotNull
        public HtmlRenderer.Builder percentEncodeUrls​(boolean percentEncodeUrls)
        Whether URLs of link or images should be percent-encoded, defaults to false.

        If enabled, the following is done:

        • Existing percent-encoded parts are preserved (e.g. "%20" is kept as "%20")
        • Reserved characters such as "/" are preserved, except for "[" and "]" (see encodeURI in JS)
        • Unreserved characters such as "a" are preserved
        • Other characters such umlauts are percent-encoded
        Parameters:
        percentEncodeUrls - true to percent-encode, false for leaving as-is
        Returns:
        this
      • nodeRendererFactory

        @NotNull
        public HtmlRenderer.Builder nodeRendererFactory​(@NotNull
                                                        NodeRendererFactory nodeRendererFactory)
        Add a factory for instantiating a node renderer (done when rendering). This allows to override the rendering of node types or define rendering for custom node types.

        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.)

        Parameters:
        nodeRendererFactory - the factory for creating a node renderer
        Returns:
        this
      • linkResolverFactory

        @NotNull
        public HtmlRenderer.Builder linkResolverFactory​(@NotNull
                                                        LinkResolverFactory linkResolverFactory)
        Add a factory for instantiating a node renderer (done when rendering). This allows to override the rendering of node types or define rendering for custom node types.

        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.)

        Specified by:
        linkResolverFactory in interface RendererBuilder
        Parameters:
        linkResolverFactory - the factory for creating a node renderer
        Returns:
        this