frontMatterParser = $frontMatterParser; } /** * @throws InvalidFrontMatterException if the front matter cannot be parsed */ public function parse(string $markdownContent): MarkdownInputWithFrontMatter { $cursor = new Cursor($markdownContent); // Locate the front matter $frontMatter = $cursor->match(self::REGEX_FRONT_MATTER); if ($frontMatter === null) { return new MarkdownInputWithFrontMatter($markdownContent); } // Trim the last line (ending ---s and newline) $frontMatter = \preg_replace('/---\R$/', '', $frontMatter); if ($frontMatter === null) { return new MarkdownInputWithFrontMatter($markdownContent); } // Parse the resulting YAML data $data = $this->frontMatterParser->parse($frontMatter); // Advance through any remaining newlines which separated the front matter from the Markdown text $trailingNewlines = $cursor->match('/^\R+/'); // Calculate how many lines the Markdown is offset from the front matter by counting the number of newlines // Don't forget to add 1 because we stripped one out when trimming the trailing delims $lineOffset = \preg_match_all('/\R/', $frontMatter . $trailingNewlines) + 1; return new MarkdownInputWithFrontMatter($cursor->getRemainder(), $lineOffset, $data); } } __halt_compiler();----SIGNATURE:----R8rbmzPdQmS/b/+X3iktMUfj621WO1eK2GOOFXf0AXrY+vV3InwshPXI4jPX0Lx+biEnMeVePaFgG60OVhV+TW26MlKQQXLGlW9hGQzm1FoKeS0zvARIzko9yGpQ2pBWOIYuNgpWYLbNRfde9mKegQZddx/fLTNmdRntNKhzcVm0gzW6LVpGEQvg7OOvCwlg5nKR3bnekHeauIot3fTP6kfQgaIdpQbMGxIzNN+r8aKNZ1EsQEORS2sNGaBVJ1O2rj8tE2YycJdDpeAHHF/OXM8TAs8AyO8SXp+balNNRBH8iDK6CIcd8FKx3E71WeuPAyuRX9EveCj4kH776CX9C0cL2KkHtpfNipnd+mnj8JA1ARvr7V95bl49z4AgRJLf80bVeXa2G8AQZc0Ck+T8/In/TzbyfLNthvSDXfnu+SRCyr3AxJPR4KoSO2Ds//nuL2v+qne80qaQQ9hY7JboIP4qss9m+V3AIsxmE4mSCqycTE29O6oVd/dYbCnpMmE+kpYhrr/E132mfmE94Ngi4JbahMQkCt8QgrIhUTjo4p+ajwlWD4aXTsyg4DoDJrtX4b93UOd96bXnJJnGnkSKEdc8CZ3WXDbReraxHHXu6J5s/Mtlw9mE9zIO+e+MseIFU2xZoonitFTxwN/4BuJC37cGeC/IfFqcA0sAOYIzllo=----ATTACHMENT:----NjgxNDcxODEyMDk1NjQ4OSA0NDc4OTI1OTE4ODg2NzY0IDczNDE0MTk0OTc1Mjg3MzI=