# API for preview

**URL:** https://meta.discourse.org/t/api-for-preview/129866
**Category:** Development
**Tags:** rest-api
**Created:** [September 30, 2019, 3:12pm UTC](https://meta.discourse.org/t/api-for-preview/129866 "2019-09-30T15:12:19Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![joa](https://avatars.discourse-cdn.com/v4/letter/j/dec6dc/32.png) [@joa](https://meta.discourse.org/u/joa)
#### Post date: [September 30, 2019, 3:12pm UTC](https://meta.discourse.org/t/api-for-preview/129866/1 "2019-09-30T15:12:19Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [October 1, 2019, 7:26am UTC](https://meta.discourse.org/t/api-for-preview/129866/4 "2019-10-01T07:26:50Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [May 29, 2023, 9:09am UTC](https://meta.discourse.org/t/api-for-preview/129866/5 "2023-05-29T09:09:55Z")

</div>



---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [May 29, 2023, 9:39am UTC](https://meta.discourse.org/t/api-for-preview/129866/6 "2023-05-29T09:39:34Z")

</div>


