[](https://pypi.python.org/pypi/django-markdownx/) [](https://pypi.python.org/pypi/django-markdownx/) [](https://pypi.python.org/pypi/django-markdownx/) # django-markdownx Django Markdownx is a markdown editor built for Django. It is simply an extension of the Django's Textarea widget made for editing Markdown with a live preview. It also supports uploading images with drag&drop functionality and auto tag insertion. Example (side-by-side editor and preview using Bootstrap's grid system):  ## Quick Start 1. Install *django-markdownx* package ```python pip install django-markdownx ``` 1. Add *markdownx* to your *INSTALLED_APPS* ```python #settings.py INSTALLED_APPS = ( [...] 'markdownx', ``` 1. Add *url* pattern to your *urls.py* ```python #urls.py urlpatterns = [ [...] url(r'^markdownx/', include('markdownx.urls')), ] ``` 1. Use *MarkdownxInput* widget in your *forms.py* ```python #forms.py from django import forms from markdownx.widgets import MarkdownxInput class MyForm(forms.ModelForm): content = forms.CharField(widget=MarkdownxInput) ``` 1. Use `manage.py collectstatic` to copy inlcuded `markdownx.js` to your `STATIC_ROOT` folder. 1. Include the form's required media in the template using `{{ form.media }}` ```html
{{ form.media }} ``` 1. Include *[jQuery](http://jquery.com)* ```html [...] ``` # Settings Place settings in your *settings.py* to override default values: ```python #settings.py MARKDOWNX_MARKDOWN_KWARGS = dict() MARKDOWNX_MEDIA_PATH = 'markdownx/' # subdirectory, where images will be stored in MEDIA_ROOT folder MARKDOWNX_MAX_UPLOAD_SIZE = 52428800 # 50MB MARKDOWNX_CONTENT_TYPES = ['image/jpeg', 'image/png'] MARKDOWNX_IMAGE_SIZE = {'size': (500, 500), 'quality': 90,} ``` *MARKDOWNX_IMAGE_SIZE* dict properties: * **size** – (width, height). When `0` used, i.e.: (500,0), property will figure out proper height by itself * **quality** – default: `None` – image quality, from `0` (full compression) to `100` (no compression) * **crop** – default: `False` – if `True` use `size` to crop final image * **upscale** – default: `False` – if image dimensions are smaller than those in `size`, upscale image to `size` dimensions # Template Default template looks like: ```html