diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,22 @@
+## 0.3.10.0
+
+-   \[Fix\] Avoid expensive set difference, use filter
+-   \[Tweak\] For div-wrapped listings merge attributes and classes
+
+    Previously, classes and attributes on the wrapping div were ignored. Now, those are merged with classes and attributes on the listing.
+
+-   \[Feat\] Add option to set label attributes to actual numbering used
+
+    New option `setLabelAttribute` which sets `label` attribute on sections, figures, etc to actual number used for referencing. This can be useful for post-processing.
+
+-   \[Fix\] Omit empty section\/item labels
+
+    Objects (sections, figures) can have empty labels (i.e. no number). Previously, if those labels were referenced (particularly with chapters enabled) this would create references like `fig 1..2`. Now these labels are omitted. It can lead to duplicate numbers in references though.
+
+-   \[Fix\] Chapter delimiter in section numbers should be chapDelim (was '.')
+
+    `chapDelim` now observed in section numbers (when `numberSections` is enabled)
+
 ## 0.3.9.1
 
 -   [CI] Bump pandoc version
diff --git a/docs/index.md b/docs/index.md
--- a/docs/index.md
+++ b/docs/index.md
@@ -355,6 +355,9 @@
 ```
 &lt;/div&gt;
 </pre>
+
+Any additional attributes and classes on the wrapping div will be merged with classes/attributes on the listing itself. In case of duplicate attributes, the behaviour is unspecified, but likely either both values will end up in the output, or div attributes will take precedence. This is important to keep in mind if you need to do some additional post-processing.
+
 ## References
 
 ``` markdown
@@ -491,6 +494,8 @@
 -   `tableEqns`, default `false`: Typeset equations and equation numbers
     in tables instead of embedding numbers into equations themselves.
     Depending on output format, this might work better or worse.
+-   `setLabelAttribute`, default `false`: set `label` attribute on objects to
+    actual number used for referencing. This can be useful for post-processing.
 
 ### Item title format
 
diff --git a/lib/Text/Pandoc/CrossRef/References/Blocks.hs b/lib/Text/Pandoc/CrossRef/References/Blocks.hs
--- a/lib/Text/Pandoc/CrossRef/References/Blocks.hs
+++ b/lib/Text/Pandoc/CrossRef/References/Blocks.hs
@@ -69,6 +69,13 @@
   noTableHead = TableHead nullAttr []
   noTableFoot = TableFoot nullAttr []
 
