Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Commonmark Laravel Package

league/commonmark

Extensible PHP Markdown parser supporting the full CommonMark spec and GitHub-Flavored Markdown. Works with PHP 7.4+ (mbstring) and provides simple converters to turn Markdown into HTML with configurable safety options.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Content Strategy & Documentation:

    • Enable Markdown-first content creation for documentation, blogs, or internal wikis (e.g., Laravel’s official docs, developer portals).
    • Replace or augment WYSIWYG editors with lightweight Markdown for structured content (e.g., admin panels, CMS backends).
    • Roadmap: Phase out legacy HTML editors in favor of Markdown for consistency and developer adoption.
  • Build vs. Buy:

    • Buy: Avoid reinventing a Markdown parser (security, compliance, performance).
    • Extend: Customize parsing rules (e.g., domain-specific syntax, security filters) via extensions (e.g., HighlightExtension, YouTubeEmbed).
    • Integrate: Leverage existing Laravel/PHP ecosystems (e.g., Blade templates, API responses) without vendor lock-in.
  • Use Cases:

    • Internal Tools: Parse user-generated Markdown in support tickets, comments, or knowledge bases (e.g., GitHub-style task lists).
    • Public-Facing: Render blog posts, API docs, or help centers with GitHub Flavored Markdown (GFM) support (tables, task lists).
    • Security-Critical: Sanitize untrusted input (e.g., forum posts) with html_input: 'strip' and allow_unsafe_links: false to prevent XSS/SSRF.
    • Performance: Benchmark against alternatives (e.g., parsedown, michelf/php-markdown) for high-throughput systems (e.g., real-time previews).

When to Consider This Package

  • Adopt if:

    • Your stack is PHP/Laravel and you need CommonMark/GFM compliance (e.g., migrating from parsedown or Michelf/Markdown).
    • You require extensibility (e.g., custom syntax, security filters, or integrations like LaTeX or Pygments).
    • Security is critical: Actively maintained with recent fixes for XSS/SSRF (e.g., DisallowedRawHtml, DomainFilteringAdapter).
    • You need GitHub-like features (task lists, tables, autolinks) without bloating dependencies.
    • Performance matters: Optimized regex and benchmarked against competitors (e.g., CommonMark JS).
  • Look elsewhere if:

    • You’re not using PHP/Laravel: Consider remark (Node.js), python-markdown, or marked.js.
    • You need real-time collaboration: Pair with tools like TipTap or ProseMirror for live editing.
    • Legacy systems require non-UTF-8 encodings (package enforces UTF-8/ASCII).
    • You prioritize WYSIWYG over Markdown: Use TinyMCE, CKEditor, or Quill instead.
    • Minimalism is key: For simple use cases, parsedown or michelf/php-markdown may suffice with fewer dependencies.

How to Pitch It (Stakeholders)

For Executives:

"This is a strategic investment in developer productivity and content security. By adopting league/commonmark, we can:

  • Reduce technical debt: Replace fragmented Markdown parsers (e.g., parsedown, custom regex) with a maintained, spec-compliant solution.
  • Improve security: Actively patched for XSS/SSRF (e.g., recent fixes for DisallowedRawHtml and domain filtering).
  • Future-proof content: Support GitHub Flavored Markdown (tables, task lists) for modern workflows, aligning with tools like Notion or GitHub.
  • Cut costs: Avoid reinventing parsing logic; leverage a battle-tested library used by Laravel, Drupal, and Cachet. Integration is lightweight (Composer install) and scales from blogs to internal docs. ROI: Faster content creation, lower maintenance risk, and compliance with security best practices."

For Engineering:

"league/commonmark is a drop-in replacement for ad-hoc Markdown parsing with key advantages:

  • Performance: Optimized regex and benchmarked against competitors (e.g., CommonMark JS).
  • Extensibility: Add custom syntax (e.g., emoji, YouTube embeds) via extensions without forking.
  • Security: Built-in safeguards for untrusted input (e.g., html_input: 'strip', allow_unsafe_links: false). Recent fixes address XSS/SSRF in DisallowedRawHtml and domain filtering.
  • Laravel Synergy: Works seamlessly with Blade templates, API responses, and caching (e.g., pre-render Markdown to HTML).
  • Roadmap Alignment: Supports CommonMark/GFM specs, so we’re not locked into proprietary formats. Trade-offs: UTF-8/ASCII only; if you need legacy encodings, pre-process input. For simple cases, parsedown is lighter, but lacks GFM features and extensibility. Recommendation: Use for all new Markdown projects; migrate legacy systems in phases. Pair with HTML Purifier for additional sanitization if needed."
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope