From 23d0a5e28e25fbacbb3dde20c20699055799440e Mon Sep 17 00:00:00 2001 From: Elitesparkle Date: Wed, 12 Oct 2022 22:42:19 +0200 Subject: [PATCH] Add details to the Markdown section I've reorganized the markdown section and added more details about its usage in embeds as well as a new part about spoilers and quotes. --- docs/getting-started/more-features.mdx | 136 +++++++++++++++++++++---- 1 file changed, 115 insertions(+), 21 deletions(-) diff --git a/docs/getting-started/more-features.mdx b/docs/getting-started/more-features.mdx index 2d4cf400..912a24e4 100644 --- a/docs/getting-started/more-features.mdx +++ b/docs/getting-started/more-features.mdx @@ -218,7 +218,7 @@ method, you can set a small footer that holds a message. This has `text` and `ic - Author - With the [`set_author`](https://docs.pycord.dev/en/master/api.html#discord.Embed.set_author) method, you can set an author for the embed. This is a small text field at the top of the embed. This includes `name`, `url` and `icon_url` kwargs. -- Thumbnail - With the [`set_thumbnial`](https://docs.pycord.dev/en/master/api.html#discord.Embed.set_thumbnail) +- Thumbnail - With the [`set_thumbnail`](https://docs.pycord.dev/en/master/api.html#discord.Embed.set_thumbnail) method, you can set a small image to reside at the top-right of the embed. This has a single `url` kwarg. - Image - With the [`set_image`](https://docs.pycord.dev/en/master/api.html#discord.Embed.set_image) method, you can set an image to sit at the bottom of an embed. This has a single `url` kwarg. @@ -227,7 +227,12 @@ There are a lot more methods and attributes you can use to configure embeds. Her ### Markdown Markdown is a type of markup language that's limited in terms of formatting yet simple. Discord allows -for a watered-down version of markdown to be in their messages. This includes: +for a watered-down version of markdown to be in their messages. + +#### Text Markdown + +Text formatting can be used in messages and in most embed parts, +as explained in the dedicated section below. @@ -250,33 +255,122 @@ for a watered-down version of markdown to be in their messages. This includes:
-Sadly, Discord does not support other types, such as hyperlinks. The only supported places for hyperlinks are -in embeds and messages sent through webhooks. - -Adding markdown to your embeds or messages will give your bot the sparkle it needs. +#### Code Markdown -Here is an example for a hyperlink in embeds. +To create a single-line code block without syntax highlight, wrap the text between single backticks. +This code block will only add a dark background to the text. ``` -[Click here!](https://pycord.dev/) +\`print("Hello world!")\` ``` -Inside the embed, the example above will look like this: [`Click here!`](https://pycord.dev/) -:::caution - -Some embed fields, such as the footer, do not support markdown *at all*, including bold and italics. - -::: +To create a multi-line code block without syntax highlight, wrap the text between triple backticks +on first and last line. This type of code block will encase the code inside a box. -#### Code Markdown +``` +\`\`\` +message = "Hello world!" +print(message) +\`\`\` +``` -For code markdown, you can choose between `Code Text` and `Code Blocks`. +To create a multi-line block with syntax highlight, add the name of the language you are using right after +the triple backticks on the first line. For example, for Python you can write either "python" or "py". -- \`Code Text\` -- \`\`\` -Code Blocks +``` +\`\`\`python +message = "Hello world!" +print(message) \`\`\` +``` + +If you want to use syntax highlight for a single line of code, you still have to format it +like a multi-line block but the code must be on a separate line than the triple backticks. + +#### Quote Markdown + +To create a single-line quote block, start the line with `>` followed by a space. + +``` +> This is a single-line quote. +``` -Code Blocks support different programming languages, such as Python. +To create a multi-line quote block, write `>>>` followed by a space. All text +from that point onwards will be included in that quote block. -If you start your Code Block with ```python, you can send readable Python code to Discord. +``` +>>> This is a +multi-line quote. +``` + +#### Spoiler Markdown + +To hide a spoiler, encase the text between double pipes. The users +will have to click on it before being able to see the text contained in it. + +``` +||spoiler|| +``` + +#### Link Markdown + +Link formatting only works in embeds and messages sent through webhooks, +by using the following syntax: + +``` +[Pycord](https://pycord.dev/) +``` + +Inside the supported elements that have just been mentioned, +the example above will look like this: [`Pycord`](https://pycord.dev/) + +Outside of them, the link will still be clickable but the formatting will be ignored, +therefore the example above will look similarly to this: `[Pycord](https://pycord.dev/)` + +#### Embed Markdown + +Adding markdown to your embeds or messages will give your bot the sparkle it needs, +however, markdown is limited inside embeds. Use the following table as a reference +and keep in mind that embed title and filed names will always show in **bold**. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PartTextLink
Embed AuthorNoNo
Embed TitleYesNo
Embed DescriptionYesYes
Field NameYesNo
Field ValueYesYes
Embed FooterNoNo