Class Code
java.lang.Object
org.tealeaf.javamarkdown.MarkdownElement
org.tealeaf.javamarkdown.types.InlineElement
org.tealeaf.javamarkdown.types.Markup
org.tealeaf.javamarkdown.elements.Code
Prints out inline-text as a small code snippet, such as This
.
Note that in markdown, code sections have a colored background (such as dark grey)
- Since:
- 0.0.1
- Author:
- Thomas Kwashnak
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected <T> T
checkType
(T object) Checks the type of a passed object.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
-
Code
Creates a code snippet with the provided content
- Parameters:
content
- Content to include in the code block
-
-
Method Details
-
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
)Throws
IllegalContentsException
if the object is an instance ofMarkdownElement
- 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
-