cmark-gfm 0.2.4 → 0.2.5
raw patch · 4 files changed
+24/−4 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ CMarkGFM: FOOTNOTE_DEFINITION :: NodeType
+ CMarkGFM: FOOTNOTE_REFERENCE :: NodeType
+ CMarkGFM: optFootnotes :: CMarkOption
Files
- CMarkGFM.hsc +18/−3
- changelog +4/−0
- cmark-gfm.cabal +1/−1
- test/test-cmark.hs +1/−0
CMarkGFM.hsc view
@@ -17,6 +17,7 @@ , optSmart , optSafe , optUnsafe+ , optFootnotes , extStrikethrough , extTable , extAutolink@@ -252,6 +253,8 @@ | TABLE [TableCellAlignment] | TABLE_ROW | TABLE_CELL+ | FOOTNOTE_REFERENCE+ | FOOTNOTE_DEFINITION deriving (Show, Read, Eq, Ord, Typeable, Data, Generic) data PosInfo = PosInfo{ startLine :: Int@@ -289,6 +292,10 @@ optUnsafe :: CMarkOption optUnsafe = CMarkOption #const CMARK_OPT_UNSAFE +-- | Enable footnote syntax support (equivalent of footnotes extension for official cmark-gfm)+optFootnotes :: CMarkOption+optFootnotes = CMarkOption #const CMARK_OPT_FOOTNOTES+ newtype CMarkExtension = CMarkExtension { unCMarkExtension :: String } extStrikethrough :: CMarkExtension@@ -351,6 +358,10 @@ -> return SOFTBREAK #const CMARK_NODE_LINEBREAK -> return LINEBREAK+ #const CMARK_NODE_FOOTNOTE_DEFINITION+ -> return FOOTNOTE_DEFINITION+ #const CMARK_NODE_FOOTNOTE_REFERENCE+ -> return FOOTNOTE_REFERENCE _ -> if nodeType == fromIntegral (Unsafe.unsafePerformIO $ peek c_CMARK_NODE_STRIKETHROUGH) then return STRIKETHROUGH else if nodeType == fromIntegral (Unsafe.unsafePerformIO $ peek c_CMARK_NODE_TABLE) then@@ -490,9 +501,13 @@ SOFTBREAK -> c_cmark_node_new (#const CMARK_NODE_SOFTBREAK) LINEBREAK -> c_cmark_node_new (#const CMARK_NODE_LINEBREAK) STRIKETHROUGH -> c_cmark_node_new (fromIntegral . Unsafe.unsafePerformIO $ peek c_CMARK_NODE_STRIKETHROUGH)- TABLE _ -> error "constructing table not supported"- TABLE_ROW -> error "constructing table row not supported"- TABLE_CELL -> error "constructing table cell not supported"+ TABLE _ -> error "constructing table not supported"+ TABLE_ROW -> error "constructing table row not supported"+ TABLE_CELL -> error "constructing table cell not supported"+ FOOTNOTE_DEFINITION -> error "constructing footnotes not supported"+ FOOTNOTE_REFERENCE -> error "constructing footnotes not supported"++ mapM_ (\child -> fromNode child >>= c_cmark_node_append_child node) children return node
changelog view
@@ -1,3 +1,7 @@+cmark-gfm 0.2.5 (27 Sep 2022)++ * Add support for enabling footnotes (#26, Anton Sorokin).+ cmark-gfm 0.2.4 (22 Sep 2022) * Pull in upstream changes (includes security fix).
cmark-gfm.cabal view
@@ -1,5 +1,5 @@ name: cmark-gfm-version: 0.2.4+version: 0.2.5 synopsis: Fast, accurate GitHub Flavored Markdown parser and renderer description: This package provides Haskell bindings for
test/test-cmark.hs view
@@ -33,5 +33,6 @@ , "<xmp>\n" ~=? commonmarkToHtml [optUnsafe] [] "<xmp>" , "<xmp>\n" ~=? commonmarkToHtml [optUnsafe] [extTagfilter] "<xmp>" , "<ul>\n<li><input type=\"checkbox\" disabled=\"\" /> foo</li>\n<li><input type=\"checkbox\" checked=\"\" disabled=\"\" /> bar</li>\n</ul>\n" ~=? commonmarkToHtml [] [extTaskList] "- [ ] foo\n- [x] bar"+ , "<p>Here is footnote<sup class=\"footnote-ref\"><a href=\"#fn-1\" id=\"fnref-1\" data-footnote-ref>1</a></sup></p>\n<section class=\"footnotes\" data-footnotes>\n<ol>\n<li id=\"fn-1\">\n<p>abc <a href=\"#fnref-1\" class=\"footnote-backref\" data-footnote-backref aria-label=\"Back to content\">↩</a></p>\n</li>\n</ol>\n</section>\n" ~=? commonmarkToHtml [optFootnotes] [] "Here is footnote[^1]\n\n[^1]: abc" ]