n0sz/commonmark-marker-extension
A Laravel and PHP CommonMark extension that adds marker-style highlighting to your Markdown. Wrap text with marker syntax and render it as highlighted output, making it easy to emphasize key passages in docs, notes, and user-generated content.
Architecture fit. Laravel renders markdown through league/commonmark — Str::markdown(), the Blade markdown component, and Mail's markdown templates all funnel into the same Environment. Any extension in that ecosystem composes via Environment::addExtension(), so the package's integration surface is one line of configuration. The extension presumably registers an inline parser and delimiter processor for ==text== plus a renderer emitting <mark>. That is the canonical, supported extension pattern — it does not monkey-patch or replace the parser, so it will not fight with core features.
Integration feasibility. Low effort, low certainty. Mechanically: composer require n0sz/commonmark-marker-extension, then bind it into a custom MarkdownConverter singleton or pass it via the extensions option wherever markdown is rendered. The real work is not integration — it is due diligence on the syntax contract and parser correctness.
Technical risk. This is the dominant concern and it is high relative to the value delivered:
league/commonmark ^2.0. Laravel 11/12 still ships CommonMark 2.x, so it likely installs — but the constraint will eventually pin the app's own upgrade path.Key questions.
==mark==, !!mark!!, other)? Is the grammar documented or only implied by the implementation?~~, superscript, emphasis boundaries) — does === or nested emphasis misparse?Stack fit. Clean. It targets the same league/commonmark environment Laravel already uses, so there is no parallel rendering pipeline to maintain and no divergence between API, Blade, and Mail rendering — provided all three are pointed at one configured Environment rather than letting Str::markdown() spin up a default each call.
Migration path. There is no incumbent to displace, so this is greenfield. The pragmatic route:
app/Support/Markdown/ under our own namespace.MarkdownServiceProvider binding a configured Environment into the container so every consumer shares one instance.This yields the feature as an owned, auditable ~150-line extension instead of an orphaned dependency — at roughly the same cost as integrating the package properly.
Compatibility. Verify composer.json constraints against the PHP and league/commonmark versions actually installed. If it pins ^2.0 and we are on 2.x, it installs; a future 3.x move breaks it whether or not we vendored it. Treat the CommonMark version constraint as the deciding factor for fork-versus-require.
Sequencing. (a) Decide the syntax contract independently of this package; (b) one-day spike reading the source and reproducing the feature; (c) security review of escaping and regex behavior with adversarial input; (d) wire the shared Environment binding; (e) enable per surface — Mail, then Blade, then user-generated content last.
Maintenance. Effectively zero upstream. A 2022 release with no dependents and no visible activity should be treated as archived. Budget for owning the code: small but non-zero, concentrated at CommonMark major-version bumps.
Support. None. No issue triage, no security advisories, no CVE feed we would be notified through. Any vulnerability is found by us or not at all — which is precisely why fork-and-own beats a silent composer require.
Scaling. Negligible. Inline delimiter parsing is linear in document size and runs in the same pass the core parser already performs. No new I/O, no caching implications, no measurable throughput change at realistic document sizes.
Failure modes.
== sequences producing stray <mark> tags or broken emphasis. Silent, cosmetic, but user-visible.league/commonmark constraint blocks or complicates a framework upgrade at the worst moment.Ramp-up. Very low. A mid-level Laravel engineer can reimplement ==text== highlighting as a CommonMark extension in under a day using the official custom-extension docs. The package saves a few hours and costs a dependency audit. Recommendation: adopt the idea and the syntax contract, verify the implementation, and ship the extension as owned code rather than as a third-party require.
How can I help you explore Laravel packages today?