Class Link
java.lang.Object
org.tealeaf.javamarkdown.MarkdownElement
org.tealeaf.javamarkdown.types.InlineElement
org.tealeaf.javamarkdown.elements.Link
- Direct Known Subclasses:
Image
Creates a clickable link in the Markdown Document. Allows setting both the
link and the display content
- Since:
- 0.0.12
- Author:
- Thomas Kwashnak
-
Constructor Summary
-
Method Summary
Methods inherited from class org.tealeaf.javamarkdown.types.InlineElement
requiresNewlineAfter, requiresNewlineBefore
Methods inherited from class org.tealeaf.javamarkdown.MarkdownElement
asString, toAppendable, toString, toWriter
-
Constructor Details
-
Link
Creates a simple link that displays the same url that it links to- Parameters:
url
- Link url- Since:
- 0.0.12
-
Link
Creates a link with the specified display and the url it links to- Parameters:
content
- What you want to be displayed for the linkurl
- The url that the link should link to- Since:
- 0.0.12
-
-
Method Details
-
asString
Formats the string into the link syntax used in Markdown- Specified by:
asString
in classMarkdownElement
- Returns:
- String representation of the formatted item
- Since:
- 0.0.12
-
checkType
protected <T> T checkType(T object) Checks the type of a passed object. This method is specific to each element and throws an
IllegalContentsException
if the passed object cannot be put in as a content of that element. This prevents instances such as nested tables, where a table is put inside another table. If such feature is necessary, using theMarkdownElement.toString()
of any markdown element will force it to be accepted in any spotThrows
IllegalContentsException
if object is an instance of theStructure
classThrows
IllegalContentsException
if object is instance of the same class (such as anItalic
within anItalic
)Does not throw if the object is an instance of
Image
- Overrides:
checkType
in classInlineElement
- Type Parameters:
T
- The type of the item- Parameters:
object
- The item to check it's class- Returns:
- That item if it is not an instance of any illegal types
- Since:
- 0.0.20
-