Class Markdown

java.lang.Object
com.github.alex1304.ultimategdbot.api.utils.Markdown

public class Markdown
extends java.lang.Object
  • Method Summary

    Modifier and Type Method Description
    static java.lang.String bold​(java.lang.String text)
    Formats the text with bold markdown
    static java.lang.String code​(java.lang.String text)
    Formats the text as code.
    static java.lang.String codeBlock​(java.lang.String text)
    Formats the text as a code block.
    static java.lang.String codeBlock​(java.lang.String text, java.lang.String language)
    Formats the text as a code block.
    static java.lang.String escape​(java.lang.String text)
    Escapes characters used in Markdown syntax using a backslash
    static java.lang.String italic​(java.lang.String text)
    Formats the text with italic markdown.
    static java.lang.String italic​(java.lang.String text, boolean starVariant)
    Formats the text with italic markdown
    static java.lang.String maskedLink​(java.lang.String clickableText, java.lang.String url)
    Make a masked link using markdown.
    static java.lang.String quote​(java.lang.String text)
    Formats the text as a quote.
    static java.lang.String spoiler​(java.lang.String text)
    Formats the text with spoiler markdown.
    static java.lang.String strikethrough​(java.lang.String text)
    Formats the text with strikethrough markdown.
    static java.lang.String underline​(java.lang.String text)
    Formats the text with underline markdown.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • escape

      public static java.lang.String escape​(java.lang.String text)
      Escapes characters used in Markdown syntax using a backslash
      Parameters:
      text - the Markdown text to escape
      Returns:
      String
    • bold

      public static java.lang.String bold​(java.lang.String text)
      Formats the text with bold markdown
      Parameters:
      text - the text to format
      Returns:
      the formatted text
    • italic

      public static java.lang.String italic​(java.lang.String text, boolean starVariant)
      Formats the text with italic markdown
      Parameters:
      text - the text to format
      starVariant - whether to use stars (*) or underscores (_) to make italic
      Returns:
      the formatted text
    • italic

      public static java.lang.String italic​(java.lang.String text)
      Formats the text with italic markdown. Uses the star variant by default.
      Parameters:
      text - the text to format
      Returns:
      the formatted text
      See Also:
      italic(String, boolean)
    • underline

      public static java.lang.String underline​(java.lang.String text)
      Formats the text with underline markdown.
      Parameters:
      text - the text to format
      Returns:
      the formatted text
    • strikethrough

      public static java.lang.String strikethrough​(java.lang.String text)
      Formats the text with strikethrough markdown.
      Parameters:
      text - the text to format
      Returns:
      the formatted text
    • spoiler

      public static java.lang.String spoiler​(java.lang.String text)
      Formats the text with spoiler markdown.
      Parameters:
      text - the text to format
      Returns:
      the formatted text
    • maskedLink

      public static java.lang.String maskedLink​(java.lang.String clickableText, java.lang.String url)
      Make a masked link using markdown. Note that this only works in Discord embed fields and descriptions, not in regular messages.
      Parameters:
      clickableText - the text that should be clickable
      url - the url to redirect to when the text is clicked
      Returns:
      the masked link markdown
    • code

      public static java.lang.String code​(java.lang.String text)
      Formats the text as code.
      Parameters:
      text - the text to format
      Returns:
      the formatted text
    • codeBlock

      public static java.lang.String codeBlock​(java.lang.String text, java.lang.String language)
      Formats the text as a code block.
      Parameters:
      text - the text to format
      language - the language of the code (hint for syntax highlighting)
      Returns:
      the formatted text
    • codeBlock

      public static java.lang.String codeBlock​(java.lang.String text)
      Formats the text as a code block. This overload does not specify a language parameter for syntax highlighting.
      Parameters:
      text - the text to format
      Returns:
      the formatted text
    • quote

      public static java.lang.String quote​(java.lang.String text)
      Formats the text as a quote.
      Parameters:
      text - the text to format
      Returns:
      the formatted text