Download the PHP package clementtalleu/easyadmin-markdown-bundle without Composer
On this page you can find all versions of the php package clementtalleu/easyadmin-markdown-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download clementtalleu/easyadmin-markdown-bundle
More information about clementtalleu/easyadmin-markdown-bundle
Files in clementtalleu/easyadmin-markdown-bundle
Package easyadmin-markdown-bundle
Short Description A Markdown editor field for EasyAdmin, powered by EasyMDE.
License MIT
Homepage https://github.com/clementtalleu/easyadmin-markdown-bundle
Informations about the package easyadmin-markdown-bundle
EasyAdminMarkdownBundle
A Markdown editor field for EasyAdmin, powered by the EasyMDE JavaScript editor.
It provides a MarkdownEditorField that behaves like EasyAdmin's built-in
TextEditorField (which uses Trix), but lets your users write Markdown with
a live preview, a toolbar and keyboard shortcuts. On the detail page the stored
Markdown is rendered as sanitized HTML.
| PHP | >= 8.2 |
| Symfony | 7.x and 8.x |
| EasyAdmin | 4.x and 5.x |
| Asset pipeline | AssetMapper (no build step required) |
Installation
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Step 1: Install the bundle
If your application uses Symfony Flex, the bundle is enabled
automatically. Otherwise, enable it by hand in config/bundles.php:
Step 2: Install the EasyMDE assets
The bundle never ships third-party JavaScript itself, so you add EasyMDE to your application's importmap. Use the self-contained build (it bundles CodeMirror and marked), which works reliably with AssetMapper:
That's it — the field automatically loads its own JavaScript (as an ES module)
and stylesheet from the bundle, and the editor resolves EasyMDE from your
importmap. No importmap.php editing is required.
Step 3 (optional): Enable HTML rendering on the detail page
To render the Markdown as HTML on the detail page, install a Markdown parser:
If you skip this step, the detail page falls back to displaying the raw Markdown source as plain text.
Usage
Use the field in any EasyAdmin CRUD controller, exactly like the native fields:
Options
setNumOfRows()
Sets the initial height (in rows) of the editor when its content is empty:
setEasyMdeConfig()
Passes any EasyMDE configuration option to the editor. The array is JSON-encoded and forwarded to the EasyMDE constructor on the client side:
By default the bundle disables EasyMDE's built-in spell checker and status bar,
and does not download Font Awesome (EasyAdmin already provides icons). You can
re-enable any of these through setEasyMdeConfig().
renderAsHtml()
Forces (or disables) HTML rendering on the detail page, regardless of whether
league/commonmark is installed:
How it works
- The field renders a standard
<textarea>whose configuration is exposed throughdata-*attributes. - A small, framework-agnostic JavaScript module (loaded through AssetMapper) scans the page and initializes EasyMDE on each editor — the same self-contained approach EasyAdmin uses for its own Trix editor, so it does not require a Stimulus application to be running on the admin pages.
- The editor keeps the original
<textarea>in sync so the form submits the Markdown source and EasyAdmin's "unsaved changes" detection keeps working. - Required fields are validated client-side even though EasyMDE hides the original textarea.
- Markdown rendered on the detail page is sanitized (raw HTML is escaped and unsafe links are stripped) to prevent stored XSS.
Security
The Markdown rendered on the detail page is converted with
league/commonmark configured with html_input: escape and
allow_unsafe_links: false. Any HTML embedded in the Markdown source is escaped
rather than executed.
Running the tests
License
This bundle is released under the MIT license.
All versions of easyadmin-markdown-bundle with dependencies
easycorp/easyadmin-bundle Version ^4.24 || ^5.0
symfony/asset-mapper Version ^7.0 || ^8.0
symfony/form Version ^7.0 || ^8.0
symfony/framework-bundle Version ^7.0 || ^8.0
symfony/twig-bundle Version ^7.0 || ^8.0