@@ -468,11 +468,11 @@ bodyPartToBlocks (Paragraph pPr parparts)
468468 $ codeBlock
469469 $ concatMap parPartToString parparts
470470 | (c : cs) <- filter (isJust . isHeaderClass) $ pStyle pPr
471− , Just n <- isHeaderClass c = do
471+ , Just (prefix, n) <- isHeaderClass c = do
472472 ils <- local (\s-> s{docxInHeaderBlock=True}) $
473473 (concatReduce <$> mapM parPartToInlines parparts)
474474 makeHeaderAnchor $
475− headerWith ("", delete ("Heading" ++ show n) cs, []) n ils
475+ headerWith ("", delete (prefix ++ show n) cs, []) n ils
476476 | otherwise = do
477477 ils <- concatReduce <$> mapM parPartToInlines parparts >>=
478478 (return . fromList . trimLineBreaks . normalizeSpaces . toList)
@@ -560,11 +560,11 @@ docxToOutput opts (Docx (Document _ body)) =
560560 let dEnv = def { docxOptions = opts} in
561561 evalDocxContext (bodyToOutput body) dEnv def
562562
563−isHeaderClass :: String -> Maybe Int
563+isHeaderClass :: String -> Maybe (String, Int)
564564isHeaderClass s | (pref:_) <- filter (\h -> isPrefixOf h s) headerPrefixes
565565 , Just s' <- stripPrefix pref s =
566566 case reads s' :: [(Int, String)] of
567567 [] -> Nothing
568− ((n, "") : []) -> Just n
568+ ((n, "") : []) -> Just (pref, n)
569569 _ -> Nothing
570570isHeaderClass _ = Nothing