A plugin for django-cms that wraps django-markdownx, enabling WYSIWYG editing of markdown fields.
Project description
To quote Richard Stallman, lo these many years ago, "What you see is what you get" == ""What you see is all there is!".
This plugin does not replace the standard CMS text plugin, it is a new plugin class, Markdown.
Home-page: https://github.com/bobhy/cmsplugin-markdownx
Author: Bob Hyman
Author-email: bob.hyman@bobssoftwareworks.com
License: MIT License
Description: Shims the estimable [django-markdownx](https://github.com/adi-/django-markdownx) into the venerable [django-cms](https://github.com/divio/django-cms).
Provides a `Markdown` plugin for Django-cms which stores content in markdown but displays as HTML.
We consider it an advantage that the rendering is all done server-side,
that ensures the editing preview looks
just like the final result in case we do preprocessing enhancements for the markdown dialect.
* [Quick Start](#quick-start)
* [Usage](#usage)
* [Customization](#customization)
* [Dependencies](#dependencies)
* [License](#license)
* [Changelog](#changelog)
# Quick Start
1. Install prerequisites, then `cmsmarkdown-markdownx` package.
```bash
pip install django-markdownx
pip install cmsmarkdown-markdownx
1. Add `cmsplugin_markdownx` to your `INSTALLED_APPS`.
```python
#settings.py
INSTALLED_APPS = (
...
'markdownx',
'cmsplugin_markdownx',
)
```
1. Refer to [#customization] for additional settings you probably want to use.
1. Add django-markdownx`s urls: (*not* in `il8n_patterns()`)
```python
#urls.py
urlpatterns = [
[...]
url(r'^markdownx/', include('markdownx.urls')),
]```
1. Collect included templates and statics to your `STATIC_ROOT` folder.
```bash
python manage.py collectstatic
```
# Usage
1. in CMS, edit a page with a placeholder.
1. Add a `Markdown` plugin
1. As you type, the preview window is updated (thank you @django-markdownx)
From the 'frontend' view, you can update the plugin content.
1. Be sure you're logged into CMS, with adequate privilees.
1. Browse to a page containing Markdown
1. Double-click on the section of the page containing the Markdown plugin.
# Customization
## Settings
Place settings in your `settings.py` to override default values:
```python
#settings.py
## for django-markdownx (see https://github.com/adi-/django-markdownx#customization)
# Markdownify
MARKDOWNX_MARKDOWNIFY_FUNCTION = 'markdownx.utils.markdownify'
# Markdown extensions
MARKDOWNX_MARKDOWN_EXTENSIONS = [
'markdown.extensions.extra',
'markdown.extensions.codehilite', ## wants Pygments
]
# specify the code highlighting stylesheet used by `markdown.extensions.codehilite`
CMSPLUGIN_MARKDOWNX_CODEHILITE_CSS = 'cmsplugin_markdownx/codehilite_colorful.css'
```
## Template Tags
If you want to design your own template to display rendered HTML from Markdown text, you need to do 2 things:
1. Include the CMSPLUGIN_MARKDOWNX_CODEHILITE_CSS stylesheet in the CSS section of the page header.
1. Run the markdown text from some instance of the Markdown plugin through the MARKDOWNX_MARKDOWNIFY_FUNCTION you configured for `django-markdownx'
In order to do any or all of the above, you must load the template tags first.
```html+django
{% load cmsplugin_markdownx %}
```
### Custom tag `{% get_settings _settingsVariable_ default=None %}`
This tag extracts the value of _settingsVariable_ from your site `settings.py`. You can specify the default value to use if it is not defined.
This tag is not dependent on markdown processing, it can be used in other apps and projects.
### Filter `{{ ... |markdownify }}`
Converts the markdown text provided by its left-hand argument into HTML using `django-markdownx`'s `MARKDOWNX_MARKDOWNIFY_FUNCTION`
The HTML blob itself does not have a `<div`> wrapper, leaving you free to style one in the template.
### Example
```html_django
{% load static sekizai_tags cmsplugin_markdownx %}
{% get_setting "CMSPLUGIN_MARKDOWNX_CODEHILITE_CSS" as codehilite_css %}
{% if codehilite_css %}
{% addtoblock "css" %}
<link rel="stylesheet" href="{% static codehilite_css %}"/>
{% endaddtoblock %}
{% endif %}
<div>{{ instance.markdown_text|markdownify }}</div>
```
# Dependencies
* Markdown
* Pillow
* Django
* jQuery
# License
cmsplugin-markdown is licensed under the MIT open source license. Read `LICENSE` file for details.
# Changelog
| version | date | notes |
| :---------: | :-------: | -------------------------- |
| 0.1 | Jan 29, 2017 | Initial release |
Keywords: django,django-cms,plugin,markdown,editor
Platform: OS Independent
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 1.10
Classifier: Framework :: Django :: 1.9
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Text Processing :: Markup
This plugin does not replace the standard CMS text plugin, it is a new plugin class, Markdown.
Home-page: https://github.com/bobhy/cmsplugin-markdownx
Author: Bob Hyman
Author-email: bob.hyman@bobssoftwareworks.com
License: MIT License
Description: Shims the estimable [django-markdownx](https://github.com/adi-/django-markdownx) into the venerable [django-cms](https://github.com/divio/django-cms).
Provides a `Markdown` plugin for Django-cms which stores content in markdown but displays as HTML.
We consider it an advantage that the rendering is all done server-side,
that ensures the editing preview looks
just like the final result in case we do preprocessing enhancements for the markdown dialect.
* [Quick Start](#quick-start)
* [Usage](#usage)
* [Customization](#customization)
* [Dependencies](#dependencies)
* [License](#license)
* [Changelog](#changelog)
# Quick Start
1. Install prerequisites, then `cmsmarkdown-markdownx` package.
```bash
pip install django-markdownx
pip install cmsmarkdown-markdownx
1. Add `cmsplugin_markdownx` to your `INSTALLED_APPS`.
```python
#settings.py
INSTALLED_APPS = (
...
'markdownx',
'cmsplugin_markdownx',
)
```
1. Refer to [#customization] for additional settings you probably want to use.
1. Add django-markdownx`s urls: (*not* in `il8n_patterns()`)
```python
#urls.py
urlpatterns = [
[...]
url(r'^markdownx/', include('markdownx.urls')),
]```
1. Collect included templates and statics to your `STATIC_ROOT` folder.
```bash
python manage.py collectstatic
```
# Usage
1. in CMS, edit a page with a placeholder.
1. Add a `Markdown` plugin
1. As you type, the preview window is updated (thank you @django-markdownx)
From the 'frontend' view, you can update the plugin content.
1. Be sure you're logged into CMS, with adequate privilees.
1. Browse to a page containing Markdown
1. Double-click on the section of the page containing the Markdown plugin.
# Customization
## Settings
Place settings in your `settings.py` to override default values:
```python
#settings.py
## for django-markdownx (see https://github.com/adi-/django-markdownx#customization)
# Markdownify
MARKDOWNX_MARKDOWNIFY_FUNCTION = 'markdownx.utils.markdownify'
# Markdown extensions
MARKDOWNX_MARKDOWN_EXTENSIONS = [
'markdown.extensions.extra',
'markdown.extensions.codehilite', ## wants Pygments
]
# specify the code highlighting stylesheet used by `markdown.extensions.codehilite`
CMSPLUGIN_MARKDOWNX_CODEHILITE_CSS = 'cmsplugin_markdownx/codehilite_colorful.css'
```
## Template Tags
If you want to design your own template to display rendered HTML from Markdown text, you need to do 2 things:
1. Include the CMSPLUGIN_MARKDOWNX_CODEHILITE_CSS stylesheet in the CSS section of the page header.
1. Run the markdown text from some instance of the Markdown plugin through the MARKDOWNX_MARKDOWNIFY_FUNCTION you configured for `django-markdownx'
In order to do any or all of the above, you must load the template tags first.
```html+django
{% load cmsplugin_markdownx %}
```
### Custom tag `{% get_settings _settingsVariable_ default=None %}`
This tag extracts the value of _settingsVariable_ from your site `settings.py`. You can specify the default value to use if it is not defined.
This tag is not dependent on markdown processing, it can be used in other apps and projects.
### Filter `{{ ... |markdownify }}`
Converts the markdown text provided by its left-hand argument into HTML using `django-markdownx`'s `MARKDOWNX_MARKDOWNIFY_FUNCTION`
The HTML blob itself does not have a `<div`> wrapper, leaving you free to style one in the template.
### Example
```html_django
{% load static sekizai_tags cmsplugin_markdownx %}
{% get_setting "CMSPLUGIN_MARKDOWNX_CODEHILITE_CSS" as codehilite_css %}
{% if codehilite_css %}
{% addtoblock "css" %}
<link rel="stylesheet" href="{% static codehilite_css %}"/>
{% endaddtoblock %}
{% endif %}
<div>{{ instance.markdown_text|markdownify }}</div>
```
# Dependencies
* Markdown
* Pillow
* Django
* jQuery
# License
cmsplugin-markdown is licensed under the MIT open source license. Read `LICENSE` file for details.
# Changelog
| version | date | notes |
| :---------: | :-------: | -------------------------- |
| 0.1 | Jan 29, 2017 | Initial release |
Keywords: django,django-cms,plugin,markdown,editor
Platform: OS Independent
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 1.10
Classifier: Framework :: Django :: 1.9
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Text Processing :: Markup
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
File details
Details for the file cmsplugin-markdownx-0.1.3.tar.gz
.
File metadata
- Download URL: cmsplugin-markdownx-0.1.3.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a34f6aba4569982a1f00a91dbd74b890fa84d2c5355dd7fd6827238282faa13 |
|
MD5 | cbde1d887bbea8a1263eceb909821044 |
|
BLAKE2b-256 | d87e4079c0e24e4f91587d361805e9b8f534ced25e6fcd1e22dc682e0e474dcc |