About Checkboxes in Markdown-based HTML
If you want to show a checklist in HTML rendered with django-markdownify, such as:
{% load markdownify %}
{% filter markdownify %}
- [ ] Develop a new feature
- [x] Fix a bug
{% endfilter %}
Use the markdown-checklist extension.
Install it with pip:
(.venv)$ pip install markdown-checklist
Then add it in the django-markdowify configuration in Django project settings:
import bleach
MARKDOWNIFY = {
"default": {
"MARKDOWN_EXTENSIONS": [
"markdown_checklist.extension",
],
"WHITELIST_TAGS": (
set(bleach.sanitizer.ALLOWED_TAGS) |
{"h1", "h2", "h3", "p", "input"}
),
"WHITELIST_ATTRS": (
bleach.sanitizer.ALLOWED_ATTRIBUTES |
{"input": ["type", "name", "value", "checked", "disabled"]}
),
}
}
Tips and Tricks Programming Development Django 6.x Django 5.2 Django 4.2 django-markdownify markdown-checklist
Also by me
Django Messaging
For Django-based social platforms.
Django Paddle Subscriptions
For Django-based SaaS projects.
Django GDPR Cookie Consent
For Django websites that use cookies.