PHP code example of mathsgod / markdown-splitter
1. Go to this page and download the library: Download mathsgod/markdown-splitter library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mathsgod / markdown-splitter example snippets
$markdownContent = <<<MD
# Heading 1
Content under heading 1
## Heading 2
Content under heading 2
### Heading 3
Content under heading 3
MD;
$splitter = new MarkdownSplitter($markdownContent);
$splitter->split();
$sections = $splitter->getSections();
foreach ($sections as $section) {
echo "Level: {$section['level']}\n";
echo "Title: {$section['title']}\n";
echo "Content:\n{$section['content']}\n";
echo "----------------------\n";
}