Class Block

java.lang.Object
com.teamten.markdown.Block

public class Block extends Object
A block is a paragraph (similar to a block in HTML DOM). It's a sequence of spans.
  • Constructor Details

    • Block

      public Block(@NotNull @NotNull BlockType blockType, int lineNumber, int counter, boolean inBlockQuote)
  • Method Details

    • getBlockType

      @NotNull public @NotNull BlockType getBlockType()
    • getLineNumber

      public int getLineNumber()
      Get line in source where this block started.
    • getCounter

      public int getCounter()
      Get the counter for numbered lists.
    • isInBlockQuote

      public boolean isInBlockQuote()
      Whether this block is inside a blockquote (indented, etc.).
    • getSpans

      @NotNull public @NotNull List<Span> getSpans()
    • getText

      public String getText()
      Return a string version of all text spans. Ignores non-text spans.
    • getShortenedText

      public String getShortenedText()
      Return the shortened version of the block, if specified using a SHORTENED tag, otherwise the normal block text.
    • getSectionName

      @Nullable public @Nullable SectionName getSectionName()
      Return the first section name span in this block, if any.
    • addSpan

      public void addSpan(Span span)
    • withBlockType

      public Block withBlockType(BlockType blockType)
      Return a copy of this block with a different block type.
    • postProcessText

      public void postProcessText(String locale)
      Convert apostrophes, quotes, etc.
      Parameters:
      locale - the locale being processed ("en_US", "fr", etc.).
    • toBriefString

      public String toBriefString()
      Return just the text of the block.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • numberedListBuilder

      public static Block.Builder numberedListBuilder(int lineNumber, int counter, boolean inBlockQuote)
      Make a builder for numbered lists.
    • bodyBlock

      public static Block bodyBlock(String text, boolean inBlockQuote)
      Make a plain body block from a string.