Class Processor
java.lang.Object
com.github.rjeschke.txtmark.Processor
Markdown processor class.
Example usage:
String result = Processor.process("This is ***TXTMARK***");
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final ConfigurationThe Configuration.private final EmitterThe emitter.private final ReaderThe reader.private booleanExtension flag. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateProcessor(Reader reader, Configuration config) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidinitListBlock(Block root) Initializes a list block by separating it into list item blocks.private Stringprocess()Does all the processing.static final StringTransforms an input file into HTML using the default Configuration.static final StringTransforms an input file into HTML.static final Stringprocess(File file, Configuration configuration) Transforms an input file into HTML using the given Configuration.static final StringTransforms an input file into HTML.static final StringTransforms an input file into HTML.static final StringTransforms an input file into HTML.static final StringTransforms an input file into HTML.static final StringTransforms an input file into HTML.static final StringTransforms an input file into HTML.static final Stringprocess(InputStream input) Transforms an input stream into HTML.static final Stringprocess(InputStream input, boolean safeMode) Transforms an input stream into HTML.static final Stringprocess(InputStream input, Configuration configuration) Transforms an input stream into HTML using the given Configuration.static final Stringprocess(InputStream input, Decorator decorator) Transforms an input stream into HTML.static final Stringprocess(InputStream input, Decorator decorator, boolean safeMode) Transforms an input stream into HTML.static final Stringprocess(InputStream input, String encoding) Transforms an input stream into HTML.static final Stringprocess(InputStream input, String encoding, boolean safeMode) Transforms an input stream into HTML.static final Stringprocess(InputStream input, String encoding, Decorator decorator) Transforms an input stream into HTML.static final Stringprocess(InputStream input, String encoding, Decorator decorator, boolean safeMode) Transforms an input stream into HTML.static final StringTransforms an input stream into HTML using the default Configuration.static final StringTransforms an input stream into HTML.static final Stringprocess(Reader reader, Configuration configuration) Transforms an input stream into HTML using the given Configuration.static final StringTransforms an input stream into HTML.static final StringTransforms an input stream into HTML.static final StringTransforms an input String into HTML using the default Configuration.static final StringTransforms an input String into HTML.static final Stringprocess(String input, Configuration configuration) Transforms an input String into HTML using the given Configuration.static final StringTransforms an input String into HTML.static final StringTransforms an input String into HTML.private BlockReads all lines from our reader.private voidRecursively process the given Block.
-
Field Details
-
reader
The reader. -
emitter
The emitter. -
config
The Configuration. -
useExtensions
private boolean useExtensionsExtension flag.
-
-
Constructor Details
-
Processor
Constructor.- Parameters:
reader- The input reader.
-
-
Method Details
-
process
Transforms an input stream into HTML using the given Configuration.- Parameters:
reader- The Reader to process.configuration- The Configuration.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- Since:
- 0.7
- See Also:
-
process
Transforms an input String into HTML using the given Configuration.- Parameters:
input- The String to process.configuration- The Configuration.- Returns:
- The processed String.
- Since:
- 0.7
- See Also:
-
process
Transforms an input file into HTML using the given Configuration.- Parameters:
file- The File to process.configuration- the Configuration- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- Since:
- 0.7
- See Also:
-
process
public static final String process(InputStream input, Configuration configuration) throws IOException Transforms an input stream into HTML using the given Configuration.- Parameters:
input- The InputStream to process.configuration- The Configuration.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- Since:
- 0.7
- See Also:
-
process
-
process
-
process
-
process
-
process
Transforms an input file into HTML using the default Configuration.- Parameters:
file- The File to process.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
Transforms an input file into HTML.- Parameters:
file- The File to process.safeMode- Set totrueto escape unsafe HTML tags.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
Transforms an input file into HTML.- Parameters:
file- The File to process.decorator- The decorator to use.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
public static final String process(File file, Decorator decorator, boolean safeMode) throws IOException Transforms an input file into HTML.- Parameters:
file- The File to process.decorator- The decorator to use.safeMode- Set totrueto escape unsafe HTML tags.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
Transforms an input file into HTML.- Parameters:
file- The File to process.encoding- The encoding to use.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
Transforms an input file into HTML.- Parameters:
file- The File to process.encoding- The encoding to use.safeMode- Set totrueto escape unsafe HTML tags.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
public static final String process(File file, String encoding, Decorator decorator) throws IOException Transforms an input file into HTML.- Parameters:
file- The File to process.encoding- The encoding to use.decorator- The decorator to use.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
public static final String process(File file, String encoding, Decorator decorator, boolean safeMode) throws IOException Transforms an input file into HTML.- Parameters:
file- The File to process.encoding- The encoding to use.decorator- The decorator to use.safeMode- Set totrueto escape unsafe HTML tags.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
Transforms an input stream into HTML.- Parameters:
input- The InputStream to process.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
Transforms an input stream into HTML.- Parameters:
input- The InputStream to process.safeMode- Set totrueto escape unsafe HTML tags.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
Transforms an input stream into HTML.- Parameters:
input- The InputStream to process.decorator- The decorator to use.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
public static final String process(InputStream input, Decorator decorator, boolean safeMode) throws IOException Transforms an input stream into HTML.- Parameters:
input- The InputStream to process.decorator- The decorator to use.safeMode- Set totrueto escape unsafe HTML tags.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
Transforms an input stream into HTML.- Parameters:
input- The InputStream to process.encoding- The encoding to use.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
public static final String process(InputStream input, String encoding, boolean safeMode) throws IOException Transforms an input stream into HTML.- Parameters:
input- The InputStream to process.encoding- The encoding to use.safeMode- Set totrueto escape unsafe HTML tags.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
public static final String process(InputStream input, String encoding, Decorator decorator) throws IOException Transforms an input stream into HTML.- Parameters:
input- The InputStream to process.encoding- The encoding to use.decorator- The decorator to use.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
public static final String process(InputStream input, String encoding, Decorator decorator, boolean safeMode) throws IOException Transforms an input stream into HTML.- Parameters:
input- The InputStream to process.encoding- The encoding to use.decorator- The decorator to use.safeMode- Set totrueto escape unsafe HTML tags.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
Transforms an input stream into HTML using the default Configuration.- Parameters:
reader- The Reader to process.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
Transforms an input stream into HTML.- Parameters:
reader- The Reader to process.safeMode- Set totrueto escape unsafe HTML tags.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
Transforms an input stream into HTML.- Parameters:
reader- The Reader to process.decorator- The decorator to use.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
process
public static final String process(Reader reader, Decorator decorator, boolean safeMode) throws IOException Transforms an input stream into HTML.- Parameters:
reader- The Reader to process.decorator- The decorator to use.safeMode- Set totrueto escape unsafe HTML tags.- Returns:
- The processed String.
- Throws:
IOException- if an IO error occurs- See Also:
-
readLines
Reads all lines from our reader.Takes care of markdown link references.
- Returns:
- A Block containing all lines.
- Throws:
IOException- If an IO error occurred.
-
initListBlock
Initializes a list block by separating it into list item blocks.- Parameters:
root- The Block to process.
-
recurse
Recursively process the given Block.- Parameters:
root- The Block to process.listMode- Flag indicating that we're in a list item block.
-
process
Does all the processing.- Returns:
- The processed String.
- Throws:
IOException- If an IO error occurred.
-