{"id":23458230,"url":"https://github.com/moxio/commonmark-ext-fancy-lists","last_synced_at":"2025-04-14T02:51:37.733Z","repository":{"id":57020277,"uuid":"300257189","full_name":"Moxio/commonmark-ext-fancy-lists","owner":"Moxio","description":"Extension for league/commonmark to support additional numbering types for ordered lists","archived":false,"fork":false,"pushed_at":"2023-10-18T09:42:26.000Z","size":70,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-05T17:44:10.528Z","etag":null,"topics":["commonmark","commonmark-extension","extension","fancy-lists","markdown","ordered-list","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Moxio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-10-01T11:37:58.000Z","updated_at":"2022-10-25T09:17:34.000Z","dependencies_parsed_at":"2022-08-23T12:20:28.437Z","dependency_job_id":"e71bd8aa-d8e4-470e-b456-a20d714a2b75","html_url":"https://github.com/Moxio/commonmark-ext-fancy-lists","commit_stats":{"total_commits":41,"total_committers":1,"mean_commits":41.0,"dds":0.0,"last_synced_commit":"ccca2f2b25e269c0e86fb83659703298e4847287"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moxio%2Fcommonmark-ext-fancy-lists","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moxio%2Fcommonmark-ext-fancy-lists/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moxio%2Fcommonmark-ext-fancy-lists/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moxio%2Fcommonmark-ext-fancy-lists/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Moxio","download_url":"https://codeload.github.com/Moxio/commonmark-ext-fancy-lists/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248813824,"owners_count":21165631,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["commonmark","commonmark-extension","extension","fancy-lists","markdown","ordered-list","php"],"created_at":"2024-12-24T05:17:50.347Z","updated_at":"2025-04-14T02:51:37.710Z","avatar_url":"https://github.com/Moxio.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![CI](https://github.com/Moxio/commonmark-ext-fancy-lists/workflows/CI/badge.svg)\n[![Latest Stable Version](https://poser.pugx.org/moxio/commonmark-ext-fancy-lists/v/stable)](https://packagist.org/packages/moxio/commonmark-ext-fancy-lists)\n[![Buy us a tree](https://img.shields.io/badge/Treeware-%F0%9F%8C%B3-lightgreen)](https://plant.treeware.earth/Moxio/commonmark-ext-fancy-lists)\n\nmoxio/commonmark-ext-fancy-lists\n================================\nExtension for the [`league/commonmark`](https://github.com/thephpleague/commonmark)\nMarkdown parser to support additional numbering types for ordered lists.\n\nUses unofficial markdown syntax based on the syntax supported by\n[Pandoc](https://pandoc.org/MANUAL.html#extension-fancy_lists). See the\nsection [Syntax](#syntax) below for details.\n\nThe parser is a modified version of the original [`ListBlockStartParser`](hhttps://github.com/thephpleague/commonmark/blob/2.3/src/Extension/CommonMark/Parser/Block/ListBlockStartParser.php)\nand related classes from [`league/commonmark`](https://github.com/thephpleague/commonmark)\nby [Colin O'Dell](https://github.com/colinodell), which is licensed\nunder the BSD-3-Clause License. It is in turn based on the\n[CommonMark JS reference implementation](https://github.com/jgm/commonmark.js)\nby [John MacFarlane](https://github.com/jgm).\n\n\nRequirements\n------------\nThis library requires PHP version 7.4 or higher and a `2.x` release of\n`league/commonmark`.\n\nInstallation\n------------\nInstall as a dependency using composer:\n```\n$ composer require --dev moxio/commonmark-ext-fancy-lists\n```\n\nUsage\n-----\nAdd `FancyListsExtension` as an extension to your CommonMark environment\ninstance and you're good to go:\n```php\nuse League\\CommonMark\\Environment\\Environment;\nuse League\\CommonMark\\Extension\\CommonMark\\CommonMarkCoreExtension;\nuse League\\CommonMark\\MarkdownConverter;\nuse Moxio\\CommonMark\\Extension\\FancyLists\\FancyListsExtension;\n\n$environment = new Environment();\n$environment-\u003eaddExtension(new CommonMarkCoreExtension());\n$environment-\u003eaddExtension(new FancyListsExtension());\n\n// Use $environment when building your MarkdownConverter\n$converter = new MarkdownConverter($environment);\necho $converter-\u003econvertToHtml('\na) foo\nb) bar\nc) baz\n');\n```\nSee the [CommonMark documentation](https://commonmark.thephpleague.com/2.3/extensions/overview/#usage)\nfor more information about using extensions.\n\nSyntax\n------\nThe supported markdown syntax is based on the one used by\n[Pandoc](https://pandoc.org/MANUAL.html#extension-fancy_lists).\n\nA simple example:\n```markdown\ni. foo\nii. bar\niii. baz\n```\nThe will yield HTML output like:\n```html\n\u003col type=\"i\"\u003e\n  \u003cli\u003efoo\u003c/li\u003e\n  \u003cli\u003ebar\u003c/li\u003e\n  \u003cli\u003ebaz\u003c/li\u003e\n\u003c/ol\u003e\n```\n\nA more complex example:\n```markdown\nc. charlie\n#. delta\n   iv) subfour\n   #) subfive\n   #) subsix\n#. echo\n```\n\nA short description of the syntactical rules:\n\n* Apart from numbers, also letters (uppercase or lowercase) and\n  Roman numerals (uppercase or lowercase) can be used to number\n  ordered list items. Like lists marked with numbers, they need to\n  be followed by a single right-parenthesis or period.\n* Changing list marker types (also between uppercase and lowercase,\n  or the symbol after the 'number') starts a new list.\n* The numeral of the first item determines the numbering of the list.\n  If the first item is numbered \"b\", the next item will be numbered\n  \"c\", even if it is marked \"z\" in the source. This corresponds to\n  the normal `league/commonmark` behavior for numeric lists, and\n  essentially also implements [Pandoc's `startnum` extension](https://pandoc.org/MANUAL.html#extension-fancy_lists).\n* If the first list item is numbered \"I\" or \"i\", the list is considered\n  to be numbered using Roman numerals, starting at 1. If the list\n  starts with another single letter that could be interpreted as a\n  Roman numeral, the list is numbered using letters: a first item\n  marked with \"C.\" uses uppercase letters starting at 3, not Roman\n  numerals starting a 100.\n* In subsequent list items, such symbols can be used without any\n  ambiguity: in \"B.\", \"C.\", \"D.\" the \"C\" is the letter \"C\"; in\n  \"IC.\", \"C.\", \"CI.\" the \"C\" is a Roman 100.\n* A \"#\" may be used in place of any numeral to continue a list. If\n  the first item in a list is marked with \"#\", that list is numbered\n  \"1\", \"2\", \"3\", etc.\n* A list marker consisting of a single uppercase letter followed by\n  a period (including Roman numerals like \"I.\" or \"V.\") needs to be\n  followed by at least two spaces ([rationale](https://pandoc.org/MANUAL.html#fn1)).\n\nAll of the above are entirely compatible with how Pandoc works. There\nare two small differences with Pandoc's syntax:\n\n* This plugin does not support list numbers enclosed in parentheses,\n  as the Commonmark spec does not support these either for lists\n  numbered with Arabic numerals.\n* Pandoc does not allow any list to interrupt a paragraph. In the\n  spirit of the Commonmark spec (which allows only lists starting\n  with 1 to interrupt a paragraph), this plugins allows lists that\n  start with \"A\", \"a\", \"I\" or \"i\" (i.e. all 'first numerals') to\n  interrupt a paragraph. The same holds for the \"#\" generic numbered\n  list item marker.\n\nConfiguration\n-------------\nAll configuration options are put under a `fancy_lists` key. You can\nspecify the configuration when creating your `Environment` class:\n```php\nuse League\\CommonMark\\Environment\\Environment;\n\n$environment = new Environment([\n    'fancy_lists' =\u003e [\n        'allow_ordinal' =\u003e true,\n        // ...\n    ],\n]);\n```\n\nSee the `league/commonmark` [documentation](https://commonmark.thephpleague.com/2.3/configuration/)\nabout configuration for more details on how to specify configuration.\n\nSupported configuration options:\n\n* `allow_ordinal` - Whether to allow an [ordinal indicator](https://en.wikipedia.org/wiki/Ordinal_indicator)\n  (`º`) after the numeral, as occurs in e.g. legal documents (default: `false`). If this option is enabled,\n  input like\n  ```markdown\n  1º. foo\n  2º. bar\n  3º. baz\n  ```\n  will be converted to\n  ```html\n  \u003col class=\"ordinal\"\u003e\n    \u003cli\u003efoo\u003c/li\u003e\n    \u003cli\u003ebar\u003c/li\u003e\n    \u003cli\u003ebaz\u003c/li\u003e\n  \u003c/ol\u003e\n  ```\n  You will need [custom CSS](https://codepen.io/MoxioHD/pen/GRrjpRb) to re-insert the ordinal indicator\n  into the displayed output based on the `ordinal` class.\n\n  Because the ordinal indicator is commonly confused with other characters like the degree symbol, these\n  characters are tolerated and considered equivalent to the ordinal indicator.\n* `allow_multi_letter` - Whether to allow multi-letter alphabetic numerals, to number lists beyond 26\n  (default: `false`). If this option is enabled,\n  input like\n  ```markdown\n  AA. foo\n  AB. bar\n  AC. baz\n  ```\n  will be converted to\n  ```html\n  \u003col type=\"A\" start=\"27\"\u003e\n    \u003cli\u003efoo\u003c/li\u003e\n    \u003cli\u003ebar\u003c/li\u003e\n    \u003cli\u003ebaz\u003c/li\u003e\n  \u003c/ol\u003e\n  ```\n  Multi-letter alphabetic numerals can consist of at most 3 characters, which should be enough for a\n  typical list. When a list starts with a numeral that can be both Roman or multi-letter alphabetic,\n  like \"II\", it is considered to be Roman.\n\nVersioning\n----------\nThis project adheres to [Semantic Versioning](http://semver.org/).\n\nContributing\n------------\nContributions to this project are more than welcome. When reporting an issue,\nplease include the input to reproduce the issue, along with the expected\noutput. When submitting a PR, please include tests with your changes.\n\nLicense\n-------\nThis project is released under the MIT license.\n\nTreeware\n--------\nThis package is [Treeware](https://treeware.earth/). If you use it in production,\nthen we'd appreciate it if you [**buy the world a tree**](https://plant.treeware.earth/Moxio/commonmark-ext-fancy-lists)\nto thank us for our work. By contributing to the Treeware forest you'll be creating\nemployment for local families and restoring wildlife habitats.\n\n---\nMade with love, coffee and fun by the [Moxio](https://www.moxio.com) team from\nDelft, The Netherlands. Interested in joining our awesome team? Check out our\n[vacancies](https://werkenbij.moxio.com/) (in Dutch).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoxio%2Fcommonmark-ext-fancy-lists","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoxio%2Fcommonmark-ext-fancy-lists","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoxio%2Fcommonmark-ext-fancy-lists/lists"}