Class MarkdownRenderer

java.lang.Object
org.ctan.markup.markdown.MarkdownRenderer

public class MarkdownRenderer extends Object
This class parses markdown and renders it as HTML.

The generated HTML can have the following structures:

  • p
  • blockquote
  • pre
  • ul
  • ul ul
  • ul ol
  • ol
  • ol ol
  • ol ul
  • Constructor Details

    • MarkdownRenderer

      protected MarkdownRenderer(CharSequence content, Tag outerTag, Map<String,String> outerArgs, String urlPrefix)
      This is the constructor for MarkdownRenderer.
      Parameters:
      content - the content
      outerTag - the outer tag
      outerArgs - the arguments for the outer tag
      urlPrefix - the URL prefix
    • MarkdownRenderer

      public MarkdownRenderer(Reader reader, String urlPrefix)
      This is the constructor for MarkdownRenderer.
      Parameters:
      reader - the reader
      urlPrefix - the URL prefix
    • MarkdownRenderer

      protected MarkdownRenderer(Reader reader, Tag outerTag, Map<String,String> outerArgs, String urlPrefix)
      This is the constructor for MarkdownRenderer.
      Parameters:
      reader - the reader
      outerTag - the outer tag
      outerArgs - the arguments for the outer tag
      urlPrefix - the URL prefix
    • MarkdownRenderer

      public MarkdownRenderer(String content, String urlPrefix)
      This is the constructor for MarkdownRenderer. -
      Parameters:
      content - the content
      urlPrefix - the URL prefix
    • MarkdownRenderer

      protected MarkdownRenderer(String content, Tag tag, Map<String,String> attributes, String urlPrefix)
      This is the constructor for MarkdownRenderer.
      Parameters:
      content - the content
      tag - the enclosing tag
      attributes - the attributes
      urlPrefix - the URL prefix
  • Method Details

    • render

      public String render() throws IOException
      This method parses the input, renders it, and returns the result as String.
      Returns:
      the rendered HTML
      Throws:
      IOException - in case of an I/O error
    • render

      public void render(Writer writer) throws IOException
      This method parses the input and renders it to the given writer. Whitespace at the beginning is ignored.
      Parameters:
      writer - the writer for output
      Throws:
      IOException - in case of an I/O error
    • setMentionResolver

      public MarkdownRenderer setMentionResolver(MentionResolver resolver)
      This is the setter for resolver.
      Parameters:
      resolver - the new value for resolver
      Returns:
      this
    • setUrlPrefix

      public void setUrlPrefix(String urlPrefix)
      This method is the setter for the URL prefix.
      Parameters:
      urlPrefix - the new URL prefix
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also: