Class MarkdownParser


  • public class MarkdownParser
    extends Object
    • Constructor Detail

      • MarkdownParser

        public MarkdownParser​(Parameters params)
        Create a new MarkdownParser that uses the platform-specific newline.
      • MarkdownParser

        public MarkdownParser​(Parameters params,
                              String newline)
        Create a new MarkdownParser that uses the specified string as a newline.
        Parameters:
        newline - The newline type that this parser will use
    • Method Detail

      • parse

        public void parse​(String markdownContent)
        Parse the given Markdown content into tokens that can be then retrieved with calls to getNextToken(). Any existing tokens from previous calls to parse(String) will be discarded.
        Parameters:
        markdownContent - The Markdown content to parse into tokens
      • hasNextToken

        public boolean hasNextToken()
      • getNextToken

        public MarkdownToken getNextToken()
        Returns the next available token.
        Returns:
        The next token
        Throws:
        IllegalStateException - If no more tokens are remaining
      • getNewline

        public String getNewline()
      • setNewline

        public void setNewline​(String newline)
      • dumpTokens

        public String dumpTokens()
        Dumps all tokens. This is for development.
        Returns:
        String representation of all MarkdownTokens generated.
      • toString

        public String toString()
        Returns a string representation the AST generated by the parser from the last call to parse(String).
        System.out.println(markdownParser.toString())
        is a convenient way to dump the parsed node tree during the development.
        Overrides:
        toString in class Object
        Returns:
        String representation of the AST