A set of Django helpers that make it easier to get up and running quickly with django-markupfield
Project description
django-markupfield-helpers is a set of Django helpers that make it easier to get up and running quickly with django-markupfield.
Source code is available on GitHub at mfcovington/django-markupfield-helpers. Information about django-markupfield is available on GitHub.
Installation
PyPI
pip install django-markupfield-helpers
GitHub (development branch)
pip install git+http://github.com/mfcovington/django-markupfield-helpers.git@develop
Configuration
Add markupfield_helpers to INSTALLED_APPS in settings.py:
INSTALLED_APPS = (
...
'markupfield_helpers',
)
Add a link to the CSS file for syntax highlighting in base.html or in a specific template.
{% load staticfiles %}
<link rel="stylesheet" type="text/css" href="{% static 'markupfield_helpers/css/syntax-highlighting.css' %}">
markupfield_helpers can be left out of INSTALLED_APPS if the provided CSS for syntax highlighting is not needed.
Helpers
MarkupField
The MarkupField class from markupfield_helpers can be used in place of the class of the same name from markupfield.
The markupfield_helpers version comes with four markup types defined:
Markdown (Default): Markdown 2 with extras (code-friendly, cuddled-lists, fenced-code-blocks, footnotes, and tables)
Markdown Basic: Markdown 2 without extras
Plain Text
reStructuredText
Here is a basic example of how to use the markupfield_helpers version of MarkupField:
from django.db import models
from markupfield_helpers.helpers import MarkupField
class Article(models.Model):
title = models.CharField(max_length=100)
slug = models.SlugField(max_length=100)
body = MarkupField()
MARKUP_FIELD_TYPES
Alternatively, MARKUP_FIELD_TYPES can be imported from markupfield_helpers.helpers and used as-is or modified. This is equivalent to the code above:
from django.db import models
from markupfield.fields import MarkupField
from markupfield_helpers.helpers import MARKUP_FIELD_TYPES
class Article(models.Model):
title = models.CharField(max_length=100)
slug = models.SlugField(max_length=100)
body = MarkupField(
default_markup_type='Markdown',
markup_choices=MARKUP_FIELD_TYPES,
)
Issues
If you experience any problems or would like to request a feature, please create an issue on GitHub.
Version 0.1.0
Revision History
0.1.0 2018-12-01
A set of Django helpers that make it easier to get up and running quickly with django-markupfield
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-markupfield-helpers-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16560534cfb32eee38785365e4499506820e0ca735c675036ca3dc14f8330abb |
|
MD5 | 14467770138c5707b1eb970ac217cb18 |
|
BLAKE2b-256 | 66bb40ccc6aad67fc52bbb4dfaf5d46620a15cfccc1909ee2ec2add51ace73f3 |
Hashes for django_markupfield_helpers-0.1.0-py33-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a52d1a597fa896d36cd2a4cce5d9e03053627ec8a83ad080a0426fb93511a509 |
|
MD5 | f51faa7b3514e0d71db53b7a3bef60b7 |
|
BLAKE2b-256 | 469bb975eec883cfe26a7fb0a129b5583f01988f18caf932bd1f27bd1302575c |