Skip to content

Instantly share code, notes, and snippets.

@matthewzring
Last active March 28, 2024 17:13
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.

@HarleyVader
Copy link

markdown has gotten me into trouble for downmarking something i should have marked down

@SrinSS01
Copy link

SrinSS01 commented May 8, 2022

can we create tables as well?

@kkrypt0nn
Copy link

kkrypt0nn commented May 8, 2022

can we create tables as well?

Nope

@SpencerTinnin
Copy link

Is there a way to add syntax highlighting to an inline/single-line code block?

@kkrypt0nn
Copy link

Is there a way to add syntax highlighting to an inline/single-line code block?

If you mean this, nope

@iOrange
Copy link

iOrange commented May 11, 2022

Need an HLSL support, esp. since there's GLSL support already.

@Crawkidile
Copy link

there is also powershell as well
image

@immjs
Copy link

immjs commented Jun 11, 2022

Recently, ansi has been added which allows you to add color as you desire on code blocks.

@kkrypt0nn
Copy link

Recently, ansi has been added which allows you to add color as you desire on code blocks.

It's been around 6 months since that has been added :)

@immjs
Copy link

immjs commented Jun 11, 2022

Recently, ansi has been added which allows you to add color as you desire on code blocks.

It's been around 6 months since that has been added :)

Regardless, i think it would make a nice addition to this gist

@kkrypt0nn
Copy link

That is true, however there is a gist for ansi color codes

https://gist.github.com/kkrypt0nn/a02506f3712ff2d1c8ca7c9e0aed7c06

@almeidx
Copy link

almeidx commented Jun 11, 2022

This gist was last updated 3 years ago

@immjs
Copy link

immjs commented Jun 11, 2022 via email

@ashishbhateja
Copy link

ashishbhateja commented Jun 30, 2022

any way to create text hyperlinks in discord? Example [text] (URL)

@RedStone576
Copy link

yea, but its only possible if the message was sent with webhook tho

@ashishbhateja
Copy link

ashishbhateja commented Jun 30, 2022

yea, but its only possible if the message was sent with webhook tho

Got it, thanks.
Do you know if I can simultaneously cross post to another channel in same category (other than copying and pasting with link)?

@Marco-Gtto
Copy link

Marco-Gtto commented Aug 6, 2022

The "YAML" only shows up because you are using a BetterDiscord theme/plugin, which is by the way against Discord's Terms of Service and can get your account terminated.. You cannot put colors in an embed without specifying a language to use.

and shutup we dont give a shit

He is right. People like you don't care about rules and how to support a platform. Your target is only get informations from servers (like hidden channels) that you should not be able to see. Probably you never went further than a discord bot, so before to criticize others work at least make sure that what you are doing respect ToS and law....

@Marco-Gtto
Copy link

The "YAML" only shows up because you are using a BetterDiscord theme/plugin, which is by the way against Discord's Terms of Service and can get your account terminated.. You cannot put colors in an embed without specifying a language to use.

and shutup we dont give a shit

He has right. People like you don't care about rules and how to support a platform. Your target is only get informations from servers (like hidden channels) that you should not be able to see. Probably you never went further than a discord bot, so before to criticize others work at least make sure that what you are doing respect ToS and law....

btw its "he is right" not he has right

Thanks, I'll keep that in mind. You know, I don't use google translate 😉

@andreolf
Copy link

andreolf commented Sep 9, 2022

love this, thanks for sharing

@YakovL
Copy link

YakovL commented Dec 27, 2022

@RedStone576

yea, but its only possible if the message was sent with webhook tho

What does this mean exactly? Could you help me with the issue of having this work only in ephemeral messages?

@KawaiiTemDev
Copy link

KawaiiTemDev commented Dec 30, 2022

lua
is also valid now!
image
image

@GrantBirki
Copy link

I wish there was formatting for console output like there is on GitHub

@Woofer21
Copy link

Woofer21 commented Jan 7, 2023

All of this needs updated now with the new code block formatting

@robbdentia
Copy link

they changed the format, please update!

@Beta-Wolf
Copy link

they changed the format, please update!
All of this needs updated now with the new code block formatting

Did Discord mention it somewhere? Trying to find some more info.

@kkrypt0nn
Copy link

kkrypt0nn commented Jan 7, 2023

they changed the format, please update!
All of this needs updated now with the new code block formatting

Did Discord mention it somewhere? Trying to find some more info.

