function _RunSpanGamut($text) { # # These are all the transformations that occur *within* block-level # tags like paragraphs, headers, and list items. # global $md_empty_element_suffix; $text = _DoCodeSpans($text); $text = _EscapeSpecialChars($text); # Process anchor and image tags. Images must come first, # because ![foo][f] looks like an anchor. $text = _DoImages($text); $text = _DoAnchors($text); # Make links out of things like `<http://example.com/>` # Must come after _DoAnchors(), because you can use < and > # delimiters in inline links like [this](<url>). $text = _DoAutoLinks($text); # Fix unencoded ampersands and <'s: $text = _EncodeAmpsAndAngles($text); $text = _DoItalicsAndBold($text); # Do hard breaks: $text = preg_replace('/ {2,}\\n/', "<br{$md_empty_element_suffix}\n", $text); return $text; }
function _RunBlockGamut($text) { global $g_empty_element_suffix; $text = _DoHeaders($text); $text = preg_replace(array('/^( ?\\* ?){3,}$/m', '/^( ?- ?){3,}$/m'), array("\n<hr{$g_empty_element_suffix}\n", "\n<hr{$g_empty_element_suffix}\n"), $text); $text = _DoLists($text); $text = _DoCodeBlocks($text); $text = _DoBlockQuotes($text); $text = _DoAutoLinks($text); $text = _HashHTMLBlocks($text); $text = _FormParagraphs($text); return $text; }
function _RunBlockGamut($text) { # # These are all the transformations that form block-level # tags like paragraphs, headers, and list items. # global $md_empty_element_suffix; $text = _DoHeaders($text); # Do Horizontal Rules: $text = preg_replace(array('/^( ?\\* ?){3,}$/m', '/^( ?- ?){3,}$/m', '/^( ?_ ?){3,}$/m'), "\n<hr{$md_empty_element_suffix}\n", $text); $text = _DoLists($text); $text = _DoCodeBlocks($text); $text = _DoBlockQuotes($text); # Make links out of things like `<http://example.com/>` $text = _DoAutoLinks($text); # We already ran _HashHTMLBlocks() before, in Markdown(), but that # was to escape raw HTML in the original Markdown source. This time, # we're escaping the markup we've just created, so that we don't wrap # <p> tags around block-level tags. $text = _HashHTMLBlocks($text); $text = _FormParagraphs($text); return $text; }