commonmark 0.2.3 → 0.2.4
raw patch · 6 files changed
+43/−6 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Commonmark.Inlines: pEscapedSymbol :: Monad m => ParsecT [Tok] s m Tok
Files
- changelog.md +12/−0
- commonmark.cabal +1/−1
- src/Commonmark/Blocks.hs +2/−2
- src/Commonmark/Inlines.hs +7/−0
- src/Commonmark/Tokens.hs +5/−3
- test/regression.md +16/−0
changelog.md view
@@ -1,5 +1,17 @@ # Changelog for commonmark +## 0.2.4++ * Do not parse hard line breaks in fenced codeblock info (#116,+ Michael Howell). This change makes commonmark-hs conform to the spec+ and behave like other implementations when an info string in a code+ block ends with a backslash.++ * [API change] Commonmark.Inlines now exports `pEscapedSymbol`+ (#116, Michael Howell).++ * Tokenize combining marks as WordChars not Symbol (#114).+ ## 0.2.3 * Re-export Text.Parsec.Pos from Commonmark.Types (Fraser
commonmark.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: commonmark-version: 0.2.3+version: 0.2.4 synopsis: Pure Haskell commonmark parser. description: This library provides the core data types and functions
src/Commonmark/Blocks.hs view
@@ -52,7 +52,7 @@ import Commonmark.Tag import Commonmark.TokParsers import Commonmark.ReferenceMap-import Commonmark.Inlines (pEscaped, pLinkDestination,+import Commonmark.Inlines (pEscapedSymbol, pLinkDestination, pLinkLabel, pLinkTitle) import Commonmark.Entity (unEntity) import Commonmark.Tokens@@ -1042,7 +1042,7 @@ guard $ fencelength >= 3 skipWhile (hasType Spaces) let infoTok = noneOfToks (LineEnd : [Symbol '`' | c == '`'])- info <- T.strip . unEntity <$> many (pEscaped <|> infoTok)+ info <- T.strip . unEntity <$> many (pEscapedSymbol <|> infoTok) lookAhead $ void lineEnd <|> eof let infotoks = tokenize "info string" info
src/Commonmark/Inlines.hs view
@@ -24,6 +24,7 @@ , pLinkDestination , pLinkTitle , pEscaped+ , pEscapedSymbol , processEmphasis , processBrackets , pBacktickSpan@@ -936,6 +937,12 @@ pEscaped = do bs <- symbol '\\' option bs $ satisfyTok asciiSymbol <|> lineEnd++-- parses backslash + punctuation, but not backslashed newline+pEscapedSymbol :: Monad m => ParsecT [Tok] s m Tok+pEscapedSymbol = do+ bs <- symbol '\\'+ option bs $ satisfyTok asciiSymbol asciiSymbol :: Tok -> Bool asciiSymbol (Tok (Symbol c) _ _) = isAscii c
src/Commonmark/Tokens.hs view
@@ -10,7 +10,7 @@ , untokenize ) where -import Unicode.Char (isAlphaNum)+import Unicode.Char (isAlphaNum, isMark) import Unicode.Char.General.Compat (isSpace) import Data.Text (Text) import qualified Data.Text as T@@ -42,8 +42,10 @@ -- everything else gets in a token by itself. f '\r' '\n' = True f ' ' ' ' = True- f x y = isAlphaNum x && isAlphaNum y+ f x y = isWordChar x && isWordChar y + isWordChar c = isAlphaNum c || isMark c+ go !_pos [] = [] go !pos (!t:ts) = -- note that t:ts are guaranteed to be nonempty case T.head t of@@ -57,7 +59,7 @@ '\n' -> Tok LineEnd pos t : go (incSourceLine (setSourceColumn pos 1) 1) ts thead- | isAlphaNum thead ->+ | isWordChar thead -> Tok WordChars pos t : go (incSourceColumn pos (T.length t)) ts | isSpace thead ->
test/regression.md view
@@ -203,3 +203,19 @@ <p><a href="http://www.example.com/">test </a> <a href="http://www.example.com/"> test</a></p> ````````````````````````````````++Issue #114.+```````````````````````````````` example+*.*̀.+.+<p>*.*̀.</p>+````````````````````````````````++Issue #115.+```````````````````````````````` example+~~~\+x+.+<pre><code class="language-\">x+</code></pre>+````````````````````````````````