Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Deindent
import Data.List
import Text.Pandoc.Definition
import Text.Pandoc.JSON
import Text.Pandoc.Walk
-- This pass implements <div class="noindent"> by adding \noindent to
-- the start of every paragraph.
deindentParas :: Block -> Block
deindentParas (Para lines) =
Para (RawInline (Format "tex") "\\noindent " : lines)
deindentParas x = x
deindentBlocks :: Block -> Block
deindentBlocks (Div (id, classes, other) blocks) =
if elem "noindent" classes
then Div (id, (delete "noindent" classes), other) (walk deindentParas blocks)
else Div (id, classes, other) blocks
deindentBlocks x = x
main :: IO ()
main = toJSONFilter deindentBlocks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.