You are here

protected function Markdown::doImages in Express 8

* Turn Markdown image shortcuts into <img> tags. *

Parameters

string $text: * @return string

1 method overrides Markdown::doImages()
MarkdownExtra::doImages in vendor/michelf/php-markdown/Michelf/MarkdownExtra.php
* Turn Markdown image shortcuts into <img> tags. *

File

vendor/michelf/php-markdown/Michelf/Markdown.php, line 794

Class

Markdown
Markdown Parser Class

Namespace

Michelf

Code

protected function doImages($text) {

  // First, handle reference-style labeled images: ![alt text][id]
  $text = preg_replace_callback('{
			(				# wrap whole match in $1
			  !\\[
				(' . $this->nested_brackets_re . ')		# alt text = $2
			  \\]

			  [ ]?				# one optional space
			  (?:\\n[ ]*)?		# one optional newline followed by spaces

			  \\[
				(.*?)		# id = $3
			  \\]

			)
			}xs', array(
    $this,
    '_doImages_reference_callback',
  ), $text);

  // Next, handle inline images:  ![alt text](url "optional title")
  // Don't forget: encode * and _
  $text = preg_replace_callback('{
			(				# wrap whole match in $1
			  !\\[
				(' . $this->nested_brackets_re . ')		# alt text = $2
			  \\]
			  \\s?			# One optional whitespace character
			  \\(			# literal paren
				[ \\n]*
				(?:
					<(\\S*)>	# src url = $3
				|
					(' . $this->nested_url_parenthesis_re . ')	# src url = $4
				)
				[ \\n]*
				(			# $5
				  ([\'"])	# quote char = $6
				  (.*?)		# title = $7
				  \\6		# matching quote
				  [ \\n]*
				)?			# title is optional
			  \\)
			)
			}xs', array(
    $this,
    '_doImages_inline_callback',
  ), $text);
  return $text;
}