Class MarkdownHelper

java.lang.Object
nz.org.riskscape.engine.cli.MarkdownHelper

public class MarkdownHelper extends Object

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 Details

    • MarkdownHelper

      public MarkdownHelper()
  • Method Details

    • build

      public String build()

      Returns the markdown as a String

    • addHeading

      public void addHeading(String text)

      Adds a markdown styled heading

    • addHeading

      public void addHeading(String text, int level)

      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

      public void addLine(String text)

      Adds the given String to the buffer, and adds two newline characters. (This corresponds to one newline once the markdown is parsed)

    • addText

      public void addText(String text)

      Directly adds the given String to the buffer

    • addTable

      public void addTable(nz.org.riskscape.engine.cli.Table table)
    • writeToFile

      public Path writeToFile(Path path, String filename) throws IOException

      Writes the stored content to the given path.

      Returns:
      The path that was written to
      Throws:
      IOException