Lemmy Markdown Formatting Guide

This post explains how to format Markdown with Lemmy and details it’s nuances as best as possible.

Important Notes on Markdown with Lemmy

Lemmy parses Markdown using CommonMark, but with some additional features namely spoilers.

NOTE: Lemmy cares about the number of newlines between paragraphs. If you want to have a new paragraph, you need to have at least one newline between the two paragraphs. Or else, Lemmy will treat it as a single paragraph. You can see this in the example below.

Newline spacing example

Correct

Format

This is a paragraph. Imagine it's a bit longer.

This is another paragraph. Again, imagine it's a bit longer.

Result

This is a paragraph. Imagine it’s a bit longer.

This is another paragraph. Again, imagine it’s a bit longer.

Incorrect

Format

This is a paragraph. Imagine it's a bit longer.
This is another paragraph. Again, imagine it's a bit longer.

Result

This is a paragraph. Imagine it’s a bit longer. This is another paragraph. Again, imagine it’s a bit longer.

Text Formatting

Paragraph Text

Format Alternate Result
_italic_ *italic* italic
**bold** __bold__ bold
**_bold italic_** __*bold italic*__ bold italic
~~strikethrough~~ strikethrough
^superscript^ superscript
~subscript~ subscript

Headings

Headings are denoted by a # at the beginning of a line. The number of #s determines the heading level up to 6. The alternate format is to have the heading text on the line below and underline it with = for heading 1 and - for heading 2.

Heading examples

Heading Format

# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6

Heading Result

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Alternate Format

Heading 1
=========

Heading 2
---------

Alternate Result

Heading 1

Heading 2

Blockquotes

Blockquotes are simply a > at the beginning of a line.

Blockquote Format

> This is a blockquote.

> This is
>
> a multiline
>
> blockquote.

> This is
> not a multiline
> blockquote.

Blockquote Result

This is a blockquote.

This is

a multiline

blockquote.

This is not a multiline blockquote.

Lists

Lists can be ordered or unordered. Ordered lists are numbered, unordered lists are bulleted. You can nest lists by indenting them with 4 spaces or a tab, and you can mix ordered and unordered lists by indenting them differently.

List examples

Unordered List Format

- Item 1
- Item 2
  - Item 2.1
  - Item 2.2
- Item 3

Unordered List Result

  • Item 1
  • Item 2
    • Item 2.1
    • Item 2.2
  • Item 3

Ordered List Format

1. Item 1
2. Item 2
   1. Item 2.1
   2. Item 2.2
3. Item 3

Ordered List Result

  1. Item 1
  2. Item 2
    1. Item 2.1
    2. Item 2.2
  3. Item 3

Mixed List Format

- Item 1
- Item 2
  1. Item 2.1
  2. Item 2.2
     - Item 2.2.1
- Item 3

Mixed List Result

  • Item 1
  • Item 2
    1. Item 2.1
    2. Item 2.2
      • Item 2.2.1
      • Item 2.2.2
  • Item 3

Code Blocks

Code blocks are denoted by 3 backticks (```) on the line before and after the code block. Currently no syntax highlighting is supported. You can also do inline code blocks by using a single backtick (`) on either side of the code.

Code block examples

Code Block Format

NOTE: Ignore the backslashes, they are only there to escape the backticks.

\`\`\` python
def hello_world():
    print("Hello World!")
\`\`\`

Code Block Result

def hello_world():
    print("Hello World!")
Inline code example

Inline Code Format

This is a paragraph with some `inline code` in it.

Inline Code Result

This is a paragraph with some inline code in it.

Links

Links are denoted by [link text](link url). You can also do reference links by doing [link text][link id] and then [link id]: link url somewhere else in the post, preferably at the bottom.

Link examples

Link Formats

[SFFA](https://sffa.community)


[SFFA][sffa-wiki]
... somewhere down at the bottom of the post ...

[sffa-wiki]: https://sffa.community

Link Results

SFFA

SFFA

… somewhere down at the bottom of the post …

Images

Images are denoted by ![alt text](image url). You can also do reference images by doing ![alt text][image id] and then [image id]: image url somewhere else in the post, preferably at the bottom of the post like with reference links.

Image examples

Image Formats

![Lemmy from Motörhead]https://upload.wikimedia.org/wikipedia/commons/8/84/Lemmy-02.jpg)

![Lemmy from Motörhead][lemmy]

... somewhere down at the bottom of the post ...

[lemmy]: https://upload.wikimedia.org/wikipedia/commons/8/84/Lemmy-02.jpg

Image Results

Lemmy from Motörhead

Lemmy from Motörhead

… somewhere down at the bottom of the post …

Tables

Tables are denoted by |s and -s. The first row is the header row, and the second row is the alignment row. The alignment row is optional, and if it is not included, the table will default to left alignment. The alignment row can be left aligned with :---, right aligned with ---:, or center aligned with :---:. The alignment row can also be omitted entirely, in which case the table will default to left alignment.

Table examples

Table Format

| Header 1 | Header 2 | Header 3 |
| :--- | :---: | ---: |
| Left | Center | Right |
| Left | Center | Right |

Table Result

Header 1 Header 2 Header 3
Left Center Right
Left Center Right

Horizontal Rules

Horizontal rules are denoted by 3 or more -s on a line by themselves and require blank new lines above and below.

Horizontal rule example

Horizontal Rule Format

some text

---

some more text

Horizontal Rule Result

some text


some more text

Spoilers

Spoilers are denoted by ::: spoiler and ::: around a block of text or other markdown elements. You can give the spoiler a title by putting it after ::: spoiler like ::: spoiler Spoiler Title.

You CAN’T nest spoilers inside of each other.

Spoiler Format

NOTE: Ignore the backslashes, they are only there to escape the colons.

Some paragraph text.

\::: spoiler Spoiler Title
Some spoiler or _other_ markdown elements.
\:::

Other paragraph text.

Spoiler Result

Some paragraph text.

Spoiler Title

Some spoiler or other markdown elements.

Other paragraph text.

  • aeharding@vger.social
    link
    fedilink
    arrow-up
    0
    ·
    4 months ago

    You CAN’T nest spoilers inside of each other.

    ACTUTUAAALYLYLY

    Spoiler One

    Some spoiler or other markdown elements.

    Spoiler Two (nested)

    Some spoiler or other markdown elements.