Parser.Builder

Builder for configuring a {@link Parser}.

Constructors

this
this()
Undocumented in source.

Members

Functions

build
Parser build()

@return the configured {@link Parser}

customBlockParserFactory
Builder customBlockParserFactory(BlockParserFactory blockParserFactory)

Adds a custom block parser factory. <p> Note that custom factories are applied <em>before</em> the built-in factories. This is so that extensions can change how some syntax is parsed that would otherwise be handled by built-in factories. "With great power comes great responsibility."

customDelimiterProcessor
Builder customDelimiterProcessor(DelimiterProcessor delimiterProcessor)

Adds a custom delimiter processor. <p> Note that multiple delimiter processors with the same characters can be added, as long as they have a different minimum length. In that case, the processor with the shortest matching length is used. Adding more than one delimiter processor with the same character and minimum length is invalid.

enabledBlockTypes
Builder enabledBlockTypes(Set!TypeInfo_Class enabledBlockTypes)

Describe the list of markdown features the parser will recognize and parse. <p> By default, CommonMark will recognize and parse the following set of "block" elements: <ul> <li>{@link Heading} ({@code #}) <li>{@link HtmlBlock} ({@code <html></html>}) <li>{@link ThematicBreak} (Horizontal Rule) ({@code ---}) <li>{@link FencedCodeBlock} ({@code ``}) <li>{@link IndentedCodeBlock} <li>{@link BlockQuote} ({@code >}) <li>{@link ListBlock} (Ordered / Unordered List) ({@code 1. / *}) </ul> <p> To parse only a subset of the features listed above, pass a list of each feature's associated {@link Block} class. <p> E.g., to only parse headings and lists: <pre> {@code Parser.builder().enabledBlockTypes(new HashSet<>(Arrays.asList(Heading.class, ListBlock.class))); } </pre>

extensions
Builder extensions(Iterable!Extension extensions)

@param extensions extensions to use on this parser @return {@code this}

inlineParserFactory
Builder inlineParserFactory(InlineParserFactory inlineParserFactory)

Overrides the parser used for inline markdown processing. <p> Provide an implementation of InlineParserFactory which provides a custom inline parser to modify how the following are parsed: bold (**) italic (*) strikethrough (~~) backtick quote (`) link (title) image (alt) <p> <p> Note that if this method is not called or the inline parser factory is set to null, then the default implementation will be used.

postProcessor
Builder postProcessor(PostProcessor postProcessor)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta