API for preview

I was playing around with a native client for Discourse using the JSON API.

Most things like posting, loading posts, etc. seems to be possible. One thing I’m struggling with matching from the web is the preview. I could of course try to process the Markdown the user entered with one of the many Markdown libs out there to get HTML, but I’d like to make sure the preview is using the same logic Discourse is using.

Is there an endpoint to get something like an HTML preview (ideally with CSS) upon submitting raw text the user wrote but without actually posting it?

You would need to write a plugin for that, we don’t have an endpoint that does the equivalent of an MD preview.

Preview code all runs client side as @riking mentions.