From what I've seen it's the same method and format, just different colors. So they probably meant the images should be updated to reflect those color changes, though nothing big...

@NUTTREX
Copy link

NUTTREX commented Jan 7, 2023

lua is also valid now! image image

lmao roblox cheats detected btw

@Shimo74
Copy link

Shimo74 commented Jan 8, 2023

All of this needs updated now with the new code block formatting

I made for it
https://gist.github.com/Shimo74/a0d07142f5912128d447aebf75230dcb

@Woofer21
Copy link

Woofer21 commented Jan 8, 2023

they changed the format, please update!
All of this needs updated now with the new code block formatting

Did Discord mention it somewhere? Trying to find some more info.

From what I've seen it's the same method and format, just different colors. So they probably meant the images should be updated to reflect those color changes, though nothing big...

I provided them with the new images, just need them to update it.

@cherryblossom000
Copy link

cherryblossom000 commented Jan 15, 2023

@GrantBirki
Copy link

@cherryblossom000 That is amazing! Thank you ⭐

@rtyyyyb
Copy link

rtyyyyb commented Jan 19, 2023

is there anyway to suggest or add a syntax highlight? like for a lesser known language

@cherryblossom000
Copy link

@rtyyyyb Discord uses highlight.js, so see this for more information about requesting a language.

@padreputativo
Copy link

What about gdscript? it is supported in highlight but not in discord

@cherryblossom000
Copy link

cherryblossom000 commented Feb 3, 2023

@padreputativo Source? I can’t find gdscript in the languages folder in the highlight.js repo and it’s also not listed in the highlight.js demo (select the ‘all’ language category).

Edit: maybe you’re referring to https://github.com/highlightjs/highlightjs-gdscript? Because it must be manually installed separately from the main highlight.js repo Discord does not support it. I believe Discord only supports the languages inside the main highlight.js repo.

@padreputativo
Copy link

padreputativo commented Feb 3, 2023

@cherryblossom000
Copy link

That repo is separate from the main highlight.js one and must be manually installed separately, and I believe Discord only supports the core languages inside the main highlight.js repo.

@padreputativo
Copy link

Yes but they talk about it in the official repo

https://github.com/highlightjs/highlight.js/issues?q=GDSCRIPT

@cherryblossom000
Copy link

cherryblossom000 commented Feb 4, 2023

Talking about it in the official repo doesn’t automatically mean it’s a core language that comes with the main highlight.js module.

highlightjs/highlight.js#2448

That seems to be a third party language module.

highlightjs/highlight.js#3108

Tracks third-party language modules

highlightjs/highlight.js#1772
highlightjs/highlight.js#1175

Closed PRs to implement GDScript support. The third-party module seems to be what is being used in the highlight.js ecosystem.


Please also see this for more information on language requests for highlight.js.

@padreputativo
Copy link

I will try to suggest it again then! Thanks!

@padreputativo
Copy link

@cherryblossom000
Copy link

You could always try making a feature request in Discord, but knowing Discord I highly doubt they’d do anything about it or support any other external languages :/

@padreputativo
Copy link

Thanks 💯

@Sapphire-code
Copy link

Sapphire-code commented Feb 12, 2023

[Comment removed by Matt]

@Sapphire-code
Copy link

Sapphire-code commented Feb 18, 2023

[Comment removed by Matt]

@Sapphire-code
Copy link

@FayaDev I bet your friends just tolerate you.

Let's just not waste our precious time on such wasteful people.

@PadowYT2
Copy link

Sadly this code quotes are not accurate color now

@Sapphire-code
Copy link

Sadly this code quotes are not accurate color now

What do you mean? I've been using it and the syntax highlighting seems to be just fine. Please attach a screenshot of how it looks like, so people can assist you with your issue. Goodluck!

@PadowYT2
Copy link

Sadly this code quotes are not accurate color now

What do you mean? I've been using it and the syntax highlighting seems to be just fine. Please attach a screenshot of how it looks like, so people can assist you with your issue. Goodluck!

It is really not an issue, but for example
Old:
https://camo.githubusercontent.com/f9f7deb94a7b33a2ad6f46def88a9b02a21a9dbf6981fee22a627fb2c1fdb18a/68747470733a2f2f692e696d6775722e636f6d2f774162523967312e706e67
New:
https://cdn.padow.ru/tsh8

@RedStone576
Copy link

i mean the last revision of this gist is around 1,270 days ago, not surprising that there is some missing or outdated images. also someone made the discord version of hljs demo page, might want to check that out

