diff options
Diffstat (limited to 'src/Text/Pandoc/Highlighting.hs')
-rw-r--r-- | src/Text/Pandoc/Highlighting.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Highlighting.hs b/src/Text/Pandoc/Highlighting.hs index f29106262..5ddaf1379 100644 --- a/src/Text/Pandoc/Highlighting.hs +++ b/src/Text/Pandoc/Highlighting.hs @@ -37,10 +37,14 @@ import Data.List (find) import Data.Maybe (fromMaybe) import Data.Char (toLower) -highlightHtml :: Attr -> String -> Either String Html -highlightHtml (_, classes, keyvals) rawCode = +highlightHtml :: Bool -- ^ True if inline HTML + -> Attr -- ^ Attributes of the Code or CodeBlock + -> String -- ^ Raw contents of the Code or CodeBlock + -> Either String Html -- ^ An error or the formatted Html +highlightHtml inline (_, classes, keyvals) rawCode = let firstNum = read $ fromMaybe "1" $ lookup "startFrom" keyvals fmtOpts = [OptNumberFrom firstNum] ++ + [OptInline | inline] ++ case find (`elem` ["number","numberLines","number-lines"]) classes of Nothing -> [] Just _ -> [OptNumberLines] @@ -65,6 +69,6 @@ languages = [] languagesByExtension :: String -> [String] languagesByExtension _ = [] -highlightHtml :: Attr -> String -> Either String Html -highlightHtml _ _ = Left "Pandoc was not compiled with support for highlighting" +highlightHtml :: Bool -> Attr -> String -> Either String Html +highlightHtml _ _ _ = Left "Pandoc was not compiled with support for highlighting" #endif |