mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
improve comments
This commit is contained in:
parent
0c61f71e3f
commit
843786c07c
@ -58,21 +58,23 @@ class Parsedown
|
|||||||
|
|
||||||
function parse($text)
|
function parse($text)
|
||||||
{
|
{
|
||||||
# removes \r characters
|
# simplifies line breaks
|
||||||
$text = str_replace("\r\n", "\n", $text);
|
$text = str_replace("\r\n", "\n", $text);
|
||||||
$text = str_replace("\r", "\n", $text);
|
$text = str_replace("\r", "\n", $text);
|
||||||
|
|
||||||
# replaces tabs with spaces
|
# replaces tabs with spaces
|
||||||
$text = str_replace("\t", ' ', $text);
|
$text = str_replace("\t", ' ', $text);
|
||||||
|
|
||||||
# ~
|
# removes surrounding line breaks
|
||||||
|
|
||||||
$text = trim($text, "\n");
|
$text = trim($text, "\n");
|
||||||
|
|
||||||
|
# splits text into lines
|
||||||
$lines = explode("\n", $text);
|
$lines = explode("\n", $text);
|
||||||
|
|
||||||
|
# converts lines into html
|
||||||
$text = $this->parse_block_elements($lines);
|
$text = $this->parse_block_elements($lines);
|
||||||
|
|
||||||
|
# removes trailing line breaks
|
||||||
$text = chop($text, "\n");
|
$text = chop($text, "\n");
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
|
Loading…
Reference in New Issue
Block a user