Weave 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 Marker Extension

Commonmark Marker Extension Laravel Package

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.

View on GitHub
Deep Wiki
Context7

A League CommonMark extension that adds support for ==marker== syntax, rendering highlighted text with <mark> tags. Seamlessly integrate it into any CommonMark environment to parse and convert ==highlighted== inline content without writing custom parsers.

  • Registers a dedicated inline parser for ==...== markers
  • Produces semantic <mark> HTML output
  • Works with the league/commonmark Environment
  • Simple one-line configuration
  • Follows CommonMark delimiter rules for clean, predictable parsing
Frequently asked questions about Commonmark Marker Extension
How do I install n0sz/commonmark-marker-extension?
Run composer require n0sz/commonmark-marker-extension, then register the extension in your League CommonMark Environment with addExtension(). Check the package composer.json constraints first to confirm it accepts the league/commonmark version your project already has locked. Because there has been no release since September 2022, review the source before putting it into production.
Does this extension work with Laravel 11 and 12?
Laravel renders Markdown through league/commonmark 2.x, and this package targets that same 2.x line, so it should install and run on Laravel 11 and 12. The version constraint is the deciding factor: a future CommonMark 3.x upgrade will break the extension whether or not you vendored it. Test the install against your actual locked PHP and CommonMark versions rather than assuming.
What Markdown syntax does the marker extension add?
It adds marker syntax so text wrapped in delimiters is rendered inside an HTML mark element for highlighting. The canonical form is ==text==, and the extension registers an inline parser plus a renderer instead of monkey-patching the core parser. Verify the exact delimiters and edge-case behavior in the source, since the grammar is implied by the implementation rather than documented.
How do I register the extension in a CommonMark Environment?
Build a League CommonMark Environment, call addExtension() with the package extension class, and construct a MarkdownConverter from that environment. In Laravel, bind the configured converter as a singleton in a service provider so Str::markdown(), the Blade markdown component, and Mail templates all share one instance. Avoid letting each call create a fresh default environment, which would silently drop the extension.
Is n0sz/commonmark-marker-extension still maintained?
No. The last release was 2022-09-27, the repository has around 3 stars and 0 dependents, and there is no visible CI or test suite. Treat it as unvetted code rather than a dependency with a community behind it. If you need the feature long term, plan to vendor or fork it under the MIT license.
Does it work with Str::markdown() and the Blade markdown component?
Only if those surfaces use an environment that includes the extension. Str::markdown() accepts an extensions option, and the Blade markdown component and Mail markdown templates funnel into the same CommonMark environment, so a shared singleton binding keeps output consistent. Passing the extension per call also works but risks divergence between API, Blade, and Mail rendering.
Is it safe to use with untrusted user-generated Markdown?
Be cautious. The extension executes in the parsing path of every document, including untrusted input, so read it line by line for regex backtracking and confirm the renderer escapes output correctly. Check whether raw HTML passthrough is permitted before enabling it on any endpoint that accepts user content, and run adversarial input through it first.
Can I change the highlight element or add a CSS class?
The renderer emits a mark element, and customization depends on whether the package exposes configuration, which the README does not document. If it does not, editing or subclassing the renderer to add a class is a small change. If you vendor the code, make the element tag and attributes configurable so your stylesheets can target the output reliably.
Does the marker syntax conflict with strikethrough or emphasis?
Delimiter processors share the inline parsing pipeline, so overlapping runs of =, ~, and * can misparse, especially with triple delimiters or nested emphasis inside a marker. The package ships no published tests proving these edge cases, so reproduce them yourself. Add regression tests for adjacent delimiters before relying on the extension.
Should I require this package or fork it into my app?
Given zero upstream maintenance and a roughly 150-line codebase, vendoring the source into app/Support/Markdown/ under your own namespace is usually the better trade. You get an auditable, testable extension at about the same integration cost and can harden escaping and regex behavior along the way. Require it only if you are comfortable pinning league/commonmark 2.x and reading the source anyway.
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.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections