From 11b66eb19dadbf060c0acf451f9159f6b0a8e3b3 Mon Sep 17 00:00:00 2001 From: Timmy O'Mahony Date: Sat, 23 May 2020 22:46:29 +0100 Subject: [PATCH] Updated readme --- README.md | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index d770a49..a50966f 100644 --- a/README.md +++ b/README.md @@ -41,9 +41,9 @@ If you want to use the pagedown editor in a django admin field, there are numero ```python from django import forms - + from pagedown.widgets import AdminPagedownWidget - + from music.models import Album class AlbumForm(forms.ModelForm): @@ -59,7 +59,7 @@ If you want to use the pagedown editor in a django admin field, there are numero ```python from django.contrib import admin - + from forms import FooModelForm from models import FooModel @@ -136,16 +136,17 @@ class MyNewWidget(PagedownWidget): js = ('custom/javascript.js',) ``` + ## Rendering Markdown -`contrib.markdown` was [deprecated in Django 1.5](https://code.djangoproject.com/ticket/18054) meaning you can no longer use the `markdown` filter in your template by default. +`contrib.markdown` was [deprecated in Django 1.5](https://code.djangoproject.com/ticket/18054) meaning you can no longer use the `markdown` filter in your template by default. -[@wkcd has a good example](https://github.com/timmyomahony/django-pagedown/issues/18#issuecomment-37535535) of how to overcome by installing `django-markdown-deux`: +[@wkcd has a good example](https://github.com/timmyomahony/django-pagedown/issues/18#issuecomment-37535535) of how to overcome by installing `django-markdown-deux`: -``` +```py {% extends 'base.html' %} {% load markdown_deux_tags %} - + ...

{{ entry.body|markdown }}

... @@ -164,11 +165,11 @@ To do so: 3. Include the pagedown paths in your `urls.py` so that the upload endpoint is available ```py - # ... - urlpatterns = [ - path('', include('pagedown.urls')), - # ... - ] + # ... + urlpatterns = [ + path('', include('pagedown.urls')), + # ... + ] ``` This will add the URL `/pagedown/image-upload/` endpoint to your project. You can [see the default view that handles the upload here](https://github.com/timmyomahony/django-pagedown/blob/develop/pagedown/views.py)