--- markdown/markdown.php.orig	2010-09-05 14:55:31.000000000 +0000
+++ markdown/markdown.php	2010-09-05 15:38:50.000000000 +0000
@@ -237,6 +237,7 @@
 	# Predefined urls and titles for reference links and images.
 	var $predef_urls = array();
 	var $predef_titles = array();
+	var $predef_alignments = array();
 
 
 	function Markdown_Parser() {
@@ -266,6 +267,7 @@
 	# Internal hashes used during transformation.
 	var $urls = array();
 	var $titles = array();
+	var $alignments = array();
 	var $html_hashes = array();
 	
 	# Status flag to avoid invalid nesting.
@@ -280,6 +282,7 @@
 		# Clear global hashes.
 		$this->urls = $this->predef_urls;
 		$this->titles = $this->predef_titles;
+		$this->alignments = $this->predef_alignments;
 		$this->html_hashes = array();
 		
 		$in_anchor = false;
@@ -292,6 +295,7 @@
 	#
 		$this->urls = array();
 		$this->titles = array();
+		$this->alignments = array();
 		$this->html_hashes = array();
 	}
 
@@ -371,6 +375,8 @@
 								[")]
 								[ ]*
 							)?	# title is optional
+							(left|right|none)?
+  # alignment (optional) = $5					
 							(?:\n+|\Z)
 			}xm',
 			array(&$this, '_stripLinkDefinitions_callback'),
@@ -382,6 +388,7 @@
 		$url = $matches[2] == '' ? $matches[3] : $matches[2];
 		$this->urls[$link_id] = $url;
 		$this->titles[$link_id] =& $matches[4];
+		$this->alignments[$link_id] =& $matches[5];
 		return ''; # String that will replace the block
 	}
 
@@ -819,7 +826,8 @@
 			array(&$this, '_doImages_reference_callback'), $text);
 
 		#
-		# Next, handle inline images:  ![alt text](url "optional title")
+		# Next, handle inline images:  
+		#	![alt text](url "optional title" "optional alignment")
 		# Don't forget: encode * and _
 		#
 		$text = preg_replace_callback('{
@@ -842,6 +850,8 @@
 				  \6		# matching quote
 				  [ \n]*
 				)?			# title is optional
+				[ \n]*
+				(left|right|none)? # alignment = $8 (optional)
 			  \)
 			)
 			}xs',
@@ -867,6 +877,11 @@
 				$title = $this->encodeAttribute($title);
 				$result .=  " title=\"$title\"";
 			}
+			if (isset($this->alignments[$link_id])) {
+				$alignment = $this->alignments[$link_id];
+				$alignment = $this->encodeAttribute($alignment);
+				$result .=  " style=\"float: $alignment\"";
+			}
 			$result .= $this->empty_element_suffix;
 			$result = $this->hashPart($result);
 		}
@@ -882,6 +897,7 @@
 		$alt_text		= $matches[2];
 		$url			= $matches[3] == '' ? $matches[4] : $matches[3];
 		$title			=& $matches[7];
+		$alignment		=& $matches[8];
 
 		$alt_text = $this->encodeAttribute($alt_text);
 		$url = $this->encodeAttribute($url);
@@ -890,6 +906,10 @@
 			$title = $this->encodeAttribute($title);
 			$result .=  " title=\"$title\""; # $title already quoted
 		}
+		if (isset($alignment)) {
+			$alignment = $this->encodeAttribute($alignment);
+			$result .= " style=\"float: $alignment\"";
+		} 
 		$result .= $this->empty_element_suffix;
 
 		return $this->hashPart($result);
@@ -2929,4 +2949,4 @@
 software, even if advised of the possibility of such damage.
 
 */
-?>
\ No newline at end of file
+?>
