aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs3
-rw-r--r--src/Text/Pandoc/Shared.hs6
-rw-r--r--src/pandoc.hs13
3 files changed, 18 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index f4384d493..cfd9c8b5c 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -394,7 +394,8 @@ codeBlockIndented = do
l <- indentedLine
return $ b ++ l))
optional blanklines
- return $ CodeBlock ("",[],[]) $ stripTrailingNewlines $ concat contents
+ st <- getState
+ return $ CodeBlock ("", stateDefaultCodeClasses st, []) $ stripTrailingNewlines $ concat contents
lhsCodeBlock :: GenParser Char ParserState Block
lhsCodeBlock = do
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index a0c45072d..73b5740d1 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -671,7 +671,8 @@ data ParserState = ParserState
stateSmart :: Bool, -- ^ Use smart typography?
stateLiterateHaskell :: Bool, -- ^ Treat input as literate haskell
stateColumns :: Int, -- ^ Number of columns in terminal
- stateHeaderTable :: [HeaderType] -- ^ Ordered list of header types used
+ stateHeaderTable :: [HeaderType], -- ^ Ordered list of header types used
+ stateDefaultCodeClasses :: [String] -- ^ Classes to use for indented code blocks
}
deriving Show
@@ -695,7 +696,8 @@ defaultParserState =
stateSmart = False,
stateLiterateHaskell = False,
stateColumns = 80,
- stateHeaderTable = [] }
+ stateHeaderTable = [],
+ stateDefaultCodeClasses = [] }
data HeaderType
= SingleHeader Char -- ^ Single line of characters underneath
diff --git a/src/pandoc.hs b/src/pandoc.hs
index d6c45501e..937491a6a 100644
--- a/src/pandoc.hs
+++ b/src/pandoc.hs
@@ -153,6 +153,7 @@ data Opt = Opt
, optSanitizeHTML :: Bool -- ^ Sanitize HTML
, optPlugins :: [Pandoc -> IO Pandoc] -- ^ Plugins to apply
, optEmailObfuscation :: ObfuscationMethod
+ , optDefaultCodeClasses :: [String] -- ^ Default classes for indented code blocks
#ifdef _CITEPROC
, optBiblioFile :: String
, optBiblioFormat :: String
@@ -189,6 +190,7 @@ defaultOpts = Opt
, optSanitizeHTML = False
, optPlugins = []
, optEmailObfuscation = JavascriptObfuscation
+ , optDefaultCodeClasses = []
#ifdef _CITEPROC
, optBiblioFile = []
, optBiblioFormat = []
@@ -312,6 +314,13 @@ options =
"none|javascript|references")
"" -- "Method for obfuscating email in HTML"
+ , Option "" ["default-code-classes"]
+ (ReqArg
+ (\arg opt -> return opt { optDefaultCodeClasses = words $
+ map (\c -> if c == ',' then ' ' else c) arg })
+ "STRING")
+ "" -- "Classes (whitespace- or comma-separated) to use for indented code-blocks"
+
, Option "" ["toc", "table-of-contents"]
(NoArg
(\opt -> return opt { optTableOfContents = True }))
@@ -531,6 +540,7 @@ main = do
, optWrapText = wrap
, optSanitizeHTML = sanitize
, optEmailObfuscation = obfuscationMethod
+ , optDefaultCodeClasses = codeBlockClasses
#ifdef _CITEPROC
, optBiblioFile = biblioFile
, optBiblioFormat = biblioFormat
@@ -586,7 +596,8 @@ main = do
stateSmart = smart || writerName' `elem`
["latex", "context", "man"],
stateColumns = columns,
- stateStrict = strict }
+ stateStrict = strict,
+ stateDefaultCodeClasses = codeBlockClasses }
let csslink = if null css
then ""
else concatMap