webuni/commonmark-attributes-extension
最新稳定版本:1.0.0
Composer 安装命令:
composer require webuni/commonmark-attributes-extension
包简介
The attributes extension adds a syntax to define attributes on the various HTML elements in CommonMark PHP implementation.
README 文档
README
The Attributes extension adds a syntax to define attributes on the various HTML elements in markdown’s output.
DEPRECATED
This extension has been deprecated. All of its functionality now exists in league/commonmark 1.5+ under the League\CommonMark\Extension\Attributes namespace, so you should upgrade to that version and use that bundled extension instead of this one.
Installation
This project can be installed via Composer:
composer require webuni/commonmark-attributes-extension Usage
use League\CommonMark\Converter; use League\CommonMark\DocParser; use League\CommonMark\Environment; use League\CommonMark\HtmlRenderer; use Webuni\CommonMark\AttributesExtension\AttributesExtension; $environment = Environment::createCommonMarkEnvironment(); $environment->addExtension(new AttributesExtension()); $converter = new Converter(new DocParser($environment), new HtmlRenderer($environment)); echo $converter->convertToHtml('# Hello World!');
Syntax
The basic syntax was inspired by Kramdown‘s Attribute Lists feature.
You can assign any attribute to a block-level element. Just directly prepend or follow the block with a block inline attribute list. That consists of a left curly brace, optionally followed by a colon, the attribute definitions and a right curly brace:
> A nice blockquote {: title="Blockquote title"} {#id .class} ## Header
As with a block-level element you can assign any attribute to a span-level elements using a span inline attribute list, that has the same syntax and must immediately follow the span-level element:
This is *red*{style="color: red"}. webuni/commonmark-attributes-extension 适用场景与选型建议
webuni/commonmark-attributes-extension 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 152.77k 次下载、GitHub Stars 达 33, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「markdown」 「attributes」 「commonmark」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 webuni/commonmark-attributes-extension 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 webuni/commonmark-attributes-extension 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 webuni/commonmark-attributes-extension 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
Allows HTML tags to be used in Markdown, while still escaping or stripping all other HTML input.
Adds more BBCode
A library that allows you to easily use the PHP-VCR library in your PHPUnit tests.
This Package provides some usefully console features like the attribute syntax for arguments and options, validation, auto ask and casting.
League/commonmark extension for HTML figure and caption.
统计信息
- 总下载量: 152.77k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 33
- 点击次数: 21
- 依赖项目数: 12
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04