1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

Add TransformableRenderable capability

This commit is contained in:
Aidan Woods
2021-10-12 21:58:24 +01:00
parent a48c451d6c
commit 8fc49f6b0a
4 changed files with 80 additions and 3 deletions

View File

@@ -0,0 +1,25 @@
<?php
namespace Erusev\Parsedown\Html;
interface TransformableRenderable extends Renderable
{
/**
* Takes a closure $Transform which will provide a transformation of
* a "contained text" into Renderables.
*
* In order for TransformableRenderable to make sense, a Renderable must
* have:
* 1. Some concept of "contained text". $Transform can be applied
* piece-wise if your container contains logically disjoint sections
* of text.
* 2. A generic mechanism for containing other Renderables, or replacing
* the current renderable with a container.
*
* It is acceptable to only partially transform "contained text".
*
* @param \Closure(string):Renderable $Transform
* @return Renderable
*/
public function transformingContent(\Closure $Transform): Renderable;
}