APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.internal.org.commonmark.renderer.text

public Class TextContentRenderer

extends Object
implements Renderer
Class Inheritance
All Implemented Interfaces
jdk.internal.org.commonmark.renderer.Renderer
Imports
jdk.internal.org.commonmark.Extension, jdk.internal.org.commonmark.internal.renderer.NodeRendererMap, jdk.internal.org.commonmark.node.Node, jdk.internal.org.commonmark.renderer.NodeRenderer, .Renderer, java.util.ArrayList, .List

Renders nodes to plain text content with minimal markup-like additions.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
private class
public static interface

Field Summary

Modifier and TypeField and Description
private final List<TextContentNodeRendererFactory>
private final boolean

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static TextContentRenderer.Builder

Returns:

a builder
builder
()

Create a new builder for configuring a TextContentRenderer.

public void
render(Node node, Appendable output)

Implements jdk.internal.org.commonmark.renderer.Renderer.render.

Render the tree of nodes to output.

public String
render(Node node)

Implements jdk.internal.org.commonmark.renderer.Renderer.render.

Render the tree of nodes to string.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nodeRendererFactoriesback to summary
private final List<TextContentNodeRendererFactory> nodeRendererFactories
stripNewlinesback to summary
private final boolean stripNewlines

Constructor Detail

TextContentRendererback to summary
private TextContentRenderer(TextContentRenderer.Builder builder)

Method Detail

builderback to summary
public static TextContentRenderer.Builder builder()

Create a new builder for configuring a TextContentRenderer.

Returns:TextContentRenderer.Builder

a builder

renderback to summary
public void render(Node node, Appendable output)

Implements jdk.internal.org.commonmark.renderer.Renderer.render.

Doc from jdk.internal.org.commonmark.renderer.Renderer.render.

Render the tree of nodes to output.

Annotations
@Override
renderback to summary
public String render(Node node)

Implements jdk.internal.org.commonmark.renderer.Renderer.render.

Doc from jdk.internal.org.commonmark.renderer.Renderer.render.

Render the tree of nodes to string.

Annotations
@Override
jdk.internal.org.commonmark.renderer.text back to summary

public Class TextContentRenderer.Builder

extends Object
Class Inheritance
  • java.lang.Object
  • jdk.internal.org.commonmark.renderer.text.TextContentRenderer.Builder

Builder for configuring a TextContentRenderer. See methods for default configuration.

Field Summary

Modifier and TypeField and Description
private List<TextContentNodeRendererFactory>
private boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public TextContentRenderer
build()

Returns: the configured TextContentRenderer

public TextContentRenderer.Builder
extensions(Iterable<? extends Extension>
extensions to use on this text content renderer
extensions
)

Returns: this

public TextContentRenderer.Builder

Returns:

this
nodeRendererFactory
(TextContentNodeRendererFactory
the factory for creating a node renderer
nodeRendererFactory
)

Add a factory for instantiating a node renderer (done when rendering).

public TextContentRenderer.Builder

Returns:

this
stripNewlines
(boolean
true for stripping new lines and render text as "single line", false for keeping all line breaks
stripNewlines
)

Set the value of flag for stripping new lines.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nodeRendererFactoriesback to summary
private List<TextContentNodeRendererFactory> nodeRendererFactories
stripNewlinesback to summary
private boolean stripNewlines

Constructor Detail

Builderback to summary
public Builder()

Method Detail

buildback to summary
public TextContentRenderer build()
Returns:TextContentRenderer

the configured TextContentRenderer

extensionsback to summary
public TextContentRenderer.Builder extensions(Iterable<? extends Extension> extensions)
Parameters
extensions:Iterable<? extends Extension>

extensions to use on this text content renderer

Returns:TextContentRenderer.Builder

this

nodeRendererFactoryback to summary
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:TextContentNodeRendererFactory

the factory for creating a node renderer

Returns:TextContentRenderer.Builder

this

stripNewlinesback to summary
public TextContentRenderer.Builder stripNewlines(boolean stripNewlines)

Set the value of flag for stripping new lines.

Parameters
stripNewlines:boolean

true for stripping new lines and render text as "single line", false for keeping all line breaks

Returns:TextContentRenderer.Builder

this

jdk.internal.org.commonmark.renderer.text back to summary

private Class TextContentRenderer.RendererContext

extends Object
implements TextContentNodeRendererContext
Class Inheritance
  • java.lang.Object
  • jdk.internal.org.commonmark.renderer.text.TextContentRenderer.RendererContext
All Implemented Interfaces
jdk.internal.org.commonmark.renderer.text.TextContentNodeRendererContext

Field Summary

Modifier and TypeField and Description
private final NodeRendererMap
private final TextContentWriter

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public TextContentWriter
public void
render(Node node)

Implements jdk.internal.org.commonmark.renderer.text.TextContentNodeRendererContext.render.

Render the specified node and its children using the configured renderers.

public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nodeRendererMapback to summary
private final NodeRendererMap nodeRendererMap
textContentWriterback to summary
private final TextContentWriter textContentWriter

Constructor Detail

RendererContextback to summary
private RendererContext(TextContentWriter textContentWriter)

Method Detail

getWriterback to summary
public TextContentWriter getWriter()

Implements jdk.internal.org.commonmark.renderer.text.TextContentNodeRendererContext.getWriter.

Annotations
@Override
renderback to summary
public void render(Node node)

Implements jdk.internal.org.commonmark.renderer.text.TextContentNodeRendererContext.render.

Doc from jdk.internal.org.commonmark.renderer.text.TextContentNodeRendererContext.render.

Render the specified node and its children using the configured renderers. This should be used to render child nodes; be careful not to pass the node that is being rendered, that would result in an endless loop.

Annotations
@Override
stripNewlinesback to summary
public boolean stripNewlines()

Implements jdk.internal.org.commonmark.renderer.text.TextContentNodeRendererContext.stripNewlines.

Annotations
@Override
jdk.internal.org.commonmark.renderer.text back to summary

public Interface TextContentRenderer.TextContentRendererExtension

extends Extension
Known Direct Implementers
jdk.internal.org.commonmark.ext.gfm.tables.TablesExtension

Extension for TextContentRenderer.

Method Summary

Modifier and TypeMethod and Description
public void

Method Detail

extendback to summary
public void extend(TextContentRenderer.Builder rendererBuilder)