Top Fields Constructors Methods
com.vladsch.flexmark.util.format

public abstract Class MarkdownWriterBase<T extends MarkdownWriterBase<T, N, C>, N, C extends NodeContext<N, C>>

extends Object
implements LineAppendable
Class Inheritance
All Implemented Interfaces
com.vladsch.flexmark.util.sequence.LineAppendable, java.lang.Iterable, java.lang.Appendable
Annotations
@SuppressWarnings:unchecked
Imports
com.vladsch.flexmark.util.misc.BitFieldSet, com.vladsch.flexmark.util.sequence.BasedSequence, .LineAppendable, .LineAppendableImpl, .LineInfo, com.vladsch.flexmark.util.sequence.builder.ISequenceBuilder, org.jetbrains.annotations.NotNull, .Nullable, java.io.IOException, java.util.Iterator

Field Summary

Modifier and TypeField and Description
protected final LineAppendableImpl
protected C

Constructor Summary

AccessConstructor and Description
public
public
MarkdownWriterBase(int formatOptions)

public
MarkdownWriterBase(@Nullable Appendable builder, int formatOptions)

Method Summary

Modifier and TypeMethod and Description
public T
public T
public T
addPrefix(@NotNull CharSequence prefix, boolean afterEol)

public T
append(char
The character to append
c
)

Implements com.vladsch.flexmark.util.sequence.LineAppendable.append.

Appends the specified character to this Appendable.

public T
append(@NotNull CharSequence
The character sequence to append. If csq is null, then the four characters "null" are appended to this Appendable.
csq
)

Implements java.lang.Appendable.append.

Appends the specified character sequence to this Appendable.

public T
append(@NotNull CharSequence
The character sequence from which a subsequence will be appended. If csq is null, then characters will be appended as if csq contained the four characters "null".
csq
,
int
The index of the first character in the subsequence
start
,
int
The index of the character following the last character in the subsequence
end
)

Implements java.lang.Appendable.append.

Appends a subsequence of the specified character sequence to this Appendable.

public T
append(@NotNull LineAppendable lines, int startLine, int endLine, boolean withPrefixes)

public T
public <T extends Appendable> T
appendTo(T
appendable to output the resulting lines
out
,
boolean
true if to include prefixes
withPrefixes
,
int
maximum blank lines to allow in the body,
maxBlankLines
,
int
maximum trailing blank lines at the end, if <maxBlankLines then maxBlankLines will be used, if -1 then no trailing EOL will be added
maxTrailingBlankLines
,
int
line from which to start output
startLine
,
int
line at which to stop output
endLine
)

Implements com.vladsch.flexmark.util.sequence.LineAppendable.appendTo.

append lines to appendable with given maximum trailing blank lines and given prefix to add to all lines

NOTE:

public T
blankLine()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.blankLine.

Add a blank line, if there is not one already appended.

public T
blankLine(int
number of blank lines to append
count
)

Implements com.vladsch.flexmark.util.sequence.LineAppendable.blankLine.

Add a blank lines, if there isn't already given number of blank lines appended.

public T
blankLineIf(boolean
when true append blank line
predicate
)

Implements com.vladsch.flexmark.util.sequence.LineAppendable.blankLineIf.

Add a blank line, if predicate is true and there isn't already blank lines appended.

public T
public T
closePreFormatted()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.closePreFormatted.

Close preformatted section and suspend content modification

public int
column()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.column.

Get column offset after last append

public boolean
public int
public @NotNull BasedSequence
public @NotNull ISequenceBuilder<?, ?>
getBuilder()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.getBuilder.

Get builder used for accumulation

public C
public @NotNull BasedSequence
getIndentPrefix()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.getIndentPrefix.

Get prefix appended after a new line character for every indent level

public @NotNull BasedSequence
getLine(int
line index
lineIndex
)

Implements com.vladsch.flexmark.util.sequence.LineAppendable.getLine.

Get Line at given line index

Note

if there is an unterminated line it will be available as the last line, without being terminated explicitly

public int
getLineCount()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.getLineCount.

Get the number of lines appended, not including any unterminated ones

public int
getLineCountWithPending()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.getLineCountWithPending.

Get the number of lines appended, including any unterminated ones

Note

if there is an unterminated line it will be available as the last line, without being terminated explicitly

public @NotNull LineInfo
getLineInfo(int
line index for the info to get
lineIndex
)

Implements com.vladsch.flexmark.util.sequence.LineAppendable.getLineInfo.

Get Line information at given line index

Note

if there is an unterminated line it will be available as the last line, without being terminated explicitly

public @NotNull Iterable<BasedSequence>
getLines(int
maximum trailing blank lines, -1 if trailing EOL should be removed
maxTrailingBlankLines
,
int
start line index
startLine
,
int
end line index, exclusive
endLine
,
boolean
true if prefixes should be included, else only non-prefix line text
withPrefixes
)

Implements com.vladsch.flexmark.util.sequence.LineAppendable.getLines.

Full line iterator over some lines

Note

will issue line() to terminate any unterminated lines before iteration

public @NotNull Iterable<LineInfo>
getLinesInfo(int
maximum trailing blank lines, -1 if trailing EOL should be removed
maxTrailingBlankLines
,
int
start line index
startLine
,
int
end line index, exclusive
endLine
)

Implements com.vladsch.flexmark.util.sequence.LineAppendable.getLinesInfo.

Full line iterator with line info

Note

