# Markdown Editor for Django

**URL:** <https://forum.djangoproject.com/t/markdown-editor-for-django/423>\
**Category:** Using Django\
**Created:** [October 26, 2019, 5:02pm UTC](https://forum.djangoproject.com/t/markdown-editor-for-django/423 "2019-10-26T17:02:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![conor](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/conor/32/3736_2.png) [@conor](https://forum.djangoproject.com/u/conor)\
**Post date:** [October 26, 2019, 5:02pm UTC](https://forum.djangoproject.com/t/markdown-editor-for-django/423/1 "2019-10-26T17:02:06Z")

</div>

Hi All,

I’ve been using Martor ([https://github.com/agusmakmun/django-markdown-editor](https://github.com/agusmakmun/django-markdown-editor)) as a markdown editor in my Django blog project. It’s not too bad, but I suspect there might be better ways to write markdown in a Django powered blog.

So my question is what do you use in your own projects for writing markdown in a Django application? Or perhaps you have a different way of writing and inputting markdown into your Django application?

Cheers,

C

---

<div class="post-metadata">

**Author:** ![rixx](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/rixx/32/29_2.png) [@rixx](https://forum.djangoproject.com/u/rixx)\
**Post date:** [November 5, 2019, 10:06am UTC](https://forum.djangoproject.com/t/markdown-editor-for-django/423/2 "2019-11-05T10:06:26Z")

</div>

It really depends on your needs – I usually use the Python [markdown](https://pypi.org/project/Markdown/) with [bleach](https://github.com/mozilla/bleach) for sanitising the input to a list of restricted allowed tags. I combine those two into a template tag – shout-out to the pretix project, where I saw the practice first. You can see it [here](https://github.com/pretix/pretix/blob/eeedd9a9c23b62685c2ce63de05d017563b87714/src/pretix/base/templatetags/rich_text.py#L114).

---

<div class="post-metadata">

**Author:** ![conor](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/conor/32/3736_2.png) [@conor](https://forum.djangoproject.com/u/conor)\
**Post date:** [November 5, 2019, 7:02pm UTC](https://forum.djangoproject.com/t/markdown-editor-for-django/423/3 "2019-11-05T19:02:04Z")

</div>

Cheers Rixx. Bleach looks very interesting and is something that I’ll check out.

What I’m really on the lookout for at this stage though is a nice editor for me to write my posts and articles in. Lot’s of sites have them, for example, Confluence and Jira, Stackoverflow, this site, but I can’t seem to find a highly recommend one that plugs into Django. I’m quite surprised by this, as I thought such a tool would be very popular. Of course, I could be missing something obvious.

Which workflow do you have for actually inputting the markdown into Django? Are you using the standard editor/textfield that comes with Django?

Cheers,

C

---

<div class="post-metadata">

**Author:** ![rixx](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/rixx/32/29_2.png) [@rixx](https://forum.djangoproject.com/u/rixx)\
**Post date:** [November 5, 2019, 7:48pm UTC](https://forum.djangoproject.com/t/markdown-editor-for-django/423/4 "2019-11-05T19:48:17Z")

</div>

I combine the rendering done by bleach and markdown on finished texts with a simple side-by-side markdown editor. I built that one using JavaScript alone, so I had no need of any Django integration (and I’m not quite sure what such an integration would gain). I’m using [marked.js](https://marked.js.org/#/README.md#README.md) because it is small and standalone, but there are really a lot of options out there. You just tie an event listener to the input field, and render its contents to the output element.

---

<div class="post-metadata">

**Author:** ![conor](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/conor/32/3736_2.png) [@conor](https://forum.djangoproject.com/u/conor)\
**Post date:** [November 5, 2019, 8:20pm UTC](https://forum.djangoproject.com/t/markdown-editor-for-django/423/5 "2019-11-05T20:20:36Z")

</div>

Cheers! I’ll give something like that a go. Thanks for the tips.

Cheers,

C

---

<div class="post-metadata">

**Author:** ![mwb](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/mwb/32/1487_2.png) [@mwb](https://forum.djangoproject.com/u/mwb)\
**Post date:** [November 4, 2020, 7:17pm UTC](https://forum.djangoproject.com/t/markdown-editor-for-django/423/6 "2020-11-04T19:17:30Z")

</div>

I think [https://github.com/timmyomahony/django-pagedown](https://github.com/timmyomahony/django-pagedown) looks slick, I’m using [https://github.com/neutronX/django-markdownx](https://github.com/neutronX/django-markdownx) right now but it does not have a ‘ui’, its just a textarea where you can type markdown with a live preview.

I know me typing this will bump up the post, but I think django-pagedown looks like a ‘proper’ markdown editor, and it was not mentioned before, and I think if you’d be in the market for such an editor you might want to find out about it.

Happy to hear any experiences with django-pagedown!

---

<div class="post-metadata">

**Author:** ![weebkid](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/weebkid/32/22657_2.png) [@weebkid](https://forum.djangoproject.com/u/weebkid)\
**Post date:** [July 17, 2024, 6:30am UTC](https://forum.djangoproject.com/t/markdown-editor-for-django/423/7 "2024-07-17T06:30:59Z")

</div>

> shout-out to the pretix project, where I saw the practice first. You can see it **here**.

Hey, rixx!

Just touching on this, but the usage of this in pretix project is really neat. Unfortunately in Django 5.0, _django.utils.http.is\_safe\_url_ seems to have been [deprecated](https://docs.djangoproject.com/en/5.0/_modules/django/utils/http/).

The tag still works fine regardless, once you remove certain parts of it.

unsure: I think _django.utils.http.url\_has\_allowed\_host\_and\_scheme_ could possibly work in its place, but I’m a bit too unskilled to make that work.

Cheers!

 ![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/3X/5/e/5eea13c7097b3bc2292f99e8813ed8f28d9f0008.png)  
A screenshot taken from my site. It works, but the styling can be a bit wonky. This might be able to be fixed with extensions to [markdown](https://python-markdown.github.io/reference/).
