It is possible to uses some HTML classes in Discourse, however, most HTML in a post is sanitized for security reasons, and only very strict whitelisted HTML is allowed in markdown. To add classes to the white-list you must use a plugin, the sanitization happens server side as well as client side. Check out
Whitelisting HTML tags / attributes for some details on where to add the whitelisted attributes, and I believe it would look similar to something like this: Discourse HTML Whitelist. and as @RGJ has mentioned, please note that the whiteList()
function is deprecated and it is called allowList()
nowadays.
Regarding other ways that you could customize content, posts are widgets, and Discourse themes have the ability to decorate widgets so you could leverage on that.
I hope this helps!