PHPackages                             evirma/commonmark-ext-attributes - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. evirma/commonmark-ext-attributes

ActiveCommonmark-extension[Parsing &amp; Serialization](/categories/parsing)

evirma/commonmark-ext-attributes
================================

The Attributes extension adds a syntax to define HTML-attributes on the various block and inline elements in League CommonMark PHP implementation.

v1.0.1(5y ago)01.4k[1 issues](https://github.com/evirma/commonmark-ext-attributes/issues)2MITPHPPHP ^7.1 || ^8.0

Since Jun 18Pushed 5y ago1 watchersCompare

[ Source](https://github.com/evirma/commonmark-ext-attributes)[ Packagist](https://packagist.org/packages/evirma/commonmark-ext-attributes)[ Docs](https://github.com/evirma/commonmark-ext-attributes)[ RSS](/packages/evirma-commonmark-ext-attributes/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (4)Versions (3)Used By (2)

League CommonMark Attributes Extension
======================================

[](#league-commonmark-attributes-extension)

The Attributes extension adds a syntax to define HTML-attributes on the various block and inline elements in League CommonMark PHP implementation. Martin Hasoň wrote extension for commonmark v0.18 and lower, it was fully rebuild for v1.0. Be aware that priority of applying css classes was changed.

Installation
------------

[](#installation)

This project can be installed via Composer:

```
composer require evirma/commonmark-ext-attributes

```

Usage
-----

[](#usage)

```
use League\CommonMark\Converter;
use League\CommonMark\DocParser;
use League\CommonMark\Environment;
use League\CommonMark\HtmlRenderer;
use Evirma\CommonMark\Extension\AttributesExtension;

$environment = Environment::createCommonMarkEnvironment();
$environment->addExtension(new AttributesExtension());

$converter = new Converter(new DocParser($environment), new HtmlRenderer($environment));

echo $converter->convertToHtml('# Hello World! {#hello}');
```

Syntax
------

[](#syntax)

The basic syntax was inspired by [Kramdown](http://kramdown.gettalong.org/syntax.html#attribute-list-definitions)‘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"}.
This is *with id*{#some-id}.
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~592 days

Total

2

Last Release

1930d ago

PHP version history (2 changes)v1.0.0PHP ^7.1

v1.0.1PHP ^7.1 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/476450?v=4)[Eugene Myazin](/maintainers/meniam)[@meniam](https://github.com/meniam)

---

Tags

phpmarkdowncommonmarkattributes

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/evirma-commonmark-ext-attributes/health.svg)

```
[![Health](https://phpackages.com/badges/evirma-commonmark-ext-attributes/health.svg)](https://phpackages.com/packages/evirma-commonmark-ext-attributes)
```

###  Alternatives

[torchlight/torchlight-commonmark

A Commonmark extension for Torchlight, the syntax highlighting API.

29256.6k6](/packages/torchlight-torchlight-commonmark)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