+setLabel :: Options -> [Inline] -> [(T.Text, T.Text)] -> [(T.Text, T.Text)]
+setLabel opts idx
+  | setLabelAttribute opts
+  = (("label", stringify idx) :)
+  . filter ((/= "label") . fst)
+  | otherwise = id
+
 replaceBlock :: Options -> Block -> WS (ReplacedResult Block)
 replaceBlock opts (Header n (label, cls, attrs) text')
   = do
@@ -97,14 +104,16 @@
                || n <= if sectionsDepth opts == 0 then chaptersDepth opts else sectionsDepth opts
                , "unnumbered" `notElem` cls
                = applyTemplate' (M.fromDistinctAscList [
-                    ("i", [Str (T.intercalate "." $ map show' cc)])
+                    ("i", idxStr)
                   , ("n", [Str $ T.pack $ show $ n - 1])
                   , ("t", text')
                   ]) $ secHeaderTemplate opts
                | otherwise = text'
-        show' (_, Just s) = s
-        show' (i, Nothing) = T.pack $ show i
-    replaceNoRecurse $ Header n (label', cls, attrs) textCC
+        idxStr = chapPrefix (chapDelim opts) cc
+        attrs' | "unnumbered" `notElem` cls
+               = setLabel opts idxStr attrs
+               | otherwise = attrs
+    replaceNoRecurse $ Header n (label', cls, attrs') textCC
 -- subfigures
 replaceBlock opts (Div (label,cls,attrs) images)
   | "fig:" `T.isPrefixOf` label
@@ -147,7 +156,7 @@
                        , Span nullAttr caption]
               , RawBlock (Format "latex") $ mkLaTeXLabel label
               , RawBlock (Format "latex") "\\end{pandoccrossrefsubfigures}"]
-          _  -> replaceNoRecurse $ Div (label, "subfigures":cls, attrs) $ toTable cont capt
+          _  -> replaceNoRecurse $ Div (label, "subfigures":cls, setLabel opts idxStr attrs) $ toTable cont capt
   where
     opts' = opts
               { figureTemplate = subfigureChildTemplate opts
@@ -189,7 +198,7 @@
         inlToCell (Image (id', cs, as) txt tgt)  = Just [Para [Image (id', cs, setW as) txt tgt]]
         inlToCell _ = Nothing
         setW as = ("width", "100%"):filter ((/="width") . fst) as
-replaceBlock opts (Div divOps@(label,_,attrs) [Table tattr (Caption short (btitle:rest)) colspec header cells foot])
+replaceBlock opts (Div (label,clss,attrs) [Table tattr (Caption short (btitle:rest)) colspec header cells foot])
   | not $ null title
   , "tbl:" `T.isPrefixOf` label
   = do
@@ -200,9 +209,9 @@
                 RawInline (Format "latex") (mkLaTeXLabel label) : title
               _  -> applyTemplate idxStr title $ tableTemplate opts
         caption' = Caption short (walkReplaceInlines title' title btitle:rest)
-    replaceNoRecurse $ Div divOps [Table tattr caption' colspec header cells foot]
+    replaceNoRecurse $ Div (label, clss, setLabel opts idxStr attrs) [Table tattr caption' colspec header cells foot]
   where title = blocksToInlines [btitle]
-replaceBlock opts (Table divOps@(label,_,attrs) (Caption short (btitle:rest)) colspec header cells foot)
+replaceBlock opts (Table (label,clss,attrs) (Caption short (btitle:rest)) colspec header cells foot)
   | not $ null title
   , "tbl:" `T.isPrefixOf` label
   = do
@@ -213,7 +222,7 @@
                 RawInline (Format "latex") (mkLaTeXLabel label) : title
               _  -> applyTemplate idxStr title $ tableTemplate opts
         caption' = Caption short (walkReplaceInlines title' title btitle:rest)
-    replaceNoRecurse $ Table divOps caption' colspec header cells foot
+    replaceNoRecurse $ Table (label, clss, setLabel opts idxStr attrs) caption' colspec header cells foot
   where title = blocksToInlines [btitle]
 replaceBlock opts cb@(CodeBlock (label, classes, attrs) code)
   | not $ T.null label
@@ -241,11 +250,11 @@
         let caption' = applyTemplate idxStr cap $ listingTemplate opts
         replaceNoRecurse $ Div (label, "listing":classes, []) [
             mkCaption opts "Caption" caption'
-          , CodeBlock ("", classes, attrs \\ [("caption", caption)]) code
+          , CodeBlock ("", classes, filter ((/="caption") . fst) $ setLabel opts idxStr attrs) code
           ]
 replaceBlock opts
-  (Div (label,"listing":_, [])
-    [Para caption, CodeBlock ("",classes,attrs) code])
+  (Div (label,"listing":divClasses, divAttrs)
+    [Para caption, CodeBlock ("",cbClasses,cbAttrs) code])
   | not $ T.null label
   , "lst:" `T.isPrefixOf` label
   = case outFormat opts of
@@ -269,16 +278,18 @@
         let caption' = applyTemplate idxStr caption $ listingTemplate opts
         replaceNoRecurse $ Div (label, "listing":classes, []) [
             mkCaption opts "Caption" caption'
-          , CodeBlock ("", classes, attrs) code
+          , CodeBlock ("", classes, setLabel opts idxStr attrs) code
           ]
-replaceBlock opts (Para [Span attrs [Math DisplayMath eq]])
+  where attrs = divAttrs <> cbAttrs
+        classes = nub $ divClasses <> cbClasses
+replaceBlock opts (Para [Span sattrs@(label, cls, attrs) [Math DisplayMath eq]])
   | not $ isLatexFormat (outFormat opts)
   , tableEqns opts
   = do
-    (eq', idx) <- replaceEqn opts attrs eq
-    replaceNoRecurse $ Div attrs [
+    (eq', idxStr) <- replaceEqn opts sattrs eq
+    replaceNoRecurse $ Div (label,cls,setLabel opts idxStr attrs) [
       simpleTable [AlignCenter, AlignRight] [ColWidth 0.9, ColWidth 0.09]
-       [[[Plain [Math DisplayMath eq']], [eqnNumber idx]]]]
+       [[[Plain [Math DisplayMath eq']], [eqnNumber $ stringify idxStr]]]]
   where
   eqnNumber idx
     | outFormat opts == Just (Format "docx")
@@ -290,7 +301,7 @@
     where mathIdx = Plain [Math DisplayMath $ "(" <> idx <> ")"]
 replaceBlock _ _ = noReplaceRecurse
 
-replaceEqn :: Options -> Attr -> T.Text -> WS (T.Text, T.Text)
+replaceEqn :: Options -> Attr -> T.Text -> WS (T.Text, [Inline])
 replaceEqn opts (label, _, attrs) eq = do
   let label' | T.null label = Left "eq"
              | otherwise = Right label
@@ -298,28 +309,30 @@
   let eq' | tableEqns opts = eq
           | otherwise = eq<>"\\qquad("<>idxTxt<>")"
       idxTxt = stringify idxStr
-  return (eq', idxTxt)
+  return (eq', idxStr)
 
 replaceInlineMany :: Options -> [Inline] -> WS (ReplacedResult [Inline])
-replaceInlineMany opts (Span attrs@(label,_,_) [Math DisplayMath eq]:xs)
+replaceInlineMany opts (Span spanAttr@(label,clss,attrs) [Math DisplayMath eq]:xs)
   | "eq:" `T.isPrefixOf` label || T.null label && autoEqnLabels opts
   = replaceRecurse . (<>xs) =<< case outFormat opts of
       f | isLatexFormat f ->
         pure [RawInline (Format "latex") "\\begin{equation}"
-        , Span attrs [RawInline (Format "latex") eq]
+        , Span spanAttr [RawInline (Format "latex") eq]
         , RawInline (Format "latex") $ mkLaTeXLabel label <> "\\end{equation}"]
-      _ -> pure . Span attrs . (:[]) . Math DisplayMath . fst <$> replaceEqn opts attrs eq
+      _ -> do
+        (eq', idxStr) <- replaceEqn opts spanAttr eq
+        pure [Span (label,clss,setLabel opts idxStr attrs) [Math DisplayMath eq']]
 replaceInlineMany _ _ = noReplaceRecurse
 
 replaceInline :: Options -> Inline -> WS (ReplacedResult Inline)
-replaceInline opts (Image attr@(label,_,attrs) alt img@(_, tit))
+replaceInline opts (Image (label,cls,attrs) alt img@(_, tit))
   | "fig:" `T.isPrefixOf` label && "fig:" `T.isPrefixOf` tit
   = do
     idxStr <- replaceAttr opts (Right label) (lookup "label" attrs) alt imgRefs
     let alt' = case outFormat opts of
           f | isLatexFormat f -> alt
           _  -> applyTemplate idxStr alt $ figureTemplate opts
-    replaceNoRecurse $ Image attr alt' img
+    replaceNoRecurse $ Image (label,cls,setLabel opts idxStr attrs) alt' img
 replaceInline _ _ = noReplaceRecurse
 
 replaceSubfigs :: Options -> [Inline] -> WS (ReplacedResult [Inline])
@@ -340,7 +353,7 @@
               tit' | "nocaption" `elem` cls = fromMaybe tit $ T.stripPrefix "fig:" tit
                    | "fig:" `T.isPrefixOf` tit = tit
                    | otherwise = "fig:" <> tit
-          in return [Image (label, cls, attrs) alt' (src, tit')]
+          in return [Image (label, cls, setLabel opts idxStr attrs) alt' (src, tit')]
 replaceSubfig _ x = return [x]
 
 divBlocks :: Block -> Block
diff --git a/lib/Text/Pandoc/CrossRef/Util/CodeBlockCaptions.hs b/lib/Text/Pandoc/CrossRef/Util/CodeBlockCaptions.hs
--- a/lib/Text/Pandoc/CrossRef/Util/CodeBlockCaptions.hs
+++ b/lib/Text/Pandoc/CrossRef/Util/CodeBlockCaptions.hs
@@ -45,13 +45,13 @@
   , Just caption <- getCodeBlockCaption ils
   , not $ T.null label
   , "lst" `T.isPrefixOf` label
-  = return $ Div (label,"listing":classes, [])
+  = return $ Div (label,["listing"], [])
       [Para caption, CodeBlock ("",classes,attrs) code] : xs
 orderAgnostic opts (Para ils:CodeBlock (_,classes,attrs) code:xs)
   | codeBlockCaptions opts
   , Just (caption, labinl) <- splitLast <$> getCodeBlockCaption ils
   , Just label <- getRefLabel "lst" labinl
-  = return $ Div (label,"listing":classes, [])
+  = return $ Div (label,["listing"], [])
       [Para $ init caption, CodeBlock ("",classes,attrs) code] : xs
   where
     splitLast xs' = splitAt (length xs' - 1) xs'
diff --git a/lib/Text/Pandoc/CrossRef/Util/Options.hs b/lib/Text/Pandoc/CrossRef/Util/Options.hs
--- a/lib/Text/Pandoc/CrossRef/Util/Options.hs
+++ b/lib/Text/Pandoc/CrossRef/Util/Options.hs
@@ -67,4 +67,5 @@
                        , subfigGrid :: Bool
                        , linkReferences :: Bool
                        , nameInLink :: Bool
+                       , setLabelAttribute :: Bool
                        }
diff --git a/lib/Text/Pandoc/CrossRef/Util/Util.hs b/lib/Text/Pandoc/CrossRef/Util/Util.hs
--- a/lib/Text/Pandoc/CrossRef/Util/Util.hs
+++ b/lib/Text/Pandoc/CrossRef/Util/Util.hs
@@ -67,7 +67,11 @@
   | otherwise = False
 
 chapPrefix :: [Inline] -> Index -> [Inline]
-chapPrefix delim index = toList $ intercalate' (fromList delim) (map (str . uncurry (fromMaybe . T.pack . show)) index)
+chapPrefix delim = toList
+  . intercalate' (fromList delim)
+  . map str
+  . filter (not . T.null)
+  . map (uncurry (fromMaybe . T.pack . show))
 
 data ReplacedResult a = Replaced Bool a | NotReplaced Bool
 type GenRR m = forall a. Data a => (a -> m (ReplacedResult a))
diff --git a/pandoc-crossref.cabal b/pandoc-crossref.cabal
--- a/pandoc-crossref.cabal
+++ b/pandoc-crossref.cabal
@@ -4,10 +4,10 @@
 --
 -- see: https://github.com/sol/hpack
 --
--- hash: 5ca00ee6e80501d52f8cd0b7fdfc2fe2b83fc57a68b1c2efe471f696dd95567b
+-- hash: 5a129dfce5b068071f7222d4862b7159b9293232e08ec191d8446632b0fe6314
 
 name:           pandoc-crossref
-version:        0.3.9.1
+version:        0.3.10.0
 synopsis:       Pandoc filter for cross-references
 description:    pandoc-crossref is a pandoc filter for numbering figures, equations, tables and cross-references to them.
 category:       Text
@@ -25,9 +25,15 @@
 data-files:
     docs/demo/demo.md
     docs/index.md
+    test/m2m/chapDelim/expect.md
+    test/m2m/chapDelim/expect.tex
+    test/m2m/chapDelim/input.md
     test/m2m/delim/expect.md
     test/m2m/delim/expect.tex
     test/m2m/delim/input.md
+    test/m2m/emptyChapterLabels/expect.md
+    test/m2m/emptyChapterLabels/expect.tex
+    test/m2m/emptyChapterLabels/input.md
     test/m2m/equations-auto/expect.md
     test/m2m/equations-auto/expect.tex
     test/m2m/equations-auto/input.md
@@ -67,6 +73,9 @@
     test/m2m/section-template/expect.md
     test/m2m/section-template/expect.tex
     test/m2m/section-template/input.md
+    test/m2m/setLabelAttribute/expect.md
+    test/m2m/setLabelAttribute/expect.tex
+    test/m2m/setLabelAttribute/input.md
     test/m2m/subfigures-ccsDelim/expect.md
     test/m2m/subfigures-ccsDelim/expect.tex
     test/m2m/subfigures-ccsDelim/input.md
@@ -119,7 +128,7 @@
     , directory >=1 && <1.4
     , filepath >=1.1 && <1.5
     , mtl >=1.1 && <2.3
-    , pandoc >=2.10 && <2.12
+    , pandoc >=2.10 && <2.13
     , pandoc-types >=1.21 && <1.23
     , roman-numerals ==0.5.*
     , syb >=0.4 && <0.8
@@ -150,7 +159,7 @@
     , mtl >=1.1 && <2.3
     , open-browser >=0.2 && <0.3
     , optparse-applicative >=0.13 && <0.17
-    , pandoc >=2.10 && <2.12
+    , pandoc >=2.10 && <2.13
     , pandoc-crossref
     , pandoc-types >=1.21 && <1.23
     , roman-numerals ==0.5.*
@@ -178,7 +187,7 @@
     , filepath >=1.1 && <1.5
     , hspec >=2.4.4 && <3
     , mtl >=1.1 && <2.3
-    , pandoc >=2.10 && <2.12
+    , pandoc >=2.10 && <2.13
     , pandoc-crossref
     , pandoc-types >=1.21 && <1.23
     , roman-numerals ==0.5.*
@@ -227,7 +236,7 @@
     , filepath >=1.1 && <1.5
     , hspec >=2.4.4 && <3
     , mtl >=1.1 && <2.3
-    , pandoc >=2.10 && <2.12
+    , pandoc >=2.10 && <2.13
     , pandoc-types >=1.21 && <1.23
     , roman-numerals ==0.5.*
     , syb >=0.4 && <0.8
diff --git a/test/m2m/chapDelim/expect.md b/test/m2m/chapDelim/expect.md
new file mode 100644
--- /dev/null
+++ b/test/m2m/chapDelim/expect.md
@@ -0,0 +1,9 @@
+# 1 Section {#sec:section}
+
+## 1delim1 Subsection {#sec:subsection}
+
+### 1delim1delim1 Subsubsection {#sec:subsubsection}
+
+# 2 Section {#sec:section-1}
+
+### 2delim1delim1 Subsubsection {#sec:subsubsection-1}
diff --git a/test/m2m/chapDelim/expect.tex b/test/m2m/chapDelim/expect.tex
new file mode 100644
--- /dev/null
+++ b/test/m2m/chapDelim/expect.tex
@@ -0,0 +1,14 @@
+\hypertarget{sec:section}{%
+\section{1 Section}\label{sec:section}}
+
+\hypertarget{sec:subsection}{%
+\subsection{1delim1 Subsection}\label{sec:subsection}}
+
+\hypertarget{sec:subsubsection}{%
+\subsubsection{1delim1delim1 Subsubsection}\label{sec:subsubsection}}
+
+\hypertarget{sec:section-1}{%
+\section{2 Section}\label{sec:section-1}}
+
+\hypertarget{sec:subsubsection-1}{%
+\subsubsection{2delim1delim1 Subsubsection}\label{sec:subsubsection-1}}
diff --git a/test/m2m/chapDelim/input.md b/test/m2m/chapDelim/input.md
new file mode 100644
--- /dev/null
+++ b/test/m2m/chapDelim/input.md
@@ -0,0 +1,16 @@
+---
+chapDelim: "delim"
+numberSections: true
+sectionsDepth: -1
+autoSectionLabels: true
+...
+
+# Section
+
+## Subsection
+
+### Subsubsection
+
+# Section
+
+### Subsubsection
diff --git a/test/m2m/emptyChapterLabels/expect.md b/test/m2m/emptyChapterLabels/expect.md
new file mode 100644
--- /dev/null
+++ b/test/m2m/emptyChapterLabels/expect.md
@@ -0,0 +1,15 @@
+# 1 Section {#sec:section}
+
+## 1 Subsection {#sec:subsection label=""}
+
+![Figure 1: Figure1](./image.png){#fig:figure1}
+
+### 1.1 Subsubsection {#sec:subsubsection}
+
+# 2 Section {#sec:section-1}
+
+### 2.1.1 Subsubsection {#sec:subsubsection-1}
+
+sec. 1.1
+
+fig. 1
diff --git a/test/m2m/emptyChapterLabels/expect.tex b/test/m2m/emptyChapterLabels/expect.tex
new file mode 100644
--- /dev/null
+++ b/test/m2m/emptyChapterLabels/expect.tex
@@ -0,0 +1,26 @@
+\hypertarget{sec:section}{%
+\section{1 Section}\label{sec:section}}
+
+\hypertarget{sec:subsection}{%
+\subsection{1 Subsection}\label{sec:subsection}}
+
+\begin{figure}
+\hypertarget{fig:figure1}{%
+\centering
+\includegraphics{./image.png}
+\caption{Figure1}\label{fig:figure1}
+}
+\end{figure}
+
+\hypertarget{sec:subsubsection}{%
+\subsubsection{1.1 Subsubsection}\label{sec:subsubsection}}
+
+\hypertarget{sec:section-1}{%
+\section{2 Section}\label{sec:section-1}}
+
+\hypertarget{sec:subsubsection-1}{%
+\subsubsection{2.1.1 Subsubsection}\label{sec:subsubsection-1}}
+
+sec.~\ref{sec:subsubsection}
+
+fig.~\ref{fig:figure1}
diff --git a/test/m2m/emptyChapterLabels/input.md b/test/m2m/emptyChapterLabels/input.md
new file mode 100644
--- /dev/null
+++ b/test/m2m/emptyChapterLabels/input.md
@@ -0,0 +1,21 @@
+---
+numberSections: true
+sectionsDepth: -1
+autoSectionLabels: true
+...
+
+# Section
+
+## Subsection {label=""}
+
+![Figure1](./image.png){#fig:figure1}
+
+### Subsubsection
+
+# Section
+
+### Subsubsection
+
+@sec:subsubsection
+
+@fig:figure1
diff --git a/test/m2m/setLabelAttribute/expect.md b/test/m2m/setLabelAttribute/expect.md
new file mode 100644
--- /dev/null
+++ b/test/m2m/setLabelAttribute/expect.md
@@ -0,0 +1,23 @@
+# Section {#section label="1"}
+
+![Figure 1.1: Figure](./image.png){#fig:1 label="1.1"}
+
+[$$equation\qquad(1.1)$$]{#eq:1 label="1.1"}
+
+::: {#tbl:1 label="1.1"}
+  a   b
+  --- ---
+  1   2
+
+  : Table 1.1: Table
+:::
+
+::: {#lst:1 .listing}
+Listing 1.1: Code Listing
+
+``` {label="1.1"}
+code
+```
+:::
+
+## Section {#section-1 label="1.customLabel"}
diff --git a/test/m2m/setLabelAttribute/expect.tex b/test/m2m/setLabelAttribute/expect.tex
new file mode 100644
--- /dev/null
+++ b/test/m2m/setLabelAttribute/expect.tex
@@ -0,0 +1,42 @@
+\hypertarget{section}{%
+\section{Section}\label{section}}
+
+\begin{figure}
+\hypertarget{fig:1}{%
+\centering
+\includegraphics{./image.png}
+\caption{Figure}\label{fig:1}
+}
+\end{figure}
+
+\begin{equation}\protect\hypertarget{eq:1}{}{equation}\label{eq:1}\end{equation}
+
+\hypertarget{tbl:1}{}
+\begin{longtable}[]{@{}ll@{}}
+\caption{\label{tbl:1}Table}\tabularnewline
+\toprule
+a & b \\
+\midrule
+\endfirsthead
+\toprule
+a & b \\
+\midrule
+\endhead
+1 & 2 \\
+\bottomrule
+\end{longtable}
+
+\begin{codelisting}
+
+\caption{Code Listing}
+
+\hypertarget{lst:1}{%
+\label{lst:1}}%
+\begin{verbatim}
+code
+\end{verbatim}
+
+\end{codelisting}
+
+\hypertarget{section-1}{%
+\subsection{Section}\label{section-1}}
diff --git a/test/m2m/setLabelAttribute/input.md b/test/m2m/setLabelAttribute/input.md
new file mode 100644
--- /dev/null
+++ b/test/m2m/setLabelAttribute/input.md
@@ -0,0 +1,25 @@
+---
+setLabelAttribute: true
+codeBlockCaptions: true
+chapters: true
+...
+
+# Section
+
+![Figure](./image.png){#fig:1}
+
+$$equation$${#eq:1}
+
+| a | b |
+|---|---|
+| 1 | 2 |
+
+: Table {#tbl:1}
+
+```
+code
+```
+
+: Code Listing {#lst:1}
+
+## Section {label="customLabel"}
diff --git a/test/test-pandoc-crossref.hs b/test/test-pandoc-crossref.hs
--- a/test/test-pandoc-crossref.hs
+++ b/test/test-pandoc-crossref.hs
@@ -244,7 +244,7 @@
 
     describe "Util.CodeBlockCaptions" $
       it "Transforms table-style codeBlock captions to codeblock divs" $ do
-        let t x = testCBCaptions x (codeBlockDiv "Code Block" "cb")
+        let t x = testCBCaptions x (codeBlockDiv' "Code Block" "cb")
         t (codeBlockForTable "cb" <> paraText ": Code Block")
         t (codeBlockForTable "cb" <> paraText "Listing: Code Block")
         t (paraText ": Code Block" <> codeBlockForTable "cb")
@@ -405,6 +405,12 @@
 
 codeBlockDiv :: T.Text -> T.Text -> Blocks
 codeBlockDiv title ref = divWith ("lst:"<>ref, ["listing","haskell"],[]) $
+  para (text title) <>
+  codeBlockWith
+    ("",["haskell"],[]) "main :: IO ()"
+
+codeBlockDiv' :: T.Text -> T.Text -> Blocks
+codeBlockDiv' title ref = divWith ("lst:"<>ref, ["listing"],[]) $
   para (text title) <>
   codeBlockWith
     ("",["haskell"],[]) "main :: IO ()"
