mmark 0.0.2.0 → 0.0.2.1
raw patch · 12 files changed
+426/−279 lines, 12 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +9/−0
- README.md +5/−2
- Text/MMark/Parser.hs +193/−156
- bench/memory/Main.hs +3/−0
- bench/speed/Main.hs +3/−0
- data/bench-blockquote.md +9/−0
- data/bench-ordered-list.md +16/−0
- data/bench-unordered-list.md +16/−0
- data/comprehensive.html +64/−22
- data/comprehensive.md +39/−25
- mmark.cabal +1/−1
- tests/Text/MMarkSpec.hs +68/−73
CHANGELOG.md view
@@ -1,3 +1,12 @@+## MMark 0.0.2.1++* Improved performance of the parser. Mainly the inline-level parser to be+ precise. The result is that now there are 3× less allocations and the code+ runs about 3× faster on paragraphs and block quotes (it's about 2.5×+ faster for a big realistic document).++* Improved quality of parse errors.+ ## MMark 0.0.2.0 * Now punctuation is stripped from header ids in
README.md view
@@ -192,6 +192,9 @@ fact, this would make every line a separate block quote). * Paragraphs can be interrupted by unordered list and ordered lists with any valid starting index.+* HTML blocks are not supported because the syntax conflicts with autolinks+ and the feature is a hack to compensate for the lack of extensibility and+ customization in the original markdown. Inline-level parsing: @@ -207,13 +210,13 @@ is possible. * Putting images in description of other images is not allowed (similarly to the situation with links).+* HTML inlines are not supported for the same reason why HTML blocks are not+ supported. Not-yet-implemented things: * Separate declaration of image's source and title is not (yet?) supported. * Reference links are not implemented yet.-* HTML blocks are not implemented yet.-* HTML inlines are not implemented yet. * Entity and numeric character references are not implemented yet. ### Additional information about MMark-specific extensions
Text/MMark/Parser.hs view
@@ -213,7 +213,7 @@ let parsed = doInline <$> rawBlocks doInline = fmap $ first (nes . replaceEof "end of inline block")- . runIsp (pInlines def <* eof)+ . runIsp pInlinesTop f block = case foldMap e2p block of PairL errs -> PairL errs@@ -573,23 +573,50 @@ , stateTokensProcessed = 0 , stateTabWidth = mkPos 4 } +-- | The top level inline parser.++pInlinesTop :: IParser (NonEmpty Inline)+pInlinesTop = do+ inlines <- pInlines def+ eof <|> void pLfdr+ return inlines+ -- | Parse inlines using settings from given 'InlineConfig'. pInlines :: InlineConfig -> IParser (NonEmpty Inline)-pInlines InlineConfig {..} =- if iconfigAllowEmpty- then nes (Plain "") <$ eof <|> stuff- else stuff+pInlines InlineConfig {..} = do+ done <- atEnd+ if done+ then+ if iconfigAllowEmpty+ then (return . nes . Plain) ""+ else unexp EndOfInput+ else NE.some $ do+ mch <- lookAhead (anyChar <?> "inline content")+ case mch of+ '`' -> pCodeSpan+ '[' ->+ if iconfigAllowLinks+ then pInlineLink+ else unexp (Tokens $ nes '[')+ '!' ->+ if iconfigAllowImages+ then try pImage <|> pPlain+ else pPlain+ '<' ->+ if iconfigAllowLinks+ then try pAutolink <|> pPlain+ else pPlain+ '\\' ->+ try pHardLineBreak <|> pPlain+ ch ->+ if isMarkupChar ch+ then pEnclosedInline+ else pPlain where- stuff = NE.some . label "inline content" . choice $- [ pCodeSpan ] <>- [ pInlineLink | iconfigAllowLinks ] <>- [ pImage | iconfigAllowImages ] <>- [ try (angel pAutolink) | iconfigAllowLinks ] <>- [ pEnclosedInline- , try pHardLineBreak- , pPlain ]- angel = between (char '<') (char '>')+ unexp x = failure+ (Just x)+ (E.singleton . Label . NE.fromList $ "inline content") -- | Parse a code span. @@ -604,8 +631,7 @@ takeWhile1P Nothing (== '`') <|> takeWhile1P Nothing (/= '`')) finalizer- put OtherChar- return r+ r <$ put OtherChar -- | Parse a link. @@ -617,8 +643,7 @@ dest <- pUri mtitle <- optional (sc1 *> pTitle) sc <* char ')'- put OtherChar- return (Link xs dest mtitle)+ Link xs dest mtitle <$ put OtherChar -- | Parse an image. @@ -631,16 +656,97 @@ src <- pUri mtitle <- optional (sc1 *> pTitle) sc <* char ')'- put OtherChar- return (Image alt src mtitle)+ Image alt src mtitle <$ put OtherChar +-- | Parse an autolink.++pAutolink :: IParser Inline+pAutolink = between (char '<') (char '>') $ do+ notFollowedBy (char '>') -- empty links don't make sense+ uri' <- URI.parser+ let (txt, uri) =+ case isEmailUri uri' of+ Nothing ->+ ( (nes . Plain . URI.render) uri'+ , uri' )+ Just email ->+ ( nes (Plain email)+ , URI.makeAbsolute mailtoScheme uri' )+ Link txt uri Nothing <$ put OtherChar++-- | Parse inline content inside an enclosing construction such as emphasis,+-- strikeout, superscript, and\/or subscript markup.++pEnclosedInline :: IParser Inline+pEnclosedInline = pLfdr >>= \case+ SingleFrame x ->+ liftFrame x <$> pInlines' <* pRfdr x+ DoubleFrame x y -> do+ inlines0 <- pInlines'+ thisFrame <- pRfdr x <|> pRfdr y+ let thatFrame = if thisFrame == x then y else x+ minlines1 <- optional pInlines'+ void (pRfdr thatFrame)+ return . liftFrame thatFrame $+ case minlines1 of+ Nothing ->+ nes (liftFrame thisFrame inlines0)+ Just inlines1 ->+ liftFrame thisFrame inlines0 <| inlines1+ where+ pInlines' = pInlines def { iconfigAllowEmpty = False }++-- | Parse a hard line break.++pHardLineBreak :: IParser Inline+pHardLineBreak = do+ void (char '\\')+ eol+ notFollowedBy eof+ sc'+ put SpaceChar+ return LineBreak++-- | Parse plain text.++pPlain :: IParser Inline+pPlain = fmap (Plain . T.pack) . some $ do+ ch <- lookAhead (anyChar <?> "inline content")+ case ch of+ '\\' ->+ (escapedChar <* put OtherChar) <|>+ try (char '\\' <* notFollowedBy eol <* put OtherChar)+ '\n' ->+ '\n' <$ eol <* sc' <* put SpaceChar+ '\r' ->+ '\n' <$ eol <* sc' <* put SpaceChar+ '!' -> do+ notFollowedBy (string "![")+ char '!'+ '<' -> do+ notFollowedBy pAutolink+ char '<'+ _ ->+ pOther ch+ where+ pNewline = hidden $+ '\n' <$ sc' <* eol <* sc' <* put SpaceChar+ pOther ch+ | isSpace ch = (try pNewline <|> char ch) <* put SpaceChar+ | isTrans ch = char ch <* put SpaceChar+ | isOther ch = char ch <* put OtherChar+ | otherwise = empty+ isTrans x = isTransparentPunctuation x && x /= '!'+ isOther x = not (isMarkupChar x) && x /= '\\' && x /= '!' && x /= '<'++----------------------------------------------------------------------------+-- Auxiliary inline-level parsers+ -- | Parse a URI. -pUri :: IParser URI-pUri = do- uri <- between (char '<') (char '>') URI.parser <|> naked- put OtherChar- return uri+pUri :: (Ord e, MonadParsec e Text m) => m URI+pUri =+ between (char '<') (char '>') URI.parser <|> naked where naked = do startPos <- getPosition@@ -664,7 +770,7 @@ -- | Parse a title of a link or an image. -pTitle :: IParser Text+pTitle :: MonadParsec e Text m => m Text pTitle = choice [ p '\"' '\"' , p '\'' '\''@@ -673,133 +779,58 @@ p start end = between (char start) (char end) $ manyEscapedWith (/= end) "unescaped character" --- | Parse an autolink.--pAutolink :: IParser Inline-pAutolink = do- notFollowedBy (char '>') -- empty links don't make sense- uri <- URI.parser- put OtherChar- return $ case isEmailUri uri of- Nothing ->- let txt = (nes . Plain . URI.render) uri- in Link txt uri Nothing- Just email ->- let txt = nes (Plain email)- uri' = URI.makeAbsolute mailtoScheme uri- in Link txt uri' Nothing---- | Parse inline content inside some sort of emphasis, strikeout,--- superscript, and\/or subscript markup.--pEnclosedInline :: IParser Inline-pEnclosedInline = do- let noEmpty = def { iconfigAllowEmpty = False }- st <- choice- [ pLfdr (DoubleFrame StrongFrame StrongFrame)- , pLfdr (DoubleFrame StrongFrame EmphasisFrame)- , pLfdr (SingleFrame StrongFrame)- , pLfdr (SingleFrame EmphasisFrame)- , pLfdr (DoubleFrame StrongFrame_ StrongFrame_)- , pLfdr (DoubleFrame StrongFrame_ EmphasisFrame_)- , pLfdr (SingleFrame StrongFrame_)- , pLfdr (SingleFrame EmphasisFrame_)- , pLfdr (DoubleFrame StrikeoutFrame StrikeoutFrame)- , pLfdr (DoubleFrame StrikeoutFrame SubscriptFrame)- , pLfdr (SingleFrame StrikeoutFrame)- , pLfdr (SingleFrame SubscriptFrame)- , pLfdr (SingleFrame SuperscriptFrame) ]- case st of- SingleFrame x ->- liftFrame x <$> pInlines noEmpty <* pRfdr x- DoubleFrame x y -> do- inlines0 <- pInlines noEmpty- thisFrame <- pRfdr x <|> pRfdr y- let thatFrame = if x == thisFrame then y else x- immediate <- True <$ pRfdr thatFrame <|> pure False- if immediate- then (return . liftFrame thatFrame . nes . liftFrame thisFrame) inlines0- else do- inlines1 <- pInlines noEmpty- void (pRfdr thatFrame)- return . liftFrame thatFrame $- liftFrame thisFrame inlines0 <| inlines1---- | Parse an opening markup sequence corresponding to given 'InlineState'+-- | Parse an opening markup sequence corresponding to given 'InlineState'. -pLfdr :: InlineState -> IParser InlineState-pLfdr st = try $ do- let dels = inlineStateDel st+pLfdr :: IParser InlineState+pLfdr = try $ do pos <- getPosition- void (string dels)- leftChar <- get- mrightChar <- lookAhead (optional anyChar)- let failNow = do+ let r st = st <$ string (inlineStateDel st)+ st <- hidden $ choice+ [ r (DoubleFrame StrongFrame StrongFrame)+ , r (DoubleFrame StrongFrame EmphasisFrame)+ , r (SingleFrame StrongFrame)+ , r (SingleFrame EmphasisFrame)+ , r (DoubleFrame StrongFrame_ StrongFrame_)+ , r (DoubleFrame StrongFrame_ EmphasisFrame_)+ , r (SingleFrame StrongFrame_)+ , r (SingleFrame EmphasisFrame_)+ , r (DoubleFrame StrikeoutFrame StrikeoutFrame)+ , r (DoubleFrame StrikeoutFrame SubscriptFrame)+ , r (SingleFrame StrikeoutFrame)+ , r (SingleFrame SubscriptFrame)+ , r (SingleFrame SuperscriptFrame) ]+ let dels = inlineStateDel st+ failNow = do setPosition pos (mmarkErr . NonFlankingDelimiterRun . toNesTokens) dels- case (leftChar, isTransparent <$> mrightChar) of- (_, Nothing) -> failNow- (_, Just True) -> failNow- (RightFlankingDel, _) -> failNow- (OtherChar, _) -> failNow- (SpaceChar, _) -> return ()- (LeftFlankingDel, _) -> return ()- put LeftFlankingDel+ lch <- get+ when (lch == OtherChar) failNow+ rch <- lookAhead (optional anyChar)+ when (maybe True isTransparent rch) failNow return st --- | Parse a closing markdup sequence corresponding to given 'InlineFrame'.+-- | Parse a closing markup sequence corresponding to given 'InlineFrame'. pRfdr :: InlineFrame -> IParser InlineFrame pRfdr frame = try $ do let dels = inlineFrameDel frame+ expectingInlineContent = region $ \case+ TrivialError pos us es ->+ TrivialError pos us (E.insert (Label $ NE.fromList "inline content") es)+ other -> other pos <- getPosition- void (string dels)- leftChar <- get- mrightChar <- lookAhead (optional anyChar)+ (void . expectingInlineContent . string) dels let failNow = do setPosition pos (mmarkErr . NonFlankingDelimiterRun . toNesTokens) dels- case (leftChar, mrightChar) of- (SpaceChar, _) -> failNow- (LeftFlankingDel, _) -> failNow- (_, Nothing) -> return ()- (_, Just rightChar) ->- if | isTransparent rightChar -> return ()- | isMarkupChar rightChar -> return ()- | otherwise -> failNow- put RightFlankingDel+ goodAfter x =+ isTransparent x || isMarkupChar x+ lch <- get+ unless (lch == OtherChar) failNow+ rch <- lookAhead (optional anyChar)+ unless (maybe True goodAfter rch) failNow return frame --- | Parse a hard line break.--pHardLineBreak :: IParser Inline-pHardLineBreak = do- void (char '\\')- eol- notFollowedBy eof- sc'- put SpaceChar- return LineBreak---- | Parse plain text.--pPlain :: IParser Inline-pPlain = Plain . T.pack <$> some- (pEscapedChar <|> pNewline <|> pNonEscapedChar)- where- pEscapedChar = escapedChar <* put OtherChar- pNewline = hidden . try $- '\n' <$ sc' <* eol <* sc' <* put SpaceChar- pNonEscapedChar = label "unescaped non-markup character" . choice $- [ try (char '\\' <* notFollowedBy eol) <* put OtherChar- , try (char '!' <* notFollowedBy (char '[')) <* put SpaceChar- , try (char '<' <* notFollowedBy (pAutolink <* char '>')) <* put OtherChar- , spaceChar <* put SpaceChar- , satisfy isTrans <* put SpaceChar- , satisfy isOther <* put OtherChar ]- isTrans x = isTransparentPunctuation x && x /= '!'- isOther x = not (isMarkupChar x) && x /= '\\' && x /= '!' && x /= '<'- ---------------------------------------------------------------------------- -- Parsing helpers @@ -813,8 +844,8 @@ someEscapedWith f = T.pack <$> some (escapedChar <|> satisfy f) escapedChar :: MonadParsec e Text m => m Char-escapedChar = try (char '\\' *> satisfy isAsciiPunctuation)- <?> "escaped character"+escapedChar = label "escaped character" $+ try (char '\\' *> satisfy isAsciiPunctuation) sc :: MonadParsec e Text m => m () sc = void $ takeWhileP (Just "white space") isSpaceN@@ -861,17 +892,23 @@ isBlank :: Text -> Bool isBlank = T.all isSpace -isMarkupChar :: Char -> Bool-isMarkupChar = \case+isFrameConstituent :: Char -> Bool+isFrameConstituent = \case '*' -> True- '~' -> True- '_' -> True- '`' -> True '^' -> True- '[' -> True- ']' -> True+ '_' -> True+ '~' -> True _ -> False +isMarkupChar :: Char -> Bool+isMarkupChar x = isFrameConstituent x || f x+ where+ f = \case+ '[' -> True+ ']' -> True+ '`' -> True+ _ -> False+ isAsciiPunctuation :: Char -> Bool isAsciiPunctuation x = (x >= '!' && x <= '/') ||@@ -937,16 +974,6 @@ g '\n' = True g _ = False -inlineFrameDel :: InlineFrame -> Text-inlineFrameDel = \case- EmphasisFrame -> "*"- EmphasisFrame_ -> "_"- StrongFrame -> "**"- StrongFrame_ -> "__"- StrikeoutFrame -> "~~"- SubscriptFrame -> "~"- SuperscriptFrame -> "^"- inlineStateDel :: InlineState -> Text inlineStateDel = \case SingleFrame x -> inlineFrameDel x@@ -961,6 +988,16 @@ StrikeoutFrame -> Strikeout SubscriptFrame -> Subscript SuperscriptFrame -> Superscript++inlineFrameDel :: InlineFrame -> Text+inlineFrameDel = \case+ EmphasisFrame -> "*"+ EmphasisFrame_ -> "_"+ StrongFrame -> "**"+ StrongFrame_ -> "__"+ StrikeoutFrame -> "~~"+ SubscriptFrame -> "~"+ SuperscriptFrame -> "^" replaceEof :: String -> ParseError Char e -> ParseError Char e replaceEof altLabel = \case
bench/memory/Main.hs view
@@ -12,6 +12,9 @@ bparser "data/bench-heading.md" bparser "data/bench-fenced-code-block.md" bparser "data/bench-indented-code-block.md"+ bparser "data/bench-unordered-list.md"+ bparser "data/bench-ordered-list.md"+ bparser "data/bench-blockquote.md" bparser "data/bench-paragraph.md" bparser "data/comprehensive.md"
bench/speed/Main.hs view
@@ -11,6 +11,9 @@ , bparser "data/bench-heading.md" , bparser "data/bench-fenced-code-block.md" , bparser "data/bench-indented-code-block.md"+ , bparser "data/bench-unordered-list.md"+ , bparser "data/bench-ordered-list.md"+ , bparser "data/bench-blockquote.md" , bparser "data/bench-paragraph.md" , bparser "data/comprehensive.md" ]
+ data/bench-blockquote.md view
@@ -0,0 +1,9 @@+> Curabitur ullamcorper, lectus id porttitor vehicula, augue purus ornare+ orci, ut consequat tellus mauris ac sem. Cras tincidunt sagittis mi, sit+ amet viverra erat ultrices vulputate. Donec urna nulla, malesuada non+ cursus et, posuere eu sapien. Fusce cursus mauris odio, id tincidunt felis+ tincidunt sed. Duis vulputate lectus eu tellus pretium gravida. Nunc at+ eros fringilla mi egestas imperdiet. In bibendum justo sapien, sed commodo+ tellus auctor sit amet. Fusce at purus turpis. Aliquam a nibh at massa+ hendrerit mollis a nec ipsum. Sed porta erat vitae justo sodales gravida+ nec sed augue. Maecenas ultrices tristique hendrerit.
+ data/bench-ordered-list.md view
@@ -0,0 +1,16 @@+1. Nullam sed nisi blandit, ultrices neque a, finibus ligula.++2. Etiam a ante sagittis nibh ornare commodo.++3. Morbi id elit vehicula, gravida enim vitae, suscipit orci.++4. Nunc mattis enim sit amet sem dictum molestie. Nam semper arcu a libero+ molestie, at accumsan turpis egestas.++5. Quisque at pulvinar enim. Cras porttitor, dolor et commodo accumsan, nibh+ sem dapibus velit, sit amet maximus urna justo id eros.++6. Praesent vitae aliquet lorem, in facilisis nulla. Proin sit amet odio+ nisl. Phasellus sed felis velit. Maecenas pretium posuere laoreet. Nullam+ dapibus ullamcorper sapien. Integer nec quam elit. Fusce at dictum lacus.+ Nam risus dui, efficitur eget urna at, ultricies sagittis ligula.
+ data/bench-unordered-list.md view
@@ -0,0 +1,16 @@+* Nullam sed nisi blandit, ultrices neque a, finibus ligula.++* Etiam a ante sagittis nibh ornare commodo.++* Morbi id elit vehicula, gravida enim vitae, suscipit orci.++* Nunc mattis enim sit amet sem dictum molestie. Nam semper arcu a libero+ molestie, at accumsan turpis egestas.++* Quisque at pulvinar enim. Cras porttitor, dolor et commodo accumsan, nibh+ sem dapibus velit, sit amet maximus urna justo id eros.++* Praesent vitae aliquet lorem, in facilisis nulla. Proin sit amet odio+ nisl. Phasellus sed felis velit. Maecenas pretium posuere laoreet. Nullam+ dapibus ullamcorper sapien. Integer nec quam elit. Fusce at dictum lacus.+ Nam risus dui, efficitur eget urna at, ultricies sagittis ligula.
data/comprehensive.html view
@@ -17,7 +17,7 @@ potenti. Nullam consequat tellus a lectus vestibulum faucibus. Ut hendrerit dolor ut libero efficitur accumsan. Mauris dapibus, leo non porttitor lobortis, lectus ipsum tempor metus, quis iaculis arcu quam malesuada nulla.</p>-<h2 id="nullam-luctus">Nullam luctus</h2>+<h2 id="nullam-luctus">Nullam luctus?!</h2> <p>Nullam <a href="http://example.org/luctus">luctus</a> placerat nisl in dapibus. Phasellus id erat eros. Ut gravida risus sit amet massa tempor volutpat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere@@ -36,6 +36,28 @@ ultricies arcu blandit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis eleifend malesuada venenatis. Morbi tincidunt quis diam ac aliquam.</p>+<ul>+<li>+Foo+</li>+<li>+Bar+<ol>+<li>+One+</li>+<li>+Two+</li>+<li>+Three+</li>+</ol>+</li>+<li>+Baz+</li>+</ul> <h2 id="sed-euismod">Sed euismod</h2> <p>Sed euismod nisi lorem, ac tempor nibh venenatis at. Integer porta nibh quis mauris vehicula porta. Sed vel tellus nec lacus porttitor sollicitudin. Sed@@ -53,15 +75,17 @@ viverra orci pretium. Vivamus mi orci, lacinia ac ligula a, condimentum aliquet ligula.</p> <h3 id="curabitur-ullamcorper">Curabitur ullamcorper</h3>+<blockquote> <p>Curabitur ullamcorper, lectus id porttitor vehicula, augue purus ornare orci, ut consequat tellus mauris ac sem. Cras tincidunt sagittis mi, sit-amet viverra erat ultrices vulputate. Donec urna nulla, malesuada non cursus-et, posuere eu sapien. Fusce cursus mauris odio, id tincidunt felis-tincidunt sed. Duis vulputate lectus eu tellus pretium gravida. Nunc at eros-fringilla mi egestas imperdiet. In bibendum justo sapien, sed commodo tellus-auctor sit amet. Fusce at purus turpis. Aliquam a nibh at massa hendrerit-mollis a nec ipsum. Sed porta erat vitae justo sodales gravida nec sed-augue. Maecenas ultrices tristique hendrerit.</p>+amet viverra erat ultrices vulputate. Donec urna nulla, malesuada non+cursus et, posuere eu sapien. Fusce cursus mauris odio, id tincidunt felis+tincidunt sed. Duis vulputate lectus eu tellus pretium gravida. Nunc at+eros fringilla mi egestas imperdiet. In bibendum justo sapien, sed commodo+tellus auctor sit amet. Fusce at purus turpis. Aliquam a nibh at massa+hendrerit mollis a nec ipsum. Sed porta erat vitae justo sodales gravida+nec sed augue. Maecenas ultrices tristique hendrerit.</p>+</blockquote> <p>Curabitur venenatis vestibulum quam, a facilisis odio dignissim in. Vestibulum ut turpis pharetra, aliquam metus a, dapibus massa. Mauris vehicula sapien quis dolor facilisis, in placerat ipsum accumsan. Morbi@@ -111,21 +135,39 @@ sed, tincidunt leo. Proin in lorem a libero maximus posuere. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed interdum eget ipsum id ullamcorper.</p>+<blockquote> <p>Aenean feugiat orci leo. Morbi fringilla, tortor id posuere mollis, lectus-est ullamcorper tellus, nec sagittis augue nibh nec est. Sed pulvinar orci a-justo eleifend dapibus. Phasellus aliquam enim in semper tincidunt. Donec-tempor tristique purus eu pretium. In ornare est at varius elementum. Cras-finibus nisl in nisi vestibulum, sed sollicitudin eros finibus.</p>-<p>Nullam sed nisi blandit, ultrices neque a, finibus ligula. Etiam a ante-sagittis nibh ornare commodo. Morbi id elit vehicula, gravida enim vitae,-suscipit orci. Nunc mattis enim sit amet sem dictum molestie. Nam semper-arcu a libero molestie, at accumsan turpis egestas. Quisque at pulvinar-enim. Cras porttitor, dolor et commodo accumsan, nibh sem dapibus velit, sit-amet maximus urna justo id eros. Praesent vitae aliquet lorem, in facilisis-nulla. Proin sit amet odio nisl. Phasellus sed felis velit. Maecenas pretium-posuere laoreet. Nullam dapibus ullamcorper sapien. Integer nec quam elit.-Fusce at dictum lacus. Nam risus dui, efficitur eget urna at, ultricies-sagittis ligula.</p>+est ullamcorper tellus, nec sagittis augue nibh nec est. Sed pulvinar orci+a justo eleifend dapibus. Phasellus aliquam enim in semper tincidunt.+Donec tempor tristique purus eu pretium. In ornare est at varius+elementum. Cras finibus nisl in nisi vestibulum, sed sollicitudin eros+finibus.</p>+</blockquote>+<ol>+<li>+<p>Nullam sed nisi blandit, ultrices neque a, finibus ligula.</p>+</li>+<li>+<p>Etiam a ante sagittis nibh ornare commodo.</p>+</li>+<li>+<p>Morbi id elit vehicula, gravida enim vitae, suscipit orci.</p>+</li>+<li>+<p>Nunc mattis enim sit amet sem dictum molestie. Nam semper arcu a libero+molestie, at accumsan turpis egestas.</p>+</li>+<li>+<p>Quisque at pulvinar enim. Cras porttitor, dolor et commodo accumsan, nibh+sem dapibus velit, sit amet maximus urna justo id eros.</p>+</li>+<li>+<p>Praesent vitae aliquet lorem, in facilisis nulla. Proin sit amet odio+nisl. Phasellus sed felis velit. Maecenas pretium posuere laoreet. Nullam+dapibus ullamcorper sapien. Integer nec quam elit. Fusce at dictum lacus.+Nam risus dui, efficitur eget urna at, ultricies sagittis ligula.</p>+</li>+</ol> <h2 id="aenean-auctor-nec">Aenean auctor nec</h2> <p>Aenean auctor nec libero ut laoreet. Etiam vulputate lorem quis ex dignissim, sit amet tincidunt ligula scelerisque. Nam venenatis blandit
data/comprehensive.md view
@@ -21,7 +21,7 @@ dolor ut libero efficitur accumsan. Mauris dapibus, leo non porttitor lobortis, lectus ipsum tempor metus, quis iaculis arcu quam malesuada nulla. -## Nullam luctus+## Nullam luctus?! Nullam [luctus](http://example.org/luctus) placerat nisl in dapibus. Phasellus id erat eros. Ut gravida risus sit amet massa tempor volutpat.@@ -44,6 +44,13 @@ netus et malesuada fames ac turpis egestas. Duis eleifend malesuada venenatis. Morbi tincidunt quis diam ac aliquam. +* Foo+* Bar+ 1. One+ 2. Two+ 3. Three+* Baz+ ## Sed euismod Sed euismod nisi lorem, ac tempor nibh venenatis at. Integer porta nibh quis@@ -66,15 +73,15 @@ ### Curabitur ullamcorper -Curabitur ullamcorper, lectus id porttitor vehicula, augue purus ornare-orci, ut consequat tellus mauris ac sem. Cras tincidunt sagittis mi, sit-amet viverra erat ultrices vulputate. Donec urna nulla, malesuada non cursus-et, posuere eu sapien. Fusce cursus mauris odio, id tincidunt felis-tincidunt sed. Duis vulputate lectus eu tellus pretium gravida. Nunc at eros-fringilla mi egestas imperdiet. In bibendum justo sapien, sed commodo tellus-auctor sit amet. Fusce at purus turpis. Aliquam a nibh at massa hendrerit-mollis a nec ipsum. Sed porta erat vitae justo sodales gravida nec sed-augue. Maecenas ultrices tristique hendrerit.+> Curabitur ullamcorper, lectus id porttitor vehicula, augue purus ornare+ orci, ut consequat tellus mauris ac sem. Cras tincidunt sagittis mi, sit+ amet viverra erat ultrices vulputate. Donec urna nulla, malesuada non+ cursus et, posuere eu sapien. Fusce cursus mauris odio, id tincidunt felis+ tincidunt sed. Duis vulputate lectus eu tellus pretium gravida. Nunc at+ eros fringilla mi egestas imperdiet. In bibendum justo sapien, sed commodo+ tellus auctor sit amet. Fusce at purus turpis. Aliquam a nibh at massa+ hendrerit mollis a nec ipsum. Sed porta erat vitae justo sodales gravida+ nec sed augue. Maecenas ultrices tristique hendrerit. Curabitur venenatis vestibulum quam, a facilisis odio dignissim in. Vestibulum ut turpis pharetra, aliquam metus a, dapibus massa. Mauris@@ -133,22 +140,29 @@ habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed interdum eget ipsum id ullamcorper. -Aenean feugiat orci leo. Morbi fringilla, tortor id posuere mollis, lectus-est ullamcorper tellus, nec sagittis augue nibh nec est. Sed pulvinar orci a-justo eleifend dapibus. Phasellus aliquam enim in semper tincidunt. Donec-tempor tristique purus eu pretium. In ornare est at varius elementum. Cras-finibus nisl in nisi vestibulum, sed sollicitudin eros finibus.+> Aenean feugiat orci leo. Morbi fringilla, tortor id posuere mollis, lectus+ est ullamcorper tellus, nec sagittis augue nibh nec est. Sed pulvinar orci+ a justo eleifend dapibus. Phasellus aliquam enim in semper tincidunt.+ Donec tempor tristique purus eu pretium. In ornare est at varius+ elementum. Cras finibus nisl in nisi vestibulum, sed sollicitudin eros+ finibus. -Nullam sed nisi blandit, ultrices neque a, finibus ligula. Etiam a ante-sagittis nibh ornare commodo. Morbi id elit vehicula, gravida enim vitae,-suscipit orci. Nunc mattis enim sit amet sem dictum molestie. Nam semper-arcu a libero molestie, at accumsan turpis egestas. Quisque at pulvinar-enim. Cras porttitor, dolor et commodo accumsan, nibh sem dapibus velit, sit-amet maximus urna justo id eros. Praesent vitae aliquet lorem, in facilisis-nulla. Proin sit amet odio nisl. Phasellus sed felis velit. Maecenas pretium-posuere laoreet. Nullam dapibus ullamcorper sapien. Integer nec quam elit.-Fusce at dictum lacus. Nam risus dui, efficitur eget urna at, ultricies-sagittis ligula.+1. Nullam sed nisi blandit, ultrices neque a, finibus ligula.++2. Etiam a ante sagittis nibh ornare commodo.++3. Morbi id elit vehicula, gravida enim vitae, suscipit orci.++4. Nunc mattis enim sit amet sem dictum molestie. Nam semper arcu a libero+ molestie, at accumsan turpis egestas.++5. Quisque at pulvinar enim. Cras porttitor, dolor et commodo accumsan, nibh+ sem dapibus velit, sit amet maximus urna justo id eros.++6. Praesent vitae aliquet lorem, in facilisis nulla. Proin sit amet odio+ nisl. Phasellus sed felis velit. Maecenas pretium posuere laoreet. Nullam+ dapibus ullamcorper sapien. Integer nec quam elit. Fusce at dictum lacus.+ Nam risus dui, efficitur eget urna at, ultricies sagittis ligula. ## Aenean auctor nec
mmark.cabal view
@@ -1,5 +1,5 @@ name: mmark-version: 0.0.2.0+version: 0.0.2.1 cabal-version: >= 1.18 tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.2.2 license: BSD3
tests/Text/MMarkSpec.hs view
@@ -71,14 +71,14 @@ "===" ==-> "<p>===</p>\n" it "CM16" $ let s = "--\n**\n__\n"- in s ~-> errFancy (posN 4 s) (nonFlanking "*")+ in s ~-> errFancy (posN 3 s) (nonFlanking "**") it "CM17" $ " ***\n ***\n ***" ==-> "<hr>\n<hr>\n<hr>\n" it "CM18" $ " ***" ==-> "<pre><code>***\n</code></pre>\n" it "CM19" $ let s = "Foo\n ***\n"- in s ~-> errFancy (posN 10 s) (nonFlanking "*")+ in s ~-> errFancy (posN 8 s) (nonFlanking "***") it "CM20" $ "_____________________________________" ==-> "<hr>\n"@@ -626,7 +626,7 @@ "<p>*not emphasized*\n<br/> not a tag\n[not a link](/foo)\n`not code`\n1. not a list\n* not a list\n# not a heading\n[foo]: /url "not a reference"</p>\n" it "CM290" $ let s = "\\\\*emphasis*"- in s ~-> err (posN 2 s) (utok '*' <> eeib <> eric)+ in s ~-> errFancy (posN 2 s) (nonFlanking "*") xit "CM291" $ "foo\\\nbar" ==-> "<p>foo<br>\nbar</p>\n"@@ -683,7 +683,7 @@ in s ~-> err (posN 7 s) (ueib <> etok '*' <> eic) it "CM321" $ let s = "[not a `link](/foo`)\n"- in s ~-> err (posN 20 s) (ueib <> etok ']' <> eic <> eric)+ in s ~-> err (posN 20 s) (ueib <> etok ']' <> eic) it "CM322" $ let s = "`<a href=\"`\">`\n" in s ~-> err (posN 14 s) (ueib <> etok '`' <> elabel "code span content")@@ -709,19 +709,19 @@ "*foo bar*" ==-> "<p><em>foo bar</em></p>\n" it "CM330" $ let s = "a * foo bar*\n"- in s ~-> err (posN 2 s) (utok '*' <> eeib <> eric)+ in s ~-> errFancy (posN 2 s) (nonFlanking "*") it "CM331" $ let s = "a*\"foo\"*\n"- in s ~-> err (posN 1 s) (utok '*' <> eeib <> eric)+ in s ~-> errFancy (posN 1 s) (nonFlanking "*") it "CM332" $ let s = "* a *\n" in s ~-> errFancy posI (nonFlanking "*") it "CM333" $ let s = "foo*bar*\n"- in s ~-> err (posN 3 s) (utok '*' <> eeib <> eric)+ in s ~-> errFancy (posN 3 s) (nonFlanking "*") it "CM334" $ let s = "5*6*78\n"- in s ~-> err (posN 1 s) (utok '*' <> eeib <> eric)+ in s ~-> errFancy (posN 1 s) (nonFlanking "*") it "CM335" $ "_foo bar_" ==-> "<p><em>foo bar</em></p>\n" it "CM336" $@@ -729,31 +729,31 @@ in s ~-> errFancy posI (nonFlanking "_") it "CM337" $ let s = "a_\"foo\"_\n"- in s ~-> err (posN 1 s) (utok '_' <> eeib <> eric)+ in s ~-> errFancy (posN 1 s) (nonFlanking "_") it "CM338" $ let s = "foo_bar_\n"- in s ~-> err (posN 3 s) (utok '_' <> eeib <> eric)+ in s ~-> errFancy (posN 3 s) (nonFlanking "_") it "CM339" $ let s = "5_6_78\n"- in s ~-> err (posN 1 s) (utok '_' <> eeib <> eric)+ in s ~-> errFancy (posN 1 s) (nonFlanking "_") it "CM340" $ let s = "пристаням_стремятся_\n"- in s ~-> err (posN 9 s) (utok '_' <> eeib <> eric)+ in s ~-> errFancy (posN 9 s) (nonFlanking "_") it "CM341" $ let s = "aa_\"bb\"_cc\n"- in s ~-> err (posN 2 s) (utok '_' <> eeib <> eric)+ in s ~-> errFancy (posN 2 s) (nonFlanking "_") it "CM342" $ let s = "foo-_(bar)_\n"- in s ~-> err (posN 4 s) (utok '_' <> eeib <> eric)+ in s ~-> errFancy (posN 4 s) (nonFlanking "_") it "CM343" $ let s = "_foo*\n"- in s ~-> err (posN 4 s) (utok '*' <> etok '_' <> eric)+ in s ~-> err (posN 4 s) (utok '*' <> etok '_' <> eic) it "CM344" $ let s = "*foo bar *\n" in s ~-> errFancy (posN 9 s) (nonFlanking "*") it "CM345" $ let s = "*foo bar\n*\n"- in s ~-> err (posN 8 s) (ueib <> etok '*' <> eic <> eric)+ in s ~-> err (posN 8 s) (ueib <> etok '*' <> eic) it "CM346" $ let s = "*(*foo)\n" in s ~-> errFancy posI (nonFlanking "*")@@ -787,33 +787,33 @@ "**foo bar**\n" ==-> "<p><strong>foo bar</strong></p>\n" it "CM357" $ let s = "** foo bar**\n"- in s ~-> errFancy (posN 1 s) (nonFlanking "*")+ in s ~-> errFancy posI (nonFlanking "**") it "CM358" $ let s = "a**\"foo\"**\n"- in s ~-> err (posN 1 s) (utok '*' <> eeib <> eric)+ in s ~-> errFancy (posN 1 s) (nonFlanking "**") it "CM359" $ let s = "foo**bar**\n"- in s ~-> err (posN 3 s) (utok '*' <> eeib <> eric)+ in s ~-> errFancy (posN 3 s) (nonFlanking "**") it "CM360" $ "__foo bar__" ==-> "<p><strong>foo bar</strong></p>\n" it "CM361" $ let s = "__ foo bar__\n"- in s ~-> errFancy (posN 1 s) (nonFlanking "_")+ in s ~-> errFancy posI (nonFlanking "__") it "CM362" $ let s = "__\nfoo bar__\n"- in s ~-> errFancy (posN 1 s) (nonFlanking "_")+ in s ~-> errFancy posI (nonFlanking "__") it "CM363" $ let s = "a__\"foo\"__\n"- in s ~-> err (posN 1 s) (utok '_' <> eeib <> eric)+ in s ~-> errFancy (posN 1 s) (nonFlanking "__") it "CM364" $ let s = "foo__bar__\n"- in s ~-> err (posN 3 s) (utok '_' <> eeib <> eric)+ in s ~-> errFancy (posN 3 s) (nonFlanking "__") it "CM365" $ let s = "5__6__78\n"- in s ~-> err (posN 1 s) (utok '_' <> eeib <> eric)+ in s ~-> errFancy (posN 1 s) (nonFlanking "__") it "CM366" $ let s = "пристаням__стремятся__\n"- in s ~-> err (posN 9 s) (utok '_' <> eeib <> eric)+ in s ~-> errFancy (posN 9 s) (nonFlanking "__") it "CM367" $ "__foo, __bar__, baz__" ==-> "<p><strong>foo, <strong>bar</strong>, baz</strong></p>\n"@@ -821,10 +821,10 @@ "foo-__\\(bar\\)__" ==-> "<p>foo-<strong>(bar)</strong></p>\n" it "CM369" $ let s = "**foo bar **\n"- in s ~-> errFancy (posN 11 s) (nonFlanking "*")+ in s ~-> errFancy (posN 10 s) (nonFlanking "**") it "CM370" $ let s = "**(**foo)\n"- in s ~-> errFancy (posN 1 s) (nonFlanking "*")+ in s ~-> errFancy posI (nonFlanking "**") it "CM371" $ let s = "*(**foo**)*\n" in s ~-> errFancy posI (nonFlanking "*")@@ -839,10 +839,10 @@ in s ~-> errFancy (posN 5 s) (nonFlanking "**") it "CM375" $ let s = "__foo bar __\n"- in s ~-> errFancy (posN 11 s) (nonFlanking "_")+ in s ~-> errFancy (posN 10 s) (nonFlanking "__") it "CM376" $ let s = "__(__foo)\n"- in s ~-> errFancy (posN 1 s) (nonFlanking "_")+ in s ~-> errFancy posI (nonFlanking "__") it "CM377" $ let s = "_(__foo__)_\n" in s ~-> errFancy posI (nonFlanking "_")@@ -872,7 +872,7 @@ "<p><em>foo <em>bar</em> baz</em></p>\n" it "CM386" $ let s = "__foo_ bar_"- in s ~-> err (posN 5 s) (utoks "_ " <> etoks "__" <> eric)+ in s ~-> err (posN 5 s) (utoks "_ " <> etoks "__" <> eic) it "CM387" $ "*foo *bar**" ==-> "<p><em>foo <em>bar</em></em></p>\n"@@ -881,14 +881,14 @@ "<p><em>foo <strong>bar</strong> baz</em></p>\n" it "CM389" $ let s = "*foo**bar**baz*\n"- in s ~-> err (posN 5 s) (utok '*' <> eeib)+ in s ~-> errFancy (posN 5 s) (nonFlanking "*") it "CM390" $ "***foo** bar*\n" ==-> "<p><em><strong>foo</strong> bar</em></p>\n" it "CM391" $ "*foo **bar***\n" ==-> "<p><em>foo <strong>bar</strong></em></p>\n" it "CM392" $ let s = "*foo**bar***\n"- in s ~-> err (posN 5 s) (utok '*' <> elabel "end of inline block")+ in s ~-> errFancy (posN 5 s) (nonFlanking "*") it "CM393" $ "*foo **bar *baz* bim** bop*\n" ==-> "<p><em>foo <strong>bar <em>baz</em> bim</strong> bop</em></p>\n"@@ -897,10 +897,10 @@ "<p><em>foo <a href=\"/url\"><em>bar</em></a></em></p>\n" it "CM395" $ let s = "** is not an empty emphasis\n"- in s ~-> errFancy (posN 1 s) (nonFlanking "*")+ in s ~-> errFancy posI (nonFlanking "**") it "CM396" $ let s = "**** is not an empty strong emphasis\n"- in s ~-> errFancy (posN 3 s) (nonFlanking "*")+ in s ~-> errFancy posI (nonFlanking "****") it "CM397" $ "**foo [bar](/url)**" ==-> "<p><strong>foo <a href=\"/url\">bar</a></strong></p>\n"@@ -924,7 +924,7 @@ "<p><strong>foo <em>bar</em> baz</strong></p>\n" it "CM404" $ let s = "**foo*bar*baz**\n"- in s ~-> err (posN 5 s) (utoks "*b" <> etoks "**" <> eric)+ in s ~-> err (posN 5 s) (utoks "*b" <> etoks "**" <> eic) it "CM405" $ "***foo* bar**" ==-> "<p><strong><em>foo</em> bar</strong></p>\n"@@ -939,13 +939,13 @@ "<p><strong>foo <a href=\"/url\"><em>bar</em></a></strong></p>\n" it "CM409" $ let s = "__ is not an empty emphasis\n"- in s ~-> errFancy (posN 1 s) (nonFlanking "_")+ in s ~-> errFancy posI (nonFlanking "__") it "CM410" $ let s = "____ is not an empty strong emphasis\n"- in s ~-> errFancy (posN 3 s) (nonFlanking "_")+ in s ~-> errFancy posI (nonFlanking "____") it "CM411" $ let s = "foo ***\n"- in s ~-> errFancy (posN 6 s) (nonFlanking "*")+ in s ~-> errFancy (posN 4 s) (nonFlanking "***") it "CM412" $ "foo *\\**" ==-> "<p>foo <em>*</em></p>\n" it "CM413" $@@ -959,25 +959,25 @@ "foo **\\_**\n" ==-> "<p>foo <strong>_</strong></p>\n" it "CM417" $ let s = "**foo*\n"- in s ~-> err (posN 5 s) (utok '*' <> etoks "**" <> eric)+ in s ~-> err (posN 5 s) (utok '*' <> etoks "**" <> eic) it "CM418" $ let s = "*foo**\n"- in s ~-> err (posN 5 s) (utok '*' <> eeib)+ in s ~-> errFancy (posN 5 s) (nonFlanking "*") it "CM419" $ let s = "***foo**\n" in s ~-> err (posN 8 s) (ueib <> etok '*' <> eic) it "CM420" $ let s = "****foo*\n"- in s ~-> err (posN 7 s) (utok '*' <> etoks "**" <> eric)+ in s ~-> err (posN 7 s) (utok '*' <> etoks "**" <> eic) it "CM421" $ let s = "**foo***\n"- in s ~-> err (posN 7 s) (utok '*' <> eeib)+ in s ~-> errFancy (posN 7 s) (nonFlanking "*") it "CM422" $ let s = "*foo****\n"- in s ~-> err (posN 5 s) (utok '*' <> eeib)+ in s ~-> errFancy (posN 5 s) (nonFlanking "***") it "CM423" $ let s = "foo ___\n"- in s ~-> errFancy (posN 6 s) (nonFlanking "_")+ in s ~-> errFancy (posN 4 s) (nonFlanking "___") it "CM424" $ "foo _\\__" ==-> "<p>foo <em>_</em></p>\n" it "CM425" $@@ -991,22 +991,22 @@ "foo __\\*__" ==-> "<p>foo <strong>*</strong></p>\n" it "CM429" $ let s = "__foo_\n"- in s ~-> err (posN 5 s) (utok '_' <> etoks "__" <> eric)+ in s ~-> err (posN 5 s) (utok '_' <> etoks "__" <> eic) it "CM430" $ let s = "_foo__\n"- in s ~-> err (posN 5 s) (utok '_' <> eeib)+ in s ~-> errFancy (posN 5 s) (nonFlanking "_") it "CM431" $ let s = "___foo__\n" in s ~-> err (posN 8 s) (ueib <> etok '_' <> eic) it "CM432" $ let s = "____foo_\n"- in s ~-> err (posN 7 s) (utok '_' <> etoks "__" <> eric)+ in s ~-> err (posN 7 s) (utok '_' <> etoks "__" <> eic) it "CM433" $ let s = "__foo___\n"- in s ~-> err (posN 7 s) (utok '_' <> eeib)+ in s ~-> errFancy (posN 7 s) (nonFlanking "_") it "CM434" $ let s = "_foo____\n"- in s ~-> err (posN 5 s) (utok '_' <> eeib)+ in s ~-> errFancy (posN 5 s) (nonFlanking "___") it "CM435" $ "**foo**" ==-> "<p><strong>foo</strong></p>\n" it "CM436" $@@ -1029,10 +1029,10 @@ "<p><strong><strong><em>foo</em></strong></strong></p>\n" it "CM444" $ let s = "*foo _bar* baz_\n"- in s ~-> err (posN 9 s) (utok '*' <> etok '_' <> eric)+ in s ~-> err (posN 9 s) (utok '*' <> etok '_' <> eic) it "CM445" $ let s = "*foo __bar *baz bim__ bam*\n"- in s ~-> err (posN 19 s) (utok '_' <> etok '*' <> eric)+ in s ~-> err (posN 19 s) (utok '_' <> etok '*' <> eic) it "CM446" $ let s = "**foo **bar baz**\n" in s ~-> err (posN 17 s) (ueib <> etoks "**" <> eic)@@ -1041,10 +1041,10 @@ in s ~-> err (posN 14 s) (ueib <> etok '*' <> eic) it "CM448" $ let s = "*[bar*](/url)\n"- in s ~-> err (posN 5 s) (utok '*' <> etok ']' <> eric)+ in s ~-> err (posN 5 s) (utok '*' <> etok ']') it "CM449" $ let s = "_foo [bar_](/url)\n"- in s ~-> err (posN 9 s) (utok '_' <> etok ']' <> eric)+ in s ~-> err (posN 9 s) (utok '_' <> etok ']') xit "CM450" $ -- FIXME pending HTML inlines "*<img src=\"foo\" title=\"*\"/>" ==-> "<p>*<img src=\"foo\" title=\"*\"/></p>\n"@@ -1146,13 +1146,13 @@ in s ~-> err (posN 6 s) (utok ' ' <> etok '(') it "CM481" $ let s = "[link [foo [bar]]](/uri)\n"- in s ~-> err (posN 6 s) (utok '[' <> etok ']' <> eic <> eric)+ in s ~-> err (posN 6 s) (utok '[' <> etok ']' <> eic) it "CM482" $ let s = "[link] bar](/uri)\n" in s ~-> err (posN 6 s) (utok ' ' <> etok '(') it "CM483" $ let s = "[link [bar](/uri)\n"- in s ~-> err (posN 6 s) (utok '[' <> etok ']' <> eic <> eric)+ in s ~-> err (posN 6 s) (utok '[' <> etok ']' <> eic) it "CM484" $ "[link \\[bar](/uri)\n" ==-> "<p><a href=\"/uri\">link [bar</a></p>\n"@@ -1164,22 +1164,22 @@ "<p><a href=\"/uri\"><img src=\"moon.jpg\" alt=\"moon\"></a></p>\n" it "CM487" $ let s = "[foo [bar](/uri)](/uri)\n"- in s ~-> err (posN 5 s) (utok '[' <> etok ']' <> eic <> eric)+ in s ~-> err (posN 5 s) (utok '[' <> etok ']' <> eic) it "CM488" $ let s = "[foo *[bar [baz](/uri)](/uri)*](/uri)\n"- in s ~-> err (posN 11 s) (utok '[' <> etok ']' <> eic <> eric)+ in s ~-> err (posN 11 s) (utok '[' <> etok ']' <> eic) it "CM489" $ let s = "](uri2)](uri3)"- in s ~-> err (posN 3 s) (utoks "[foo" <> eeib <> eic)+ in s ~-> err (posN 3 s) (utok '[' <> eeib <> eic) it "CM490" $ let s = "*[foo*](/uri)\n"- in s ~-> err (posN 5 s) (utok '*' <> etok ']' <> eric)+ in s ~-> err (posN 5 s) (utok '*' <> etok ']') it "CM491" $ let s = "[foo *bar](baz*)\n"- in s ~-> err (posN 9 s) (utok ']' <> etok '*' <> eic <> eric)+ in s ~-> err (posN 9 s) (utok ']' <> etok '*' <> eic) it "CM492" $ let s = "*foo [bar* baz]\n"- in s ~-> err (posN 9 s) (utok '*' <> etok ']' <> eric)+ in s ~-> err (posN 9 s) (utok '*' <> etok ']') xit "CM493" $ -- FIXME pending inline HTML let s = "[foo <bar attr=\"](baz)\">" in s ~-> err (posN 5 s) (utok '<' <> etok ']')@@ -1198,7 +1198,7 @@ "<p><img src=\"train.jpg\" title=\"train & tracks\" alt=\"foo bar\"></p>\n" it "CM543" $ let s = "](/url2)\n"- in s ~-> err (posN 6 s) (utok '!' <> etok ']')+ in s ~-> err (posN 6 s) (utok '!' <> etok ']' <> eeib) it "CM544" $ "](/url2)" ==-> "<p><img src=\"/url2\" alt=\"foo bar\"></p>\n"@@ -1363,12 +1363,12 @@ let s = "#My header\n\nSomething goes __here __.\n" s ~~-> [ err (posN 1 s) (utok 'M' <> etok '#' <> elabel "white space")- , errFancy (posN 35 s) (nonFlanking "_") ]+ , errFancy (posN 34 s) (nonFlanking "__") ] describe "every block in a list gets its parse error propagated" $ do context "with unordered list" $ it "works" $ do let s = "- *foo\n\n *bar\n- *baz\n\n *quux\n"- e = ueib <> etok '*' <> eic <> eric+ e = ueib <> etok '*' <> eic s ~~-> [ err (posN 6 s) e , err (posN 14 s) e@@ -1377,7 +1377,7 @@ context "with ordered list" $ it "works" $ do let s = "1. *foo\n\n *bar\n2. *baz\n\n *quux\n"- e = ueib <> etok '*' <> eic <> eric+ e = ueib <> etok '*' <> eic s ~~-> [ err (posN 7 s) e , err (posN 16 s) e@@ -1387,11 +1387,11 @@ let s = "1234567890. *something\n1234567891. [\n" s ~~-> [ errFancy posI (indexTooBig 1234567890)- , err (posN 22 s) (ueib <> etok '*' <> eic <> eric)+ , err (posN 22 s) (ueib <> etok '*' <> eic) , err (posN 36 s) (ueib <> etok ']') ] it "non-consecutive indices in ordered list do not prevent further validation" $ do let s = "1. *foo\n3. *bar\n4. *baz\n"- e = ueib <> etok '*' <> eic <> eric+ e = ueib <> etok '*' <> eic s ~~-> [ err (posN 7 s) e , errFancy (posN 8 s) (indexNonCons 3 2)@@ -1460,7 +1460,7 @@ let s = "---\nx: 100\ny: x:\n---\nHere we *go." in s ~~-> [ errFancy (posN 15 s) mappingErr- , err (posN 33 s) (ueib <> etok '*' <> eic <> eric)+ , err (posN 33 s) (ueib <> etok '*' <> eic) ] ----------------------------------------------------------------------------@@ -1528,11 +1528,6 @@ eic :: Ord t => ET t eic = elabel "inline content"---- | Expecting rest of inline content. Eric!--eric :: Ord t => ET t-eric = elabel "the rest of inline content" -- | Create a error component complaining that the given 'Text' is not in -- left- or right- flanking position.