/** * Constructs a content's content * * This will load a simple not-paragraphed content if the original * body seems to be a single line and a concatenation of the * metadata + body + notes otherwise. * * @param \MarkdownExtended\API\ContentInterface $content * * @return \MarkdownExtended\API\ContentInterface */ protected function constructContent(ContentInterface $content) { $body = $content->getBody(); // if source is a single line if (Helper::isSingleLine($body)) { $content->setContent(preg_replace('#<[/]?p>#i', '', $body)); } else { $content->setContent((!empty($meta) ? $content->getMetadataFormatted() . PHP_EOL : '') . $body . (!empty($notes) ? PHP_EOL . $content->getNotesFormatted() : '')); } return $content; }