Technology

How to Format Text as Code in Discord

0
Please log in or register to do it.
How to Format Text as Code in Discord

I’d love to guide you on how to format text as code in Discord! This can be a fun way to share snippets of code, highlight technical terms, or even just to make your messages stand out. Let’s dive right in, shall we?

What is Markdown in Discord?

Before we start, it’s important to understand what we’re dealing with. Discord uses a simplified version of Markdown, a lightweight markup language that you can use to format text. In other words, Markdown is a set of rules that define how to style and format text on the web. It’s designed to be easy to write and read, even in its raw form.

Markdown is used by many platforms, including GitHub, Reddit, and, of course, Discord. So learning how to use it can be quite useful beyond just your Discord adventures.

Single Line Code Blocks in Discord

To format a small piece of text as a code in Discord, you can use single backticks (`). Anything between single backticks will be formatted as inline code. Here’s how you do it:

  1. Open your Discord app and go to the server or direct message where you want to send the message.
  2. In the message box, type a backtick ( ), your text, and then another backtick (`). It should look like this: `Your text here`
  3. Hit Enter to send the message. Your text will appear in a monospace font, which is typically used for code.

Example: `Hello, world!` will appear as Hello, world!

Multi-line Code Blocks in Discord

If you want to share a larger piece of code or keep your text more organized, you can use multi-line code blocks. This can be done with triple backticks (“`). Here’s how:

  1. Open your Discord app and navigate to the server or direct message where you want to send the message.
  2. In the message box, type three backticks (“`) to start a new line, then press Enter.
  3. On the new line, type your text. You can start new lines by pressing Enter.
  4. After you’re finished with your text, start a new line and type three more backticks (“`). It should look like this: “`Your text here“`
  5. Hit Enter to send the message. Your text will appear in a block of monospace text.

Example:

“`
Hello,
world!
“`

will appear as:

Hello,
world!

Syntax Highlighting in Discord

Now, if you want to go the extra mile and make your code not only formatted but also color-highlighted according to the programming language syntax, you can do that too! Here’s how:

  1. Open your Discord app and navigate to the server or direct message where you want to send the message.
  2. In the message box, type three backticks (“`) followed by the language identifier (like python, javascript, html, etc.), then press Enter.
  3. On the new line, type your code.
  4. After you’re finished with your code, start a new line and type three more backticks (“`). It should look like this: “`language\nYour code here“`
  5. Hit Enter to send the message. Your code will appear color-highlighted according to the syntax of the specified language.

Example:

“`javascript
var s = “Hello, world!”;
alert(s);
“`

will appear as:

var s = "Hello, world!";
alert(s);

And voila! You’re now a Discord Markdown wizard! Remember, with great power comes great responsibility. So, use your new skills wisely, and happy coding!

References:

How to Reset Your Hotmail Password
How to Transfer Photos from iPhone to PC

Reactions

0
0
0
0
0
0
Already reacted for this post.