v0.10 - Markdown 3.4+, inline links with pks, extend or override settings
This release bring a number of fixes and improvements.
🔗 Inline links
Markdown | Result |
---|---|
[page link](page:1) |
<a href="/path/to/page-1/">page link</a> |
[document link](doc:3) |
<a href="/documents/1/the-document.pdf">document link</a> |
![image](image:37) |
<img alt="image" class="left" src="https://thing.public.s3.amazonaws.com/images/foo.png\"> |
![image](image:37,class=full-width) |
<img alt="image" class="full-width" src="https://thing.public.s3.amazonaws.com/images/foo.width-500.png"> |
![image](image:37,filter=fill-1000x1000) |
<img alt="image" class="left" src="https://thing.public.s3.amazonaws.com/images/foo.fill-1000x1000.png"> |
![image](image:37,class=full-width,filter=width-100|format-webp) |
<img alt="image" class="full-with" src="https://thing.public.s3.amazonaws.com/images/foo.width-100.format-webp.webp"> |
If you have wagtailmedia installed, you can link to a media item via [media item link text](media:123)
which will produce a link to the media file.
⚙️ Additional EasyMDE options
You can now customise the EasyMDE options. To do this, create a JavaScript file in your app (for example my_app_name/static/js/easymde_custom.js) and add the following:
// my_app/static/js/easymde_custom.js
window.wagtailMarkdown = window.wagtailMarkdown || {};
window.wagtailMarkdown.options = window.wagtailMarkdown.options || {};
window.wagtailMarkdown.options.spellChecker = false;
# my_app/wagtail_hoos.py
from django.templatetags.static import static
from django.utils.html import format_html
from wagtail import hooks
@hooks.register("insert_global_admin_js", order=100)
def global_admin_js():
"""Add /static/js/admin/easymde_custom.js to the admin."""
return format_html('<script src="{}"></script>', static("js/easymde_custom.js"))
🎛️ Settings mode
You can now change how wagtail-markdown inteprets the options you provide in the WAGTAILMARKDOWN
setting via allowed_settings_mode
(optional. "extend" or "override". default: "extend") for allowed_tags
, allowed_styles
and allowed_attributes
options. And extensions_settings_mode
(optional. "extend" or "override". default: "extend") for extensions
and extension_configs
options.
allowed_attributes
option would replace the default ones, so you had to provide all values. With this change, they should be extended. (original issue)
Dropped custom tables plugin
wftable
class.
What's Changed
- Add option to pass additional EasyMDE options by @frcroth in #104
- Markdown 3.4 compatibility and tidyups by @zerolab in #106 with thanks to @vegaelle for the work started in #105
- Page and media linking by @zerolab in #107 with many thanks to @richtier for the initial work in #44
- Add
allowed_*
andextension*
settings control mode by @zerolab in #108
Full Changelog: v0.9.0...v0.10.0