Class HtmlRenderer

  • All Implemented Interfaces:
    com.vladsch.flexmark.util.ast.IRender

    public class HtmlRenderer
    extends Object
    implements com.vladsch.flexmark.util.ast.IRender
    Renders a tree of nodes to HTML.

    Start with the builder() method to configure the renderer. Example:

    
     HtmlRenderer renderer = HtmlRenderer.builder().escapeHtml(true).build();
     renderer.render(node);
     
    • Field Detail

      • SOFT_BREAK

        public static final com.vladsch.flexmark.util.data.DataKey<String> SOFT_BREAK
      • HARD_BREAK

        public static final com.vladsch.flexmark.util.data.DataKey<String> HARD_BREAK
      • STRONG_EMPHASIS_STYLE_HTML_OPEN

        public static final com.vladsch.flexmark.util.data.NullableDataKey<String> STRONG_EMPHASIS_STYLE_HTML_OPEN
      • STRONG_EMPHASIS_STYLE_HTML_CLOSE

        public static final com.vladsch.flexmark.util.data.NullableDataKey<String> STRONG_EMPHASIS_STYLE_HTML_CLOSE
      • EMPHASIS_STYLE_HTML_OPEN

        public static final com.vladsch.flexmark.util.data.NullableDataKey<String> EMPHASIS_STYLE_HTML_OPEN
      • EMPHASIS_STYLE_HTML_CLOSE

        public static final com.vladsch.flexmark.util.data.NullableDataKey<String> EMPHASIS_STYLE_HTML_CLOSE
      • CODE_STYLE_HTML_OPEN

        public static final com.vladsch.flexmark.util.data.NullableDataKey<String> CODE_STYLE_HTML_OPEN
      • CODE_STYLE_HTML_CLOSE

        public static final com.vladsch.flexmark.util.data.NullableDataKey<String> CODE_STYLE_HTML_CLOSE
      • INLINE_CODE_SPLICE_CLASS

        public static final com.vladsch.flexmark.util.data.NullableDataKey<String> INLINE_CODE_SPLICE_CLASS
      • PERCENT_ENCODE_URLS

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> PERCENT_ENCODE_URLS
      • INDENT_SIZE

        public static final com.vladsch.flexmark.util.data.DataKey<Integer> INDENT_SIZE
      • ESCAPE_HTML

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> ESCAPE_HTML
      • ESCAPE_HTML_BLOCKS

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> ESCAPE_HTML_BLOCKS
      • ESCAPE_HTML_COMMENT_BLOCKS

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> ESCAPE_HTML_COMMENT_BLOCKS
      • ESCAPE_INLINE_HTML

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> ESCAPE_INLINE_HTML
      • ESCAPE_INLINE_HTML_COMMENTS

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> ESCAPE_INLINE_HTML_COMMENTS
      • SUPPRESS_HTML

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> SUPPRESS_HTML
      • SUPPRESS_HTML_BLOCKS

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> SUPPRESS_HTML_BLOCKS
      • SUPPRESS_HTML_COMMENT_BLOCKS

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> SUPPRESS_HTML_COMMENT_BLOCKS
      • SUPPRESS_INLINE_HTML

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> SUPPRESS_INLINE_HTML
      • SUPPRESS_INLINE_HTML_COMMENTS

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> SUPPRESS_INLINE_HTML_COMMENTS
      • SOURCE_WRAP_HTML

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> SOURCE_WRAP_HTML
      • SOURCE_WRAP_HTML_BLOCKS

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> SOURCE_WRAP_HTML_BLOCKS
      • HEADER_ID_GENERATOR_RESOLVE_DUPES

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> HEADER_ID_GENERATOR_RESOLVE_DUPES
      • HEADER_ID_GENERATOR_TO_DASH_CHARS

        public static final com.vladsch.flexmark.util.data.DataKey<String> HEADER_ID_GENERATOR_TO_DASH_CHARS
      • HEADER_ID_GENERATOR_NON_DASH_CHARS

        public static final com.vladsch.flexmark.util.data.DataKey<String> HEADER_ID_GENERATOR_NON_DASH_CHARS
      • HEADER_ID_GENERATOR_NO_DUPED_DASHES

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> HEADER_ID_GENERATOR_NO_DUPED_DASHES
      • HEADER_ID_GENERATOR_NON_ASCII_TO_LOWERCASE

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> HEADER_ID_GENERATOR_NON_ASCII_TO_LOWERCASE
      • HEADER_ID_REF_TEXT_TRIM_LEADING_SPACES

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> HEADER_ID_REF_TEXT_TRIM_LEADING_SPACES
      • HEADER_ID_REF_TEXT_TRIM_TRAILING_SPACES

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> HEADER_ID_REF_TEXT_TRIM_TRAILING_SPACES
      • HEADER_ID_ADD_EMOJI_SHORTCUT

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> HEADER_ID_ADD_EMOJI_SHORTCUT
      • RENDER_HEADER_ID

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> RENDER_HEADER_ID
      • GENERATE_HEADER_ID

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> GENERATE_HEADER_ID
      • DO_NOT_RENDER_LINKS

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> DO_NOT_RENDER_LINKS
      • FENCED_CODE_LANGUAGE_CLASS_PREFIX

        public static final com.vladsch.flexmark.util.data.DataKey<String> FENCED_CODE_LANGUAGE_CLASS_PREFIX
      • FENCED_CODE_LANGUAGE_CLASS_MAP

        public static final com.vladsch.flexmark.util.data.DataKey<HashMap<String,​String>> FENCED_CODE_LANGUAGE_CLASS_MAP
      • FENCED_CODE_NO_LANGUAGE_CLASS

        public static final com.vladsch.flexmark.util.data.DataKey<String> FENCED_CODE_NO_LANGUAGE_CLASS
      • FENCED_CODE_LANGUAGE_DELIMITERS

        public static final com.vladsch.flexmark.util.data.DataKey<String> FENCED_CODE_LANGUAGE_DELIMITERS
      • SOURCE_POSITION_ATTRIBUTE

        public static final com.vladsch.flexmark.util.data.DataKey<String> SOURCE_POSITION_ATTRIBUTE
      • SOURCE_POSITION_PARAGRAPH_LINES

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> SOURCE_POSITION_PARAGRAPH_LINES
      • TYPE

        public static final com.vladsch.flexmark.util.data.DataKey<String> TYPE
      • TAG_RANGES

        public static final com.vladsch.flexmark.util.data.DataKey<ArrayList<com.vladsch.flexmark.util.sequence.TagRange>> TAG_RANGES
      • RECHECK_UNDEFINED_REFERENCES

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> RECHECK_UNDEFINED_REFERENCES
      • OBFUSCATE_EMAIL

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> OBFUSCATE_EMAIL
      • OBFUSCATE_EMAIL_RANDOM

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> OBFUSCATE_EMAIL_RANDOM
      • HTML_BLOCK_OPEN_TAG_EOL

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> HTML_BLOCK_OPEN_TAG_EOL
      • HTML_BLOCK_CLOSE_TAG_EOL

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> HTML_BLOCK_CLOSE_TAG_EOL
      • UNESCAPE_HTML_ENTITIES

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> UNESCAPE_HTML_ENTITIES
      • AUTOLINK_WWW_PREFIX

        public static final com.vladsch.flexmark.util.data.DataKey<String> AUTOLINK_WWW_PREFIX
      • SUPPRESSED_LINKS

        public static final com.vladsch.flexmark.util.data.DataKey<String> SUPPRESSED_LINKS
      • NO_P_TAGS_USE_BR

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> NO_P_TAGS_USE_BR
      • EMBEDDED_ATTRIBUTE_PROVIDER

        public static final com.vladsch.flexmark.util.data.DataKey<Boolean> EMBEDDED_ATTRIBUTE_PROVIDER
      • FORMAT_FLAGS

        public static final com.vladsch.flexmark.util.data.DataKey<Integer> FORMAT_FLAGS
        output control for FormattingAppendable, see LineAppendable.setOptions(int)
      • MAX_TRAILING_BLANK_LINES

        public static final com.vladsch.flexmark.util.data.DataKey<Integer> MAX_TRAILING_BLANK_LINES
      • MAX_BLANK_LINES

        public static final com.vladsch.flexmark.util.data.DataKey<Integer> MAX_BLANK_LINES
      • CONVERT_TABS

        @Deprecated
        public static final int CONVERT_TABS
        Deprecated.
      • COLLAPSE_WHITESPACE

        @Deprecated
        public static final int COLLAPSE_WHITESPACE
        Deprecated.
      • SUPPRESS_TRAILING_WHITESPACE

        @Deprecated
        public static final int SUPPRESS_TRAILING_WHITESPACE
        Deprecated.
      • PASS_THROUGH

        @Deprecated
        public static final int PASS_THROUGH
        Deprecated.
      • FORMAT_ALL

        @Deprecated
        public static final int FORMAT_ALL
        Deprecated.
      • RENDERER_TYPE_EQUIVALENCE

        public static final com.vladsch.flexmark.util.data.DataKey<List<com.vladsch.flexmark.util.misc.Pair<String,​String>>> RENDERER_TYPE_EQUIVALENCE
        Stores pairs of equivalent renderer types to allow extensions to resolve types not known to them

        Pair contains: rendererType, equivalentType

      • FORMAT_CONVERT_TABS

        @Deprecated
        public static final int FORMAT_CONVERT_TABS
        Deprecated.
      • FORMAT_COLLAPSE_WHITESPACE

        @Deprecated
        public static final int FORMAT_COLLAPSE_WHITESPACE
        Deprecated.
      • FORMAT_SUPPRESS_TRAILING_WHITESPACE

        @Deprecated
        public static final int FORMAT_SUPPRESS_TRAILING_WHITESPACE
        Deprecated.
      • FORMAT_ALL_OPTIONS

        @Deprecated
        public static final int FORMAT_ALL_OPTIONS
        Deprecated.
      • TRACKED_OFFSETS

        public static final com.vladsch.flexmark.util.data.DataKey<List<com.vladsch.flexmark.util.format.TrackedOffset>> TRACKED_OFFSETS
    • Method Detail

      • builder

        @NotNull
        public static @NotNull HtmlRenderer.Builder builder​(@Nullable
                                                            @Nullable com.vladsch.flexmark.util.data.DataHolder options)
        Create a new builder for configuring an HtmlRenderer.
        Parameters:
        options - initialization options
        Returns:
        a builder
      • getOptions

        @NotNull
        public @NotNull com.vladsch.flexmark.util.data.DataHolder getOptions()
        Specified by:
        getOptions in interface com.vladsch.flexmark.util.ast.IRender
      • render

        public void render​(@NotNull
                           @NotNull com.vladsch.flexmark.util.ast.Node node,
                           @NotNull
                           @NotNull Appendable output)
        Render a node to the appendable
        Specified by:
        render in interface com.vladsch.flexmark.util.ast.IRender
        Parameters:
        node - node to render
        output - appendable to use for the output
      • render

        public void render​(@NotNull
                           @NotNull com.vladsch.flexmark.util.ast.Node node,
                           @NotNull
                           @NotNull Appendable output,
                           int maxTrailingBlankLines)
        Render a node to the appendable
        Parameters:
        node - node to render
        output - appendable to use for the output
      • render

        @NotNull
        public @NotNull String render​(@NotNull
                                      @NotNull com.vladsch.flexmark.util.ast.Node node)
        Render the tree of nodes to HTML.
        Specified by:
        render in interface com.vladsch.flexmark.util.ast.IRender
        Parameters:
        node - the root node
        Returns:
        the rendered HTML.
      • isCompatibleRendererType

        public static boolean isCompatibleRendererType​(@NotNull
                                                       @NotNull com.vladsch.flexmark.util.data.MutableDataHolder options,
                                                       @NotNull
                                                       @NotNull String supportedRendererType)
      • isCompatibleRendererType

        public static boolean isCompatibleRendererType​(@NotNull
                                                       @NotNull com.vladsch.flexmark.util.data.MutableDataHolder options,
                                                       @NotNull
                                                       @NotNull String rendererType,
                                                       @NotNull
                                                       @NotNull String supportedRendererType)
      • addRenderTypeEquivalence

        @NotNull
        public static @NotNull com.vladsch.flexmark.util.data.MutableDataHolder addRenderTypeEquivalence​(@NotNull
                                                                                                         @NotNull com.vladsch.flexmark.util.data.MutableDataHolder options,
                                                                                                         @NotNull
                                                                                                         @NotNull String rendererType,
                                                                                                         @NotNull
                                                                                                         @NotNull String supportedRendererType)