Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/belak/wagtail-commonmark
Commonmark support for Wagtail
https://github.com/belak/wagtail-commonmark
django python wagtail
Last synced: about 2 months ago
JSON representation
Commonmark support for Wagtail
- Host: GitHub
- URL: https://github.com/belak/wagtail-commonmark
- Owner: belak
- License: mit
- Created: 2019-10-04T17:45:44.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-09T23:38:04.000Z (about 5 years ago)
- Last Synced: 2024-11-13T16:14:17.869Z (2 months ago)
- Topics: django, python, wagtail
- Language: JavaScript
- Homepage:
- Size: 121 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## wagtail-commonmark: CommonMark fields and blocks for Wagtail
Tired of annoying rich text editors getting in the way of your content
input? Wish Wagtail worked more like a wiki? Well, now it can.`wagtail-commonmark` provides CommonMark field support for [Wagtail](https://github.com/torchbox/wagtail/).
Specifically, it provides:* A `wagtailcommonmark.blocks.CommonMarkBlock` for use in streamfields.
* A `wagtailcommonmark.fields.CommonMarkField` for use in page models.
* A `wagtailcommonmark.edit_handlers.CommonMarkPanel` for use in the editor interface.
* A `wagtailcommonmark.jinja2tags.commonmark` extension for use in jinja2 templates.
* A `commonmark` template tag.### Installation
Alpha release is available on Pypi - https://pypi.org/project/wagtail-commonmark/ - installable via `pip install wagtail-commonmark`.
### Using it
Add it to `INSTALLED_APPS`:
```python
INSTALLED_APPS += [
'wagtailcommonmark',
]
```Use it as a `StreamField` block:
```python
from wagtailcommonmark.blocks import CommonMarkBlockclass MyStreamBlock(StreamBlock):
markdown = CommonMarkBlock(icon="code")
```Or use as a page field:
```python
from wagtailcommonmark.edit_handlers import CommonMarkPanel
from wagtailcommonmark.fields import CommonMarkFieldclass MyPage(Page):
body = CommonMarkField()content_panels = [
FieldPanel("title", classname="full title"),
CommonMarkPanel("body"),
]
```And render the content in a template:
```html+django
{% load wagtailcommonmark %}{{ self.body|commonmark }}
```