Class HtmlRenderer

java.lang.Object
com.vladsch.flexmark.html.HtmlRenderer
All Implemented Interfaces:
IRender

public class HtmlRenderer extends Object implements 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 Details

    • SOFT_BREAK

      public static final DataKey<String> SOFT_BREAK
    • HARD_BREAK

      public static final DataKey<String> HARD_BREAK
    • STRONG_EMPHASIS_STYLE_HTML_OPEN

      public static final NullableDataKey<String> STRONG_EMPHASIS_STYLE_HTML_OPEN
    • STRONG_EMPHASIS_STYLE_HTML_CLOSE

      public static final NullableDataKey<String> STRONG_EMPHASIS_STYLE_HTML_CLOSE
    • EMPHASIS_STYLE_HTML_OPEN

      public static final NullableDataKey<String> EMPHASIS_STYLE_HTML_OPEN
    • EMPHASIS_STYLE_HTML_CLOSE

      public static final NullableDataKey<String> EMPHASIS_STYLE_HTML_CLOSE
    • CODE_STYLE_HTML_OPEN

      public static final NullableDataKey<String> CODE_STYLE_HTML_OPEN
    • CODE_STYLE_HTML_CLOSE

      public static final NullableDataKey<String> CODE_STYLE_HTML_CLOSE
    • INLINE_CODE_SPLICE_CLASS

      public static final NullableDataKey<String> INLINE_CODE_SPLICE_CLASS
    • PERCENT_ENCODE_URLS

      public static final DataKey<Boolean> PERCENT_ENCODE_URLS
    • INDENT_SIZE

      public static final DataKey<Integer> INDENT_SIZE
    • ESCAPE_HTML

      public static final DataKey<Boolean> ESCAPE_HTML
    • ESCAPE_HTML_BLOCKS

      public static final DataKey<Boolean> ESCAPE_HTML_BLOCKS
    • ESCAPE_HTML_COMMENT_BLOCKS

      public static final DataKey<Boolean> ESCAPE_HTML_COMMENT_BLOCKS
    • ESCAPE_INLINE_HTML

      public static final DataKey<Boolean> ESCAPE_INLINE_HTML
    • ESCAPE_INLINE_HTML_COMMENTS

      public static final DataKey<Boolean> ESCAPE_INLINE_HTML_COMMENTS
    • SUPPRESS_HTML

      public static final DataKey<Boolean> SUPPRESS_HTML
    • SUPPRESS_HTML_BLOCKS

      public static final DataKey<Boolean> SUPPRESS_HTML_BLOCKS
    • SUPPRESS_HTML_COMMENT_BLOCKS

      public static final DataKey<Boolean> SUPPRESS_HTML_COMMENT_BLOCKS
    • SUPPRESS_INLINE_HTML

      public static final DataKey<Boolean> SUPPRESS_INLINE_HTML
    • SUPPRESS_INLINE_HTML_COMMENTS

      public static final DataKey<Boolean> SUPPRESS_INLINE_HTML_COMMENTS
    • SOURCE_WRAP_HTML

      public static final DataKey<Boolean> SOURCE_WRAP_HTML
    • SOURCE_WRAP_HTML_BLOCKS

      public static final DataKey<Boolean> SOURCE_WRAP_HTML_BLOCKS
    • HEADER_ID_GENERATOR_RESOLVE_DUPES

      public static final DataKey<Boolean> HEADER_ID_GENERATOR_RESOLVE_DUPES
    • HEADER_ID_GENERATOR_TO_DASH_CHARS

      public static final DataKey<String> HEADER_ID_GENERATOR_TO_DASH_CHARS
    • HEADER_ID_GENERATOR_NON_DASH_CHARS

      public static final DataKey<String> HEADER_ID_GENERATOR_NON_DASH_CHARS
    • HEADER_ID_GENERATOR_NO_DUPED_DASHES

      public static final DataKey<Boolean> HEADER_ID_GENERATOR_NO_DUPED_DASHES
    • HEADER_ID_GENERATOR_NON_ASCII_TO_LOWERCASE

      public static final DataKey<Boolean> HEADER_ID_GENERATOR_NON_ASCII_TO_LOWERCASE
    • HEADER_ID_REF_TEXT_TRIM_LEADING_SPACES

      public static final DataKey<Boolean> HEADER_ID_REF_TEXT_TRIM_LEADING_SPACES
    • HEADER_ID_REF_TEXT_TRIM_TRAILING_SPACES

      public static final DataKey<Boolean> HEADER_ID_REF_TEXT_TRIM_TRAILING_SPACES
    • HEADER_ID_ADD_EMOJI_SHORTCUT

      public static final DataKey<Boolean> HEADER_ID_ADD_EMOJI_SHORTCUT
    • RENDER_HEADER_ID

      public static final DataKey<Boolean> RENDER_HEADER_ID
    • GENERATE_HEADER_ID

      public static final DataKey<Boolean> GENERATE_HEADER_ID
    • FENCED_CODE_LANGUAGE_CLASS_PREFIX

      public static final DataKey<String> FENCED_CODE_LANGUAGE_CLASS_PREFIX
    • FENCED_CODE_LANGUAGE_CLASS_MAP

      public static final DataKey<HashMap<String,String>> FENCED_CODE_LANGUAGE_CLASS_MAP
    • FENCED_CODE_NO_LANGUAGE_CLASS

      public static final DataKey<String> FENCED_CODE_NO_LANGUAGE_CLASS
    • FENCED_CODE_LANGUAGE_DELIMITERS

      public static final DataKey<String> FENCED_CODE_LANGUAGE_DELIMITERS
    • SOURCE_POSITION_ATTRIBUTE

      public static final DataKey<String> SOURCE_POSITION_ATTRIBUTE
    • SOURCE_POSITION_PARAGRAPH_LINES

      public static final DataKey<Boolean> SOURCE_POSITION_PARAGRAPH_LINES
    • TYPE

      public static final DataKey<String> TYPE
    • TAG_RANGES

      public static final DataKey<ArrayList<TagRange>> TAG_RANGES
    • RECHECK_UNDEFINED_REFERENCES

      public static final DataKey<Boolean> RECHECK_UNDEFINED_REFERENCES
    • OBFUSCATE_EMAIL

      public static final DataKey<Boolean> OBFUSCATE_EMAIL
    • OBFUSCATE_EMAIL_RANDOM

      public static final DataKey<Boolean> OBFUSCATE_EMAIL_RANDOM
    • HTML_BLOCK_OPEN_TAG_EOL

      public static final DataKey<Boolean> HTML_BLOCK_OPEN_TAG_EOL
    • HTML_BLOCK_CLOSE_TAG_EOL

      public static final DataKey<Boolean> HTML_BLOCK_CLOSE_TAG_EOL
    • UNESCAPE_HTML_ENTITIES

      public static final DataKey<Boolean> UNESCAPE_HTML_ENTITIES
    • NO_P_TAGS_USE_BR

      public static final DataKey<Boolean> NO_P_TAGS_USE_BR
    • EMBEDDED_ATTRIBUTE_PROVIDER

      public static final DataKey<Boolean> EMBEDDED_ATTRIBUTE_PROVIDER
    • FORMAT_FLAGS

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

      public static final DataKey<Integer> MAX_TRAILING_BLANK_LINES
    • MAX_BLANK_LINES

      public static final 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 DataKey<List<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 DataKey<List<TrackedOffset>> TRACKED_OFFSETS
    • attributeProviderFactories

      final List<AttributeProviderFactory> attributeProviderFactories
    • nodeRendererFactories

      final List<DelegatingNodeRendererFactoryWrapper> nodeRendererFactories
    • linkResolverFactories

      final List<LinkResolverFactory> linkResolverFactories
    • htmlIdGeneratorFactory

      final HeaderIdGeneratorFactory htmlIdGeneratorFactory
    • htmlOptions

      final HtmlRendererOptions htmlOptions
    • options

      final DataHolder options
  • Constructor Details

  • Method Details

    • builder

      @NotNull public static @NotNull HtmlRenderer.Builder builder()
      Create a new builder for configuring an HtmlRenderer.
      Returns:
      a builder
    • builder

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

      @NotNull public @NotNull DataHolder getOptions()
      Description copied from interface: IRender
      Get Options for parsing
      Specified by:
      getOptions in interface IRender
      Returns:
      DataHolder for options
    • render

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

      public void render(@NotNull @NotNull 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 Node node)
      Render the tree of nodes to HTML.
      Specified by:
      render in interface IRender
      Parameters:
      node - the root node
      Returns:
      the rendered HTML.
    • isCompatibleRendererType

      public static boolean isCompatibleRendererType(@NotNull @NotNull MutableDataHolder options, @NotNull @NotNull String supportedRendererType)
    • isCompatibleRendererType

      public static boolean isCompatibleRendererType(@NotNull @NotNull MutableDataHolder options, @NotNull @NotNull String rendererType, @NotNull @NotNull String supportedRendererType)
    • addRenderTypeEquivalence

      @NotNull public static @NotNull MutableDataHolder addRenderTypeEquivalence(@NotNull @NotNull MutableDataHolder options, @NotNull @NotNull String rendererType, @NotNull @NotNull String supportedRendererType)