@@ -57,6 +57,7 @@ module Text.Pandoc.Shared (
57 normalize,
57 normalize,
58 normalizeInlines,
58 normalizeInlines,
59 normalizeBlocks,
59 normalizeBlocks,
60 stringify,
61 stringify,
61 compactify,
62 compactify,
62 compactify',
63 compactify',
@@ -493,6 +494,19 @@ normalizeInlines (Cite cs ils : ys) =
493normalizeInlines (x : xs) = x : normalizeInlines xs
494normalizeInlines (x : xs) = x : normalizeInlines xs
494normalizeInlines [] = []
495normalizeInlines [] = []
497+-- | Remove inline formatting from a list of inlines.
498+removeFormatting :: [Inline] -> [Inline]
499+removeFormatting = query go . walk deNote
500+ where go :: Inline -> [Inline]
501+ go (Str xs) = [Str xs]
503+ go (Code _ x) = [Str x]
504+ go (Math _ x) = [Str x]
505+ go LineBreak = [Space]
507+ deNote (Note _) = Str ""
496-- | Convert pandoc structure to a string with formatting removed.
510-- | Convert pandoc structure to a string with formatting removed.
497-- Footnotes are skipped (since we don't want their contents in link
511-- Footnotes are skipped (since we don't want their contents in link
498-- labels).
512-- labels).