From c6689c9985ff8e9e204cad61cd36949642434566 Mon Sep 17 00:00:00 2001 From: Pouria Hadjibagheri Date: Thu, 4 May 2017 11:24:06 +0100 Subject: [PATCH 1/3] Issue #64 + slight improvement. --- docs-src/customization.rst | 78 +++++++++- docs-src/example.rst | 65 -------- docs-src/markdownx/docs/urls.rst | 12 +- docs/_modules/index.html | 6 +- docs/_modules/markdownx/exceptions.html | 6 +- docs/_modules/markdownx/forms.html | 22 +-- docs/_modules/markdownx/utils.html | 28 ++-- docs/_modules/markdownx/views.html | 6 +- docs/_sources/customization.rst.txt | 78 +++++++++- docs/_sources/example.rst.txt | 65 -------- docs/contribution.html | 6 +- docs/customization.html | 140 +++++++++++++----- docs/doctrees/customization.doctree | Bin 58485 -> 69179 bytes docs/doctrees/environment.pickle | Bin 56379 -> 56716 bytes docs/doctrees/example.doctree | Bin 21508 -> 11035 bytes docs/doctrees/index.doctree | Bin 18809 -> 18809 bytes docs/doctrees/markdownx/docs/admins.doctree | Bin 5800 -> 5800 bytes .../markdownx/docs/exceptions.doctree | Bin 19031 -> 19031 bytes docs/doctrees/markdownx/docs/fields.doctree | Bin 5130 -> 5130 bytes docs/doctrees/markdownx/docs/forms.doctree | Bin 18759 -> 18759 bytes docs/doctrees/markdownx/docs/models.doctree | Bin 22979 -> 22979 bytes .../doctrees/markdownx/docs/utilities.doctree | Bin 17553 -> 17873 bytes docs/doctrees/markdownx/docs/views.doctree | Bin 21822 -> 21822 bytes docs/example.html | 79 +--------- docs/genindex.html | 6 +- docs/getting_started.html | 6 +- docs/index.html | 11 +- docs/installation.html | 6 +- docs/js/docs.html | 6 +- docs/js/docs/markdownx.html | 6 +- docs/js/docs/utils.html | 6 +- docs/js/events.html | 6 +- docs/js/js.html | 6 +- docs/license.html | 6 +- docs/markdownx/docs/admins.html | 6 +- docs/markdownx/docs/exceptions.html | 6 +- docs/markdownx/docs/fields.html | 6 +- docs/markdownx/docs/forms.html | 6 +- docs/markdownx/docs/models.html | 6 +- docs/markdownx/docs/utilities.html | 10 +- docs/markdownx/docs/views.html | 6 +- docs/markdownx/markdownx.html | 6 +- docs/py-modindex.html | 6 +- docs/search.html | 6 +- docs/searchindex.js | 2 +- docs/translation.html | 6 +- 46 files changed, 380 insertions(+), 348 deletions(-) diff --git a/docs-src/customization.rst b/docs-src/customization.rst index 996f3af..73a43f2 100644 --- a/docs-src/customization.rst +++ b/docs-src/customization.rst @@ -1,6 +1,80 @@ Customization ============= +---- + +General (ex. settings) +********************** + +Templates +--------- + +The default widget is as seen `here +`_. + +If you would like to customise this; for instance, using `Bootstrap `_ to implement +side-by-side panes (as seen in :doc:`preview animation`), you should override the default template by creating +your own template and saving it under ``markdownx/widget2.html`` (Django 1.11+) or ``markdownx/widget.html`` (Django +1.10 and below) in your project's :guilabel:`TEMPLATE_DIRS`. + +Here is an example of the contents: + +.. code-block:: html + +
+
+ {{ markdownx_editor }} +
+
+
+
+
+ + +Fields +------ + +We have ensured that **MarkdownX** is fully extensible and provides a high degree of flexibility in development. + +There are times that you may wish to Markdownify a different type of field, or utilize your own customized widget. To +accommodate this, we have provided the tools to apply **MarkdownX** infrastructure to other fields through *Widgets*. + +For instance, to apply **MarkdownX** to ``TextField`` instances in your Django Admins, you can override the default +widget in the Admins module in :guilabel:`admin.py` of your Django App as follows: + +.. code-block:: python + :linenos: + + 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) + + +Image tags +---------- + +Markdown uses ``![]()`` tag by default to insert uploaded image file. This generates a simple (X)HTML ```` tag. +If you wish to have more control and use your own HTML tags, you may create a custom ``form_valid()`` function in +``ImageUploadView`` class, as highlighted `here +`_. + +---- + +Settings +******** + You may place any of the variables outlined in this page in your :guilabel:`settings.py`, alter their values and override default behaviours. @@ -9,6 +83,7 @@ override default behaviours. customisations, or to be rather more accurate, **event controls** are enabled in the frontend through JavaScript events. To learn more about these events, see our :doc:`JavaScript documentations on events`. + Quick Reference --------------- @@ -55,6 +130,7 @@ Looking for a specific feature? see the sidebar for the table of contents. Markdownify ........... + Default function that compiles markdown using defined extensions. Using custom function can allow you to pre-process or post-process markdown text. See below for more info. @@ -244,7 +320,7 @@ by setting the value to ``False`` if so is desired. .. Important:: - MarkdownX does *not* disable CSRF protection by default, and requires the token for all AJAX request. + **MarkdownX** does *not* disable CSRF protection by default, and requires the token for all AJAX request. Editor diff --git a/docs-src/example.rst b/docs-src/example.rst index 655af98..378900f 100644 --- a/docs-src/example.rst +++ b/docs-src/example.rst @@ -75,71 +75,6 @@ your :guilabel:`app/admin.py` as follows: admin.site.register(MyModel, MarkdownxModelAdmin) -Advanced --------- - -Template customization -...................... - -The default widget is as seen `here -`_. - -If you would like to customise this; for instance, using `Bootstrap `_ to implement -side-by-side panes (as seen in :doc:`preview animation`), you should override the default template by creating -your own template and saving it under ``markdownx/widget.html`` (Django 1.11+) or ``markdownx/widget2.html`` (Django -1.10 and below) in your project's :guilabel:`TEMPLATE_DIRS`. - -Here is an example of the contents: - -.. code-block:: html - -
-
- {{ markdownx_editor }} -
-
-
-
-
- - -Field customization -................... - -We have ensured that **MarkdownX** is fully extensible and provides a high degree of flexibility in development. - -There are times that you may wish to Markdownify a different type of field, or utilize your own customized widget. To -accommodate this, we have provided the tools to apply **MarkdownX** infrastructure to other fields through *Widgets*. - -For instance, to apply **MarkdownX** to ``TextField`` instances in your Django Admins, you can override the default -widget in the Admins module in :guilabel:`admin.py` of your Django App as follows: - -.. code-block:: python - :linenos: - - 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) - - -Custom image tags -................. -Markdown uses ``![]()`` tag by default to insert uploaded image file. This generates a simple (X)HTML ```` tag. -If you wish to have more control and use your own HTML tags, you may create a custom ``form_valid()`` function in -``ImageUploadView`` class, as highlighted `here -`_. .. _TextField: https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.TextField \ No newline at end of file diff --git a/docs-src/markdownx/docs/urls.rst b/docs-src/markdownx/docs/urls.rst index b620581..efad936 100644 --- a/docs-src/markdownx/docs/urls.rst +++ b/docs-src/markdownx/docs/urls.rst @@ -2,5 +2,15 @@ URLs ---- + .. automodule:: markdownx.urls - :members: + + + +.. tip:: + All **MarkdownX** URLs patterns have unique names that start with ``markdownx_`` and are followed by a specific + name; for instance, the `upload` link has the name :guilabel:`markdownx_upload`. It is still possible to use + the ``namespace`` attribute (see `Django docs`_ to find out more) when including the patterns in your project. + + +.. _Django docs: https://docs.djangoproject.com/en/dev/topics/http/urls/#url-namespaces \ No newline at end of file diff --git a/docs/_modules/index.html b/docs/_modules/index.html index 476af9f..bbccf1d 100644 --- a/docs/_modules/index.html +++ b/docs/_modules/index.html @@ -8,7 +8,7 @@ - Overview: module code — Django Markdownx 2.0.16 documentation + Overview: module code — Django Markdownx 2.0.19 documentation @@ -35,7 +35,7 @@ - + @@ -202,7 +202,7 @@ @@ -411,7 +411,7 @@ @@ -204,7 +204,7 @@