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 Sup Sub Extensions Laravel Package

ows/commonmark-sup-sub-extensions

Add superscript and subscript support to your CommonMark markdown with this lightweight PHP extension. It registers ^text^ and text style syntax so you can render scientific notation, footnotes, and chemical formulas cleanly in Laravel or any CommonMark-powered app.

Deep Wiki
Context7

Technical Evaluation

Architecture fit. The package is a narrowly scoped league/commonmark extension that adds superscript/subscript inline parsing and rendering. Architecturally it slots into the same parser Laravel already depends on (league/commonmark powers Str::markdown() and Markdown mail templates), so there is no new runtime, service, or datastore. Fit is good if the application has a genuine scientific/technical notation requirement (footnote markers, exponents, chemical formulas, version annotations). Fit is poor if adopted opportunistically: CommonMark has no sup/sub syntax, so this introduces a non-standard dialect that will not render on GitHub, in most editors, or in downstream consumers.

Integration feasibility. Mechanically simple: composer require, instantiate the extension, register it on a Environment/converter. The friction is Laravel-side, not package-side. Str::markdown() builds a GithubFlavoredMarkdownConverter internally and does not expose extension registration, and Laravel's Markdown mail renderer likewise owns its converter. Integration therefore requires replacing or wrapping the framework's default pipeline (custom singleton, Blade directive, or a Str::macro) rather than a config flag. That is a contained change but touches a shared rendering path, so it should be scoped to specific content types, not applied globally.

Technical risk.

  • Licensing (highest severity). GPL-3.0 is copyleft and inconsistent with the MIT/Apache posture of a typical Laravel product. SaaS use without distribution is generally not triggered, but any on-prem, appliance, or white-label distribution likely creates disclosure obligations for the combining work. This needs legal sign-off before engineering effort, and is a strong argument for an in-house equivalent given the small surface area.
  • Supply chain / provenance. Repository is unknown and the package has ~10 stars. Source, maintainer identity, test coverage, and CI cannot be verified from the metadata provided. The reported last release date (2026-10-30) is anomalous and suggests unreliable registry data — treat all metadata as unverified.
  • Version coupling. CommonMark v1 → v2 changed extension and environment APIs. Laravel 10/11 ships commonmark v2; if this package targets v1, it is unusable without a fork. Composer constraints must be the first thing checked.
  • Dialect collisions. ~ overlaps GFM strikethrough (~~text~~) and ^ appears in shell snippets and code. Inline parser precedence determines whether existing content silently changes meaning. Escaping behavior must be tested explicitly.
  • Output safety. Renderers emit raw <sup>/<sub>; confirm the extension respects html_input/allow_unsafe_links and does not open an escaping gap in the surrounding sanitization layer.

Key questions.

  1. Is the repository public and auditable, and who maintains it?
  2. What league/commonmark versions are supported, and is there CI against v2?
  3. Under what distribution model will this ship (SaaS only vs. distributed), and does Legal accept GPL-3.0?
  4. Is the delimiter syntax configurable, and how does it interact with GFM strikethrough and code spans?
  5. Does the package's parsed output survive our existing HTML sanitization pipeline unchanged?

Integration Approach

Stack fit. Composer-native, no PHP extensions or system dependencies. The only decision point is where the converter lives: a dedicated MarkdownRenderer service bound as a singleton, injected into the resources/controllers that need notation support, with the framework default left untouched for mail and general-purpose markdown.

Migration path. Do not swap the global markdown pipeline. Instead:

  1. Pin the package and verify it resolves against the installed league/commonmark version in a scratch branch.
  2. Build the custom Environment, register the extension, and expose it behind one service class.
  3. Run a corpus diff: render a representative sample of stored content (docs, comments, product copy) through old and new converters and diff the HTML. Any change on existing content is a migration incident waiting to happen.
  4. Decide escaping policy for literal ^ and ~, and document it for authors.

Compatibility. Verify against the exact Laravel and commonmark versions in composer.lock before anything else. Because the framework's Str::markdown() and mail renderer are not extension-aware, plan for a thin adapter and accept that behavior will differ between "rich content" fields and everything else. If the package targets an older commonmark major, fork-and-patch is a realistic outcome — budget for it.

Sequencing. Legal/license review → version compatibility spike → adapter implementation → corpus diff → sanitization verification → internal docs/authoring guidance → feature-flag rollout to a single low-risk surface → expand. Do not gate a release on this; it is a content-capability enhancement, not a dependency.

Build-vs-buy note. Given the tiny feature surface and the GPL/no-provenance profile, an in-house SupExtension/SubExtension (inline parser + renderer, roughly a day of work for someone fluent in CommonMark's delimiter model) is a credible alternative that removes both the license and the supply-chain question entirely. Recommend pricing that option before committing.

Operational Impact

Maintenance. Low ongoing effort if it works, but the maintenance burden is effectively ours: single-purpose community package, minimal adoption, unverified maintainer activity. Expect to own patches for commonmark major bumps. No vendor support channel exists.

Support. Failures will surface as "markdown looks wrong" reports from content authors, not as exceptions, which makes triage slow and diffuse. Requires a documented syntax guide and a clear statement of which fields support the notation. Add a rendering test fixture so regressions are caught in CI rather than by users.

Scaling. Negligible. Parsing is per-render and cheap; the correct pattern is to cache rendered HTML keyed by a content hash so the extension is not invoked on every request. No impact on queue, DB, or infra footprint.

Failure modes.

  • Composer update pulls a new commonmark major → converter construction throws at boot, taking down any page that renders markdown. Mitigate with a pinned constraint and a boot-time smoke test.
  • Delimiter collision silently rewrites existing content (e.g., ~~struck~~ becoming subscript). Mitigate with the corpus diff and explicit escaping rules.
  • Escaping regression in the renderer → XSS in user-generated content. Mitigate by keeping the existing sanitizer as the final stage and testing it against sup/sub payloads.
  • Package abandonment → frozen against future commonmark releases. Mitigate by vendoring or in-housing; the code is small enough to fork cleanly.

Ramp-up. Developer ramp-up is minimal — anyone who has touched CommonMark extensions can wire this in an afternoon, and authors need only a one-page syntax reference. The real ramp-up cost is organizational: legal review of GPL-3.0, plus editorial discipline to keep the non-standard dialect from leaking into content that gets syndicated or exported. If the content is ever rendered outside this application, the notation degrades to literal caret and tilde characters, which is a product-visible defect rather than a technical one.

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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console