mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
35 lines
1.2 KiB
PHP
35 lines
1.2 KiB
PHP
<?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;
|
|
|
|
/**
|
|
* Similar to transformingContent, but replace the string $search in text content
|
|
* with the renderable $Replacement and return the result.
|
|
*
|
|
* @param string $search
|
|
* @return Renderable
|
|
*/
|
|
public function replacingAll(string $search, Renderable $Replacement): Renderable;
|
|
}
|