aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Text/Pandoc/Writers/HTML.hs25
-rw-r--r--templates/Highlighting.no.hs5
-rw-r--r--templates/Highlighting.yes.hs4
3 files changed, 8 insertions, 26 deletions
diff --git a/Text/Pandoc/Writers/HTML.hs b/Text/Pandoc/Writers/HTML.hs
index 5fbeaaab9..d4ba09293 100644
--- a/Text/Pandoc/Writers/HTML.hs
+++ b/Text/Pandoc/Writers/HTML.hs
@@ -33,7 +33,7 @@ import Text.Pandoc.ASCIIMathML
import Text.Pandoc.CharacterReferences ( decodeCharacterReferences )
import Text.Pandoc.Shared
import Text.Pandoc.Readers.TeXMath
-import Text.Pandoc.Highlighting ( highlightHtml )
+import Text.Pandoc.Highlighting ( highlightHtml, defaultHighlightingCss )
import Numeric ( showHex )
import Data.Char ( ord, toLower, isAlpha )
import Data.List ( isPrefixOf, intersperse, find )
@@ -223,27 +223,6 @@ addToCSS item = do
let current = stCSS st
put $ st {stCSS = S.insert item current}
--- | Generic CSS for syntax highlighting.
-highlightingCSS :: String
-highlightingCSS =
- "pre.sourceCode { }\n\
- \pre.sourceCode span.LineNumber { display: none; }\n\
- \pre.numberLines span.LineNumber { display: inline; color: #AAAAAA; padding-right: 0; border-right: 1px solid #AAAAAA; margin-right: 3px; }\n\
- \pre.sourceCode span.Normal { }\n\
- \pre.sourceCode span.Keyword { color: #007020; font-weight: bold; } \n\
- \pre.sourceCode span.DataType { color: #902000; }\n\
- \pre.sourceCode span.DecVal { color: #40a070; }\n\
- \pre.sourceCode span.BaseN { color: #40a070; }\n\
- \pre.sourceCode span.Float { color: #40a070; }\n\
- \pre.sourceCode span.Char { color: #4070a0; }\n\
- \pre.sourceCode span.String { color: #4070a0; }\n\
- \pre.sourceCode span.Comment { color: #60a0b0; font-style: italic; }\n\
- \pre.sourceCode span.Others { color: #007020; }\n\
- \pre.sourceCode span.Alert { color: red; font-weight: bold; }\n\
- \pre.sourceCode span.Function { color: #06287e; }\n\
- \pre.sourceCode span.RegionMarker { }\n\
- \pre.sourceCode span.Error { color: red; font-weight: bold; }"
-
-- | Convert Pandoc inline list to plain text identifier.
inlineListToIdentifier :: [Inline] -> String
inlineListToIdentifier = dropWhile (not . isAlpha) . inlineListToIdentifier'
@@ -298,7 +277,7 @@ blockToHtml opts (CodeBlock attr@(_,classes,_) rawCode) = do
then []
else [theclass $ unwords classes]) $ thecode <<
(rawCode ++ "\n")
- Right h -> addToCSS highlightingCSS >> return h
+ Right h -> addToCSS defaultHighlightingCss >> return h
blockToHtml opts (BlockQuote blocks) =
-- in S5, treat list in blockquote specially
-- if default is incremental, make it nonincremental;
diff --git a/templates/Highlighting.no.hs b/templates/Highlighting.no.hs
index ed6b7c325..f6b2427ba 100644
--- a/templates/Highlighting.no.hs
+++ b/templates/Highlighting.no.hs
@@ -28,10 +28,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Exports functions for syntax highlighting.
-}
-module Text.Pandoc.Highlighting ( languages, highlightHtml ) where
+module Text.Pandoc.Highlighting ( languages, highlightHtml, defaultHighlightingCss ) where
import Text.XHtml
import Text.Pandoc.Definition
+defaultHighlightingCss :: String
+defaultHighlightingCss = ""
+
languages :: [String]
languages = []
diff --git a/templates/Highlighting.yes.hs b/templates/Highlighting.yes.hs
index 915f6ffee..12d7f2c53 100644
--- a/templates/Highlighting.yes.hs
+++ b/templates/Highlighting.yes.hs
@@ -28,8 +28,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Exports functions for syntax highlighting.
-}
-module Text.Pandoc.Highlighting ( languages, highlightHtml ) where
-import Text.Highlighting.Kate
+module Text.Pandoc.Highlighting ( languages, highlightHtml, defaultHighlightingCss ) where
+import Text.Highlighting.Kate ( languages, highlightAs, formatAsXHtml, FormatOption (..), defaultHighlightingCss )
import Text.XHtml
import Data.List (find, lookup)
import Data.Maybe (fromMaybe)