We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
According The package wrongly parses a Markdown code inside a Markdown post the routine parse() in YamlFrontMatter does not handle Markdown code correctly.
parse()
YamlFrontMatter
I corrected EntryParser.php. Here is the relevant, corrected code in the class:
EntryParser.php
public function parseEntry($filePath) { $content = file_get_contents($filePath); $n3dash = 0; // count number of triple dashes $pos1 = 0; $pos2 = 0; $len = strlen($content); for ($pos=0;; $pos+=3) { $pos = strpos($content,"---",$pos); if ($pos === false) { // no pair of triple dashes at all $data = []; $data['content_raw'] = $content; return $data; } // Are we at end or is next character white space? if ( $pos + 3 == $len || ctype_space(substr($content,$pos+3,1)) ) { if ($n3dash == 0 && ($pos == 0 || $pos > 0 && substr($content,$pos-1,1)=="\n")) { $n3dash = 1; // found first triple dash $pos1 = $pos + 3; } else if ($n3dash == 1 && substr($content,$pos-1,1) == "\n") { // found 2nd properly enclosed triple dash $n3dash = 2; $pos2 = $pos + 3; break; } } } $matter = substr($content,$pos1,$pos2-3-$pos1); $body = substr($content,$pos2); $matter = Yaml::parse($matter); // $object = EntryParser::parse(file_get_contents($filePath)); //$data = $object->matter(); //$data['content_raw'] = $object->body(); $data = $matter; $data['content_raw'] = $body; return $data; }
With that code change triple dashes in Markdown code are handled correctly. See, for example, Saaze docs: Entries.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
According The package wrongly parses a Markdown code inside a Markdown post the routine
parse()
inYamlFrontMatter
does not handle Markdown code correctly.I corrected
EntryParser.php
. Here is the relevant, corrected code in the class:With that code change triple dashes in Markdown code are handled correctly. See, for example, Saaze docs: Entries.
The text was updated successfully, but these errors were encountered: