Portability | portable |
---|---|
Stability | alpha |
Maintainer | John MacFarlane <[email protected]> |
Text.Pandoc
Contents
Description
This helper module exports the main writers, readers, and data structure definitions from the Pandoc libraries.
A typical application will chain together a reader and a writer to convert strings from one format to another. For example, the following simple program will act as a filter converting markdown fragments to reStructuredText, using reference-style links instead of inline links:
module Main where import Text.Pandoc -- include the following two lines only if you're using ghc < 6.12: import Prelude hiding (getContents, putStrLn) import System.IO.UTF8 markdownToRST :: String -> String markdownToRST = (writeRST defaultWriterOptions {writerReferenceLinks = True}) . readMarkdown defaultParserState main = getContents >>= putStrLn . markdownToRST
Note: all of the readers assume that the input text has '\n'
line endings. So if you get your input text from a web form,
you should remove '\r'
characters using filter (/='\r')
.
- module Text.Pandoc.Definition
- readMarkdown :: ParserState -> String -> Pandoc
- readRST :: ParserState -> String -> Pandoc
- readLaTeX :: ParserState -> String -> Pandoc
- readHtml :: ParserState -> String -> Pandoc
- data ParserState = ParserState {
- stateParseRaw :: Bool
- stateParserContext :: ParserContext
- stateQuoteContext :: QuoteContext
- stateSanitizeHTML :: Bool
- stateKeys :: KeyTable
- stateNotes :: NoteTable
- stateTabStop :: Int
- stateStandalone :: Bool
- stateTitle :: [Inline]
- stateAuthors :: [[Inline]]
- stateDate :: [Inline]
- stateStrict :: Bool
- stateSmart :: Bool
- stateLiterateHaskell :: Bool
- stateColumns :: Int
- stateHeaderTable :: [HeaderType]
- stateIndentedCodeClasses :: [String]
- stateNextExample :: Int
- stateExamples :: Map String Int
- stateHasChapters :: Bool
- defaultParserState :: ParserState
- data ParserContext
- data QuoteContext
- type KeyTable = Map Key Target
- type NoteTable = [(String, String)]
- data HeaderType
- writeNative :: WriterOptions -> Pandoc -> String
- writeMarkdown :: WriterOptions -> Pandoc -> String
- writePlain :: WriterOptions -> Pandoc -> String
- writeRST :: WriterOptions -> Pandoc -> String
- writeLaTeX :: WriterOptions -> Pandoc -> String
- writeConTeXt :: WriterOptions -> Pandoc -> String
- writeTexinfo :: WriterOptions -> Pandoc -> String
- writeHtml :: WriterOptions -> Pandoc -> Html
- writeHtmlString :: WriterOptions -> Pandoc -> String
- writeDocbook :: WriterOptions -> Pandoc -> String
- writeOpenDocument :: WriterOptions -> Pandoc -> String
- writeMan :: WriterOptions -> Pandoc -> String
- writeMediaWiki :: WriterOptions -> Pandoc -> String
- writeRTF :: WriterOptions -> Pandoc -> String
- writeODT :: Maybe FilePath -> WriterOptions -> Pandoc -> IO ByteString
- writeEPUB :: Maybe String -> WriterOptions -> Pandoc -> IO ByteString
- data WriterOptions = WriterOptions {
- writerStandalone :: Bool
- writerTemplate :: String
- writerVariables :: [(String, String)]
- writerEPUBMetadata :: String
- writerTabStop :: Int
- writerTableOfContents :: Bool
- writerSlideVariant :: HTMLSlideVariant
- writerIncremental :: Bool
- writerXeTeX :: Bool
- writerHTMLMathMethod :: HTMLMathMethod
- writerIgnoreNotes :: Bool
- writerNumberSections :: Bool
- writerSectionDivs :: Bool
- writerStrictMarkdown :: Bool
- writerReferenceLinks :: Bool
- writerWrapText :: Bool
- writerLiterateHaskell :: Bool
- writerEmailObfuscation :: ObfuscationMethod
- writerIdentifierPrefix :: String
- writerSourceDirectory :: FilePath
- writerUserDataDir :: Maybe FilePath
- data HTMLSlideVariant
- = S5Slides
- | SlidySlides
- | NoSlides
- data HTMLMathMethod
- defaultWriterOptions :: WriterOptions
- module Text.Pandoc.Templates
- pandocVersion :: String
Definitions
module Text.Pandoc.Definition
Readers: converting to Pandoc format
Arguments
:: ParserState | Parser state, including options for parser |
-> String | String to parse (assuming |
-> Pandoc |
Read markdown from an input string and return a Pandoc document.
Arguments
:: ParserState | Parser state, including options for parser |
-> String | String to parse (assuming |
-> Pandoc |
Parse reStructuredText string and return Pandoc document.
Arguments
:: ParserState | Parser state, including options for parser |
-> String | String to parse (assumes |
-> Pandoc |
Parse LaTeX from string and return Pandoc
document.
Arguments
:: ParserState | Parser state |
-> String | String to parse (assumes |
-> Pandoc |
Convert HTML-formatted string to Pandoc
document.
Parser state used in readers
data ParserState Source
Parsing options.
Constructors
ParserState | |
Fields
|
Instances
data ParserContext Source
Constructors
ListItemState | Used when running parser on list item contents |
NullState | Default state |
Instances
data QuoteContext Source
Constructors
InSingleQuote | Used when parsing inside single quotes |
InDoubleQuote | Used when parsing inside double quotes |
NoQuote | Used when not parsing inside quotes |
Instances
data HeaderType Source
Constructors
SingleHeader Char | Single line of characters underneath |
DoubleHeader Char | Lines of characters above and below |
Instances
Writers: converting from Pandoc format
writeNative :: WriterOptions -> Pandoc -> StringSource
Prettyprint Pandoc document.
writeMarkdown :: WriterOptions -> Pandoc -> StringSource
Convert Pandoc to Markdown.
writePlain :: WriterOptions -> Pandoc -> StringSource
Convert Pandoc to plain text (like markdown, but without links, pictures, or inline formatting).
writeRST :: WriterOptions -> Pandoc -> StringSource
Convert Pandoc to RST.
writeLaTeX :: WriterOptions -> Pandoc -> StringSource
Convert Pandoc to LaTeX.
writeConTeXt :: WriterOptions -> Pandoc -> StringSource
Convert Pandoc to ConTeXt.
writeTexinfo :: WriterOptions -> Pandoc -> StringSource
Convert Pandoc to Texinfo.
writeHtml :: WriterOptions -> Pandoc -> HtmlSource
Convert Pandoc document to Html structure.
writeHtmlString :: WriterOptions -> Pandoc -> StringSource
Convert Pandoc document to Html string.
writeDocbook :: WriterOptions -> Pandoc -> StringSource
Convert Pandoc document to string in Docbook format.
writeOpenDocument :: WriterOptions -> Pandoc -> StringSource
Convert Pandoc document to string in OpenDocument format.
writeMan :: WriterOptions -> Pandoc -> StringSource
Convert Pandoc to Man.
writeMediaWiki :: WriterOptions -> Pandoc -> StringSource
Convert Pandoc to MediaWiki.
writeRTF :: WriterOptions -> Pandoc -> StringSource
Convert Pandoc to a string in rich text format.
Arguments
:: Maybe FilePath | Path specified by --reference-odt |
-> WriterOptions | Writer options |
-> Pandoc | Document to convert |
-> IO ByteString |
Produce an ODT file from a Pandoc document.
Arguments
:: Maybe String | EPUB stylesheet specified at command line |
-> WriterOptions | Writer options |
-> Pandoc | Document to convert |
-> IO ByteString |
Produce an EPUB file from a Pandoc document.
Writer options used in writers
data WriterOptions Source
Options for writers
Constructors
WriterOptions | |
Fields
|
Instances
data HTMLSlideVariant Source
Varieties of HTML slide shows.
Constructors
S5Slides | |
SlidySlides | |
NoSlides |
data HTMLMathMethod Source
Constructors
PlainMath | |
LaTeXMathML (Maybe String) | |
JsMath (Maybe String) | |
GladTeX | |
WebTeX String | |
MathML (Maybe String) |
Instances
defaultWriterOptions :: WriterOptionsSource
Default writer options.
Rendering templates and default templates
module Text.Pandoc.Templates
Version
Version number of pandoc library.