Search by

bnine / mdeditorbundle

arno

Symfony bundle providing an EasyMDE Markdown form type and its assets

Package info

github.com/afornerot/bNine-MdEditorBundle

Type:symfony-bundle

pkg:composer/bnine/mdeditorbundle

Statistics

Installs: 535

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.1.6 2026-10-22 20:56 UTC

This package is auto-updated.

Last update: 2026-11-03 11:02:02 UTC


README

A lightweight Symfony bundle to integrate a Markdown editor (EasyMDE) into your forms using a reusable FormType.

The bundle packages the required JS/CSS assets and provides a simple configuration and rendering mechanism.

✨ Features

  • Simple integration of EasyMDE Markdown editor via a custom FormType.
  • Bundled JS/CSS assets, no external CDN dependency required.
  • Ready-to-use form integration; un exemple complet est fourni dans sample/.
  • Symfony 7 compatible.
  • Assets auto-installed via assets:install.

🚀 Installation

Require the bundle via Composer:

composer require bnine/mdeditorbundle

Then install the assets:

php bin/console assets:install

Make sure Symfony copies the bundle's public assets to public/bundles/bninemdeditor.

🧩 Usage

Include the JavaScript helper in your base layout

In your base Twig layout (e.g. base.html.twig), add:

<script src="{{ asset('bundles/bninemdeditor/bninemdeditor.js') }}"
        data-css="{{ asset('bundles/bninemdeditor/easymde.min.css') }}"
        data-js="{{ asset('bundles/bninemdeditor/easymde.min.js') }}"></script>

Use the MarkdownType in a Form

<?php

namespace Bnine\MdEditorBundle\Form;

use Bnine\MdEditorBundle\Dto\Markdown;
use Bnine\MdEditorBundle\Form\Type\MarkdownType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class DtoType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('markdown', MarkdownType::class)
            ->add('submit', SubmitType::class, [
                'label' => 'Prévisualiser',
            ]);
    }

    public function configureOptions(OptionsResolver $resolver): void
    {
        $resolver->setDefaults([
            'data_class' => Markdown::class,
        ]);
    }
}

📦 Requirements

  • PHP ^8.1
  • PHP ^8.1
  • Symfony ^7.1
  • league/commonmark et twig/markdown-extra (fournis par le bundle)

📜 License

MIT

👤 Author

Arnaud Fornerot
https://github.com/afornerot