Class Emitter
java.lang.Object
com.github.rjeschke.txtmark.Emitter
Emitter class responsible for generating HTML output.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConfigurationThe configuration.Link references.booleanExtension flag. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLinkRef(String key, LinkRef linkRef) Adds a LinkRef to this set of LinkRefs.private static intcheckEntity(StringBuilder out, String in, int start) Check if this is a valid XML/HTML entity.private intcheckHtml(StringBuilder out, String in, int start) Check if there is a valid HTML tag here.private intcheckLink(StringBuilder out, String in, int start, MarkToken token) Checks if there is a valid markdown link definition.voidemit(StringBuilder out, Block root) Transforms the given block recursively into HTML.private voidemitCodeLines(StringBuilder out, Line lines, String meta, boolean removeIndent) Writes a code block into the StringBuilder.private voidemitLines(StringBuilder out, Block block) Transforms lines into HTML.private voidemitMarkedLines(StringBuilder out, Line lines) Writes a set of markdown lines into the StringBuilder.private voidemitRawLines(StringBuilder out, Line lines) Writes a set of raw lines into the StringBuilder.private intFinds the position of the given Token in the given String.private MarkTokenCheck if there is any markdown Token.private intrecursiveEmitLine(StringBuilder out, String in, int start, MarkToken token) Recursively scans through the given line, taking care of any markdown stuff.private static charwhitespaceToSpace(char c) Turns every whitespace character into a space character.
-
Field Details
-
linkRefs
-
config
The configuration. -
useExtensions
public boolean useExtensionsExtension flag.
-
-
Constructor Details
-
Emitter
Constructor.
-
-
Method Details
-
addLinkRef
-
emit
Transforms the given block recursively into HTML.- Parameters:
out- The StringBuilder to write to.root- The Block to process.
-
emitLines
Transforms lines into HTML.- Parameters:
out- The StringBuilder to write to.block- The Block to process.
-
findToken
-
checkLink
Checks if there is a valid markdown link definition.- Parameters:
out- The StringBuilder containing the generated output.in- Input String.start- Starting position.token- Either LINK or IMAGE.- Returns:
- The new position or -1 if there is no valid markdown link.
-
checkHtml
Check if there is a valid HTML tag here. This method also transforms auto links and mailto auto links.- Parameters:
out- The StringBuilder to write to.in- Input String.start- Starting position.- Returns:
- The new position or -1 if nothing valid has been found.
-
checkEntity
Check if this is a valid XML/HTML entity.- Parameters:
out- The StringBuilder to write to.in- Input String.start- Starting position- Returns:
- The new position or -1 if this entity in invalid.
-
recursiveEmitLine
Recursively scans through the given line, taking care of any markdown stuff.- Parameters:
out- The StringBuilder to write to.in- Input String.start- Start position.token- The matching Token (for e.g. '*')- Returns:
- The position of the matching Token or -1 if token was NONE or no Token could be found.
-
whitespaceToSpace
private static char whitespaceToSpace(char c) Turns every whitespace character into a space character.- Parameters:
c- Character to check- Returns:
- 32 is c was a whitespace, c otherwise
-
getToken
-
emitMarkedLines
Writes a set of markdown lines into the StringBuilder.- Parameters:
out- The StringBuilder to write to.lines- The lines to write.
-
emitRawLines
Writes a set of raw lines into the StringBuilder.- Parameters:
out- The StringBuilder to write to.lines- The lines to write.
-
emitCodeLines
Writes a code block into the StringBuilder.- Parameters:
out- The StringBuilder to write to.lines- The lines to write.meta- Meta information.
-