public function parse($markdown) { $replacements = []; // We need to replace "{@include <url>}" tags with random unique IDs // else URLs are turned into <a> tags by the Markdown parser $markdown = $this->replaceTagsWithUniqueIds($markdown, $replacements); $document = $this->wrapped->parse($markdown); $document->htmlContent = $this->replaceUniqueIdsWithFileContent($document->htmlContent, $replacements); return $document; }
public function parse($markdown) { $parsed = $this->parser->parse($markdown, false); // Get the FrontYaml content $metadata = $parsed->getYAML(); if (!is_array($metadata)) { $metadata = []; } // Get the Markdown with the FrontYaml removed $markdown = $parsed->getContent(); $document = $this->wrapped->parse($markdown); $document->metadata = array_merge($document->metadata, $metadata); return $document; }