Do not allow reference link labels contain left brackets (dart-lang/markdown#402)

diff --git a/pkgs/markdown/lib/src/inline_parser.dart b/pkgs/markdown/lib/src/inline_parser.dart
index e1f4a43..a0ea9d5 100644
--- a/pkgs/markdown/lib/src/inline_parser.dart
+++ b/pkgs/markdown/lib/src/inline_parser.dart
@@ -1118,6 +1118,8 @@
           buffer.writeCharCode(char);
         }
         buffer.writeCharCode(next);
+      } else if (char == $lbracket) {
+        return null;
       } else if (char == $rbracket) {
         break;
       } else {
diff --git a/pkgs/markdown/test/common_mark/links.unit b/pkgs/markdown/test/common_mark/links.unit
index d80a980..8ce80f9 100644
--- a/pkgs/markdown/test/common_mark/links.unit
+++ b/pkgs/markdown/test/common_mark/links.unit
@@ -321,7 +321,7 @@
 
 [ref[]: /uri
 <<<
-<p><a href="/uri">foo</a></p>
+<p>[foo][ref[]</p>
 >>> Links - 546
 [foo][ref[bar]]
 
diff --git a/pkgs/markdown/test/gfm/links.unit b/pkgs/markdown/test/gfm/links.unit
index 35266a9..f0209c9 100644
--- a/pkgs/markdown/test/gfm/links.unit
+++ b/pkgs/markdown/test/gfm/links.unit
@@ -309,7 +309,7 @@
 
 [ref[]: /uri
 <<<
-<p><a href="/uri">foo</a></p>
+<p>[foo][ref[]</p>
 >>> Links - 555
 [foo][ref[bar]]