Class Markdown


  • public final class Markdown
    extends Object
    • Method Detail

      • escape

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

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

        public static String italic​(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 String italic​(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 String underline​(String text)
        Formats the text with underline markdown.
        Parameters:
        text - the text to format
        Returns:
        the formatted text
      • strikethrough

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

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

        public static String maskedLink​(String clickableText,
                                        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 String code​(String text)
        Formats the text as code.
        Parameters:
        text - the text to format
        Returns:
        the formatted text
      • codeBlock

        public static String codeBlock​(String text,
                                       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 String codeBlock​(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 String quote​(String text)
        Formats the text as a quote.
        Parameters:
        text - the text to format
        Returns:
        the formatted text