.. _simpleisbetterthancomplex_markdown: ================================================================================================ a-complete-beginners-guide-to-django-part-6.html#adding-markdown By Vitor Freitas ================================================================================================ .. seealso:: - https://simpleisbetterthancomplex.com/series/2017/10/09/a-complete-beginners-guide-to-django-part-6.html#adding-markdown - https://twitter.com/vitorfs .. contents:: :depth: 3 Adding Markdown ================== Let’s improve the user experience by adding Markdown to our text areas. You will see it’s very easy and simple. First, let’s install a library called Python-Markdown:: pip install markdown We can add a new method to the Post model:: boards/models.py (view complete file contents) from django.db import models from django.utils.html import mark_safe from markdown import markdown class Post(models.Model): # ... def get_message_as_markdown(self): return mark_safe(markdown(self.message, safe_mode='escape'))