@@ -200,7 +200,7 @@ hrule = try $ do
200200-- strict in the nesting, sublist must start at exactly "parent depth
201201-- plus one"
202202anyList :: Parser [Char] ParserState Block
203−anyList = try $ ( (anyListAtDepth 1) <* blanklines )
203+anyList = try $ anyListAtDepth 1 <* blanklines
204204
205205-- | This allow one type of list to be nested into an other type,
206206-- provided correct nesting
@@ -234,14 +234,23 @@ orderedListItemAtDepth = genericListItemAtDepth '#'
234234genericListItemAtDepth :: Char -> Int -> Parser [Char] ParserState [Block]
235235genericListItemAtDepth c depth = try $ do
236236 count depth (char c) >> optional attributes >> whitespace
237− p <- inlines
237+ p <- many listInline
238+ newline
238239 sublist <- option [] (singleton <$> anyListAtDepth (depth + 1))
239− return ((Plain p):sublist)
240+ return (Plain p : sublist)
240241
241242-- | A definition list is a set of consecutive definition items
242243definitionList :: Parser [Char] ParserState Block
243244definitionList = try $ DefinitionList <$> many1 definitionListItem
244245
246+-- | List start character.
247+listStart :: Parser [Char] st Char
248+listStart = oneOf "*#-"
249+
250+listInline :: Parser [Char] ParserState Inline
251+listInline = try (notFollowedBy newline >> inline)
252+ <|> try (endline <* notFollowedBy listStart)
253+
245254-- | A definition list item in textile begins with '- ', followed by
246255-- the term defined, then spaces and ":=". The definition follows, on
247256-- the same single line, or spaned on multiple line, after a line
@@ -250,10 +259,11 @@ definitionListItem :: Parser [Char] ParserState ([Inline], [[Block]])
250259definitionListItem = try $ do
251260 string "- "
252261 term <- many1Till inline (try (whitespace >> string ":="))
253− def' <- inlineDef <|> multilineDef
262+ def' <- multilineDef <|> inlineDef
254263 return (term, def')
255264 where inlineDef :: Parser [Char] ParserState [[Block]]
256− inlineDef = liftM (\d -> [[Plain d]]) $ try (whitespace >> inlines)
265+ inlineDef = liftM (\d -> [[Plain d]])
266+ $ optional whitespace >> many listInline <* newline
257267 multilineDef :: Parser [Char] ParserState [[Block]]
258268 multilineDef = try $ do
259269 optional whitespace >> newline
@@ -348,10 +358,6 @@ maybeExplicitBlock name blk = try $ do
348358inline :: Parser [Char] ParserState Inline
349359inline = choice inlineParsers <?> "inline"
350360
351−-- | List of consecutive inlines before a newline
352−inlines :: Parser [Char] ParserState [Inline]
353−inlines = manyTill inline newline
354−
355361-- | Inline parsers tried in order
356362inlineParsers :: [Parser [Char] ParserState Inline]
357363inlineParsers = [ autoLink