PHPackages                             moxio/commonmark-ext-fancy-lists - 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-fancy-lists

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

moxio/commonmark-ext-fancy-lists
================================

Extension for league/commonmark to support additional numbering types for ordered lists

v2.0.1(2y ago)2153.6k↓37%MITPHPPHP ^7.4 || ^8.0

Since Oct 1Pushed 2y ago10 watchersCompare

[ Source](https://github.com/Moxio/commonmark-ext-fancy-lists)[ Packagist](https://packagist.org/packages/moxio/commonmark-ext-fancy-lists)[ RSS](/packages/moxio-commonmark-ext-fancy-lists/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (5)Versions (8)Used By (0)

[![CI](https://github.com/Moxio/commonmark-ext-fancy-lists/workflows/CI/badge.svg)](https://github.com/Moxio/commonmark-ext-fancy-lists/workflows/CI/badge.svg)[![Latest Stable Version](https://camo.githubusercontent.com/c18380764603e1b11097bf2226a33f564a9686c5e3b2fc1f41b7e2f774b0cbdc/68747470733a2f2f706f7365722e707567782e6f72672f6d6f78696f2f636f6d6d6f6e6d61726b2d6578742d66616e63792d6c697374732f762f737461626c65)](https://packagist.org/packages/moxio/commonmark-ext-fancy-lists)[![Buy us a tree](https://camo.githubusercontent.com/130148911f548b001b2ac68a32c0a06559977ca60ada3bf480c72ae4ea093175/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54726565776172652d2546302539462538432542332d6c69676874677265656e)](https://plant.treeware.earth/Moxio/commonmark-ext-fancy-lists)

moxio/commonmark-ext-fancy-lists
================================

[](#moxiocommonmark-ext-fancy-lists)

Extension for the [`league/commonmark`](https://github.com/thephpleague/commonmark)Markdown parser to support additional numbering types for ordered lists.

Uses unofficial markdown syntax based on the syntax supported by [Pandoc](https://pandoc.org/MANUAL.html#extension-fancy_lists). See the section [Syntax](#syntax) below for details.

The parser is a modified version of the original `ListBlockStartParser`and related classes from [`league/commonmark`](https://github.com/thephpleague/commonmark)by [Colin O'Dell](https://github.com/colinodell), which is licensed under the BSD-3-Clause License. It is in turn based on the [CommonMark JS reference implementation](https://github.com/jgm/commonmark.js)by [John MacFarlane](https://github.com/jgm).

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

[](#requirements)

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

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

[](#installation)

Install as a dependency using composer:

```
$ composer require --dev moxio/commonmark-ext-fancy-lists

```

Usage
-----

[](#usage)

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

```
use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
use League\CommonMark\MarkdownConverter;
use Moxio\CommonMark\Extension\FancyLists\FancyListsExtension;

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

// Use $environment when building your MarkdownConverter
$converter = new MarkdownConverter($environment);
echo $converter->convertToHtml('
a) foo
b) bar
c) baz
');
```

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

Syntax
------

[](#syntax)

The supported markdown syntax is based on the one used by [Pandoc](https://pandoc.org/MANUAL.html#extension-fancy_lists).

A simple example:

```
i. foo
ii. bar
iii. baz
```

The will yield HTML output like:

```

  foo
  bar
  baz

```

A more complex example:

```
c. charlie
#. delta
   iv) subfour
   #) subfive
   #) subsix
#. echo
```

A short description of the syntactical rules:

- Apart from numbers, also letters (uppercase or lowercase) and Roman numerals (uppercase or lowercase) can be used to number ordered list items. Like lists marked with numbers, they need to be followed by a single right-parenthesis or period.
- Changing list marker types (also between uppercase and lowercase, or the symbol after the 'number') starts a new list.
- The numeral of the first item determines the numbering of the list. If the first item is numbered "b", the next item will be numbered "c", even if it is marked "z" in the source. This corresponds to the normal `league/commonmark` behavior for numeric lists, and essentially also implements [Pandoc's `startnum` extension](https://pandoc.org/MANUAL.html#extension-fancy_lists).
- If the first list item is numbered "I" or "i", the list is considered to be numbered using Roman numerals, starting at 1. If the list starts with another single letter that could be interpreted as a Roman numeral, the list is numbered using letters: a first item marked with "C." uses uppercase letters starting at 3, not Roman numerals starting a 100.
- In subsequent list items, such symbols can be used without any ambiguity: in "B.", "C.", "D." the "C" is the letter "C"; in "IC.", "C.", "CI." the "C" is a Roman 100.
- A "#" may be used in place of any numeral to continue a list. If the first item in a list is marked with "#", that list is numbered "1", "2", "3", etc.
- A list marker consisting of a single uppercase letter followed by a period (including Roman numerals like "I." or "V.") needs to be followed by at least two spaces ([rationale](https://pandoc.org/MANUAL.html#fn1)).

All of the above are entirely compatible with how Pandoc works. There are two small differences with Pandoc's syntax:

- This plugin does not support list numbers enclosed in parentheses, as the Commonmark spec does not support these either for lists numbered with Arabic numerals.
- Pandoc does not allow any list to interrupt a paragraph. In the spirit of the Commonmark spec (which allows only lists starting with 1 to interrupt a paragraph), this plugins allows lists that start with "A", "a", "I" or "i" (i.e. all 'first numerals') to interrupt a paragraph. The same holds for the "#" generic numbered list item marker.

Configuration
-------------

[](#configuration)

All configuration options are put under a `fancy_lists` key. You can specify the configuration when creating your `Environment` class:

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

$environment = new Environment([
    'fancy_lists' => [
        'allow_ordinal' => true,
        // ...
    ],
]);
```

See the `league/commonmark` [documentation](https://commonmark.thephpleague.com/2.3/configuration/)about configuration for more details on how to specify configuration.

Supported configuration options:

- `allow_ordinal` - Whether to allow an [ordinal indicator](https://en.wikipedia.org/wiki/Ordinal_indicator)(`º`) after the numeral, as occurs in e.g. legal documents (default: `false`). If this option is enabled, input like

    ```
    1º. foo
    2º. bar
    3º. baz
    ```

    will be converted to

    ```

      foo
      bar
      baz

    ```

    You will need [custom CSS](https://codepen.io/MoxioHD/pen/GRrjpRb) to re-insert the ordinal indicator into the displayed output based on the `ordinal` class.

    Because the ordinal indicator is commonly confused with other characters like the degree symbol, these characters are tolerated and considered equivalent to the ordinal indicator.
- `allow_multi_letter` - Whether to allow multi-letter alphabetic numerals, to number lists beyond 26 (default: `false`). If this option is enabled, input like

    ```
    AA. foo
    AB. bar
    AC. baz
    ```

    will be converted to

    ```

      foo
      bar
      baz

    ```

    Multi-letter alphabetic numerals can consist of at most 3 characters, which should be enough for a typical list. When a list starts with a numeral that can be both Roman or multi-letter alphabetic, like "II", it is considered to be Roman.

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-fancy-lists)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

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

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

Recently: every ~89 days

Total

7

Last Release

943d ago

Major Versions

v0.1.0 → v1.0.02021-04-16

v1.x-dev → v2.0.02023-03-08

### 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 (44 commits)")

---

Tags

commonmarkcommonmark-extensionextensionfancy-listsmarkdownordered-listphpmarkdowncommonmarkextensionfancy-listsordered-list

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

2.9k404.0M702](/packages/league-commonmark)[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)
