Implement custom parsers/renderers with autowiring for snip content
This commit is contained in:
18
src/Service/SnipParser/Website/HtmlParser.php
Normal file
18
src/Service/SnipParser/Website/HtmlParser.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\SnipParser\Website;
|
||||
|
||||
use App\Service\SnipParser\AbstractParser;
|
||||
|
||||
class HtmlParser extends AbstractParser
|
||||
{
|
||||
public static function getName(): string
|
||||
{
|
||||
return 'html';
|
||||
}
|
||||
|
||||
public function parseView(string $content): string
|
||||
{
|
||||
return sprintf('<pre><code class="hljs">%s</code></pre>', htmlspecialchars($content));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user