File fixing_url_generation_from_markdown.patch of Package rubygem-redcarpet
diff --git a/ext/redcarpet/houdini_href_e.c b/ext/redcarpet/houdini_href_e.c
index 981b3b1..1a02a85 100644
--- a/ext/redcarpet/houdini_href_e.c
+++ b/ext/redcarpet/houdini_href_e.c
@@ -22,10 +22,10 @@
  * have its native function (i.e. as an URL 
  * component/separator) and hence needs no escaping.
  *
- * There are two exceptions: the chacters & (amp)
- * and ' (single quote) do not appear in the table.
- * They are meant to appear in the URL as components,
- * yet they require special HTML-entity escaping
+ * There is one exception: the ' (single quote) 
+ * character does not appear in the table.
+ * It is meant to appear in the URL as components,
+ * however it require special HTML-entity escaping
  * to generate valid HTML markup.
  *
  * All other characters will be escaped to %XX.
@@ -34,7 +34,7 @@
 static const char HREF_SAFE[] = {
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 
+	0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 
@@ -73,12 +73,6 @@ houdini_escape_href(struct buf *ob, const uint8_t *src, size_t size)
 			break;
 
 		switch (src[i]) {
-		/* amp appears all the time in URLs, but needs
-		 * HTML-entity escaping to be inside an href */
-		case '&': 
-			BUFPUTSL(ob, "&");
-			break;
-
 		/* the single quote is a valid URL character
 		 * according to the standard; it needs HTML
 		 * entity escaping too */
diff --git a/test/html_render_test.rb b/test/html_render_test.rb
index efdaf8b..4afb3dd 100644
--- a/test/html_render_test.rb
+++ b/test/html_render_test.rb
@@ -47,6 +47,12 @@ def test_that_no_image_flag_works
     assert_no_match %r{<img}, output
   end
 
+  def test_that_links_with_ampersands_work
+    markdown = %([/?a=b&c=d](/?a=b&c=d))
+    output   = render(markdown)
+    assert_equal "<p><a href=\"/?a=b&c=d\">/?a=b&c=d</a></p>\n", output
+  end
+
   def test_that_no_links_flag_works
     markdown = %([This link](http://example.net/) <a href="links.html">links</a>)
     output   = render(markdown, with: [:no_links])
diff --git a/test/markdown_test.rb b/test/markdown_test.rb
index aab3e39..e39ff75 100644
--- a/test/markdown_test.rb
+++ b/test/markdown_test.rb
@@ -32,7 +32,7 @@ def test_that_inline_markdown_starts_and_ends_correctly
 
   def test_that_urls_are_not_doubly_escaped
     markdown = @markdown.render('[Page 2](/search?query=Markdown+Test&page=2)')
-    assert_equal "<p><a href=\"/search?query=Markdown+Test&page=2\">Page 2</a></p>\n", markdown
+    assert_equal "<p><a href=\"/search?query=Markdown+Test&page=2\">Page 2</a></p>\n", markdown
   end
 
   def test_simple_inline_html
@@ -287,7 +287,7 @@ def test_autolinking_with_ent_chars
     markdown = render_with({:autolink => true}, <<text)
 This a stupid link: https://github.com/rtomayko/tilt/issues?milestone=1&state=open
 text
-    assert_equal "<p>This a stupid link: <a href=\"https://github.com/rtomayko/tilt/issues?milestone=1&state=open\">https://github.com/rtomayko/tilt/issues?milestone=1&state=open</a></p>\n", markdown
+    assert_equal "<p>This a stupid link: <a href=\"https://github.com/rtomayko/tilt/issues?milestone=1&state=open\">https://github.com/rtomayko/tilt/issues?milestone=1&state=open</a></p>\n", markdown
   end
 
   def test_spaced_headers