Package net.dv8tion.jda.api.utils
Class MarkdownUtil
java.lang.Object
net.dv8tion.jda.api.utils.MarkdownUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Escapes already existing bold regions in the input and applies bold formatting to the entire string.static String
Escapes already existing codeblock regions in the input and applies codeblock formatting to the entire string.static String
Escapes already existing codeblock regions in the input and applies codeblock formatting to the entire string.static String
Escapes already existing italics (with underscore) regions in the input and applies italics formatting to the entire string.static String
maskedLink
(String text, String url) Creates a masked link with the provided url as target.static String
Escapes already existing monospace (single backtick) regions in the input and applies monospace formatting to the entire string.static String
Escapes already existing quote regions in the input and applies quote formatting to the entire string.static String
quoteBlock
(String input) Applies quote block formatting to the entire string.static String
Escapes already existing spoiler regions in the input and applies spoiler formatting to the entire string.static String
Escapes already existing strike regions in the input and applies strike formatting to the entire string.static String
Escapes already existing underline regions in the input and applies underline formatting to the entire string.
-
Method Details
-
bold
Escapes already existing bold regions in the input and applies bold formatting to the entire string.
The resulting string will be"**" + escaped(input) + "**"
.- Parameters:
input
- The input to bold- Returns:
- The resulting output
-
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
Escapes already existing monospace (single backtick) regions in the input and applies monospace formatting to the entire string.
The resulting string will be"`" + escaped(input) + "`"
.- 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
Escapes already existing spoiler regions in the input and applies spoiler formatting to the entire string.
The resulting string will be"||" + escaped(input) + "||"
.- Parameters:
input
- The input to spoiler- Returns:
- The resulting output
-
strike
Escapes already existing strike regions in the input and applies strike formatting to the entire string.
The resulting string will be"~~" + escaped(input) + "~~"
.- Parameters:
input
- The input to strike- Returns:
- The resulting output
-
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
Applies quote block formatting to the entire string.
The resulting string will be">>> " + input
.- Parameters:
input
- The input to quote block- Returns:
- The resulting output
-
maskedLink
Creates a masked link with the provided url as target.
This will replace any closing parentheses (in the url) with the url encoded equivalent and replace closing square brackets with their escaped equivalent.- Parameters:
text
- The text to displayurl
- The target url- Returns:
- The resulting output
-