Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- para :: Text -> Block
- plain :: Text -> Block
- table :: Text -> [Text] -> [Alignment] -> [Int] -> [[Text]] -> Block
- code :: Text -> [Text] -> Text -> Block
- data Flavour
- readPandoc :: FilePath -> Flavour -> IO (Either PandocError Pandoc)
- renderMarkdown :: Flavour -> Pandoc -> Either PandocError Text
- output :: Monad m => Text -> Text -> StateT (Map Text Text) m ()
- runOutput :: (FilePath, Flavour) -> (FilePath, Flavour) -> StateT Output IO () -> IO (Either PandocError ())
- tweakHaskellCodeBlock :: Block -> Block
Documentation
para :: Text -> Block Source #
doctest >>> :set -XOverloadedStrings
turn text into a Pandoc Paragraph Block >>> para "hello" Para [Str "hello"]
plain :: Text -> Block Source #
turn text into a Pandoc Plain Block >>> plain "hello" Plain [Str "hello"]
table :: Text -> [Text] -> [Alignment] -> [Int] -> [[Text]] -> Block Source #
table caption headers alignments widths rows >>> table "an example table" ["first column", "second column"] [AlignLeft, AlignRight] [0,0] [["first row", "1"], ["second row", "1000"]] Table [Str "an example table"] [AlignLeft,AlignRight] [0.0,0.0] [[Para [Str "first column"]],[Para [Str "second column"]]] [[[Para [Str "first row"]],[Para [Str "1"]]],[[Para [Str "second row"]],[Para [Str "1000"]]]]
code :: Text -> [Text] -> Text -> Block Source #
code identifier classes text >>> code "name" ["sourceCode", "literate", "haskell"] "x = 1n" CodeBlock ("name",["sourceCode","literate","haskell"],[]) "x = 1n"
use LHS when you want to just add output to a *.lhs | use GitHubMarkdown for rendering code and results on github
readPandoc :: FilePath -> Flavour -> IO (Either PandocError Pandoc) Source #
read a file into the pandoc AST
renderMarkdown :: Flavour -> Pandoc -> Either PandocError Text Source #
render a pandoc AST
output :: Monad m => Text -> Text -> StateT (Map Text Text) m () Source #
add an output key-value pair to state
runOutput :: (FilePath, Flavour) -> (FilePath, Flavour) -> StateT Output IO () -> IO (Either PandocError ()) Source #
insert outputs into a new file
tweakHaskellCodeBlock :: Block -> Block Source #
literate haskell code blocks comes out of markdown+lhs to native pandoc with the following classes:
- "sourceCode","literate","haskell"
and then conversion to github flavour gives:
``` sourceCode ```
which doesn't lead to nice code highlighting on github (and elsewhere). This function tweaks the list so that ["haskell"] is the class, and it all works.