Class Code<T extends Code<T>>


public class Code<T extends Code<T>> extends PhrasingContentElement<T>
Represents an HTML <code> element for displaying code snippets.

The Code element defines a piece of computer code. Browsers typically render code elements in a monospace font. For multi-line code blocks, wrap this element in a Pre element.

Features:

  • Semantic markup for code snippets
  • Typically rendered in monospace font
  • For inline code fragments
  • Combine with Pre for code blocks

Usage:


 Paragraph p = new Paragraph();
 p.addChild(new Text("Use the "));
 p.addChild(new Code("System.out.println()"));
 p.addChild(new Text(" method."));
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Code

      public Code()
      Constructs an empty <code> element.
    • Code

      public Code(String text)
      Constructs a <code> element with code text.
      Parameters:
      text - the code snippet text