Class MarkdownParser
Component.
This class processes text components and applies Markdown-style formatting (Bold, Italic, Strikethrough, Underline, Spoiler, Hyperlink, Color, CopyToClipboard)
to the text. The formatting is controlled globally or individually through the MarkdownParser.EnableMarkdownFor and
MarkdownParser.DisableMarkdownFor inner classes.
Purpose: This class provides a utility for parsing and applying Markdown formatting in Minecraft chat messages.
When: This class is used when a message needs to be formatted with Markdown syntax.
Where: The class is invoked in various components where text formatting is required, typically in chat rendering or message construction.
Additional Info: The formatting can be enabled or disabled globally or selectively for specific features like bold or italic. The settings are managed via the MarkdownParser.EnableMarkdownFor and MarkdownParser.DisableMarkdownFor classes.
parseMarkdown(Component)- Parses and applies Markdown formatting to a given message component.enableMarkdown()- Enables global Markdown formatting.disableMarkdown()- Disables global Markdown formatting.enableMarkdownFor()- Returns an instance ofMarkdownParser.EnableMarkdownForto enable specific Markdown features.disableMarkdownFor()- Returns an instance ofMarkdownParser.DisableMarkdownForto disable specific Markdown features.
- Since:
- 1.1.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn inner class used to disable Markdown formatting for specific features.static classAn inner class used to enable Markdown formatting for specific features. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidDisables global Markdown formatting.Returns a new instance ofMarkdownParser.DisableMarkdownForto disable Markdown for specific formats.static voidEnables global Markdown formatting.Returns a new instance ofMarkdownParser.EnableMarkdownForto enable Markdown for specific formats.static net.minecraft.network.chat.MutableComponentparseMarkdown(net.minecraft.network.chat.Component pMessage) Parses and applies Markdown formatting to a givenComponentmessage.
-
Constructor Details
-
MarkdownParser
public MarkdownParser()
-
-
Method Details
-
parseMarkdown
public static net.minecraft.network.chat.MutableComponent parseMarkdown(net.minecraft.network.chat.Component pMessage) Parses and applies Markdown formatting to a givenComponentmessage.Purpose: To parse and apply Markdown formatting to a given message component.
When: Called when a component is to be formatted with Markdown styles.
Where: This method is invoked in various places where a text message is being processed for display.
Additional Info: The method checks if global Markdown formatting is enabled and applies the relevant formats like bold, italic, etc.- Parameters:
pMessage-Component- The message component containing the text to format.- Returns:
- A
MutableComponentwith the Markdown formatting applied. - Since:
- 1.1.0
- See Also:
-
enableMarkdown
public static void enableMarkdown()Enables global Markdown formatting.Purpose: To enable global Markdown formatting for all messages.
When: Called when global Markdown formatting needs to be enabled.
Where: This method is typically called during initialization or configuration of the Markdown settings.
Additional Info: Enabling global formatting will allow the system to apply all Markdown features like bold, italic, etc.- Since:
- 1.1.0
- See Also:
-
disableMarkdown
public static void disableMarkdown()Disables global Markdown formatting.Purpose: To disable global Markdown formatting for all messages.
When: Called when global Markdown formatting should be disabled.
Where: This method is typically invoked when the user wants to prevent any Markdown formatting from being applied.
Additional Info: Disabling global formatting ensures no Markdown styles (e.g., bold, italic) are applied to any messages.- Since:
- 1.1.0
- See Also:
-
enableMarkdownFor
Returns a new instance ofMarkdownParser.EnableMarkdownForto enable Markdown for specific formats.Purpose: To allow selective enabling of specific Markdown features.
When: Called when specific Markdown features (e.g., bold, italic) need to be enabled.
Where: Typically invoked in settings or configuration code to modify Markdown options.
Additional Info: This method returns an instance ofMarkdownParser.EnableMarkdownFor, which can be used for method chaining to enable various Markdown features.- Returns:
- A new
MarkdownParser.EnableMarkdownForinstance. - Since:
- 1.1.0
- See Also:
-
disableMarkdownFor
Returns a new instance ofMarkdownParser.DisableMarkdownForto disable Markdown for specific formats.Purpose: To allow selective disabling of specific Markdown features.
When: Called when specific Markdown features (e.g., bold, italic) need to be disabled.
Where: Typically invoked in settings or configuration code to modify Markdown options.
Additional Info: This method returns an instance ofMarkdownParser.DisableMarkdownFor, which can be used for method chaining to disable various Markdown features.- Returns:
- A new
MarkdownParser.DisableMarkdownForinstance. - Since:
- 1.1.0
- See Also:
-