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 @@

All modules for which code is available

@@ -411,7 +411,7 @@

X

@@ -204,7 +204,7 @@