Ad doption to set start character on an unordered list in md output

This commit is contained in:
Joshua Ramon Enslin 2021-02-21 01:57:15 +01:00
parent 376333b660
commit 06bbaf5f97
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -143,18 +143,19 @@ final class MDFormatter {
/**
* Applies markdown formatting for an unordered list item.
*
* @param string $content Content of the list item.
* @param string $content Content of the list item.
* @param string $delimiter Starting character of a line.
*
* @return string
*/
public static function formatMarkdownUnorderedListItem(string $content):string {
public static function formatMarkdownUnorderedListItem(string $content, string $delimiter = '-'):string {
if (\strpos($content, PHP_EOL) === false) {
return '- ' . $content . PHP_EOL;
return $delimiter . ' ' . $content . PHP_EOL;
}
$lines = \explode(PHP_EOL, $content);
$output = '- ' . $lines[0] . PHP_EOL;
$output = $delimiter . ' ' . $lines[0] . PHP_EOL;
foreach ($lines as $i => $line) {
if ($i === 0) continue;