diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,9 @@
 # Changelog for commonmark
 
+## 0.2.1.1
+
+  * Fix bug in `prettyShow` for `SourceRange` (#80).
+    The bug led to an infinite loop in certain cases.
 
 ## 0.2.1
 
diff --git a/commonmark.cabal b/commonmark.cabal
--- a/commonmark.cabal
+++ b/commonmark.cabal
@@ -1,6 +1,6 @@
 cabal-version:  2.2
 name:           commonmark
-version:        0.2.1
+version:        0.2.1.1
 synopsis:       Pure Haskell commonmark parser.
 description:
    This library provides the core data types and functions
diff --git a/src/Commonmark/Blocks.hs b/src/Commonmark/Blocks.hs
--- a/src/Commonmark/Blocks.hs
+++ b/src/Commonmark/Blocks.hs
@@ -403,6 +403,8 @@
    where
      go [] = []
      go ((!startpos1, !endpos1):(!startpos2, !endpos2):rest)
+       | startpos1 == startpos2
+       , endpos1 == endpos2   = go ((startpos1, endpos2):rest)
        | endpos1 == startpos2 = go ((startpos1, endpos2):rest)
      go (x:xs) = x : go xs
 
diff --git a/src/Commonmark/Types.hs b/src/Commonmark/Types.hs
--- a/src/Commonmark/Types.hs
+++ b/src/Commonmark/Types.hs
@@ -125,20 +125,19 @@
   ranged :: SourceRange -> a -> a
 
 prettyRange :: SourceRange -> String
-prettyRange (SourceRange []) = ""
-prettyRange (SourceRange xs@((p,_):_)) =
-  sourceName p ++ "@" ++ go (sourceName p) xs
+prettyRange (SourceRange xs) = go "" xs
   where
     go _ [] = ""
     go curname ((p1,p2):rest)
-      | sourceName p1 /= curname =
-         sourceName p1 ++ "@" ++ go (sourceName p) ((p1,p2):rest)
-      | otherwise =
+      = (if sourceName p1 /= curname
+            then sourceName p1 ++ "@"
+            else "") ++
          show (sourceLine p1) ++ ":" ++
          show (sourceColumn p1) ++ "-" ++
-         (if sourceName p2 /= curname
+         (if sourceName p2 /= sourceName p1
              then sourceName p2 ++ "@"
-             else "") ++ show (sourceLine p2) ++
+             else "") ++
+         show (sourceLine p2) ++
          ":" ++ show (sourceColumn p2) ++
          if null rest
             then ""
