Formatting posts using markdown, BBCode, and HTML

:bookmark: 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.

:person_raising_hand: 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 for its markdown implementation.

Some commonly used markdown features include:

  • Bold: **text**

  • Italic: *text*

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

  • Inline code: `code`

  • Highlight: <mark></mark>

  • Blockquote: > quoted text

  • Code block:

    ```
    code block
    ```
    

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

# Heading 1
## Heading 2
### Heading 3

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

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

For a full list of markdown features, please refer to the interactive guide.

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
[quote="user"]quoted text[/quote]

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

spoiled text

[spoiler]spoiled text[/spoiler]
details="click to expand"\]hidden text\[/details
[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.

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.

:information_source: Note: Inline styles, like <span style="color:red">colored text</span>, are not supported. For custom styles, see customize post contents.

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.

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 for more information.

Additional resources

Last edited by @renato 2026-01-26T18:46:43Z

Check documentPerform check on document:
32개의 좋아요

이 참조 자료 중 어느 것도 테이블을 언급하지 않습니다.

2개의 좋아요

맞습니다. 하지만 이 다른 주제는 해당됩니다. Adding a table to your post using markdown

3개의 좋아요

텍스트 색과 텍스트 배경색이 <span>이나 bbcode와 함께 작동하지 않는 것 같습니다. 제가 놓친 부분이 있나요?

  • <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]
2개의 좋아요

네, HTML 인라인 스타일은 지원되지 않는 것 같습니다

다음 가이드를 참고해 보세요:

(여기서 작동하는 모습을 볼 수 있습니다: 📜 [Wiki] Schlumpf hub serial numbers reference - Unicycles and Equipment - Unicyclist.com)

또는 BBcode 지원을 확장하는 이 플러그인을 사용하세요:

허용되는 HTML 태그에 대해서는 이 레퍼런스가 맞을 것 같습니다:
https://github.com/discourse/discourse/blob/main/app/assets/javascripts/pretty-text/addon/allow-lister.js#L115

하지만 왜인지 허용되는 테이블 HTML 태그를 그 안에서 찾지 못했습니다.

아마도 여기에서 참조되고 있기 때문일 것입니다:

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

5개의 좋아요

유용한 참고 자료를 제공해 주셔서 정말 감사합니다!

1개의 좋아요

현재 필터는 td와 th 요소의 rowspan 및 colspan 속성이 제거되도록 설정된 것으로 보입니다. 이 속성들은 안전하며(매우 유용하다고 생각합니다): 팀이 이 속성들을 허용하는 데 열려 있을까요?

부연 설명으로, @Canapin이 table 태그 허용 목록의 위치에 대해 언급했습니다.

그러나 .../discourse-markdown/table.js 파일은 특정 마크다운 테이블에 대한 구현인 것 같습니다. 일반 HTML 테이블의 경우 allowList에 별도의 확장 기능이 필요할까요?

rowspan과 colspan은 꽤 안전하다고 생각하지만, 다른 마크업 한 가지를 더 요청하고 싶습니다. 테이블 요소에 data-* 속성을 허용할 수 있을까요? 이는 테이블 콘텐츠의 다양한 유형을 지정하는 데 매우 유용할 것 같으며, 특히 커스텀 CSS를 위한 후크로 사용할 수 있을 것입니다.

1개의 좋아요

안녕하세요 :slight_smile:

기대보다 더 까다로운 문제가 될 것 같습니다.
게시물에 HTML 테이블을 생성하고 누군가 그 테이블을 인용(quote)하면, rowspan과 colspan을 지원하지 않는 Markdown으로 변환됩니다.

아직 생각하지 못한 다른 문제들도 있을 것 같습니다.

정확히 동일한 방식은 아니지만, [wrap] 태그로 테이블을 감싸는 방법이 있습니다 :slight_smile:
참고: Customize posts' contents with your own styles
하지만 HTML 테이블 안쪽에 data- 속성을 사용할 수는 없습니다(예: 특정 행이나 셀을 커스터마이즈하는 경우).

수정: 만약 HTML 대신 Markdown을 사용하여 테이블을 만들었다면, 다음과 같이 data- 속성을 가진 span을 삽입할 수 있습니다:

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

하지만 누군가 테이블을 인용하거나 복사-붙여넣기하면 이 속성들은 제거됩니다.

1개의 좋아요

Discourse 게시물에 추가된 원시 HTML에서 몇 가지 단순하고 안전한 인라인 CSS 스타일이 적용된다면 정말 유용할 것입니다. 이전 포럼 엔진에서 변환된 HTML 게시물이 있거나, 사용자가 텍스트 및/또는 이미지 정렬과 같은 리치 텍스트를 붙여넣는 경우가 있기 때문입니다.

다음은 예상대로 작동합니다:


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

Test

하지만 이것은 작동하지 않습니다:


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

Test


인라인 <span style="color: ... 포맷팅도 마찬가지입니다.

다른 WYSIWYG 편집기에서 변환하거나 붙여넣은 콘텐츠에는 그런 종류의 인라인 스타일이 더 자주 나타날 가능성이 높습니다.

style 속성은 Discourse에서 허용되지 않습니다. 쉽게 문제를 일으킬 수 있기 때문입니다.

또한 Discourse는 게시물에 정보를 어떻게 표시해야 하는지에 대해 특정한 철학을 가지고 있으며, 태그와 속성을 의도적으로 제한하고 있습니다.

<div>의 align 속성은 여기에서 명시적으로 허용됩니다: https://github.com/discourse/discourse/blob/main/app/assets/javascripts/pretty-text/addon/allow-lister.js#LL147C2-L147C16

포럼을 이전하면서 색상과 같은 특수 스타일링을 유지하고 싶다면 Discourse BBCode 을 사용하고, 필요시 가져오기(importer)를 수정하는 것이 좋습니다 :slight_smile:

3개의 좋아요

> 인용구(markup)가 마크다운 섹션에 포함되어 있지 않은 이유가 있을까요? 제 경험상, 사람들이 마크다운을 사용할 때 가장 많이 놓치는 것이 바로 이것입니다.

모든 것을 나열할 수는 없다는 것을 알지만, 다른 출처를 인용하는 경우가 많은 포럼에서는 이 기능이 필수적입니다.

@one1님, 포럼 내부 인용에서는 사용을 지양해야 합니다. 해당 용도에는 [quote]를 대체로 사용합니다. 그 외에는 동의합니다.

저는 학술 논문에서 인용하는 것에 대해 이야기하고 있었습니다.

정말 큰 도움이 됩니다! 정말 감사합니다! :grinning_face:

그 링크가 깨져 있습니다.

2개의 좋아요

감사합니다! 이제 수정되었을 것입니다.

1개의 좋아요

8개의 게시글이 새로운 주제(컴포저에서 H1과 H2 제목의 사용)으로 분리되었습니다.