@matthewzring
Copy link
Author

Wow.... it's been a long time since this gist was last updated. Sorry about that!

I've updated this gist with new languages and examples. Thank you to everyone who reached out to me!

I'll do my best to keep this updated in the future. I heard Discord may be adding more markdown options to messages.

If you have any suggestions or feedback, the best way to get in contact with me would be through my discord server. Thanks!

@CamKem
Copy link

CamKem commented Mar 30, 2023

Can we please have syntax highlighting for the Discord mobile app… very frustrating to not be able to see it! @matthewzring

@kkrypt0nn
Copy link

kkrypt0nn commented Mar 30, 2023

Can we please have syntax highlighting for the Discord mobile app… very frustrating to not be able to see it! @matthewzring

Wrong place to ask for that. This is not a Discord gist nor written by any Discord employee. Ask Discord directly at https://dis.gd/contact

@pendragons-code
Copy link

pendragons-code commented Apr 5, 2023

Is there any way we can get discord to process the markdown:

e.g. links

@RedStone576
Copy link

Is there any way we can get discord to process the markdown:

e.g. links

yeah but currently only webhook could send a hyperlink

@pendragons-code
Copy link

pendragons-code commented Apr 5, 2023 via email

@nattadasu
Copy link

Is there any way we can get discord to process the markdown:

e.g. links

At the moment, there's experiment to support new markdown syntaxes, this includes hyperlink, bullet listing, and headings (H1-H3)
image

But yeah, generally, only bot and webhook could add a hyperlink

@matthewzring
Copy link
Author

matthewzring commented Apr 15, 2023

I've updated this gist with organizational text formatting, including headers, unordered lists, and ordered lists! Keep in mind this is currently an experiment and is not available on all servers at this time.

@squigglezworth
Copy link

<3

@WeeeeeeeeeeS
Copy link

you can't disable this right?

@kkrypt0nn
Copy link

you can't disable this right?

Not at the moment, eventually later with some update but I doubt.

@WeeeeeeeeeeS
Copy link

you can't disable this right?

Not at the moment, eventually later with some update but I doubt.

yeah this regex disables it 🤡 "^#\s+.+$"

@RedStone576
Copy link

that just gonna block only the heading tag tho, also why the clown emoji

@WeeeeeeeeeeS
Copy link

WeeeeeeeeeeS commented Apr 20, 2023

that just gonna block only the heading tag tho, also why the clown emoji

yeah, smaller headers are fine.

@SPEED0U
Copy link

SPEED0U commented Apr 23, 2023

Any idea why it doesn't work on every servers ?

@kkrypt0nn
Copy link

kkrypt0nn commented Apr 23, 2023

Any idea why it doesn't work on every servers ?

"This is currently an experiment and is not available on all servers at this time."

https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline-#h_01GY0DB14X1PFY87CJFFVHFW4T

@kkrypt0nn
Copy link

kkrypt0nn commented Apr 27, 2023

Organisational Text Formatting is now available to 100% of the guilds ^^

It is also possible to block these with AutoMod regexes, see here. (In Discord Developers server.)

@SPEED0U
Copy link

SPEED0U commented Apr 28, 2023

Still not for me :(

@kkrypt0nn
Copy link

kkrypt0nn commented Apr 28, 2023

Still not for me :(

Yeah, they temporarily disabled it ~12 hours ago to fix some issues
image

Consider it going back live soon again

@Fptbb
Copy link

Fptbb commented May 5, 2023

Yeah, they temporarily disabled it ~12 hours ago to fix some issues image

Consider it going back live soon again

Well, i think it's dead for a lot more than 24, but let's wait and see.

@kairusds
Copy link

is it still disabled?

@kkrypt0nn
Copy link

is it still disabled?

Yes

@kkrypt0nn
Copy link

They started rolling out the new markdown again, just without hyperlinks.

@kairusds
Copy link

They started rolling out the new markdown again, just without hyperlinks.

thank god

@kkrypt0nn
Copy link

kkrypt0nn commented May 19, 2023

Has been entirely rolled back again :)

Aaaaand it's back again

@LudovicoPiero
Copy link

Still not for me :(

Yeah, they temporarily disabled it ~12 hours ago to fix some issues image

Consider it going back live soon again

What server is this?

@bdawg1989
Copy link

I hope they enable masked embeds again.

@matthewzring
Copy link
Author

@WitherredAway Yes, that's why I included:

The numbers don't have to be in numerical order, but the list will always start with the first number.

@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