Package nz.org.riskscape.engine.cli
Class MarkdownHelper
java.lang.Object
nz.org.riskscape.engine.cli.MarkdownHelper
A convinent wrapper around a StringBuilder that allows you to build a
markdown file. Call the various addHeading
, addText
methods,
then at the end call writeToFile
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addHeading
(String text) Adds a markdown styled headingvoid
addHeading
(String text, int level) Adds a markdown styled headingvoid
addLine()
Adds two newlines.void
Adds the given String to the buffer, and adds two newline characters.void
addTable
(nz.org.riskscape.engine.cli.Table table) void
Directly adds the given String to the bufferbuild()
Returns the markdown as a StringwriteToFile
(Path path, String filename) Writes the stored content to the given path.
-
Constructor Details
-
MarkdownHelper
public MarkdownHelper()
-
-
Method Details
-
build
Returns the markdown as a String
-
addHeading
Adds a markdown styled heading
-
addHeading
Adds a markdown styled heading
- Parameters:
level
- The size of the heading (1 is biggest, higher numbers create subheadings.)
-
addLine
public void addLine()Adds two newlines. Equivalent to
addLine("")
-
addLine
Adds the given String to the buffer, and adds two newline characters. (This corresponds to one newline once the markdown is parsed)
-
addText
Directly adds the given String to the buffer
-
addTable
public void addTable(nz.org.riskscape.engine.cli.Table table) -
writeToFile
Writes the stored content to the given path.
- Returns:
- The path that was written to
- Throws:
IOException
-