src/Converter/CodeConverter.php 1 location
|
@@ 44-50 (lines=7) @@
|
| 41 |
|
|
| 42 |
|
// Checking if the code has multiple lines |
| 43 |
|
$lines = preg_split('/\r\n|\r|\n/', $code); |
| 44 |
|
if (count($lines) > 1) { |
| 45 |
|
// Multiple lines detected, adding three backticks and newlines |
| 46 |
|
$markdown .= '```' . $language . "\n" . $code . "\n" . '```'; |
| 47 |
|
} else { |
| 48 |
|
// One line of code, wrapping it on one backtick. |
| 49 |
|
$markdown .= '`' . $language . $code . '`'; |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
return $markdown; |
| 53 |
|
} |
src/Converter/PreformattedConverter.php 1 location
|
@@ 41-47 (lines=7) @@
|
| 38 |
|
|
| 39 |
|
// Checking if the string has multiple lines |
| 40 |
|
$lines = preg_split('/\r\n|\r|\n/', $pre_content); |
| 41 |
|
if (count($lines) > 1) { |
| 42 |
|
// Multiple lines detected, adding three backticks and newlines |
| 43 |
|
$markdown .= '```' . "\n" . $pre_content . "\n" . '```'; |
| 44 |
|
} else { |
| 45 |
|
// One line of code, wrapping it on one backtick. |
| 46 |
|
$markdown .= '`' . $pre_content . '`'; |
| 47 |
|
} |
| 48 |
|
|
| 49 |
|
return $markdown; |
| 50 |
|
} |