Skip to content

belak/wagtail-commonmark

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

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. 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:

INSTALLED_APPS += [
    'wagtailcommonmark',
]

Use it as a StreamField block:

from wagtailcommonmark.blocks import CommonMarkBlock

class MyStreamBlock(StreamBlock):
    markdown = CommonMarkBlock(icon="code")

Or use as a page field:

from wagtailcommonmark.edit_handlers import CommonMarkPanel
from wagtailcommonmark.fields import CommonMarkField

class MyPage(Page):
    body = CommonMarkField()

    content_panels = [
        FieldPanel("title", classname="full title"),
        CommonMarkPanel("body"),
    ]

And render the content in a template:

{% load wagtailcommonmark %}
<article>
{{ self.body|commonmark }}
</article>

About

Commonmark support for Wagtail

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published