yivoff/commonmark-bundle
A Symfony bundle that wraps the league/commonmark Markdown parser, providing a configurable CommonMark converter service and Twig filter for rendering Markdown in templates. It simplifies setup for projects that need consistent Markdown-to-HTML conversion.
league/commonmark v2 — a mature, widely used library. This bundle is a thin Symfony DI layer on top of it. That reframes the buy decision: you are not buying a Markdown engine, you are buying roughly a service-definition file and a compiler pass. The real question is "do we want to spend a sprint designing a converter-registry abstraction, or copy ~200 lines of YAML/PHP?"Adopt (or, more realistically, vendor/fork) when all of the following hold:
league/commonmark plus a single service definition — or over Twig's markdown filter via twig/markdown-extra.Look elsewhere, or plan to substitute, when:
symfony/ux-markdown (first-party, actively maintained) or wire league/commonmark yourself — the latter is a legitimate afternoon of work.Environment object.league/commonmark gets those; this wrapper is a fixed snapshot of its config surface.Net PM recommendation: do not add this as a live dependency. Instead, read it as a design reference — the "multiple named converters" pattern is worth adopting, and the bundle demonstrates the shape of it — then implement the pattern in-house against league/commonmark v2 directly, or fork the bundle under your own namespace if you want the config-driven ergonomics.
To executives (30 seconds): We need different Markdown safety settings for different parts of the product — locked-down for anything a customer types, feature-rich for content our own team writes. The open-source package that solves this is MIT-licensed and free, but it's effectively abandoned (last release 2021, two stars, no users). Recommendation: don't depend on it. The idea is worth ~1 engineering day to implement ourselves on top of the well-maintained league/commonmark library, which we'd be using either way. This de-risks a future security/compliance conversation at trivial cost and avoids onboarding a dependency nobody maintains.
To engineering: yivoff/commonmark-bundle is a Symfony 5 DI wrapper that lets you register N named league/commonmark converters with distinct configs. The parsing is all upstream — the bundle is a compiler pass and some service definitions. Value is the named-converter registry pattern, not the code volume. Concrete ask: spend a day building markdown.converter.<name> services with a tagged locator, one hardening profile (no HTML, html_input: strip) and one extended profile. Constraints to note: the bundle is Symfony 5-only and unmaintained, so pulling it in directly creates an upgrade blocker at the exact moment we move to Symfony 6.4/7. If we want it verbatim, vendor it under our namespace so we control the release.
To security/compliance: this is the mechanism that makes "untrusted Markdown is rendered with raw HTML disabled and unsafe links stripped" a declarative, reviewable configuration rather than an assumption spread across templates. That's the audit artifact worth having.
How can I help you explore Laravel packages today?