Package org.ctan.markup.markdown
Class MarkdownRenderer
java.lang.Object
org.ctan.markup.markdown.MarkdownRenderer
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 Summary
ConstructorsModifierConstructorDescriptionMarkdownRenderer
(Reader reader, String urlPrefix) This is the constructor forMarkdownRenderer
.protected
This is the constructor forMarkdownRenderer
.protected
MarkdownRenderer
(CharSequence content, Tag outerTag, Map<String, String> outerArgs, String urlPrefix) This is the constructor forMarkdownRenderer
.MarkdownRenderer
(String content, String urlPrefix) This is the constructor forMarkdownRenderer
.protected
This is the constructor forMarkdownRenderer
. -
Method Summary
Modifier and TypeMethodDescriptionrender()
This method parses the input, renders it, and returns the result as String.void
This method parses the input and renders it to the given writer.setMentionResolver
(MentionResolver resolver) This is the setter forresolver
.void
setUrlPrefix
(String urlPrefix) This method is the setter for the URL prefix.toString()
-
Constructor Details
-
MarkdownRenderer
protected MarkdownRenderer(CharSequence content, Tag outerTag, Map<String, String> outerArgs, String urlPrefix) This is the constructor forMarkdownRenderer
.- Parameters:
content
- the contentouterTag
- the outer tagouterArgs
- the arguments for the outer tagurlPrefix
- the URL prefix
-
MarkdownRenderer
This is the constructor forMarkdownRenderer
.- Parameters:
reader
- the readerurlPrefix
- the URL prefix
-
MarkdownRenderer
protected MarkdownRenderer(Reader reader, Tag outerTag, Map<String, String> outerArgs, String urlPrefix) This is the constructor forMarkdownRenderer
.- Parameters:
reader
- the readerouterTag
- the outer tagouterArgs
- the arguments for the outer tagurlPrefix
- the URL prefix
-
MarkdownRenderer
This is the constructor forMarkdownRenderer
. -- Parameters:
content
- the contenturlPrefix
- the URL prefix
-
MarkdownRenderer
protected MarkdownRenderer(String content, Tag tag, Map<String, String> attributes, String urlPrefix) This is the constructor forMarkdownRenderer
.- Parameters:
content
- the contenttag
- the enclosing tagattributes
- the attributesurlPrefix
- the URL prefix
-
-
Method Details
-
render
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
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
This is the setter forresolver
.- Parameters:
resolver
- the new value for resolver- Returns:
- this
-
setUrlPrefix
This method is the setter for the URL prefix.- Parameters:
urlPrefix
- the new URL prefix
-
toString
-