Discourse is migrating to CommonMark!

Discourse (the forum software that powers this forum) is migrating to CommonMark.

More details are here:

I expect it to take a few months for the move, but as soon as I feel it is ready I will enable the new engine here!

14 Likes

It is now checked in and we will be testing it extensively next week

I went ahead and enabled CommonMark here :confetti_ball: :dancer: :space_invader:

We are using https://github.com/markdown-it/markdown-it and a series of plugins that enable all the obscure Discourse features.

Huge thank you to @rlidwka and @vitaly for making such a pluggable and easy to work with CommonMark engine.

Huge thank you to @jgm for driving the CommonMark :bus: and getting us to this day!

1 Like

@codinghorror, we need to push forward question about quotes markup and metadata. Current format in discourse can deviate from spec. That’s not good or bad, because discourse need working code “right now”. But it would be nice to stabilize this and avoid “one more standard”.

What do you mean? It’s straight BBCode so it should not matter…

[quote="vitaly, post:4, topic:2476"]
quotes markup
[/quote]

That’s an imitation. https://github.com/markdown-it/markdown-it-container - with very specific opening and closing tags.

For example, this one will not be rendered as quote:

[quote="vitaly, post:4, topic:2476"]
quotes markup
[/quote] foo bar

It’s impossible to mix bbcode blocks with markdown without side effect. Because of incompatible syntax approaches.

AFAIK, all possible bbcodes were dropped, except some without correct alternatives.

Absolutely correct! But I think we can accept the very strong limitations, and split into 2 implementations, block bbcode and inline bbcode. Never mix-and-match. For block form.

  • No, non-white space chars after ]
  • [ is the first char in the line.

It gives us a “safe”, “limited” syntax that seems to fill our current gap at Discourse. However I also completely agree it does not really look like Markdown at all and it would have been better to have a more “markdownish” way of solving this.

1 Like

I think if one sort the rest of bbcodes by usage, it will be clear that quotes at forum are in top, with big gap to the rest.

That’s the reason why it’s important to do something with quotes. Everything else is much more rare and can be postponed.

Could BBCode in Discourse follow the same rules as raw HTML in CommonMark? It seems that they are similar in a lot of ways.

I don’t really see why, I am very much against supporting stuff like

test [b] test

test
[/b]

Whereas

test <b> test

test
</b>

test test

test

Is allowed and finally cleaned up by our sanitizer/html parser.

Even though HTML allows this weird mixing I do not see the value in allowing it for bbcode, the markup is way less readable for almost no reason.

Pick inline or pick block … you can not pick both.

It allows writers to be sloppy, which was one of the reasons for the raw HTML rules I believe (along with other “lazy” aspects of Markdown). In practice writers can be quite chaotic in their markup.