@@ -680,9 +680,12 @@ replaceAnchor :: PandocMonad m => ParaElem -> Pres m ParaElem
680replaceAnchor (Run rProps s)
680replaceAnchor (Run rProps s)
681 | Just (ExternalTarget ('#':anchor, _)) <- rLink rProps = do
681 | Just (ExternalTarget ('#':anchor, _)) <- rLink rProps = do
682 anchorMap <- gets stAnchorMap
682 anchorMap <- gets stAnchorMap
683+ -- If the anchor is not in the anchormap, we just remove the
683− return $ case M.lookup anchor anchorMap of
685+ let rProps' = case M.lookup anchor anchorMap of
684− Just n -> Run (rProps{rLink = Just $ InternalTarget n}) s
686+ Just n -> rProps{rLink = Just $ InternalTarget n}
687+ Nothing -> rProps{rLink = Nothing}
685− Nothing -> Run rProps s
688+ return $ Run rProps' s
686replaceAnchor pe = return pe
689replaceAnchor pe = return pe
688blocksToPresentation :: PandocMonad m => [Block] -> Pres m Presentation
691blocksToPresentation :: PandocMonad m => [Block] -> Pres m Presentation