kirra / markdown-task-lists
Support Github's Task Lists in a cebe/markdown parser.
v1.0.1
2019-10-15 12:38 UTC
Requires
- php: >=7.1
- cebe/markdown: 1.2.*
Requires (Dev)
- php-coveralls/php-coveralls: ^2.1
- phpunit/phpunit: ^7.5
This package is auto-updated.
Last update: 2024-03-15 22:32:47 UTC
README
A trait to extend cebe/markdown with Task Lists support.
Installation
PHP 7.1 or higher is required to use it.
composer require kirra/markdown-task-lists
Usage
To parse a Task List you need to make your own parser, and let it use
the TaskListsTrait.
class MyParser extends \cebe\markdown\Markdown { use Kirra\Markdown\TaskListsTrait; } $parser = new MyParser(); $parser->parse("- [ ] Open"); // Will return a list with an open checkbox.
Everything after the checkbox will be parsed as inline elements. So you can still apply every inline style your parser supports.
Usage in your own parser
If you build a fully custom parser, make sure it includes cebe\markdown\block\ListTrait
, as the checkbox only works
within a list.