@@ -561,6 +561,16 @@ pandocToEPUB version opts doc = do
561561 | not (TS.null ident) = [(ident, TS.pack (showChapter num) <> "#" <> ident)]
562562 extractLinkURL' num (Image (ident, _, _) _ _)
563563 | not (TS.null ident) = [(ident, TS.pack (showChapter num) <> "#" <> ident)]
564+ extractLinkURL' num (RawInline fmt raw)
565+ | isHtmlFormat fmt
566+ = foldr (\tag ->
567+ case tag of
568+ TagOpen{} ->
569+ case fromAttrib "id" tag of
570+ "" -> id
571+ x -> ((x, TS.pack (showChapter num) <> "#" <> x):)
572+ _ -> id)
573+ [] (parseTags raw)
564574 extractLinkURL' _ _ = []
565575
566576 let extractLinkURL :: Int -> Block -> [(TS.Text, TS.Text)]
@@ -570,6 +580,16 @@ pandocToEPUB version opts doc = do
570580 | not (TS.null ident) = [(ident, TS.pack (showChapter num) <> "#" <> ident)]
571581 extractLinkURL num (Table (ident,_,_) _ _ _ _ _)
572582 | not (TS.null ident) = [(ident, TS.pack (showChapter num) <> "#" <> ident)]
583+ extractLinkURL num (RawBlock fmt raw)
584+ | isHtmlFormat fmt
585+ = foldr (\tag ->
586+ case tag of
587+ TagOpen{} ->
588+ case fromAttrib "id" tag of
589+ "" -> id
590+ x -> ((x, TS.pack (showChapter num) <> "#" <> x):)
591+ _ -> id)
592+ [] (parseTags raw)
573593 extractLinkURL num b = query (extractLinkURL' num) b
574594
575595 let reftable = concat $ zipWith (\(Chapter bs) num ->