cmark-highlight 0.1.0.0 → 0.2.0.0
raw patch · 3 files changed
+15/−12 lines, 3 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
- CMark.Highlight: highlight :: Node -> Node
- CMark.Highlight: highlightWith :: (Text -> Text -> FormatOptions -> FormatOptions) -> Node -> Node
+ CMark.Highlight: highlightNode :: Node -> Node
+ CMark.Highlight: highlightNodeWith :: (Text -> Text -> FormatOptions -> FormatOptions) -> Node -> Node
Files
- CHANGELOG.md +4/−0
- cmark-highlight.cabal +1/−1
- lib/CMark/Highlight.hs +10/−11
CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.2.0.0++* Renamed `highlight` to `highlightNode`.+ # 0.1.0.0 First release.
cmark-highlight.cabal view
@@ -1,5 +1,5 @@ name: cmark-highlight-version: 0.1.0.0+version: 0.2.0.0 synopsis: Code highlighting for cmark description: Code highlighting for cmark
lib/CMark/Highlight.hs view
@@ -1,14 +1,13 @@ {-# LANGUAGE-ViewPatterns,-RecordWildCards+ViewPatterns #-} module CMark.Highlight ( -- * Highlighting- highlight,- highlightWith,+ highlightNode,+ highlightNodeWith, -- * Options FormatOptions(..),@@ -35,18 +34,18 @@ By default, the rest of the attribute line (i.e. all words after the first word after @~~~@ or @```@) get added as classes to the container block of the code. -}-highlight :: Node -> Node-highlight = highlightWith (\_ _ x -> x)+highlightNode :: Node -> Node+highlightNode = highlightNodeWith (\_ _ x -> x) {- | The function is given code block's language (i.e. the 1st word of the attribute line after @~~~@ or @```@) and the rest of the attribute line. If you don't want the classes to be derived from the attribute line, make the function set 'containerClasses' to @[]@. -}-highlightWith+highlightNodeWith :: (Text -> Text -> FormatOptions -> FormatOptions) -> Node -> Node-highlightWith f (Node pos (CODE_BLOCK info code) ns) =- Node pos (HTML_BLOCK formatted) (map (highlightWith f) ns)+highlightNodeWith f (Node pos (CODE_BLOCK info code) ns) =+ Node pos (HTML_BLOCK formatted) (map (highlightNodeWith f) ns) where (codeLang, T.drop 1 -> codeInfo) = T.break (== ' ') (T.strip info) highlighted = highlightAs (T.unpack codeLang) (T.unpack code)@@ -54,5 +53,5 @@ containerClasses = words (T.unpack codeInfo) } formatted = TL.toStrict . renderHtml $ formatHtmlBlock (f codeLang codeInfo opts) highlighted-highlightWith f (Node pos type_ ns) =- Node pos type_ (map (highlightWith f) ns)+highlightNodeWith f (Node pos type_ ns) =+ Node pos type_ (map (highlightNodeWith f) ns)