@@ -863,14 +863,16 @@ listLineCommon = concat <$> manyTill
864-- parse raw text for one list item, excluding start marker and continuations
864-- parse raw text for one list item, excluding start marker and continuations
865rawListItem :: PandocMonad m
865rawListItem :: PandocMonad m
866+ => Bool -- four space rule
866− => MarkdownParser m a
867+ -> MarkdownParser m a
867 -> MarkdownParser m (String, Int)
868 -> MarkdownParser m (String, Int)
868−rawListItem start = try $ do
869+rawListItem fourSpaceRule start = try $ do
869 pos1 <- getPosition
870 pos1 <- getPosition
871 pos2 <- getPosition
872 pos2 <- getPosition
872− continuationIndent <- (4 <$ guardEnabled Ext_four_space_rule)
873+ let continuationIndent = if fourSpaceRule
873− <|> return (sourceColumn pos2 - sourceColumn pos1)
875+ else (sourceColumn pos2 - sourceColumn pos1)
874 first <- listLineCommon
876 first <- listLineCommon
875 rest <- many (do notFollowedBy listStart
877 rest <- many (do notFollowedBy listStart
876 notFollowedBy (() <$ codeBlockFenced)
878 notFollowedBy (() <$ codeBlockFenced)
@@ -914,10 +916,11 @@ notFollowedByHtmlCloser = do
914 Nothing -> return ()
916 Nothing -> return ()
916listItem :: PandocMonad m
918listItem :: PandocMonad m
919+ => Bool -- four-space rule
917− => MarkdownParser m a
920+ -> MarkdownParser m a
918 -> MarkdownParser m (F Blocks)
921 -> MarkdownParser m (F Blocks)
919−listItem start = try $ do
922+listItem fourSpaceRule start = try $ do
920− (first, continuationIndent) <- rawListItem start
923+ (first, continuationIndent) <- rawListItem fourSpaceRule start
921 continuations <- many (listContinuation continuationIndent)
924 continuations <- many (listContinuation continuationIndent)
922 -- parsing with ListItemState forces markers at beginning of lines to
925 -- parsing with ListItemState forces markers at beginning of lines to
923 -- count as list item markers, even if not separated by blank space.
926 -- count as list item markers, even if not separated by blank space.
@@ -938,14 +941,18 @@ orderedList = try $ do
938 delim `elem` [DefaultDelim, Period]) $
941 delim `elem` [DefaultDelim, Period]) $
939 guardEnabled Ext_fancy_lists
942 guardEnabled Ext_fancy_lists
940 when (style == Example) $ guardEnabled Ext_example_lists
943 when (style == Example) $ guardEnabled Ext_example_lists
944+ fourSpaceRule <- (True <$ guardEnabled Ext_four_space_rule)
945+ <|> return (style == Example)
941− items <- fmap sequence $ many1 $ listItem
946+ items <- fmap sequence $ many1 $ listItem fourSpaceRule
942 (orderedListStart (Just (style, delim)))
947 (orderedListStart (Just (style, delim)))
943 start' <- (start <$ guardEnabled Ext_startnum) <|> return 1
948 start' <- (start <$ guardEnabled Ext_startnum) <|> return 1
944 return $ B.orderedListWith (start', style, delim) <$> fmap compactify items
949 return $ B.orderedListWith (start', style, delim) <$> fmap compactify items
946bulletList :: PandocMonad m => MarkdownParser m (F Blocks)
951bulletList :: PandocMonad m => MarkdownParser m (F Blocks)
947bulletList = do
952bulletList = do
953+ fourSpaceRule <- (True <$ guardEnabled Ext_four_space_rule)
948− items <- fmap sequence $ many1 $ listItem bulletListStart
955+ items <- fmap sequence $ many1 $ listItem fourSpaceRule bulletListStart
949 return $ B.bulletList <$> fmap compactify items
956 return $ B.bulletList <$> fmap compactify items
951-- definition lists
958-- definition lists