Package org.commonmark.renderer.text
Class TextContentRenderer.Builder
- java.lang.Object
-
- org.commonmark.renderer.text.TextContentRenderer.Builder
-
- Enclosing class:
- TextContentRenderer
public static class TextContentRenderer.Builder extends java.lang.Object
Builder for configuring aTextContentRenderer
. See methods for default configuration.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<TextContentNodeRendererFactory>
nodeRendererFactories
private boolean
stripNewlines
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TextContentRenderer
build()
TextContentRenderer.Builder
extensions(java.lang.Iterable<? extends Extension> extensions)
TextContentRenderer.Builder
nodeRendererFactory(TextContentNodeRendererFactory nodeRendererFactory)
Add a factory for instantiating a node renderer (done when rendering).TextContentRenderer.Builder
stripNewlines(boolean stripNewlines)
Set the value of flag for stripping new lines.
-
-
-
Field Detail
-
stripNewlines
private boolean stripNewlines
-
nodeRendererFactories
private java.util.List<TextContentNodeRendererFactory> nodeRendererFactories
-
-
Method Detail
-
build
public TextContentRenderer build()
- Returns:
- the configured
TextContentRenderer
-
stripNewlines
public TextContentRenderer.Builder stripNewlines(boolean stripNewlines)
Set the value of flag for stripping new lines.- Parameters:
stripNewlines
- true for stripping new lines and render text as "single line", false for keeping all line breaks- Returns:
this
-
nodeRendererFactory
public TextContentRenderer.Builder nodeRendererFactory(TextContentNodeRendererFactory nodeRendererFactory)
Add a factory for instantiating a node renderer (done when rendering). This allows to override the rendering of node types or define rendering for custom node types.If multiple node renderers for the same node type are created, the one from the factory that was added first "wins". (This is how the rendering for core node types can be overridden; the default rendering comes last.)
- Parameters:
nodeRendererFactory
- the factory for creating a node renderer- Returns:
this
-
extensions
public TextContentRenderer.Builder extensions(java.lang.Iterable<? extends Extension> extensions)
- Parameters:
extensions
- extensions to use on this text content renderer- Returns:
this
-
-