<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/testcases/span/01_link/links_with_angle_brackets.html</filename>
    </added>
    <added>
      <filename>test/testcases/span/01_link/links_with_angle_brackets.text</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -852,6 +852,7 @@ one space) in normal parentheses. For example:
 
     This is [a link](http://rubyforge.org) to a page.
     A [link](../test &quot;local URI&quot;) can also have a title.
+    And [spaces](&lt;link with spaces.html&gt;)!
 
 Notes:
 
@@ -860,15 +861,12 @@ Notes:
   to escape them. It is not possible to create nested links!
 
 * The link URL must not contain any spaces and it has to contain properly nested parentheses if no
-  title is specified. There must not be any spaces before the link URL, and if no title is
-  specified, no spaces are allowed between the link URL and the closing parenthesis.
+  title is specified, or the link URL must be contained in angle brackets (then spaces and
+  incorrectly nested parentheses are allowed). There must not be any spaces before the link URL, and
+  if no title is specified, no spaces are allowed between the link URL and the closing parenthesis.
 
 * The link title may not contain its delimiters and may not be empty.
 
-&gt; In contrast to the original Markdown syntax, the link URL may not be enclosed in angle brackets,
-&gt; neither in inline links nor in link definitions.
-{: .markdown-difference}
-
 To create a reference style link, you need to surround the link text with square brackets (as with
 inline links), followed by optional spaces/tabs/line breaks and then optionally followed with
 another set of square brackets with the link identifier in them. A link indentifier may only contain
@@ -895,7 +893,8 @@ The link definition has the following structure:
 
 * The link identifier in square brackets, optionally indented up to three spaces,
 * then a colon and one or more spaces/tabs,
-* then the link URL,
+* then the link URL which must not contain any spaces or a left angle bracket, the link URL which may
+  contain spaces and a right angle bracket,
 * then optionally the title in single or double quotes, separated from the link URL by one or more
   spaces or on the next line by itself indented any number of spaces/tabs.
 </diff>
      <filename>doc/syntax.page</filename>
    </modified>
    <modified>
      <diff>@@ -468,12 +468,12 @@ module Kramdown
       PUNCTUATION_CHARS = &quot;_.:,;!?-&quot;
       LINK_ID_CHARS = /[a-zA-Z0-9 #{PUNCTUATION_CHARS}]/
       LINK_ID_NON_CHARS = /[^a-zA-Z0-9 #{PUNCTUATION_CHARS}]/
-      LINK_DEFINITION_START = /^#{OPT_SPACE}\[(#{LINK_ID_CHARS}+)\]:[ \t]*([^\s]+)[ \t]*?(?:\n?[ \t]*?([&quot;'])(.+?)\3[ \t]*?)?\n/
+      LINK_DEFINITION_START = /^#{OPT_SPACE}\[(#{LINK_ID_CHARS}+)\]:[ \t]*(?:&lt;(.*?)&gt;|([^\s]+))[ \t]*?(?:\n?[ \t]*?([&quot;'])(.+?)\4[ \t]*?)?\n/
 
       # Parse the link definition at the current location.
       def parse_link_definition
         @src.pos += @src.matched_size
-        link_id, link_url, link_title = @src[1].downcase, @src[2], @src[4]
+        link_id, link_url, link_title = @src[1].downcase, @src[2] || @src[3], @src[5]
         warning(&quot;Duplicate link ID '#{link_id}' - overwriting&quot;) if @doc.parse_infos[:link_defs][link_id]
         @doc.parse_infos[:link_defs][link_id] = [link_url, link_title]
         true
@@ -938,26 +938,35 @@ module Kramdown
           return
         end
 
-        link_url = ''
-        re = /\(|\)|\s/
-        nr_of_brackets = 0
-        while temp = @src.scan_until(re)
-          link_url += temp
-          case @src.matched
-          when /\s/
-            break
-          when '('
-            nr_of_brackets += 1
-          when ')'
-            nr_of_brackets -= 1
-            break if nr_of_brackets == 0
+        # link url in parentheses
+        if @src.scan(/\(&lt;(.*?)&gt;/)
+          link_url = @src[1]
+          if @src.scan(/\)/)
+            add_link(el, link_url, nil, alt_text)
+            return
           end
-        end
-        link_url = link_url[1..-2]
+        else
+          link_url = ''
+          re = /\(|\)|\s/
+          nr_of_brackets = 0
+          while temp = @src.scan_until(re)
+            link_url += temp
+            case @src.matched
+            when /\s/
+              break
+            when '('
+              nr_of_brackets += 1
+            when ')'
+              nr_of_brackets -= 1
+              break if nr_of_brackets == 0
+            end
+          end
+          link_url = link_url[1..-2]
 
-        if nr_of_brackets == 0
-          add_link(el, link_url, nil, alt_text)
-          return
+          if nr_of_brackets == 0
+            add_link(el, link_url, nil, alt_text)
+            return
+          end
         end
 
         if @src.scan(LINK_INLINE_TITLE_RE)</diff>
      <filename>lib/kramdown/parser.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,6 +3,8 @@ This is a para.
 
 [otherid1]: http://wwww.example.com/ &quot;title 1&quot;
 [otherid2]: http://wwww.example.com/ 'title 2'
+[otherid3]: &lt;some spaces.html&gt;
+[otherid4]: &lt;some spaces.html&gt; 'title'
 
 [break]:	http://www.example.com/test/asdf.html
                 'Another title'</diff>
      <filename>test/testcases/span/01_link/link_defs.text</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5b5ec9ccf3b64540a96f8e82d50cd9ff4a3e7dce</id>
    </parent>
  </parents>
  <author>
    <name>Thomas Leitner</name>
    <email>t_leitner@gmx.at</email>
  </author>
  <url>http://github.com/gettalong/kramdown/commit/d6f246053de97e1ced8abbeeca73cfda004393a2</url>
  <id>d6f246053de97e1ced8abbeeca73cfda004393a2</id>
  <committed-date>2009-11-11T23:46:31-08:00</committed-date>
  <authored-date>2009-11-11T23:46:31-08:00</authored-date>
  <message>Now allowing link URLs to be enclosed in angle brackets</message>
  <tree>4be64bbd20789a0e99f0802141ea4599d707efd3</tree>
  <committer>
    <name>Thomas Leitner</name>
    <email>t_leitner@gmx.at</email>
  </committer>
</commit>
