Comments (7)
@will-emmerson You can install the django-markdown-deux package, add 'markdown_deux' to INSTALLED_APPS and put {% load markdown_deux_tags %} in the head of your template.
You can then apply the markdown-filter on the variable that holds the markdown-content.
Heres an example:
{% extends 'base.html' %}
{% load markdown_deux_tags %}
{% block content %}
<div class="blog-post">
<h2 class="blog-post-title">{{ entry.title }}</h2>
<p class="blog-post-meta">{{ entry.created }} by {{ entry.author.first_name }}</p>
{{ entry.body|markdown }}
</div>
{% if user.is_superuser %}
<a href="{% url 'entry_update' slug=entry.slug %}" role="button" class="btn btn-primary"> Edit</a>
{% endif %}
{% endblock %
from django-pagedown.
I've added a section at the bottom of the README addressing this, so hopefully it is clearer now:
from django-pagedown.
I presume you mean you don't want to see the preview when writing your markdown in the django admin or elsewhere? You could simply hide the preview via css:
.wmd-preview{
display: none;
}
but there is no built in way to ommit the preview div
from django-pagedown.
No, I want to see the preview in the admin and allow editing via the admin, but on other pages I just want the rendered html without the preview. Django 1.5 had a markdown template tag but 1.6 doesn't, I'm just wondering if pagedown includes any.
from django-pagedown.
I will add this to the README
from django-pagedown.
There is a difference between the django-pagedown preview and the html generated by the django-markdown-deux. Specifically the preview from pagedown shows line breaks when I press enter, but when I render it using the deux tag, the line breaks are gone. BUT, it I put two line breaks, then deux DOES puts
tags.
I am not sure if its a bug in pagedown, or its just the fact that I am silly!
from django-pagedown.
@hitarths that's interesting, I haven't noticed that before. The django-markdown-deux
library uses python-markdown2
behind the scenes. python-markdown2
allows configuration via "Extras". I notice a break-on-newline
option there. Something like this might work (I haven't tested it though):
MARKDOWN_DEUX_STYLES = {
"default": {
"extras": {
"break-on-newline": None,
},
# ...
},
}
from django-pagedown.
Related Issues (20)
- 'default_app_config' is deprecated in Django 3.2.X HOT 2
- I get a: ModuleNotFoundError: No module named 'pagedown.urls' HOT 2
- Can you add a feature so LaTeX/MathJax renders in the preview? HOT 1
- Accidentally double-tapping the "save" button when adding an image
- Not compatible with dark mode introduced in Django 3.2
- Write some tests
- Needed JS? HOT 1
- Does this support Python 3? HOT 2
- pip install django-pagedown not working fine. HOT 4
- Widget doesn't work on forms that are part of formsets HOT 2
- Django admin page raise TypeError HOT 1
- content = forms.TextField(widget=PagedownWidget()) Doesn't work on Djnago 2.0 HOT 7
- Space before URL results in malformed URL in markdown HOT 4
- Django 2.2 requires jquery to be set as dependency HOT 1
- Add to Django Packages -> Markdown Category HOT 1
- Customise form site attributes doesn't seem to work HOT 2
- Where do you put the widget customization? HOT 1
- Collectstatic pulling in demo project css HOT 2
- Collect Static does not collect pagedown.css HOT 4
- Mobile display issue HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-pagedown.