What markdown parser Discourse is using?

AI-generated summary

In the Dev category, thangngoc89 seeks a JavaScript markdown parser compatible with Discourse for a static site generator portal. fantasticfears suggests using Markdown.js, noting it will likely be replaced by markdown-it in the next release. thangngoc89 acknowledges the tip. The discussion then shifts to retrieving the cooked HTML version of a post directly via the API. erkist explains that requesting /p/{id} redirects to the topic, where the cooked field contains the rendered HTML. thangngoc89 finds this method too data-heavy for their current server constraints. Finally, thangngoc89 shares a configuration snippet to make the remark parser behave like markdown.js.

I’m building a portal page for our community by using Statinamic (a static site generator) which will pull data from Discourse API and rebuild everyday.

But I can’t find a compatible Javascript markdown parser for Discourse so any pointers would be appreciated.

By the way, the portal is open source under MIT License. If anyone interested, please take a look at:

Markdown.js

Most likely, it will be replaced by markdown-it for the next release.

Thanks. I’ll take a look.

Do you happen to know how to get cooked version of post from post id ?

After a while, I think it’s much simpler if I just get the cooked HTML instead of convert markdown from raw content.

Probably not the best way, one way to do it would be to issue a request to /p/{id} which will respond with a 302 pointing to the topic containing said post. Issuing a request there will then give you a cooked version of the response in post_stream>posts>cooked

Thanks :slight_smile: . But it looks like that endpoint contains too many information. I’ll find another way (our server is not in a good shape)

Well. This is configuration to make remark markdown to act the same as markdown.js