Skip to content

Instantly share code, notes, and snippets.

@matthewzring
Last active April 24, 2024 18:43
Show Gist options
  • Save matthewzring/9f7bbfd102003963f9be7dbcf7d40e51 to your computer and use it in GitHub Desktop.
Save matthewzring/9f7bbfd102003963f9be7dbcf7d40e51 to your computer and use it in GitHub Desktop.
A guide to Markdown on Discord.

Markdown Text 101

Want to inject some flavor into your everyday text chat? You're in luck! Discord uses Markdown, a simple plain text formatting system that'll help you make your sentences stand out. Here's how to do it! Just add a few characters before & after your desired text to change your text! I'll show you some examples...

What this guide covers:

Text Formatting

Italics *italics* or _italics_

Underline italics __*underline italics*__

Bold **bold**

Underline bold __**underline bold**__

Bold Italics ***bold italics***

underline bold italics __***underline bold italics***__

Underline __underline__

Strikethrough ~~Strikethrough~~

Don't want to use markdown? You can slap a backslash in front of your statement, or put your message in a code block, and it'll escape the markdown formatting. You'll see those asterisks as you'd like!

Organizational Text Formatting

Headers

To create a header, you need to include a specific number of the hash/pound sign character (#). Use (#) for a big header, (##) for a smaller header, or (###) for an even smaller header as the first character(s) in a new line.

headers

Masked Links

You can use masked links to make text a clickable or pressable hyperlink. To do so, you need to include the text you want displayed in brackets and then the URL in parentheses. For example:

masked links

If you don't wish to embed a link, you can wrap the link with <> to remove the embed for that specific link.

Unordered Lists

You can create a bulleted list using either (-) or (*) in the beginning of each line. You can indent your list by adding a space before (-) or (*) at the beginning of each line.

unordered lists

Ordered Lists

To create an ordered list, add line items with numbers followed by periods. The numbers don't have to be in numerical order, but the list will always start with the first number. You can indent your list by adding a space before the number at the beginning of each line.

ordered lists

Code Blocks

Discord also supports code blocks as well. You can make your own code blocks by wrapping your text in backticks (`)

one line code blocks

You can also use three backticks (```) to create multiline code blocks, like this beautifully written haiku.

multiline code blocks

Block Quotes

The syntax to use Block Quotes is > or >>> followed by a space.

> at the beginning of a line of text, creates a single-line block quote.

one line block quote

>>> at the beginning of a line of text, creates a multi-line block quote. All text from >>> until the end of the message will be included in the quote.

multiline block quote

Spoiler Tags

You can manually tag spoilers by using the syntax || around your text or by typing /spoiler before your message. This is also negated by a code block.

spoiler tags

Syntax Highlighting

If you really want to spruce up your code blocks, you can denote a specific language for syntax highlighting, by typing the name of the language you want the code block to expect right after the first three backticks beginning your code block. An example...

syntax highlighting

There are many different languages in place of Markdown that Discord's syntax highlighting support. Each different language has its own approach to highlight-able syntax. Note that you won't be able to view syntax highlighting on the mobile app.

asciidoc

asciidoc

autohotkey

autohotkey

bash

bash

coffeescript

coffeescript

cpp (C++)

cpp

cs (C#)

cs

css

css

diff

diff

fix

fix

glsl

glsl

ini

ini

json

json

md (markdown)

md

ml

ml

prolog

prolog

ps

ps

py

py

tex

tex

xl

xl

xml

xml

yaml

yaml

And you get the idea! Now you're a Discord text markdown expert. Get out there and highlight your statements!

Acknowledgements

Discord
Discord Highlight.js

If you have any questions or want to get in contact with me, you can add matthewzring on Discord or join my discord server.

@StarKrypt
Copy link

Awesome discord update & ty for your guide!

@wingashan
Copy link

This is great. I'm really looking forward to the mobile compatibility. I'm sure they're working on it because this is beautiful. Thanks for the guide.

@kkrypt0nn
Copy link

This is great. I'm really looking forward to the mobile compatibility. I'm sure they're working on it because this is beautiful. Thanks for the guide.

It's already on mobile..? Except some syntax highlighting but that's nothing new

@wingashan
Copy link

This is great. I'm really looking forward to the mobile compatibility. I'm sure they're working on it because this is beautiful. Thanks for the guide.

It's already on mobile..? Except some syntax highlighting but that's nothing new

I think I meant the highlighting itself for mobile. I think it's great for general purpose use depending on its application.

@kkrypt0nn
Copy link

Yeah then sorry to disappoint you but they're not working on it, it's been like that for years :)

@wingashan
Copy link

Yeah then sorry to disappoint you but they're not working on it, it's been like that for years :)