will issue line() to terminate any unterminated lines before iteration

public int
getOptions()

Overrides default com.vladsch.flexmark.util.sequence.LineAppendable.getOptions.

Get current options as bit mask flags

public @NotNull BitFieldSet<LineAppendable.Options>
getOptionSet()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.getOptionSet.

Get current options as set which can be used to modify options

public int
getPendingEOL()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.getPendingEOL.

Get number of EOLs at end of appendable, this is actually number of tail blank lines

public int
getPendingSpace()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.getPendingSpace.

Get number of spaces at end of pending text

public @NotNull BasedSequence
getPrefix()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.getPrefix.

Get prefix being applied to all lines, even in pre-formatted sections This is the prefix that will be set after EOL

public int
getTrailingBlankLines(int
end line
endLine
)

Implements com.vladsch.flexmark.util.sequence.LineAppendable.getTrailingBlankLines.

Get trailing blank line count ending on given line

public T
indent()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.indent.

Increase the indent level, will terminate the current line if there is unterminated text

Note

this is equivalent to pushPrefix(), addPrefix(getIndentPrefix()) but adds a flag to validate that unIndent() is called only on prefixes added by this method

public void
insertLine(int lineIndex, @NotNull CharSequence prefix, @NotNull CharSequence text)

public boolean
isPendingSpace()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.isPendingSpace.

Test if trailing text ends in space or tab

public boolean
public @NotNull Iterator<LineInfo>
iterator()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.iterator.

Full line iterator NOTE: will not issue line() to terminate any unterminated lines before iteration and will not include unterminated lines in iteration

public abstract @NotNull BasedSequence
public T
line()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.line.

Add a new line if there was any unterminated text appended or if this is a preformatted region

public T
lineIf(boolean
call line() if value is true.
predicate
)

Implements com.vladsch.flexmark.util.sequence.LineAppendable.lineIf.

Add a new line, if predicate is true and line() would add an EOL.

public T
public T
lineWithTrailingSpaces(int
number of trailing spaces to add
count
)

Implements com.vladsch.flexmark.util.sequence.LineAppendable.lineWithTrailingSpaces.

Add a new line, keep trailing spaces if there was any unterminated text appended

Note

only applies in preformatted region or if the line is not empty

public int
offset()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.offset.

Get text offset of all output lines, excluding any text for the last line being accumulated

public int
offsetWithPending()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.offsetWithPending.

Get offset after last append as if EOL was added but without the EOL itself

public T
openPreFormatted(boolean
if true will add the current prefix to first line
keepIndent
)

Implements com.vladsch.flexmark.util.sequence.LineAppendable.openPreFormatted.

Open preformatted section and suspend content modification

public T
public T
popPrefix()

Overrides default com.vladsch.flexmark.util.sequence.LineAppendable.popPrefix.

Pop a prefix from the stack and set the current prefix

public T
popPrefix(boolean
if true prefix will take effect after EOL
afterEol
)

Implements com.vladsch.flexmark.util.sequence.LineAppendable.popPrefix.

Pop a prefix from the stack and set the current prefix

public T
public T
pushPrefix()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.pushPrefix.

Save the current prefix on the stack

public T
removeExtraBlankLines(int
maximum blank lines to allow in the body
maxBlankLines
,
int
maximum trailing blank lines ending on endLine, if <maxBlankLines then maxBlankLines will be used
maxTrailingBlankLines
,
int
line from which to start output
startLine
,
int
line at which to stop output
endLine
)

Implements com.vladsch.flexmark.util.sequence.LineAppendable.removeExtraBlankLines.

Normalize the appendable by removing extra blank lines in the body or at the end of given line range

public T
public T
public void
setContext(C context)

public T
public void
setLine(int lineIndex, @NotNull CharSequence prefix, @NotNull CharSequence text)

public T
setOptions(int
option flags
flags
)

Overrides default com.vladsch.flexmark.util.sequence.LineAppendable.setOptions.

Set options on processing text

public T
public T
setPrefix(@Nullable CharSequence prefix, boolean afterEol)

public void
setPrefixLength(int
index of the line
lineIndex
,
int
new prefix length
prefixEndIndex
)

Implements com.vladsch.flexmark.util.sequence.LineAppendable.setPrefixLength.

Change prefix length for a given line without changing the line content

public T
public T
tailBlankLine(int count)

public @NotNull CharSequence
toSequence(int
maximum blank lines to allow in the text
maxBlankLines
,
int
maximum trailing blank lines
maxTrailingBlankLines
,
boolean
true if to include prefixes
withPrefixes
)

Implements com.vladsch.flexmark.util.sequence.LineAppendable.toSequence.

get the resulting text for all lines

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public @NotNull String
toString(int
maximum blank lines to allow in the text
maxBlankLines
,
int
maximum trailing blank lines
maxTrailingBlankLines
,
boolean
true if to include prefixes
withPrefixes
)

Implements com.vladsch.flexmark.util.sequence.LineAppendable.toString.

get the resulting text for all lines

public T
unIndent()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.unIndent.

Decrease the indent level, min level is 0, will terminate the current line if there is unterminated text

Note

this is equivalent to popPrefix() but with validation that it is called only on prefixes added by indent()

public T
unIndentNoEol()

Implements com.vladsch.flexmark.util.sequence.LineAppendable.unIndentNoEol.

Decrease the indent level, if there is unterminated text then unindented prefix is to be applied after the next EOL.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait