Post format reference documentation


(Dan Fabulich) #1

Is there any documentation on the official reference format Discourse uses for formatting posts?

Use Markdown or BBCode to format.

I know there’s no official Markdown spec, and the BBCode.org reference documentation leaves much to be desired.

Is there, at least, a list of BBCode tags Discourse supports? (For example, BBCode.org doesn’t document the very useful [spoiler] tag.)


(Jeff Atwood) #2

There’s three things to consider.

  1. What Markdown is allowed?
  2. What BBCode is allowed?
  3. What HTML is allowed?

All 3 can be mixed and merged to some extent.

Markdown

Simple: the Markdown implementation is very close to the standard.

http://commonmark.org/help

BBCode

We support a subset of “common” BBCode.

As for what BBCode is supported, the best place to look is the tests (tests\javascripts\lib\bbcode-test.js.es6), and here’s what I see there:

[b]strong[/b]
[i]emphasis[/i]
[u]underlined[/u]
[s]strikethrough[/s]
[ul][li]option one[/li][/ul]

[quote="eviltrout"][/quote]

[img]http://eviltrout.com/eviltrout.png[/img]
[url]http://bettercallsaul.com[/url]
[email]eviltrout@mailinator.com[/email]
[code]\nx++\n[/code]

Custom BBCode specific to Discourse, needed for functions that don’t fit into Markdown, but do fit into BBCode.

[spoiler]it's a sled[/spoiler]
[quote="eviltrout, post:1, topic:2"]

HTML

Markdown specifies that it works seamlessly with HTML, so we do.

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.


Supported BBCode?
Import script (phpbb)
(Dan Fabulich) #3

Awesome, that’s a huge help. It’d be nice to have an /editing-help page like that on all Discourse instances.

I’d also point out that StackExchange has a “>!” style for spoilers, which Discourse does not support.


(Jeff Atwood) #4

I moved 8 posts to a new topic: How do I select a language in code blocks?


(Jeff Atwood) #5

Where should we link this help page from? The toolbar in the editor?

At Stack Exchange I found very, very few users could find a help button in the toolbar. I wonder if we should instead show more / better edit default text tips in the editor area for new users with a prominent BUTTON to link to more help. That might be better.