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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHeading(String text) Adds a markdown styled headingvoidaddHeading(String text, int level) Adds a markdown styled headingvoidaddLine()Adds two newlines.voidAdds the given String to the buffer, and adds two newline characters.voidaddTable(nz.org.riskscape.engine.cli.Table table) voidvoidDirectly 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) -
addTable
-
writeToFile
Writes the stored content to the given path.
- Returns:
- The path that was written to
- Throws:
IOException
-