s9e/text-formatter
PHP text formatting library with plugin support for BBCode, Markdown, HTML, and more. Includes predefined bundles, extensive documentation, and a JavaScript port for client-side preview and demos. Install via Composer and integrate customizable parsing/rendering.
Rules are contained in s9e\TextFormatter\Configurator\Collections\Ruleset.
They are set on a per-tag basis, for example:
$configurator = new Configurator;
$tag = $configurator->tags->add('B');
$tag->rules->autoReopen();
$tag->rules->denyChild('X');
Method calls can be chained for convenience. The same example can be written as:
$configurator = new Configurator;
$tag = $configurator->tags->add('B');
$tag->rules->autoReopen()
->denyChild('X');
Rules can be:
Rules that apply to descendants also apply to children. Rules that apply to ancestors also apply to the parent. A tag that is explicitly denied cannot be allowed by another rule.
How can I help you explore Laravel packages today?