misuzu/src/Parsers/MarkdownParser.php

25 lines
681 B
PHP
Raw Normal View History

2022-09-13 13:14:49 +00:00
<?php
namespace Misuzu\Parsers;
use Parsedown;
class MarkdownParser extends Parsedown implements ParserInterface {
public function parseText(string $text): string {
return $this->text($text);
}
public function parseLine(string $line): string {
return $this->line($line);
}
protected function inlineImage($excerpt) {
$object = parent::inlineImage($excerpt);
if(!empty($object['element']['attributes']['src']) && !is_local_url($object['element']['attributes']['src'])) {
$object['element']['attributes']['src'] = url_proxy_media($object['element']['attributes']['src']);
}
return $object;
}
}