Class FlexmarkHtmlConverter


  • public class FlexmarkHtmlConverter
    extends java.lang.Object
    Renders a tree of nodes to HTML.

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

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

      • MAX_BLANK_LINES

        public static final DataKey<java.lang.Integer> MAX_BLANK_LINES
      • MAX_TRAILING_BLANK_LINES

        public static final DataKey<java.lang.Integer> MAX_TRAILING_BLANK_LINES
      • LIST_CONTENT_INDENT

        public static final DataKey<java.lang.Boolean> LIST_CONTENT_INDENT
      • SETEXT_HEADINGS

        public static final DataKey<java.lang.Boolean> SETEXT_HEADINGS
      • OUTPUT_UNKNOWN_TAGS

        public static final DataKey<java.lang.Boolean> OUTPUT_UNKNOWN_TAGS
      • TYPOGRAPHIC_QUOTES

        public static final DataKey<java.lang.Boolean> TYPOGRAPHIC_QUOTES
      • TYPOGRAPHIC_SMARTS

        public static final DataKey<java.lang.Boolean> TYPOGRAPHIC_SMARTS
      • EXTRACT_AUTO_LINKS

        public static final DataKey<java.lang.Boolean> EXTRACT_AUTO_LINKS
      • OUTPUT_ATTRIBUTES_ID

        public static final DataKey<java.lang.Boolean> OUTPUT_ATTRIBUTES_ID
      • OUTPUT_ATTRIBUTES_NAMES_REGEX

        public static final DataKey<java.lang.String> OUTPUT_ATTRIBUTES_NAMES_REGEX
      • WRAP_AUTO_LINKS

        public static final DataKey<java.lang.Boolean> WRAP_AUTO_LINKS
      • RENDER_COMMENTS

        public static final DataKey<java.lang.Boolean> RENDER_COMMENTS
      • DOT_ONLY_NUMERIC_LISTS

        public static final DataKey<java.lang.Boolean> DOT_ONLY_NUMERIC_LISTS
      • COMMENT_ORIGINAL_NON_NUMERIC_LIST_ITEM

        public static final DataKey<java.lang.Boolean> COMMENT_ORIGINAL_NON_NUMERIC_LIST_ITEM
      • PRE_CODE_PRESERVE_EMPHASIS

        public static final DataKey<java.lang.Boolean> PRE_CODE_PRESERVE_EMPHASIS
      • ORDERED_LIST_DELIMITER

        public static final DataKey<java.lang.Character> ORDERED_LIST_DELIMITER
      • UNORDERED_LIST_DELIMITER

        public static final DataKey<java.lang.Character> UNORDERED_LIST_DELIMITER
      • DEFINITION_MARKER_SPACES

        public static final DataKey<java.lang.Integer> DEFINITION_MARKER_SPACES
      • MIN_SETEXT_HEADING_MARKER_LENGTH

        public static final DataKey<java.lang.Integer> MIN_SETEXT_HEADING_MARKER_LENGTH
      • LIST_ITEM_INDENT

        public static final DataKey<java.lang.Integer> LIST_ITEM_INDENT
      • CODE_INDENT

        public static final DataKey<java.lang.String> CODE_INDENT
      • NBSP_TEXT

        public static final DataKey<java.lang.String> NBSP_TEXT
      • EOL_IN_TITLE_ATTRIBUTE

        public static final DataKey<java.lang.String> EOL_IN_TITLE_ATTRIBUTE
      • THEMATIC_BREAK

        public static final DataKey<java.lang.String> THEMATIC_BREAK
      • UNIQUE_LINK_REF_ID_GENERATOR

        public static final DataKey<java.util.function.BiFunction<java.lang.String,​java.lang.Integer,​java.lang.String>> UNIQUE_LINK_REF_ID_GENERATOR
      • UNWRAPPED_TAGS

        public static final DataKey<java.lang.String[]> UNWRAPPED_TAGS
      • WRAPPED_TAGS

        public static final DataKey<java.lang.String[]> WRAPPED_TAGS
      • OUTPUT_ID_ATTRIBUTE_REGEX

        public static final DataKey<java.lang.String> OUTPUT_ID_ATTRIBUTE_REGEX
      • TABLE_MIN_SEPARATOR_COLUMN_WIDTH

        @Deprecated
        public static final DataKey<java.lang.Integer> TABLE_MIN_SEPARATOR_COLUMN_WIDTH
        Deprecated.
      • TABLE_MIN_SEPARATOR_DASHES

        @Deprecated
        public static final DataKey<java.lang.Integer> TABLE_MIN_SEPARATOR_DASHES
        Deprecated.
      • TABLE_LEAD_TRAIL_PIPES

        @Deprecated
        public static final DataKey<java.lang.Boolean> TABLE_LEAD_TRAIL_PIPES
        Deprecated.
      • TABLE_SPACE_AROUND_PIPES

        @Deprecated
        public static final DataKey<java.lang.Boolean> TABLE_SPACE_AROUND_PIPES
        Deprecated.
      • LISTS_END_ON_DOUBLE_BLANK

        public static final DataKey<java.lang.Boolean> LISTS_END_ON_DOUBLE_BLANK
      • DIV_AS_PARAGRAPH

        public static final DataKey<java.lang.Boolean> DIV_AS_PARAGRAPH
      • BR_AS_PARA_BREAKS

        public static final DataKey<java.lang.Boolean> BR_AS_PARA_BREAKS
      • BR_AS_EXTRA_BLANK_LINES

        public static final DataKey<java.lang.Boolean> BR_AS_EXTRA_BLANK_LINES
      • DIV_TABLE_PROCESSING

        public static final DataKey<java.lang.Boolean> DIV_TABLE_PROCESSING
      • DIV_TABLE_HDR_CLASSES

        public static final DataKey<java.lang.String[]> DIV_TABLE_HDR_CLASSES
      • DIV_TABLE_ROW_CLASSES

        public static final DataKey<java.lang.String[]> DIV_TABLE_ROW_CLASSES
      • DIV_TABLE_CELL_CLASSES

        public static final DataKey<java.lang.String[]> DIV_TABLE_CELL_CLASSES
      • ADD_TRAILING_EOL

        public static final DataKey<java.lang.Boolean> ADD_TRAILING_EOL
      • SKIP_HEADING_1

        public static final DataKey<java.lang.Boolean> SKIP_HEADING_1
      • SKIP_HEADING_2

        public static final DataKey<java.lang.Boolean> SKIP_HEADING_2
      • SKIP_HEADING_3

        public static final DataKey<java.lang.Boolean> SKIP_HEADING_3
      • SKIP_HEADING_4

        public static final DataKey<java.lang.Boolean> SKIP_HEADING_4
      • SKIP_HEADING_5

        public static final DataKey<java.lang.Boolean> SKIP_HEADING_5
      • SKIP_HEADING_6

        public static final DataKey<java.lang.Boolean> SKIP_HEADING_6
      • SKIP_ATTRIBUTES

        public static final DataKey<java.lang.Boolean> SKIP_ATTRIBUTES
      • SKIP_FENCED_CODE

        public static final DataKey<java.lang.Boolean> SKIP_FENCED_CODE
      • SKIP_CHAR_ESCAPE

        public static final DataKey<java.lang.Boolean> SKIP_CHAR_ESCAPE
      • TYPOGRAPHIC_REPLACEMENT_MAP

        public static final DataKey<java.util.Map<java.lang.String,​java.lang.String>> TYPOGRAPHIC_REPLACEMENT_MAP
      • DUMP_HTML_TREE

        public static final DataKey<java.lang.Boolean> DUMP_HTML_TREE
        if true then will dump HTML tree of body element to console when using convert(String, Appendable)(String)
      • IGNORE_TABLE_HEADING_AFTER_ROWS

        public static final DataKey<java.lang.Boolean> IGNORE_TABLE_HEADING_AFTER_ROWS
        If true then will ignore rows with th columns after rows with td columns have been emitted to the table.

        If false then will convert these to regular columns.

      • HEADING_NODES

        public static final java.lang.String[] HEADING_NODES
      • EXPLICIT_LINK_TEXT_TAGS

        public static java.lang.String[] EXPLICIT_LINK_TEXT_TAGS
      • TABLE_CELL_ALIGNMENT_MAP

        public static final DataKey<java.util.Map<java.lang.Object,​CellAlignment>> TABLE_CELL_ALIGNMENT_MAP
      • NULL_ITERABLE

        public static final java.lang.Iterable<org.jsoup.nodes.Node> NULL_ITERABLE
    • Method Detail

      • convert

        public void convert​(@NotNull
                            java.lang.String html,
                            @NotNull
                            java.lang.Appendable output)
        Render a node to the appendable
        Parameters:
        html - html to convert to markdown
        output - appendable to use for the output
      • convert

        public java.lang.String convert​(@NotNull
                                        java.lang.String html)
        Parse HTML with default options
        Parameters:
        html - html to be parsed
        Returns:
        resulting markdown string
      • convert

        public java.lang.String convert​(@NotNull
                                        java.lang.String html,
                                        int maxTrailingBlankLines)
        Parse HTML with given options and max trailing blank lines
        Parameters:
        html - html to be parsed
        maxTrailingBlankLines - max trailing blank lines, -1 will suppress trailing EOL
        Returns:
        resulting markdown string
      • dumpHtmlTree

        public static void dumpHtmlTree​(LineAppendable out,
                                        org.jsoup.nodes.Node node)
      • convert

        public void convert​(org.jsoup.nodes.Node node,
                            java.lang.Appendable output,
                            int maxTrailingBlankLines)
        Render a node to the appendable
        Parameters:
        node - node to render
        output - appendable to use for the output
        maxTrailingBlankLines - max blank lines allowed at end of output
      • convert

        public java.lang.String convert​(org.jsoup.nodes.Node node)
        Render the tree of nodes to markdown
        Parameters:
        node - the root node
        Returns:
        the formatted markdown
      • processWrapped

        public static void processWrapped​(@NotNull
                                          HtmlNodeConverterSubContext context,
                                          @NotNull
                                          org.jsoup.nodes.Node node,
                                          @Nullable
                                          java.lang.Boolean isBlock,
                                          boolean escapeMarkdown)