@@ -172,11 +172,11 @@ to get ``IMGUR_CLIENT_ID`` and ``IMGUR_API_KEY``.
172172 MARTOR_MARKDOWN_BASE_EMOJI_URL = 'https://github.githubassets.com/images/icons/emoji/' # default from github
173173 MARTOR_MARKDOWN_BASE_MENTION_URL = 'https://python.web.id/author/' # please change this to your domain
174174
175- # If you need to use your own themed semantic ui dependency
175+ # If you need to use your own themed "bootstrap" or " semantic ui" dependency
176176 # replace the values with the file in your static files dir
177177 MARTOR_ALTERNATIVE_JS_FILE_THEME = "semantic-themed/semantic.min.js" # default None
178178 MARTOR_ALTERNATIVE_CSS_FILE_THEME = "semantic-themed/semantic.min.css" # default None
179- MARTOR_ALTERNATIVE_JQUERY_JS_FILE = "jquery/dist/jquery.js" # default None
179+ MARTOR_ALTERNATIVE_JQUERY_JS_FILE = "jquery/dist/jquery.min. js" # default None
180180
181181Check this setting is not set else csrf will not be sent over ajax calls:
182182
@@ -229,7 +229,7 @@ Usage
229229 admin.site.register(YourModel, YourModelAdmin)
230230
231231
232- **Template **
232+ **Template Renderer **
233233
234234Simply safely parse markdown content as html ouput by loading templatetags from ``martor/templatetags/martortags.py ``.
235235
@@ -242,6 +242,85 @@ Simply safely parse markdown content as html ouput by loading templatetags from
242242 {{ post.description|safe_markdown }}
243243
244244
245+ Don't miss to include the required css & js files before use.
246+ You can take a look at this folder `martor_demo/app/templates `_ for more details.
247+ The below example is a one of the way to implement it when you choose the ``MARTOR_THEME = 'bootstrap' ``:
248+
249+ ::
250+
251+ {% extends "bootstrap/base.html" %}
252+ {% load static %}
253+ {% load martortags %}
254+
255+ {% block css %}
256+ <link href="{% static 'plugins/css/ace.min.css' %}" type="text/css" media="all" rel="stylesheet" />
257+ <link href="{% static 'martor/css/martor.bootstrap.min.css' %}" type="text/css" media="all" rel="stylesheet" />
258+ {% endblock %}
259+
260+ {% block content %}
261+ <div class="martor-preview">
262+ <h1>Title: {{ post.title }}</h1>
263+ <p><b>Description:</b></p>
264+ <hr />
265+ {{ post.description|safe_markdown }}
266+ </div>
267+ {% endblock %}
268+
269+ {% block js %}
270+ <script type="text/javascript" src="{% static 'plugins/js/highlight.min.js' %}"></script>
271+ <script>
272+ $('.martor-preview pre').each(function(i, block){
273+ hljs.highlightBlock(block);
274+ });
275+ </script>
276+ {% endblock %}
277+
278+
279+ **Template Editor Form **
280+
281+ Different with *Template Renderer *, the *Template Editor Form * have more css & javascript dependencies.
282+
283+ ::
284+
285+ {% extends "bootstrap/base.html" %}
286+ {% load static %}
287+
288+ {% block css %}
289+ <link href="{% static 'plugins/css/ace.min.css' %}" type="text/css" media="all" rel="stylesheet" />
290+ <link href="{% static 'plugins/css/resizable.min.css' %}" type="text/css" media="all" rel="stylesheet" />
291+ <link href="{% static 'martor/css/martor.bootstrap.min.css' %}" type="text/css" media="all" rel="stylesheet" />
292+ {% endblock %}
293+
294+ {% block content %}
295+ <form class="form" method="post">{% csrf_token %}
296+ <div class="form-group">
297+ {{ form.title }}
298+ </div>
299+ <div class="form-group">
300+ {{ form.description }}
301+ </div>
302+ <div class="form-group">
303+ <button class="btn btn-success">
304+ <i class="save icon"></i> Save Post
305+ </button>
306+ </div>
307+ </form>
308+ {% endblock %}
309+
310+ {% block js %}
311+ <script type="text/javascript" src="{% static 'plugins/js/ace.js' %}"></script>
312+ <script type="text/javascript" src="{% static 'plugins/js/mode-markdown.js' %}"></script>
313+ <script type="text/javascript" src="{% static 'plugins/js/ext-language_tools.js' %}"></script>
314+ <script type="text/javascript" src="{% static 'plugins/js/theme-github.js' %}"></script>
315+ <script type="text/javascript" src="{% static 'plugins/js/typo.js' %}"></script>
316+ <script type="text/javascript" src="{% static 'plugins/js/spellcheck.js' %}"></script>
317+ <script type="text/javascript" src="{% static 'plugins/js/highlight.min.js' %}"></script>
318+ <script type="text/javascript" src="{% static 'plugins/js/resizable.min.js' %}"></script>
319+ <script type="text/javascript" src="{% static 'plugins/js/emojis.min.js' %}"></script>
320+ <script type="text/javascript" src="{% static 'martor/js/martor.bootstrap.min.js' %}"></script>
321+ {% endblock %}
322+
323+
245324Custom Uploader
246325-----------------
247326
@@ -285,5 +364,6 @@ Notes
285364.. _Python Markdown : https://github.com/waylan/Python-Markdown
286365.. _Online reStructuredText editor : http://rst.ninjs.org
287366.. _WIKI : https://github.com/agusmakmun/django-markdown-editor/wiki
367+ .. _martor_demo/app/templates : https://github.com/agusmakmun/django-markdown-editor/tree/master/martor_demo/app/templates
288368.. _fixed this issue : https://github.com/agusmakmun/django-markdown-editor/issues/3
289369.. _custom uploader : https://github.com/agusmakmun/django-markdown-editor/wiki
0 commit comments