# Formatting posts using markdown, BBCode, and HTML

**URL:** https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348
**Category:** Using Discourse
**Tags:** reference
**Created:** [August 25, 2014, 5:47am UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348 "2014-08-25T05:47:06Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [August 25, 2014, 5:47am UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348/1 "2014-08-25T05:47:06Z")

</div>

> 🔖 This reference guide details all the formatting options available in Discourse posts, including markdown, BBCode, and HTML. It specifies what is supported and provides resources where you can see examples.
> 
> 🙋 Required user level: All users

# Understanding supported formatting in posts

While plain text is sufficient for most replies, Discourse allows users to enhance the formatting of their posts by using markdown, BBCode, and HTML. This guide explains what types of formatting are supported and how you can use them effectively.

You can also practice some of the basics in an interactive tutorial by sending a personal message to @discobot here or on any Discourse site.

## Summary

This guide covers:

- Supported markdown syntax
- Supported BBCode tags
- Supported and safe HTML tags and attributes

## Best practices

- Use markdown primarily for its simplicity and readability.
- Mix markdown and BBCode only when necessary, and keep usage consistent.
- Limit the use of HTML to simple, safe tags to avoid formatting issues and ensure posts are secure.

## Supported markdown

Discourse uses [markdown-it](https://github.com/markdown-it/markdown-it) for its markdown implementation.

Some commonly used markdown features include:

- **Bold** : ` **text** `

- _Italic_: `*text*`

- [Link](https://example.com): `[title](https://example.com)`

- `Inline code`: ``code``

- Highlight: `<mark></mark>`

- Blockquote: `> quoted text`

- Code block:

In longer posts (like this one), it can also be helpful to add structure using headings:

```plaintext
# Heading 1
## Heading 2
### Heading 3

```

Note: when an image is uploaded, the markdown syntax to reference the image will automatically be generated.

```plaintext
![caption|500x500](upload://image.jpeg)

```

For a full list of markdown features, please refer to the [interactive guide](https://markdown-it.github.io/).

## Supported BBCode

Discourse supports a subset of common BBCode tags, some of which are generated automatically to support special formatting, for example when you quote a post in your reply:

quote="user"\]quoted text\[/quote

```plaintext
[quote="user"]quoted text[/quote]

```

You can also use BBCode to hide text as a spoiler or as details

spoiled text

```plaintext
[spoiler]spoiled text[/spoiler]

```

details="click to expand"\]hidden text\[/details

```plaintext
[details="click to expand"]hidden text[/details]

```

BBCode tags for simple formatting supported by markdown or are also supported:

- `[b]strong[/b]`
- `[i]emphasis[/i]`
- `[u]underlined[/u]`
- `[s]strikethrough[/s]`
- `[ul][li]option one[/li][/ul]`
- `[img]http://example.com/image.png[/img]`
- `[url]http://example.com[/url]`
- `[code]code[/code]`

For a complete list of supported BBCode tags and examples, check the [Discourse BBCode tests](https://github.com/discourse/discourse/blob/main/frontend/discourse/tests/unit/lib/pretty-text-test.js).

## Supported HTML

Discourse supports a safe subset of HTML. While you can mix HTML with markdown, only specific HTML tags and attributes are allowed to ensure security and consistent styling.

Some of the allowed HTML tags include:

- `<a href="https://example.com">link</a>`
- `<strong>bold text</strong>`
- `<em>italic text</em>`
- `<ul><li>list item</li></ul>`
- `<img src="https://example.com/image.png" alt="description">`

For a detailed list of allowed HTML tags and attributes, refer to [Discourse’s allow-list](https://github.com/discourse/discourse/blob/main/frontend/pretty-text/addon/allow-lister.js#L115).

ℹ **Note:** Inline styles, like `<span style="color:red">colored text</span>`, are not supported. For custom styles, see [customize post contents](https://meta.discourse.org/t/customize-posts-contents-with-your-own-styles/257738).

## Common issues and solutions

- **BBCode or HTML tags not working:** Ensure the tags you are using are part of the supported subset.
- **Inline styles being stripped:** Discourse does not support inline styles for security reasons. Use custom styles or plugins if necessary.
- **Formatting changes on pasting from other editors:** Some rich-text formats may not render correctly. Use markdown to format text consistently.

## FAQs

**Q: Can I use tables in Discourse?**  
A: Yes, you can use markdown to create tables. For more information, see [this guide on tables](https://meta.discourse.org/t/add-a-table-to-your-post-using-markdown/66544).

**Q: Why isn’t my inline style working?**  
A: Discourse does not support inline styles in HTML for security reasons. Consider using custom BBCode or the Discourse custom styling guide.

**Q: Can I add custom BBCode tags?**  
A: Yes, you can add custom BBCode tags. Refer to the [Discourse BBCode plugin](https://meta.discourse.org/t/discourse-bbcode/65425) for more information.

## Additional resources

- Interactive markdown guide: [https://markdown-it.github.io/](https://markdown-it.github.io/)
- Customize post contents: [Customize posts' contents with your own styles](https://meta.discourse.org/t/customize-posts-contents-with-your-own-styles/257738)
- Discourse BBCode plugin: [Discourse BBCode](https://meta.discourse.org/t/discourse-bbcode/65425)

> Last edited by @renato 2026-01-26T18:46:43Z
> 
> > **Check document**
> >
> > Perform check on document:

---

<div class="post-metadata">

### Author: ![Nikki\_Locke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nikki_locke/32/146184_2.png) [@Nikki\_Locke](https://meta.discourse.org/u/Nikki_Locke)
#### Post date: [October 14, 2022, 3:37pm UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348/2 "2022-10-14T15:37:17Z")

</div>

None of these references mention tables.

---

<div class="post-metadata">

### Author: ![not-ethan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/not-ethan/32/282617_2.png) [@not-ethan](https://meta.discourse.org/u/not-ethan)
#### Post date: [October 14, 2022, 3:54pm UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348/3 "2022-10-14T15:54:16Z")

</div>

That is true but this other topic does. [Adding a table to your post using markdown](https://meta.discourse.org/t/add-a-table-to-your-post-using-markdown/66544)

---

<div class="post-metadata">

### Author: ![rahim123](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@rahim123](https://meta.discourse.org/u/rahim123)
#### Post date: [December 2, 2022, 2:12pm UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348/4 "2022-12-02T14:12:20Z")

</div>

> [@codinghorror](#):
>
> However, we only support a “safe” subset of HTML. I’ll have to dig to find the specifics, but anything common you’d expect to work that isn’t crazy – like `<script>` – should work.

Text color and text background color doesn’t seem to work with `<span>` or bbcode, am I missing something?

- `<span style="color:red">some red markdown text</span>`
  - some red markdown text

- bbcode: `[color=red]Red color text[/color]`
  - [color=red]Red color text[/color]

---

<div class="post-metadata">

### Author: ![Maksim\_Beliaev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maksim_beliaev/32/286189_2.png) [@Maksim\_Beliaev](https://meta.discourse.org/u/Maksim_Beliaev)
#### Post date: [December 16, 2022, 4:06pm UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348/5 "2022-12-16T16:06:23Z")

</div>

yes, looks like HTML inline style is not supported

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [December 16, 2022, 6:02pm UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348/6 "2022-12-16T18:02:11Z")

</div>

> [@rahim123](#):
>
> Text color and text background color doesn’t seem to work with `<span>` or bbcode, am I missing something?

You can make use of this guide:

> [@Customize posts' contents with your own styles](https://meta.discourse.org/t/customize-posts-contents-with-your-own-styles/257738):
>
> Requirementsinformation_source To be able to use these tips and tricks, you need to be an administrator of either a self-hosted Discourse instance or a [Discourse-hosted plan](https://discourse.org/pricing) higher than Basic. Introduction Discourse supports several methods to format and customize a post’s contents. You can find the list here: But sometimes, you’ll want something more specific, for example, a link that looks like a button. [Green button] This is the kind of modification we’ll learn here. The logic I’l…

(And see it in action here: [📜 [Wiki] Schlumpf hub serial numbers reference - Unicycles and Equipment - Unicyclist.com](https://unicyclist.com/t/wiki-schlumpf-hub-serial-numbers-reference/106130))

Or use this plugin that extends BBcode support:

> [@Discourse BBCode](https://meta.discourse.org/t/discourse-bbcode/65425):
>
> information_sourceSummary Discourse BBCode adds the ability to use BBCode to format posts.discourse2Hosted by us? This plugin is available on our Enterprise plansmechanicSelf-host Install [Install plugins on a self-hosted site](https://meta.discourse.org/t/install-plugins-on-a-self-hosted-site/19157)hammer_and_wrenchRepository Link [https://github.com/discourse/discourse-bbcode](https://github.com/discourse/discourse-bbcode) The Discourse BBCode plugin enhances the Markdown composer [[1]](#footnote-304175-1) with support for the [BBCode syntax](https://www.bbcode.org/reference.php) beyond what is included by default (i.e. [i], [b], [s], [u], […

As for the allowed HTML tags, I believe this is the reference:  
[https://github.com/discourse/discourse/blob/main/app/assets/javascripts/pretty-text/addon/allow-lister.js#L115](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/pretty-text/addon/allow-lister.js#L115)

Though I don’t find table HTML tags (which are allowed) inside for some reason.

Maybe because they are referenced here:

[https://github.com/discourse/discourse/blob/main/app/assets/javascripts/pretty-text/engines/discourse-markdown/table.js#L31](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/pretty-text/engines/discourse-markdown/table.js#L31)

---

<div class="post-metadata">

### Author: ![rahim123](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@rahim123](https://meta.discourse.org/u/rahim123)
#### Post date: [December 16, 2022, 6:15pm UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348/7 "2022-12-16T18:15:21Z")

</div>

Thanks a lot for the useful references!

---

<div class="post-metadata">

### Author: ![jlc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jlc/32/251717_2.png) [@jlc](https://meta.discourse.org/u/jlc)
#### Post date: [March 31, 2023, 6:40pm UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348/8 "2023-03-31T18:40:43Z")

</div>

> [@codinghorror](#):
>
> we only support a “safe” subset of HTML.

It looks like currently, the filter is set up so that the `rowspan` and `colspan` attributes on `td` and `th` elements are filtered out. My understanding is that these are safe (and I believe they are very useful): would the team be open to allowing these attributes?

As a sidebar, @Canapin talked about the location of the allowed list of `table` tags.

> [@Canapin](#):
>
> Though I don’t find table HTML tags (which are allowed) inside for some reason.
> 
> Maybe because they are referenced here:
> 
> [https://github.com/discourse/discourse/blob/main/app/assets/javascripts/pretty-text/engines/discourse-markdown/table.js#L31](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/pretty-text/engines/discourse-markdown/table.js#L31)

The `.../discourse-markdown/table.js` file, though, seems to be an implementation around specifically Markdown tables; would regular HTML tables need a separate extension to `allowList`?

I believe `rowspan` and `colspan` are pretty safe, but I also want to ask for one other piece of markup. Could we allow `data-*` attributes on table elements? I think this would be very useful for specifying different types of table contents, in particular to use as hooks for custom CSS.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [March 31, 2023, 8:27pm UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348/9 "2023-03-31T20:27:33Z")

</div>

Hi 🙂

> [@jlc](#):
>
> would the team be open to allowing these attributes?

I think this would be trickier than expected.  
If you create an HTML table in your post, and someone quotes your table, it’s converted into Markdown which doesn’t support `rowspan` and `colspan`.

I suspect there would be other issues I didn’t think about.

> [@jlc](#):
>
> Could we allow `data-*` attributes on table elements? I think this would be very useful for specifying different types of table contents, in particular to use as hooks for custom CSS.

It’s not exactly the same, but you can wrap your table with `[wrap]` tags 🙂  
See: [Customize posts' contents with your own styles](https://meta.discourse.org/t/customize-posts-contents-with-your-own-styles/257738)  
But you won’t be able to have `data-` attributes _inside_ an HTML table (for example, to customize specific rows or cells).

edit: if your table uses Markdown instead of HTML, you can insert spans with `data-` attributes like this:

```plaintext
|Column 1 | Column 2|
|--- | ---|
|<span data-thing>test</span> | test|
|test | test|

```

But they will be removed if someone quotes or copy-paste your table.

---

<div class="post-metadata">

### Author: ![rahim123](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@rahim123](https://meta.discourse.org/u/rahim123)
#### Post date: [June 11, 2023, 5:33pm UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348/12 "2023-06-11T17:33:31Z")

</div>

It would be really helpful if some simple and safe inline CSS styles were obeyed in raw HTML added to Discourse posts. There could be converted HTML posts from a previous forum engine and/or users sometimes paste in rich text with things like text and/or image alignment.

The following works as expected:

* * *

```plaintext
<div align="center">
<p>Test</p>
</div>

```

Test

But this doesn’t:

* * *

`<p style="text-align: center;">Test</p>`

Test

* * *

The same goes for inline `<span style="color: ...` formatting.

There’s more likely to be inline styles like that in converted / pasted content from other WYSIWYG editors.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [June 12, 2023, 4:23pm UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348/13 "2023-06-12T16:23:23Z")

</div>

The `style` attribute isn’t allowed in Discourse because it could easily break things.

Also, Discourse has a certain philosophy on how information show be presented in posts, and limits tags and attributes on purpose.

The `align` attribute on `<div>` is explicitly allowed here: [https://github.com/discourse/discourse/blob/main/app/assets/javascripts/pretty-text/addon/allow-lister.js#LL147C2-L147C16](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/pretty-text/addon/allow-lister.js#LL147C2-L147C16)

If you were to migrate a forum and wanted to keep some special styling like colors, I’d go with [Discourse BBCode](https://meta.discourse.org/t/discourse-bbcode/65425) and edit the importer if needed 🙂

---

<div class="post-metadata">

### Author: ![one1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/one1/32/493591_2.png) [@one1](https://meta.discourse.org/u/one1)
#### Post date: [April 9, 2025, 10:47pm UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348/15 "2025-04-09T22:47:58Z")

</div>

Is there a reason why the `>` blockquote markup is not included in the Markdown section? This is by far, in my experience, the most common thing people aren’t using when they should.

I know you can’t list everything, but in forums where people are often quoting other sources this is essential.

---

<div class="post-metadata">

### Author: ![roke\_julian\_lockhart](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roke_julian_lockhart/32/540179_2.png) [@roke\_julian\_lockhart](https://meta.discourse.org/u/roke_julian_lockhart)
#### Post date: [April 10, 2025, 10:29am UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348/16 "2025-04-10T10:29:07Z")

</div>

@one1, it should be discouraged for intra-forum quotation. Its replacement there is `[quote]`. Otherwise, I agree.

---

<div class="post-metadata">

### Author: ![one1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/one1/32/493591_2.png) [@one1](https://meta.discourse.org/u/one1)
#### Post date: [April 10, 2025, 6:05pm UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348/17 "2025-04-10T18:05:45Z")

</div>

I was talking about quoting from academic papers.

---

<div class="post-metadata">

### Author: ![Paige\_Nicole](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paige_nicole/32/500092_2.png) [@Paige\_Nicole](https://meta.discourse.org/u/Paige_Nicole)
#### Post date: [April 22, 2025, 8:49pm UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348/18 "2025-04-22T20:49:54Z")

</div>

This is super helpful! Thank you so much! 😀

---

<div class="post-metadata">

### Author: ![willemb2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/willemb2/32/91608_2.png) [@willemb2](https://meta.discourse.org/u/willemb2)
#### Post date: [January 26, 2026, 6:34pm UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348/19 "2026-01-26T18:34:51Z")

</div>

> [@Discourse](#):
>
> For a detailed list of allowed HTML tags and attributes, refer to [Discourse’s allow-list](https://github.com/discourse/discourse/blob/main/frontend/pretty-text/addon/allow-lister.js#L115).

That link is broken.

---

<div class="post-metadata">

### Author: ![renato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renato/32/383632_2.png) [@renato](https://meta.discourse.org/u/renato)
#### Post date: [January 26, 2026, 6:47pm UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348/20 "2026-01-26T18:47:37Z")

</div>

Thank you! It should be fixed now.

---

<div class="post-metadata">

### Author: ![ToddZ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/toddz/32/328350_2.png) [@ToddZ](https://meta.discourse.org/u/ToddZ)
#### Post date: [February 26, 2026, 7:28am UTC](https://meta.discourse.org/t/formatting-posts-using-markdown-bbcode-and-html/239348/21 "2026-02-26T07:28:22Z")

</div>

8 posts were split to a new topic: [Use of H1 vs. H2 headings in composer](https://meta.discourse.org/t/use-of-h1-vs-h2-headings-in-composer/397100)
