diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,12 @@
 # Changelog for commonmark-pandoc
 
+## 0.2.1.2
+
+- Fix addition of sourcepos attributes to blocks (jgm/pandoc#7769).
+  We were always adding an enclosing Div, even when the block
+  admits attributes. Now the attributes are added to the block
+  itself, unless it can't accept attributes (as with inlines).
+
 ## 0.2.1.1
 
 - Don't collapse Para to Plain in task lists (#77).
diff --git a/commonmark-pandoc.cabal b/commonmark-pandoc.cabal
--- a/commonmark-pandoc.cabal
+++ b/commonmark-pandoc.cabal
@@ -1,5 +1,5 @@
 name:           commonmark-pandoc
-version:        0.2.1.1
+version:        0.2.1.2
 synopsis:       Bridge between commonmark and pandoc AST.
 description:    This library provides typeclasses for rendering
                 commonmark to Pandoc types.
diff --git a/src/Commonmark/Pandoc.hs b/src/Commonmark/Pandoc.hs
--- a/src/Commonmark/Pandoc.hs
+++ b/src/Commonmark/Pandoc.hs
@@ -1,4 +1,3 @@
-{-# LANGUAGE CPP                        #-}
 {-# LANGUAGE ExtendedDefaultRules       #-}
 {-# LANGUAGE FlexibleContexts           #-}
 {-# LANGUAGE FlexibleInstances          #-}
@@ -35,9 +34,6 @@
 import Commonmark.Extensions.Smart
 import Data.Char (isSpace)
 import Data.Coerce (coerce)
-#if !MIN_VERSION_base(4,11,0)
-import Data.Semigroup       (Semigroup, (<>))
-#endif
 
 newtype Cm b a = Cm { unCm :: a }
   deriving (Show, Semigroup, Monoid)
@@ -108,7 +104,7 @@
   ranged _r x = x
 
 instance Rangeable (Cm SourceRange B.Blocks) where
-  ranged r x = B.divWith ("",[],[("data-pos",T.pack (show r))]) <$> x
+  ranged r = addAttributes [("data-pos", T.pack (show r))]
 
 instance HasMath (Cm b B.Inlines) where
   inlineMath t = Cm $ B.math t
