PHPackages                             moxio/commonmark-ext-definition-list - 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. moxio/commonmark-ext-definition-list

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

moxio/commonmark-ext-definition-list
====================================

Extension for league/commonmark to support definition lists

v1.1.0(4y ago)410.3k2MITPHPPHP ^7.4 || ^8.0CI passing

Since Sep 18Pushed 5mo ago10 watchersCompare

[ Source](https://github.com/Moxio/commonmark-ext-definition-list)[ Packagist](https://packagist.org/packages/moxio/commonmark-ext-definition-list)[ RSS](/packages/moxio-commonmark-ext-definition-list/feed)WikiDiscussions master Synced today

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

[![Continuous Integration](https://github.com/Moxio/commonmark-ext-definition-list/workflows/Continuous%20Integration/badge.svg)](https://github.com/Moxio/commonmark-ext-definition-list/workflows/Continuous%20Integration/badge.svg)[![Latest Stable Version](https://camo.githubusercontent.com/65ea4500b4f5d9a9f60bb508e6a811934395856ac6a63f09f0ee6fdbfa35d077/68747470733a2f2f706f7365722e707567782e6f72672f6d6f78696f2f636f6d6d6f6e6d61726b2d6578742d646566696e6974696f6e2d6c6973742f762f737461626c65)](https://packagist.org/packages/moxio/commonmark-ext-definition-list)[![Buy us a tree](https://camo.githubusercontent.com/130148911f548b001b2ac68a32c0a06559977ca60ada3bf480c72ae4ea093175/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54726565776172652d2546302539462538432542332d6c69676874677265656e)](https://plant.treeware.earth/Moxio/commonmark-ext-definition-list)

moxio/commonmark-ext-definition-list
====================================

[](#moxiocommonmark-ext-definition-list)

Extension for the `league/commonmark` Markdown parser to support definition lists.

Uses unofficial markdown syntax based on the syntax supported by [PHP Markdown Extra](https://michelf.ca/projects/php-markdown/extra/#def-list), [Pandoc](https://pandoc.org/MANUAL.html#definition-lists) and [markdown-it](https://github.com/markdown-it/markdown-it-deflist). See the section [Syntax](#syntax) below for details.

Requirements
------------

[](#requirements)

This library requires PHP version 7.4 or higher and a `1.x` release of `league/commonmark`.

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

[](#installation)

Install as a dependency using composer:

```
$ composer require --dev moxio/commonmark-ext-definition-list

```

Usage
-----

[](#usage)

Add `DefinitionListExtension` as an extension to your CommonMark environment instance and you're good to go:

```
use League\CommonMark\CommonMarkConverter;
use League\CommonMark\Environment;
use Moxio\CommonMark\Extension\DefinitionList\DefinitionListExtension;

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

// Use $environment when building your CommonMarkConverter
$converter = new CommonMarkConverter([], $environment);
echo $converter->convertToHtml('
Term 1
: Definition of term 1.

Term 2
: Definition of term 2.
');
```

See the [CommonMark documentation](https://commonmark.thephpleague.com/1.5/extensions/overview/#usage)for more information about using extensions.

Syntax
------

[](#syntax)

The supported markdown syntax is based on the one used by [PHP Markdown Extra](https://michelf.ca/projects/php-markdown/extra/#def-list), [Pandoc](https://pandoc.org/MANUAL.html#definition-lists) and [markdown-it](https://github.com/markdown-it/markdown-it-deflist). Since there are subtle differences between the syntaxes understood by these libraries and there is no formally defined standard, 100% compatibility with any of the aforementioned libraries cannot be guaranteed. The use of the tilde (`~`) as a definition list marker (as understood by Pandoc) is also supported.

A simple example:

```
Apple
:   Pomaceous fruit of plants of the genus Malus in
the family Rosaceae.

Orange
:   The fruit of an evergreen tree of the genus Citrus.
```

The will yield HTML output like:

```

  Apple
  Pomaceous fruit of plants of the genus Malus in
the family Rosaceae.
  Orange
  The fruit of an evergreen tree of the genus Citrus.

```

A more complex example:

```
Term 1

:   This is a definition with two paragraphs. Lorem ipsum
    dolor sit amet, consectetuer adipiscing elit. Aliquam
    hendrerit mi posuere lectus.

    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
    vitae, risus.

:   Second definition for term 1, also wrapped in a paragraph
    because of the blank line preceding it.

Term 2

:   This definition has a code block, a blockquote and a list.

        code block.

    > block quote
    > on two lines.

    1.  first list item
    2.  second list item
```

Versioning
----------

[](#versioning)

This project adheres to [Semantic Versioning](http://semver.org/).

Contributing
------------

[](#contributing)

Contributions to this project are more than welcome. When reporting an issue, please include the input to reproduce the issue, along with the expected output. When submitting a PR, please include tests with your changes.

License
-------

[](#license)

This project is released under the MIT license.

Treeware
--------

[](#treeware)

This package is [Treeware](https://treeware.earth/). If you use it in production, then we'd appreciate it if you [**buy the world a tree**](https://plant.treeware.earth/Moxio/commonmark-ext-definition-list)to thank us for our work. By contributing to the Treeware forest you'll be creating employment for local families and restoring wildlife habitats.

---

Made with love, coffee and fun by the [Moxio](https://www.moxio.com) team from Delft, The Netherlands. Interested in joining our awesome team? Check out our [vacancies](https://werkenbij.moxio.com/) (in Dutch).

###  Health Score

40

—

FairBetter than 87% of packages

Maintenance51

Moderate activity, may be stable

Popularity24

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity61

Established project with proven stability

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

Total

3

Last Release

1601d ago

Major Versions

v0.1.0 → v1.0.02021-01-19

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/815524?v=4)[Arnout Boks](/maintainers/aboks)[@aboks](https://github.com/aboks)

![](https://avatars.githubusercontent.com/u/4497863?v=4)[Moxio](/maintainers/moxio)[@Moxio](https://github.com/Moxio)

---

Top Contributors

[![aboks](https://avatars.githubusercontent.com/u/815524?v=4)](https://github.com/aboks "aboks (39 commits)")

---

Tags

commonmarkcommonmark-extensiondefinition-listextensionmarkdownphpmarkdowncommonmarkextensiondefinition-list

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/moxio-commonmark-ext-definition-list/health.svg)

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

###  Alternatives

[zoon/commonmark-ext-youtube-iframe

Extension for league/commonmark to replace youtube link with iframe

12275.9k1](/packages/zoon-commonmark-ext-youtube-iframe)

PHPackages © 2026

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