diff options
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Highlighting.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Highlighting.hs b/src/Text/Pandoc/Highlighting.hs index f80ebeac7..efa4fa20e 100644 --- a/src/Text/Pandoc/Highlighting.hs +++ b/src/Text/Pandoc/Highlighting.hs @@ -40,9 +40,11 @@ import Data.Char (toLower) 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 + -> Either String Html -- ^ An error or the formatted Html +highlightHtml inline (id', classes, keyvals) rawCode = + let firstNum = case reads (fromMaybe "1" $ lookup "startFrom" keyvals) of + ((n,_):_) -> n + [] -> 1 fmtOpts = [OptNumberFrom firstNum] ++ [OptInline | inline] ++ case find (`elem` ["number","numberLines","number-lines"]) classes of |