Provides the ability to use markdown
as a type of input element.
To install the latest release, using Composer, run:
composer require rkeet/zf-form-markdown
To enable this module, enable both this module and AssetManager. In modules.config.php
add the following:
'AssetManager',
'Keet\Markdown',
Element provides an HTML <textarea>
element and paired <div>
element to render
a preview of whatever is entered in text area.
use Keet\Markdown\Form\Element\Markdown;
...
$this->add(
[
'name' => 'body',
'type' => Markdown::class,
'options' => [
'label' => 'Body',
],
'attributes' => [
'rows' => 4,
],
]
);
- Zend Form to extend
- Parsedown for PHP side parsing to HTML
- ShowdownJS for client side parsing to HTML for preview
- AssetManager to inject JS with ViewHelper
- Provides Service (
MarkdownService
) for handling markdown conversion server-side - Provides a ZF Form Element (
Markdown
) for Form input- Provides Showdown to client when using
Markdown
Form Element
- Provides Showdown to client when using
- Create better preview - possibly:
- option: inject some overridable default styling
- option: side-by-side preview instead of above/below
- option: minimum (overridable) styling to always have a visible preview container
- Figure out incompatibilities between Parsedown and ShowdownJS