| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
Parser |
build() |
Parser.Builder |
customBlockParserFactory(BlockParserFactory blockParserFactory)
Adds a custom block parser factory.
|
Parser.Builder |
customDelimiterProcessor(DelimiterProcessor delimiterProcessor)
Adds a custom delimiter processor.
|
Parser.Builder |
enabledBlockTypes(Set<Class<? extends Block>> enabledBlockTypes)
Describe the list of markdown features the parser will recognize and parse.
|
Parser.Builder |
extensions(Iterable<? extends Extension> extensions) |
Parser.Builder |
includeSourceSpans(IncludeSourceSpans includeSourceSpans)
Whether to calculate
SourceSpan for Node. |
Parser.Builder |
inlineParserFactory(InlineParserFactory inlineParserFactory)
Overrides the parser used for inline markdown processing.
|
Parser.Builder |
postProcessor(PostProcessor postProcessor) |
public Parser.Builder extensions(Iterable<? extends Extension> extensions)
extensions - extensions to use on this parserthispublic Parser.Builder enabledBlockTypes(Set<Class<? extends Block>> enabledBlockTypes)
By default, CommonMark will recognize and parse the following set of "block" elements:
Heading (#)
HtmlBlock (<html></html>)
ThematicBreak (Horizontal Rule) (---)
FencedCodeBlock (```)
IndentedCodeBlock
BlockQuote (>)
ListBlock (Ordered / Unordered List) (1. / *)
To parse only a subset of the features listed above, pass a list of each feature's associated Block class.
E.g., to only parse headings and lists:
Parser.builder().enabledBlockTypes(new HashSet<>(Arrays.asList(Heading.class, ListBlock.class)));
enabledBlockTypes - A list of block nodes the parser will parse.
If this list is empty, the parser will not recognize any CommonMark core features.thispublic Parser.Builder includeSourceSpans(IncludeSourceSpans includeSourceSpans)
includeSourceSpans - which kind of source spans should be includedthispublic Parser.Builder customBlockParserFactory(BlockParserFactory blockParserFactory)
Note that custom factories are applied before 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."
blockParserFactory - a block parser factory implementationthispublic Parser.Builder customDelimiterProcessor(DelimiterProcessor delimiterProcessor)
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.
delimiterProcessor - a delimiter processor implementationthispublic Parser.Builder postProcessor(PostProcessor postProcessor)
public Parser.Builder inlineParserFactory(InlineParserFactory inlineParserFactory)
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](http://)) image ()
Note that if this method is not called or the inline parser factory is set to null, then the default implementation will be used.
inlineParserFactory - an inline parser factory implementationthisCopyright © 2021. All rights reserved.