Oh! Well, I guess I'll just have to appreciate the desktop client more then.

@oyes77
Copy link

oyes77 commented Jun 11, 2023

Can embeds send headings? and experimental markdown? this is really neat if it can be implemented in some of my bots

@kkrypt0nn
Copy link

kkrypt0nn commented Jun 11, 2023

Only in some fields e.g. description - just like any markdown in embeds

@letrad
Copy link

letrad commented Jun 16, 2023

I was disappointed to not see a horizontal rule or separator line, the one typically made with three dashes:

---

Or even tables for that matter.

@a-sajjad72
Copy link

why discord not preview markdown links like this. is there any way to approach such markdown preview???

@A7U
Copy link

A7U commented Jun 23, 2023

why discord not preview markdown links like this. is there any way to approach such markdown preview???

It did before, but they've removed it for some reason.

@kkrypt0nn
Copy link

kkrypt0nn commented Jun 23, 2023

"We have not rolled out masked links for general messages to users. It is unclear if/when we will do this"

discord/discord-api-docs#6088 (comment)

@darbiirue
Copy link

I really hope they roll out proper linking. I use their forums as a sort of Wiki-environment so that my people can get to helpful guides for games and such, and it looks really crappy when it shows as:

- Official Homepage: http://na.finalfantasyxiv.com/pr/

Like... It would look a ton better if I could just have a list of proper links.

@kkrypt0nn
Copy link

I really hope they roll out proper linking. I use their forums as a sort of Wiki-environment so that my people can get to helpful guides for games and such, and it looks really crappy when it shows as:

- Official Homepage: http://na.finalfantasyxiv.com/pr/

Like... It would look a ton better if I could just have a list of proper links.

Use an embed sent by a bot or a webhook with normal message or embed as well. Works fine

@WitherredAway
Copy link

WitherredAway commented Jul 11, 2023

have you ever considered adding details about ANSI syntax highlighting?

edit: oh one already exists

@PhonicUK
Copy link

Table formatting would be really nice, currently the only equivalent is to use text-tables in code blocks, but that's a hack and not as nice.

@slowloriss
Copy link

can it showing with line number?

@kkrypt0nn
Copy link

can it showing with line number?

No. The only way to have lines is to upload a file with the code.

@slowloriss
Copy link

can it showing with line number?

No. The only way to have lines is to upload a file with the code.

thank you for the anser
very useful for me

@lastmeta
Copy link

lastmeta commented Sep 9, 2023

no checkoff list?

@kkrypt0nn
Copy link

no checkoff list?

Nope

@Andre601
Copy link

2 things regarding syntax highlighting:

  1. The link to highlightjs redirects to a info page telling that they aren't a CDN... So maybe remove it. Especially because...
  2. Discord switched over to highlight colours from GitHub. Not sure if that actually also changes the highlighter used tho. Still think it's better to remove the link...

@matthewzring
Copy link
Author

@Andre601 Fixed, thanks!

@Tier-ng
Copy link

Tier-ng commented Oct 28, 2023

The markdown for c# seems to work perfectly while typing up the message, but once I send it it just becomes plain white text. Am I missing something?

@Polda18
Copy link

Polda18 commented Nov 10, 2023

Is there a way I can send messages in Discord with keyboard keys markup, like <kbd>Ctrl</kbd> <kbd>S</kbd>Ctrl S?

@kkrypt0nn
Copy link

Is there a way I can send messages in Discord with keyboard keys markup, like <kbd>Ctrl</kbd> <kbd>S</kbd> → Ctrl S?

No

@wmantly
Copy link

wmantly commented Nov 13, 2023

Where can bugs for the pre-formated block be reported? On mobile, it should NOT wrap lines in a pre-formated block

@Andre601
Copy link

Andre601 commented Feb 4, 2024

A small thing I would like to point out on (un)ordered lists:

Just like normal markdown can you have multi-line entries by indenting each new line with spaces (Not sure if one is enough here. I always do two, even for nested lists).

So as an example:

- Line1
  Line2

would result in
grafik

@Andre601
Copy link

Andre601 commented Feb 4, 2024

Also, Java seems to be missing from the list, so here is a quick rundown of the different options:
grafik

Some quick notes I want to share:

  • As with other languages (probably), this one turns specific keywords (public, private, static, etc.) red, as you can see with the new keyword.
  • The Red red is only colored when a = is followed with the first word being red.
  • The text after @ can be anything... I just did it like that with the () for consistency.
  • /* ... */ also work as comments, just with multiline.

@SyloTV
Copy link

SyloTV commented Mar 9, 2024

amazing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment