Class Markdown
- java.lang.Object
-
- com.github.alex1304.ultimategdbot.api.util.Markdown
-
public class Markdown extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Stringbold(String text)Formats the text with bold markdownstatic Stringcode(String text)Formats the text as code.static StringcodeBlock(String text)Formats the text as a code block.static StringcodeBlock(String text, String language)Formats the text as a code block.static Stringescape(String text)Escapes characters used in Markdown syntax using a backslashstatic Stringitalic(String text)Formats the text with italic markdown.static Stringitalic(String text, boolean starVariant)Formats the text with italic markdownstatic StringmaskedLink(String clickableText, String url)Make a masked link using markdown.static Stringquote(String text)Formats the text as a quote.static Stringspoiler(String text)Formats the text with spoiler markdown.static Stringstrikethrough(String text)Formats the text with strikethrough markdown.static Stringunderline(String text)Formats the text with underline markdown.
-
-
-
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 formatstarVariant- 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 clickableurl- 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 formatlanguage- 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
-
-