support markdown in upload notes
This commit is contained in:
parent
ebeb5f096c
commit
6f42528428
@ -117,7 +117,8 @@ class MyParsedown extends ParsedownExtended {
|
||||
|
||||
url: $image_url,
|
||||
direct_url: $image->getDirectUrl(),
|
||||
note: $this->lang !== null && $this->lang == PostLanguage::Russian ? $image->noteRu : $image->noteEn
|
||||
note: markup::markdownToHtml($this->lang !== null && $this->lang == PostLanguage::Russian ? $image->noteRu : $image->noteEn,
|
||||
no_paragraph: true)
|
||||
);
|
||||
|
||||
return $result;
|
||||
|
@ -7,9 +7,14 @@ class markup {
|
||||
|
||||
public static function markdownToHtml(string $md,
|
||||
bool $use_image_previews = true,
|
||||
?PostLanguage $lang = null): string {
|
||||
?PostLanguage $lang = null,
|
||||
bool $no_paragraph = false): string {
|
||||
$pd = new MyParsedown(useImagePreviews: $use_image_previews, lang: $lang);
|
||||
return $pd->text($md);
|
||||
$html = $pd->text($md);
|
||||
if ($no_paragraph) {
|
||||
$html = preg_replace('/<p>(.*?)<\/p>/', '$1', $html);
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
public static function toc(string $md): string {
|
||||
|
Loading…
x
Reference in New Issue
Block a user