Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow balanced (..) and <..> in link or image source.

  • Loading branch information...
commit 8f7ccd31d28662e9589a23154d6f6d926ae6e39b 1 parent d27d193
@jgm authored
Showing with 5 additions and 4 deletions.
  1. +5 −4 Markdown.hs
View
9 Markdown.hs
@@ -157,12 +157,13 @@ doc = mdo
text "#" <++> many1 digit // many1 alphaNum) <<- char ';' ## Entity
label <- newRule $ char '[' ->> many (doesNotMatch (char ']') ->> inline) <<- char ']'
- title <- newRule $ char '"' ->> many (doesNotMatch (char '"' <> sp <> (text ")" // newline)) ->>
+ title <- newRule $ char '"' ->> many (doesNotMatch (char '"' <> sp <> (text ")" // newline)) ->>
doesNotMatch newline ->> anyChar) <<- char '"' //
- char '\'' ->> many (doesNotMatch (char '\'' <> sp <> (text ")" // newline)) ->>
+ char '\'' ->> many (doesNotMatch (char '\'' <> sp <> (text ")" // newline)) ->>
doesNotMatch newline ->> anyChar) <<- char '\''
- source <- newRule $ char '<' ->> many (noneOf ">") <<- char '>' //
- many (noneOf ")\n\t ")
+ source <- newRule $ char '<' ->> source' <<- char '>' // source'
+ source' <- newRule $ many (many1 (noneOf "()> \n\t") // (text "(" <++> source' <++> text ")") //
+ (text "<" <++> source' <++> text ">")) ## concat
sourceAndTitle <- newRule $ char '(' ->> sp ->> source <<- spnl <> option "" title <<- sp <<- char ')'
explicitLink <- newRule $ label <> spnl ->> sourceAndTitle ## (\(l, s) -> Link l (Src s))
autolinkUrl <- newRule $ char '<' ->> many1 alpha <++> text "://" <++>
Please sign in to comment.
Something went wrong with that request. Please try again.