Top Description Inners Fields Constructors Methods
com.vladsch.flexmark.formatter

public Class Formatter

extends Object
implements IRender
Class Inheritance
All Implemented Interfaces
com.vladsch.flexmark.util.ast.IRender
Annotations
@SuppressWarnings:WeakerAccess
Imports
com.vladsch.flexmark.formatter.internal.*, com.vladsch.flexmark.html.AttributeProviderFactory, .LinkResolver, .LinkResolverFactory, com.vladsch.flexmark.html.renderer.*, com.vladsch.flexmark.parser.Parser, .ParserEmulationProfile, com.vladsch.flexmark.util.ast.*, com.vladsch.flexmark.util.builder.BuilderBase, com.vladsch.flexmark.util.collection.SubClassingBag, com.vladsch.flexmark.util.data.*, com.vladsch.flexmark.util.dependency.DependencyResolver, com.vladsch.flexmark.util.format.*, com.vladsch.flexmark.util.format.options.*, com.vladsch.flexmark.util.html.Attributes, com.vladsch.flexmark.util.misc.CharPredicate, .Extension, com.vladsch.flexmark.util.sequence.BasedSequence, .LineAppendable, .SequenceUtils, com.vladsch.flexmark.util.sequence.builder.ISequenceBuilder, .SequenceBuilder, org.jetbrains.annotations.NotNull, .Nullable, java.util.*, java.util.function.Function, .Supplier, java.util.regex.Pattern

Renders a tree of nodes to Markdown.

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


Formatter formatter = Formatter.builder().build();
formatter.render(node);

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Formatter.Builder

Builder for configuring an Formatter.

public static interface
private class

Field Summary

Modifier and TypeField and Description
public static final DataKey<Boolean>
public static final DataKey<Boolean>
public static final DataKey<Map<String, String>>
public static final DataKey<EqualizeTrailingMarker>
ATX_HEADER_TRAILING_MARKER

Deprecated
use corrected name
public static final DataKey<EqualizeTrailingMarker>
public static final DataKey<Boolean>
public static final DataKey<BlockQuoteMarker>
public static final DataKey<String>
public static final DataKey<String>
public static final DataKey<CharSequence>
public static final DataKey<CharSequence>
public static final Document[]
public static final DataKey<Boolean>
public static final DataKey<Boolean>
public static final DataKey<Integer>
public static final DataKey<CodeFenceMarker>
public static final DataKey<Boolean>
public static final DataKey<Boolean>
public static final DataKey<Boolean>
public static final int
FORMAT_ALL_OPTIONS

Deprecated
public static final DataKey<CharWidthProvider>
public static final int
public static final int
public static final DataKey<Integer>
FORMAT_FLAGS

output control for FormattingAppendable, see LineAppendable#setOptions(int)

public static final int
public static final DataKey<TableCaptionHandling>
FORMAT_TABLE_CAPTION

Deprecated
use TableFormatOptions instead
public static final DataKey<DiscretionaryText>
FORMAT_TABLE_CAPTION_SPACES

Deprecated
use TableFormatOptions instead
public static final DataKey<String>
FORMAT_TABLE_INDENT_PREFIX

Deprecated
use TableFormatOptions instead
public static final DataKey<ParserEmulationProfile>
public static final DataKey<String>
public static final DataKey<String>
public static final DataKey<Boolean>
public static final DataKey<Boolean>
public static final DataKey<Boolean>
public static final DataKey<HeadingStyle>
pack-priv final HeaderIdGeneratorFactory
public static final DataKey<Boolean>
public static final DataKey<Boolean>
public static final DataKey<Boolean>
pack-priv final List<LinkResolverFactory>
public static final DataKey<Boolean>
public static final DataKey<ElementAlignment>
public static final DataKey<ListBulletMarker>
public static final DataKey<ListNumberedMarker>
public static final DataKey<Boolean>
public static final DataKey<Boolean>
public static final DataKey<Boolean>
public static final DataKey<ListSpacing>
public static final DataKey<Boolean>
public static final DataKey<Integer>
public static final DataKey<Integer>
pack-priv final List<NodeFormatterFactory>
public static final Iterable<Node>
private static final Iterator<Node>
public static final DataKey<Boolean>
private final DataHolder
public static final DataKey<ElementPlacement>
public static final DataKey<ElementPlacementSort>
public static final DataKey<Boolean>
public static final DataKey<Integer>
public static final DataKey<Boolean>
SETEXT_HEADER_EQUALIZE_MARKER

Deprecated
use corrected name
public static final DataKey<Boolean>
public static final DataKey<DiscretionaryText>
public static final NullableDataKey<String>
public static final DataKey<List<TrackedOffset>>
public static final DataKey<BasedSequence>
public static final DataKey<String>
public static final DataKey<String>
public static final DataKey<String>
public static final DataKey<String>
public static final DataKey<String>
public static final DataKey<String>
public static final DataKey<Boolean>
public static final DataKey<Map<String, String>>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public static Formatter.Builder

Returns:

a builder
builder
()

Create a new builder for configuring an Formatter.

public static Formatter.Builder

Returns:

a builder.
builder
(DataHolder
initialization options
options
)

Create a new builder for configuring an Formatter.

private static List<NodeFormatterFactory>
public @NotNull DataHolder
getOptions()

Implements com.vladsch.flexmark.util.ast.IRender.getOptions.

Get Options for parsing

public TranslationHandler
getTranslationHandler(TranslationHandlerFactory translationHandlerFactory, HtmlIdGeneratorFactory idGeneratorFactory)

public TranslationHandler
public TranslationHandler
public void
mergeRender(Document[]
node to render
documents
,
Appendable
appendable to use for the output
output
)

Render a node to the appendable

public void
mergeRender(List<Document> documents, Appendable output)

public String

Returns:

the formatted markdown
mergeRender
(Document[]
the root node
documents
,
int maxTrailingBlankLines)

Render the tree of nodes to markdown

public String
mergeRender(List<Document> documents, int maxTrailingBlankLines)

public void
mergeRender(List<Document>
nodes to merge render
documents
,
Appendable
appendable to use for the output
output
,
int maxTrailingBlankLines)

Render a node to the appendable

public void
mergeRender(Document[] documents, Appendable output, int maxTrailingBlankLines)

public void
render(@NotNull Node
node to render
node
,
@NotNull Appendable
appendable to use for the output
output
)

Render a node to the appendable

Note

if Appendable is LineAppendable then its builder will be used as builder for the markdown text, else string sequence builder will be used

public void
render(@NotNull Node
node to render
node
,
@NotNull Appendable
appendable to which to render the resulting text
output
,
int
max trailing blank lines in output, -1 means no last line EOL
maxTrailingBlankLines
)

Render node

Note

if Appendable is LineAppendable then its builder will be used as builder for the markdown text, else string sequence builder will be used

public @NotNull String

Returns:

the formatted markdown
render
(@NotNull Node
the root node
document
)

Render the tree of nodes to markdown

public void
translationRender(Node
node to render
document
,
Appendable
appendable to use for the output
output
,
TranslationHandler translationHandler, RenderPurpose renderPurpose)

Render a node to the appendable

public String

Returns:

the formatted markdown
translationRender
(Node
the root node
document
,
TranslationHandler translationHandler, RenderPurpose renderPurpose)

Render the tree of nodes to markdown

public void
translationRender(Node
node to render
document
,
Appendable
appendable to use for the output
output
,
int maxTrailingBlankLines, TranslationHandler translationHandler, RenderPurpose renderPurpose)

Render a node to the appendable

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait