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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> TcheckType(T object) Checks the type of a passed object.Methods inherited from class org.tealeaf.javamarkdown.types.InlineElement
requiresNewlineAfter, requiresNewlineBeforeMethods 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
IllegalContentsExceptionif 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
IllegalContentsExceptionif object is an instance of theStructureclassThrows
IllegalContentsExceptionif object is instance of the same class (such as anItalicwithin anItalic)Throws
IllegalContentsExceptionif the object is an instance ofMarkdownElement- Overrides:
checkTypein 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
-