Class Code


public class Code extends Markup

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
  • Constructor Details

    • Code

      public Code(Object content)

      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 the MarkdownElement.toString() of any markdown element will force it to be accepted in any spot

      Throws IllegalContentsException if object is an instance of the Structure class
      Throws IllegalContentsException if object is instance of the same class (such as an Italic within an Italic)
      Throws IllegalContentsException if the object is an instance of MarkdownElement
      Overrides:
      checkType in class InlineElement
      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