Skip to content

Commit

Permalink
Strip title from markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
svandragt committed Oct 1, 2020
1 parent 9f1f51d commit e3acaa5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/system/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,10 @@ public function section(string $content_section, $section_key): StdClass
}
break;
case 'markdown':
$md_sections = preg_split('/(\r\n|\n|\r)/', trim($content_section), 2);
$title_sections = preg_split('/\R/', trim($md_sections[0]), 2);
$Section->title = $title_sections[0];
$Section->main = Markdown::defaultTransform($md_sections[1]);

$markdown = Markdown::defaultTransform($content_section);
$sections = preg_split('/(\r\n|\n|\r)/', trim($markdown), 2);
$Section->title = strip_tags(array_shift($sections));
$Section->main = implode(PHP_EOL,$sections);
break;

default:
Expand Down

0 comments on commit e3acaa5

Please sign in to comment.