PHPackages                             8fold/commonmark-accessible-heading-permalinks - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. 8fold/commonmark-accessible-heading-permalinks

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

8fold/commonmark-accessible-heading-permalinks
==============================================

An extension of PHP League's CommonMark library to enable accessible Heading Permalinks usage.

1.0.0(3y ago)02.3k1MITPHPPHP ^8.1

Since Nov 13Pushed 3y ago1 watchersCompare

[ Source](https://github.com/8fold/commonmark-accessible-heading-permalinks)[ Packagist](https://packagist.org/packages/8fold/commonmark-accessible-heading-permalinks)[ GitHub Sponsors](https://github.com/8fold)[ GitHub Sponsors](https://github.com/joshbruce)[ RSS](/packages/8fold-commonmark-accessible-heading-permalinks/feed)WikiDiscussions main Synced 4w ago

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

8fold Accessible Heading Permalinks for CommonMark
==================================================

[](#8fold-accessible-heading-permalinks-for-commonmark)

This library is an extension for the [CommonMark parser](https://github.com/thephpleague/commonmark) from the PHP League adding accessible heading permalinks inspired by [Amber Wilson](https://amberwilson.co.uk/blog/are-your-anchor-links-accessible/).

> 🗒 Note: The HTML rendered on this page most likely doesn't use this approach.

> ⚠️ Warning: Do NOT use with the heading permalinks extension provided with CommonMark. I'm not sure what will happen; could be nothing, could be a singularity causing event, who knows?

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

[](#installation)

```
composer require 8fold/commonmark-accessible-heading-permalinks
```

Usage
-----

[](#usage)

```
use League\CommonMark\Environment\Environment;
use League\CommonMark\MarkdownConverter;

use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;

use Eightfold\CommonMarkAccessibleHeadingPermalink\HeadingPermalinkExtension;

$environment = new Environment();
$environment->addExtension(new CommonMarkCoreExtension());
$environment->addExtension(new HeadingPermalinkExtension());

$converter = new MarkdownConverter($environment);
```

Then write the markdown as you normally would.

```
# Hello

This should be an improvement.
```

Which will output the following (whitespace added for improved readability).

```

  Hello

    ¶
    Section titled Hello

```

Details
-------

[](#details)

The HTML is treated as a whole component. Styling the inner elements can be accomplished by referencing the containing element and using child and sibling selectors.

For example, the second `span` in the link should be primarily reserved for those using assistive technologies. Therefore, I want it to be off-screen and still read aloud when on the link has focus.

```
div[is='heading-wrapper'] > a > span:nth-of-type(2) {
  position: absolute;
  left: -999em;
  right: auto;
}
```

This example uses the solution provided by the [United States Web Design System](https://github.com/uswds/uswds/blob/1908d1391bc59410624ca1934cc70b7404e8f443/src/stylesheets/core/mixins/_screen-reader.scss) and is not the only method used or available to accomplish similar results.

Other
-----

[](#other)

- [Code of Conduct](https://github.com/8fold/commonmark-fluent-markdown/blob/main/.github/CODE_OF_CONDUCT.md)
- [Contributing](https://github.com/8fold/commonmark-accessible-heading-permalinks/blob/main/.github/CONTRIBUTING.md)
- [Governance](https://github.com/8fold/commonmark-accessible-heading-permalinks/blob/main/.github/GOVERNANCE.md)
- [Versioning](https://github.com/8fold/commonmark-accessible-heading-permalinks/blob/main/.github/VERSIONING.md)
- [Security](https://github.com/8fold/commonmark-accessible-heading-permalinks/blob/main/.github/SECURITY.md)
- [Coding Standards and Style](https://github.com/8fold/commonmark-accessible-heading-permalinks/blob/main/.github/coding-standards-and-styles.md)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~252 days

Total

2

Last Release

1385d ago

Major Versions

0.0.1 → 1.0.02022-07-23

PHP version history (2 changes)0.0.1PHP ^7.4||^8.0

1.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/3ff7aa36dc04c5b535cd71eadbf66038401edde0c9dfaa688bec4fc16c6d7e8b?d=identicon)[eightfold](/maintainers/eightfold)

---

Top Contributors

[![joshbruce](https://avatars.githubusercontent.com/u/15252830?v=4)](https://github.com/joshbruce "joshbruce (28 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/8fold-commonmark-accessible-heading-permalinks/health.svg)

```
[![Health](https://phpackages.com/badges/8fold-commonmark-accessible-heading-permalinks/health.svg)](https://phpackages.com/packages/8fold-commonmark-accessible-heading-permalinks)
```

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

22.8k69.3k](/packages/grumpydictator-firefly-iii)[phiki/phiki

Syntax highlighting using TextMate grammars in PHP.

3573.0M23](/packages/phiki-phiki)[spatie/commonmark-highlighter

Highlight your markdown code blocks with league/commonmark

138400.5k19](/packages/spatie-commonmark-highlighter)[monsieurbiz/sylius-rich-editor-plugin

A Rich Editor plugin for Sylius.

75380.8k6](/packages/monsieurbiz-sylius-rich-editor-plugin)[horstoeko/zugferdvisualizer

A library

33198.3k2](/packages/horstoeko-zugferdvisualizer)[torchlight/engine

The PHP-based Torchlight code annotation and rendering engine.

655.7k4](/packages/torchlight-engine)

PHPackages © 2026

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