-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc1b072
commit 9372327
Showing
7 changed files
with
145 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from django import template | ||
from django.utils.safestring import mark_safe | ||
|
||
from ..utils import markdownify | ||
|
||
register = template.Library() | ||
|
||
|
||
@register.filter | ||
def safe_markdown(field_name): | ||
""" | ||
Safe the markdown text as html ouput. | ||
Usage: | ||
{% load dractags %} | ||
{{ field_name|safe_markdown }} | ||
Example: | ||
{{ post.description|safe_markdown }} | ||
""" | ||
return mark_safe(markdownify(field_name)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{% load staticfiles %} | ||
{% load dractags %} | ||
<!DOCTYPE html> | ||
<html lang="en-us"> | ||
<head> | ||
<title>Test Markdonify :: DracEditor</title> | ||
<link href="{% static 'plugins/css/ace.min.css' %}" type="text/css" media="all" rel="stylesheet" /> | ||
<link href="{% static 'plugins/css/semantic.min.css' %}" type="text/css" media="all" rel="stylesheet" /> | ||
<style> | ||
.main-container {margin-top: 7em} | ||
</style> | ||
|
||
<script type="text/javascript" src="{% static 'plugins/js/jquery.min.js' %}"></script> | ||
</head> | ||
<body> | ||
<header> | ||
<div class="ui fixed inverted menu"> | ||
<div class="ui container"> | ||
<div class="header item">DracEditor</div> | ||
<a class="item" href="https://github.com/agusmakmun/dracos-markdown-editor" target="_blank"> | ||
<i class="github icon"></i> Github | ||
</a> | ||
<a class="item" href="https://dracos-linux.org"><i class="spy icon"></i> Dracos Linux</a> | ||
<div class="ui dropdown item" tabindex="0">Choice Demo | ||
<i class="dropdown icon"></i> | ||
<div class="menu transition hidden" tabindex="-1"> | ||
<a href="{% url 'simple_form' %}" class="item">Simple Form</a> | ||
<a href="{% url 'post_form' %}" class="item">Post Form (login require)</a> | ||
<a href="{% url 'test_markdownify' %}" class="item">Test Markdownify</a> | ||
</div> | ||
</div> | ||
<div class="right menu"> | ||
<div class="item"> | ||
<div class="ui transparent inverted icon input"> | ||
<i class="search icon"></i> | ||
<input type="text" placeholder="Search"> | ||
</div> | ||
</div> | ||
<a class="item">Link</a> | ||
</div> | ||
</div> | ||
</div> | ||
</header> | ||
|
||
<div class="ui container main-container"> | ||
<div class="ui segment"> | ||
<h1>Title: {{ post.title }}</h1> | ||
<p><b>Description:</b></p> | ||
<hr /> | ||
{{ post.description|safe_markdown }} | ||
</div> | ||
</div> | ||
|
||
<script type="text/javascript" src="{% static 'plugins/js/semantic.min.js' %}"></script> | ||
<script type="text/javascript" src="{% static 'plugins/js/highlight.min.js' %}"></script> | ||
<script> | ||
$('pre').each(function(i, block){ | ||
hljs.highlightBlock(block); | ||
}); | ||
$('.ui.dropdown').dropdown(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
from django.conf.urls import url | ||
|
||
from app.views import (simple_form_view, post_form_view) | ||
from app.views import ( | ||
simple_form_view, | ||
post_form_view, | ||
test_markdownify | ||
) | ||
|
||
urlpatterns = [ | ||
url(r'^simple-form/$', simple_form_view, name='simple_form'), | ||
|
||
# require to logged in | ||
url(r'^post-form/$', post_form_view, name='post_form'), | ||
|
||
# test markdownify | ||
url(r'^test-markdownify/$', test_markdownify, name='test_markdownify'), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters