diff --git a/CHANGES.md b/CHANGES.md
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -21,6 +21,11 @@
 Internal/api/developer-ish changes in the hledger-lib (and hledger) packages.
 For user-visible changes, see the hledger package changelog.
 
+# 1.33.1 2024-05-02
+
+- Updates for hledger 1.33.1
+
+
 # 1.33 2024-04-18
 
 Breaking changes
@@ -57,6 +62,7 @@
 - distinguish oneLineFmt and oneLineNoCostFmt; add fullZeroFmt
 - matchedPostingsBeforeAndDuring: improve debug output
 
+[#2177]: https://github.com/simonmichael/hledger/issues/2177
 
 
 # 1.32.3 2024-01-28
diff --git a/Hledger/Data/Amount.hs b/Hledger/Data/Amount.hs
--- a/Hledger/Data/Amount.hs
+++ b/Hledger/Data/Amount.hs
@@ -87,7 +87,7 @@
   showAmount,
   showAmountWith,
   showAmountB,
-  showAmountsCostB,
+  showAmountCostB,
   cshowAmount,
   showAmountWithZeroCommodity,
   showAmountDebug,
@@ -633,19 +633,6 @@
 
 -- Amount rendering
 
--- Show an amount's cost as @ UNITCOST or @@ TOTALCOST (builder version).
-showAmountsCostB :: Amount -> WideBuilder
-showAmountsCostB amt = case acost amt of
-    Nothing              -> mempty
-    Just (UnitCost  pa) -> WideBuilder (TB.fromString " @ ")  3 <> showAmountB defaultFmt{displayZeroCommodity=True} pa
-    Just (TotalCost pa) -> WideBuilder (TB.fromString " @@ ") 4 <> showAmountB defaultFmt{displayZeroCommodity=True} (sign pa)
-  where sign = if aquantity amt < 0 then negate else id
-
-showAmountCostDebug :: Maybe AmountCost -> String
-showAmountCostDebug Nothing                = ""
-showAmountCostDebug (Just (UnitCost pa))  = " @ "  ++ showAmountDebug pa
-showAmountCostDebug (Just (TotalCost pa)) = " @@ " ++ showAmountDebug pa
-
 -- | Render an amount using its display style and the default amount format.
 -- Zero-equivalent amounts  are shown as just \"0\".
 -- The special "missing" amount is shown as the empty string.
@@ -662,7 +649,7 @@
 showAmountB :: AmountFormat -> Amount -> WideBuilder
 showAmountB _ Amount{acommodity="AUTO"} = mempty
 showAmountB
-  AmountFormat{displayCommodity, displayZeroCommodity, displayDigitGroups
+  afmt@AmountFormat{displayCommodity, displayZeroCommodity, displayDigitGroups
                    ,displayForceDecimalMark, displayCost, displayColour}
   a@Amount{astyle=style} =
     color $ case ascommodityside style of
@@ -676,7 +663,20 @@
       | amountLooksZero a && not displayZeroCommodity = (WideBuilder (TB.singleton '0') 1, "")
       | otherwise = (quantity, quoteCommoditySymbolIfNeeded $ acommodity a)
     space = if not (T.null comm) && ascommodityspaced style then WideBuilder (TB.singleton ' ') 1 else mempty
-    cost = if displayCost then showAmountsCostB a else mempty
+    cost = if displayCost then showAmountCostB afmt a else mempty
+
+-- Show an amount's cost as @ UNITCOST or @@ TOTALCOST (builder version).
+showAmountCostB :: AmountFormat -> Amount -> WideBuilder
+showAmountCostB afmt amt = case acost amt of
+  Nothing              -> mempty
+  Just (UnitCost  pa) -> WideBuilder (TB.fromString " @ ")  3 <> showAmountB afmt pa
+  Just (TotalCost pa) -> WideBuilder (TB.fromString " @@ ") 4 <> showAmountB afmt (sign pa)
+  where sign = if aquantity amt < 0 then negate else id
+
+showAmountCostDebug :: Maybe AmountCost -> String
+showAmountCostDebug Nothing                = ""
+showAmountCostDebug (Just (UnitCost pa))  = " @ "  ++ showAmountDebug pa
+showAmountCostDebug (Just (TotalCost pa)) = " @@ " ++ showAmountDebug pa
 
 -- | Colour version. For a negative amount, adds ANSI codes to change the colour,
 -- currently to hard-coded red.
diff --git a/hledger-lib.cabal b/hledger-lib.cabal
--- a/hledger-lib.cabal
+++ b/hledger-lib.cabal
@@ -5,7 +5,7 @@
 -- see: https://github.com/sol/hpack
 
 name:           hledger-lib
-version:        1.33
+version:        1.33.1
 synopsis:       A library providing the core functionality of hledger
 description:    This library contains hledger's core functionality.
                 It is used by most hledger* packages so that they support the same
@@ -156,6 +156,67 @@
   if (!(os(windows)))
     build-depends:
         pager >=0.1.1.0
+
+test-suite doctest
+  type: exitcode-stdio-1.0
+  main-is: doctests.hs
+  hs-source-dirs:
+      ./
+      test
+  ghc-options: -Wall -Wno-incomplete-uni-patterns -Wno-missing-signatures -Wno-orphans -Wno-type-defaults -Wno-unused-do-bind
+  build-depends:
+      Decimal >=0.5.1
+    , Glob >=0.7
+    , aeson >=1 && <2.3
+    , aeson-pretty
+    , ansi-terminal >=0.9
+    , array
+    , base >=4.14 && <4.20
+    , base-compat
+    , blaze-markup >=0.5.1
+    , bytestring
+    , call-stack
+    , cassava
+    , cassava-megaparsec
+    , cmdargs >=0.10
+    , colour >=2.3.6
+    , containers >=0.5.9
+    , data-default >=0.5
+    , deepseq
+    , directory
+    , doclayout >=0.3 && <0.5
+    , doctest >=0.18.1
+    , extra >=1.6.3
+    , file-embed >=0.0.10
+    , filepath
+    , hashtables >=1.2.3.1
+    , megaparsec >=7.0.0 && <9.7
+    , microlens >=0.4
+    , microlens-th >=0.4
+    , mtl >=2.2.1
+    , parser-combinators >=0.4.0
+    , pretty-simple >4 && <5
+    , regex-tdfa
+    , safe >=0.3.20
+    , tabular >=0.2
+    , tasty >=1.2.3
+    , tasty-hunit >=0.10.0.2
+    , template-haskell
+    , terminal-size >=0.3.3
+    , text >=1.2.4.1
+    , text-ansi >=0.2.1
+    , time >=1.5
+    , timeit
+    , transformers >=0.2
+    , uglymemo
+    , unordered-containers >=0.2
+    , utf8-string >=0.3.5
+  default-language: Haskell2010
+  if (!(os(windows)))
+    build-depends:
+        pager >=0.1.1.0
+  if impl(ghc >= 9.0) && impl(ghc < 9.2)
+    buildable: False
 
 test-suite unittest
   type: exitcode-stdio-1.0
