Metadata-Version: 1.1
Name: django-markdownx
Version: 1.4
Summary: Django Markdown editor with image uploads (stored in MEDIA_ROOT folder) and live preview.
Home-page: https://github.com/adi-/django-markdownx
Author: adi-
Author-email: aaadeji@gmail.com
License: BSD
Description: django-markdownx |Version|
        ==========================
        
        |Travis| |Python Versions| |Status| |Downloads| |License|
        
        Django Markdownx is a Markdown editor built for Django. It enables raw
        editing with a live preview and image uploads (stored locally in
        ``MEDIA_ROOT`` folder! yay!) with drag&drop functionality and auto tag
        insertion. Also, django-markdownx supports multiple editors on one page.
        
        Template is highly customizable, so you can easily use i.e. Bootstrap to
        layout editor pane and preview pane side by side (as in preview
        animation below).
        
        *Side note: Just to keep it simple, all UI editing controls are
        unwelcome – this is Markdown editor not a web MS Word imitation.*
        
        Preview
        '''''''
        
        .. figure:: https://github.com/adi-/django-markdownx/blob/master/django-markdownx-preview.gif?raw=true
           :alt: Preview
        
           Preview
        *(using Bootstrap for layout and styling)*
        
        Menu
        ''''
        
        -  `Quick Start <#quick-start>`__
        -  `Usage <#usage>`__
        
           -  `Model <#model>`__
           -  `Form <#form>`__
           -  `Django Admin <#django-admin>`__
        
        -  `Customization <#customization>`__
        
           -  `Settings <#settings>`__
           -  `Widget's template <#widgets-template>`__
           -  `JS event handlers <#js-event-handlers>`__
        
        -  `Dependencies <#dependencies>`__
        -  `Changelog <#changelog>`__
        -  `License <#license>`__
        
        --------------
        
        Quick Start
        ===========
        
        1. Install ``django-markdownx`` package.
        
           .. code:: python
        
               pip install django-markdownx
        
        2. Add ``markdownx`` to your ``INSTALLED_APPS``.
        
           .. code:: python
        
               #settings.py
               INSTALLED_APPS = (
                   [...]
                   'markdownx',
               )
        
        3. Add url pattern to your ``urls.py``.
        
           .. code:: python
        
               #urls.py
               urlpatterns = [
                   [...]
                   url(r'^markdownx/', include('markdownx.urls')),
               ]
        
        4. Collect included ``markdownx.js`` and ``markdownx.css`` (for django
           admin styling) to your ``STATIC_ROOT`` folder.
        
           .. code:: python
        
               python manage.py collectstatic
        
        5. ...and don't forget to include jQuery in your html file.
        
           .. code:: html
        
               <head>
                   [...]
                   <script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
               </head>
        
        Usage
        =====
        
        Model
        -----
        
        .. code:: python
        
            #models.py
            from markdownx.models import MarkdownxField
        
            class MyModel(models.Model):
        
                myfield = MarkdownxField()
        
        ...and then, include a form's required media in the template using
        ``{{ form.media }}``:
        
        .. code:: html
        
            <form method="POST" action="">{% csrf_token %}
                {{ form }}
            </form>
            {{ form.media }}
        
        Form
        ----
        
        .. code:: python
        
            #forms.py
            from markdownx.fields import MarkdownxFormField
        
            class MyForm(forms.Form):
        
                myfield = MarkdownxFormField()
        
        ...and then, include a form's required media in the template using
        ``{{ form.media }}``:
        
        .. code:: html
        
            <form method="POST" action="">{% csrf_token %}
                {{ form }}
            </form>
            {{ form.media }}
        
        Django Admin
        ------------
        
        When using included ``MarkdowxModel`` class in your models, just use
        ``MarkdownxModelAdmin`` as follows:
        
        .. code:: python
        
            #admin.py
            from django.contrib import admin
        
            from markdownx.admin import MarkdownxModelAdmin
        
            from .models import MyModel
        
            admin.site.register(MyModel, MarkdownxModelAdmin)
        
        However, when you want to use ``markdownx`` with other classes – lets
        say ``TextField`` – than override default widget as below:
        
        .. code:: python
        
            #admin.py
            from django.db import models
            from django.contrib import admin
        
            from markdownx.widgets import AdminMarkdownxWidget
        
            from .models import MyModel
        
            class MyModelAdmin(admin.ModelAdmin):
                formfield_overrides = {
                    models.TextField: {'widget': AdminMarkdownxWidget},
                }
        
            admin.site.register(MyModel, MyModelAdmin)
        
        Customization
        =============
        
        Settings
        --------
        
        Place settings in your ``settings.py`` to override default values:
        
        .. code:: python
        
            #settings.py
            MARKDOWNX_MARKDOWN_EXTENSIONS = []
            MARKDOWNX_MARKDOWN_EXTENSION_CONFIGS = {}
            MARKDOWNX_URLS_PATH = '/markdownx/markdownify/' # Urls path that returns compiled markdown text. Change this path to your custom app url. That could i.e. enable do some additional work with compiled markdown text.
            MARKDOWNX_UPLOAD_URLS_PATH = '/markdownx/upload/' # Urls path for uploading image on text-editor. Will return markdown notation of the image. Change this path to your custom app url.
            MARKDOWNX_MEDIA_PATH = 'markdownx/' # subdirectory, where images will be stored in MEDIA_ROOT folder
            MARKDOWNX_UPLOAD_MAX_SIZE = 52428800 # 50MB
            MARKDOWNX_UPLOAD_CONTENT_TYPES = ['image/jpeg', 'image/png']
            MARKDOWNX_IMAGE_MAX_SIZE = {'size': (500, 500), 'quality': 90,}
            MARKDOWNX_EDITOR_RESIZABLE = True # update editor's height to inner content height while typing
        
        **NOTE:** ``MARKDOWNX_IMAGE_MAX_SIZE`` dict properties:
        
        -  **size** – (width, height). When ``0`` used, i.e.: (500,0), property
           will figure out proper height by itself
        -  **quality** – default: ``90`` – 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
        
        Custom MARKDOWNX\_URLS\_PATH
        ----------------------------
        
        Change this path to your app path in ``urls.py``. Default view that
        compiles markdown text:
        
        .. code:: python
        
            #views.py
            import markdown
        
            from django.http import HttpResponse
            from django.views.generic.edit import View
        
            from _your_app_.settings import MARKDOWNX_MARKDOWN_EXTENSIONS, MARKDOWNX_MARKDOWN_EXTENSION_CONFIGS
        
            class MarkdownifyView(View):
        
                def post(self, request, *args, **kwargs):
                    return HttpResponse(markdown.markdown(
                        request.POST['content'],
                        extensions=MARKDOWNX_MARKDOWN_EXTENSIONS,
                        extension_configs=MARKDOWNX_MARKDOWN_EXTENSION_CONFIGS))
        
        Widget's template
        -----------------
        
        Default widget's template looks like:
        
        .. code:: html
        
            <div class="markdownx">
                {{ markdownx_editor }}
                <div class="markdownx-preview"></div>
            </div>
        
        When you want to use Bootstrap 3 and side-by-side panes (as in preview
        image above), just place ``templates/markdownx/widget.html`` file in
        your project with:
        
        .. code:: html
        
            <div class="markdownx row">
                <div class="col-md-6">
                    {{ markdownx_editor }}
                </div>
                <div class="col-md-6">
                    <div class="markdownx-preview"></div>
                </div>
            </div>
        
        JS event handlers
        -----------------
        
        Each markdownx jQuery object triggers two basic events:
        
        -  'markdownx.init'
        -  'markdownx.update' – also returns 'response' variable containing
           markdownified text
        
        .. code:: js
        
            $('.markdownx').on('markdownx.init', function() {
                console.log("INIT");
            });
        
            $('.markdownx').on('markdownx.update', function(e, response) {
                console.log("UPDATE" + response);
            });
        
        Dependencies
        ============
        
        -  Markdown
        -  Pillow
        -  Django
        -  jQuery
        
        Changelog
        =========
        
        v1.4
            
        
        -  Added JS (jQuery) events
        -  Custom upload url path
        -  Fix when subclassing MarkdownxWidget
        
        v1.3
            
        
        -  Added Markdown extension configuration setting
        
        v1.2.1
              
        
        -  Fix by Eduard Sukharev: Fix accessing file length in python3
        
        v1.2
            
        
        -  Added custom url path setting MARKDOWNX\_URLS\_PATH to compile
           markdown with custom view (i.e. for pre/post altering markdown text)
        
        v1.1.3
              
        
        -  Setup tools fix
        
        v1.1.2
              
        
        -  Critical fix for image upload
        
        v1.1.1
              
        
        -  Package fix
        
        v1.1
            
        
        -  Python 3.3+ support
        -  Very simple test added just to test python 3 support
        
        v1.0.1
              
        
        -  Moved html logic from FormField to Widget to be able to override
           model objects other than included MarkdownxModel
        -  Fixed default value for ``MARKDOWNX_EDITOR_RESIZABLE``
        
        v1.0.0
              
        
        -  Warning: no backward compatibility
        -  Admin, Model and Form custom objects
        -  Django admin styles for compiled markdown
        -  Settings variables changed:
        
           -  MARKDOWNX\_MAX\_SIZE => MARKDOWNX\_IMAGE\_MAX\_SIZE
           -  MARKDOWNX\_MARKDOWN\_KWARGS => MARKDOWNX\_MARKDOWN\_EXTENSIONS
           -  MARKDOWNX\_MAX\_UPLOADSIZE => MARKDOWNX\_UPLOAD\_MAX\_SIZE
           -  MARKDOWNX\_CONTENT\_TYPES => MARKDOWNX\_UPLOAD\_CONTENT\_TYPES
        
        v0.4.2
              
        
        -  Path fix by argaen
        
        v0.4.1
              
        
        -  Better editor height updates
        -  Refresh preview on image upload
        -  Small JS code fixes
        
        v0.4.0
              
        
        -  editor auto height
        
        v0.3.1
              
        
        -  JS event fix
        
        v0.3.0
              
        
        -  version bump
        
        v0.2.9
              
        
        -  Removed any inlcuded css
        -  Removed JS markdown compiler (full python support now with Markdown
           lib)
        
        v0.2.0
              
        
        -  Allow to paste tabs using Tab button
        
        v0.1.4
              
        
        -  package data fix
        
        v0.1.3
              
        
        -  README.md fix on PyPi
        
        v0.1.2
              
        
        -  critical setuptools fix
        
        v0.1.1
              
        
        -  change context name ``editor`` to ``markdownx_editor`` for better
           consistency
        
        v0.1.0
              
        
        -  init
        
        License
        =======
        
        django-markdown is licensed under the open source BSD license
        
        Notes
        =====
        
        **django-markdownx** was inspired by great
        `django-images <https://github.com/mirumee/django-images>`__ and
        `django-bootstrap-markdown <http://thegoods.aj7may.com/django-bootstrap-markdown/>`__
        packages.
        
        .. |Version| image:: https://img.shields.io/pypi/v/django-markdownx.svg
           :target: https://pypi.python.org/pypi/django-markdownx/
        .. |Travis| image:: https://img.shields.io/travis/adi-/django-markdownx.svg
           :target: https://travis-ci.org/adi-/django-markdownx
        .. |Python Versions| image:: https://img.shields.io/pypi/pyversions/django-markdownx.svg
           :target: https://pypi.python.org/pypi/django-markdownx/
        .. |Status| image:: https://img.shields.io/pypi/status/django-markdownx.svg
           :target: https://pypi.python.org/pypi/django-markdownx/
        .. |Downloads| image:: https://img.shields.io/pypi/dm/django-markdownx.svg
           :target: https://pypi.python.org/pypi/django-markdownx/
        .. |License| image:: https://img.shields.io/pypi/l/django-markdownx.svg
           :target: https://pypi.python.org/pypi/django-markdownx/
        
Keywords: django markdown live preview images upload
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: User Interfaces
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: JavaScript
