diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 7434ef1f6..af7588562 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -392,7 +392,9 @@ referenceKey = try $ do
   src <- try betweenAngles <|> sourceURL
   tit <- option "" referenceTitle
   attr   <- option nullAttr $ try $
-              guardEnabled Ext_link_attributes >> skipSpaces >> attributes
+              do guardEnabled Ext_link_attributes
+                 skipSpaces >> optional newline >> skipSpaces
+                 attributes
   addKvs <- option [] $ guardEnabled Ext_mmd_link_attributes
                           >> many (try $ spnl >> keyValAttr)
   blanklines
diff --git a/test/command/3674.md b/test/command/3674.md
index 09f4e0d1e..92ed4bed7 100644
--- a/test/command/3674.md
+++ b/test/command/3674.md
@@ -24,3 +24,16 @@ Make sure we don't get duplicate reference links, even with
 
   [2]: b
 ```
+
+Subsidiary issue:  allow line break between reference link
+url/title and attributes:
+
+```
+% pandoc
+[a]
+
+[a]: url
+{.class}
+^D
+<p><a href="url" class="class">a</a></p>
+```