mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-29 06:18:26 +02:00
Only use inline style for commonmark parser
This commit is contained in:
parent
f7259a118b
commit
b14fc0e22a
1 changed files with 5 additions and 5 deletions
|
@ -50,6 +50,7 @@ use League\CommonMark\Environment\Environment;
|
||||||
use League\CommonMark\Extension\InlinesOnly\InlinesOnlyExtension;
|
use League\CommonMark\Extension\InlinesOnly\InlinesOnlyExtension;
|
||||||
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||||
use League\CommonMark\MarkdownConverter;
|
use League\CommonMark\MarkdownConverter;
|
||||||
|
use League\CommonMark\Node\Block\Paragraph;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,7 +63,6 @@ final class PartProvider implements PlaceholderProviderInterface
|
||||||
|
|
||||||
public function __construct(private readonly SIFormatter $siFormatter, private readonly TranslatorInterface $translator)
|
public function __construct(private readonly SIFormatter $siFormatter, private readonly TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
$this->blockConverter = new GithubFlavoredMarkdownConverter();
|
|
||||||
$environment = new Environment();
|
$environment = new Environment();
|
||||||
$environment->addExtension(new InlinesOnlyExtension());
|
$environment->addExtension(new InlinesOnlyExtension());
|
||||||
$this->inlineConverter = new MarkdownConverter($environment);
|
$this->inlineConverter = new MarkdownConverter($environment);
|
||||||
|
@ -123,19 +123,19 @@ final class PartProvider implements PlaceholderProviderInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('[[DESCRIPTION]]' === $placeholder) {
|
if ('[[DESCRIPTION]]' === $placeholder) {
|
||||||
return $this->inlineConverter->convert($part->getDescription())->getContent();
|
return trim($this->inlineConverter->convert($part->getDescription())->getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('[[DESCRIPTION_T]]' === $placeholder) {
|
if ('[[DESCRIPTION_T]]' === $placeholder) {
|
||||||
return strip_tags($this->inlineConverter->convert($part->getDescription())->getContent());
|
return trim(strip_tags($this->inlineConverter->convert($part->getDescription())->getContent()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('[[COMMENT]]' === $placeholder) {
|
if ('[[COMMENT]]' === $placeholder) {
|
||||||
return $this->blockConverter->convert($part->getComment())->getContent();
|
return trim($this->inlineConverter->convert($part->getComment())->getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('[[COMMENT_T]]' === $placeholder) {
|
if ('[[COMMENT_T]]' === $placeholder) {
|
||||||
return strip_tags($this->blockConverter->convert($part->getComment())->getContent());
|
return trim(strip_tags($this->inlineConverter->convert($part->getComment())->getContent()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue