Ad doption to set start character on an unordered list in md output
This commit is contained in:
parent
376333b660
commit
06bbaf5f97
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user