Class MarkdownUtil
java.lang.Object
net.dv8tion.jda.api.utils.MarkdownUtil
Utility class to escape markdown characters.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringEscapes already existing bold regions in the input and applies bold formatting to the entire string.static StringEscapes already existing codeblock regions in the input and applies codeblock formatting to the entire string.static StringEscapes already existing codeblock regions in the input and applies codeblock formatting to the entire string.static StringEscapes already existing italics (with underscore) regions in the input and applies italics formatting to the entire string.static StringmaskedLink(String text, String url) Creates a masked link with the provided url as target.static StringApplies monospace formatting to the input, checking for backticks present and handling them appropriately.static StringEscapes already existing quote regions in the input and applies quote formatting to the entire string.static StringquoteBlock(String input) Applies quote block formatting to the entire string.static StringEscapes already existing spoiler regions in the input and applies spoiler formatting to the entire string.static StringEscapes already existing strike regions in the input and applies strike formatting to the entire string.static StringEscapes already existing underline regions in the input and applies underline formatting to the entire string.
-
Method Details
-
bold
-
italics
Escapes already existing italics (with underscore) regions in the input and applies italics formatting to the entire string.
The resulting string will be"_" + escaped(input) + "_".- Parameters:
input- The input to italics- Returns:
- The resulting output
-
underline
Escapes already existing underline regions in the input and applies underline formatting to the entire string.
The resulting string will be"__" + escaped(input) + "__".- Parameters:
input- The input to underline- Returns:
- The resulting output
-
monospace
Applies monospace formatting to the input, checking for backticks present and handling them appropriately.
The resulting string will be"`" + input + "`"or"``" + input + "``"depending on whether backticks are present. If there are backticks directly in the beginning or end of the input, an extra space will be added before or after them to ensure the input is properly monospaced.- Parameters:
input- The input to monospace- Returns:
- The resulting output
-
codeblock
Escapes already existing codeblock regions in the input and applies codeblock formatting to the entire string.
The resulting string will be"```" + escaped(input) + "```".- Parameters:
input- The input to codeblock- Returns:
- The resulting output
-
codeblock
Escapes already existing codeblock regions in the input and applies codeblock formatting to the entire string.
The resulting string will be"```" + language + "\n" + escaped(input) + "```".- Parameters:
language- The language to use for syntax highlighting (null to use no language)input- The input to codeblock- Returns:
- The resulting output
-
spoiler
-
strike
-
quote
Escapes already existing quote regions in the input and applies quote formatting to the entire string.
The resulting string will be"> " + escaped(input).replace("\n", "\n> ").- Parameters:
input- The input to quote- Returns:
- The resulting output
-
quoteBlock
-
maskedLink
-