Skip to content

Getting Started (Markdown)

Aram edited this page Dec 8, 2024 · 6 revisions

Getting Started with Markdown

Overview

The MarkdownParser in BlueLib introduces support for Markdown formatting in Minecraft, allowing for enhanced text styling options such as bold, italic, strikethrough, underline, hyperlink and spoiler. By default, Markdown support is enabled, providing modders and users a seamless way to integrate formatted text into their Minecraft mods or experiences.

This feature ensures flexibility with options to disable Markdown entirely, disable specific elements, or even escape Markdown formatting in specific instances using a backslash (\).

Due to github not supporting spoilers, we are unable to showcase it here in the documentation. But in Minecraft, using the Spoiler Markdown, the text will get obfuscated using Minecraft Obfuscated system.

Features

Supported Markdown Elements

As of the most recent version, the following Markdown elements are supported:

  • Bold: **text**
  • Italic: *text*
  • Strikethrough: ~~text~~
  • Underline: __text__
  • hyperlink: [text](link)
  • spoiler: ||spoiler||

Escaping Markdown

If you need to cancel out Markdown formatting for specific text, you can use a backslash (\) before the Markdown prefix. This is useful when you want to display the raw syntax instead of applying the style.

Example

To show **text** as plain text in chat instead of rendering it as text, write:

\**text**

This will display the exact string **text** in chat.

Similarly, to escape each element:

  • For bold: \**text**
  • For italic: \*text*
  • For strikethrough: \~~text~~
  • For underline: \__text__
  • For hyperlink: \[text](link)
  • For spoiler: \||text||

Disabling Markdown

Markdown can be toggled either globally or for individual elements:

Disabling Markdown Globally

To disable Markdown entirely, use:

MarkdownParser.disableMarkdown();

Disabling Specific Markdown Elements

To disable specific Markdown elements, use the following methods:

MarkdownParser.disableMarkdownFor.Bold();
MarkdownParser.disableMarkdownFor.Italic();
MarkdownParser.disableMarkdownFor.Underline();
MarkdownParser.disableMarkdownFor.Strikethrough();
MarkdownParser.disableMarkdownFor.Hyperlink();
MarkdownParser.disableMarkdownFor.Spoiler();

You can also combine these for greater control. For example, to disable both bold and italic, use:

MarkdownParser.disableMarkdownFor.Bold().Italic();

Key Points

  • Seamless Integration: Add Markdown text styling to Minecraft chat.
  • Flexible Controls: Enable or disable Markdown globally or on a per-element basis.
  • Escape Markdown: Use a backslash (\) to prevent Markdown formatting on specific text.

Note: The MarkdownParser is designed specifically for Minecraft chat use, enhancing the way text appears during gameplay. It’s a perfect fit for creating immersive and visually appealing chat interactions within the game.

For further information and advanced customization options, refer to the official Discord community where you can seek help, share experiences, and learn from other developers. You may also refer to our API Documentation.