@@ -232,7 +232,8 @@ para = do
232232table :: PandocMonad m => MWParser m Blocks
233233table = do
234234 tableStart
235− styles <- option [] parseAttrs
235+ styles <- option [] $
236+ parseAttrs <* skipMany spaceChar <* optional (char '|')
236237 skipMany spaceChar
237238 optional blanklines
238239 let tableWidth = case lookup "width" styles of
@@ -283,17 +284,29 @@ rowsep = try $ guardColumnOne *> skipSpaces *> sym "|-" <*
283284
284285cellsep :: PandocMonad m => MWParser m ()
285286cellsep = try $ do
287+ col <- sourceColumn <$> getPosition
286288 skipSpaces
287− (char '|' *> notFollowedBy (oneOf "-}+") *> optional (char '|'))
288− <|> (char '!' *> optional (char '!'))
289+ let pipeSep = do
290+ char '|'
291+ notFollowedBy (oneOf "-}+")
292+ if col == 1
293+ then optional (char '|')
294+ else void (char '|')
295+ let exclSep = do
296+ char '!'
297+ if col == 1
298+ then optional (char '!')
299+ else void (char '!')
300+ pipeSep <|> exclSep
289301
290302tableCaption :: PandocMonad m => MWParser m Inlines
291303tableCaption = try $ do
292304 guardColumnOne
293305 skipSpaces
294306 sym "|+"
295− optional (try $ parseAttr *> skipSpaces *> char '|' *> skipSpaces)
296− (trimInlines . mconcat) <$> many (notFollowedBy (cellsep <|> rowsep) *> inline)
307+ optional (try $ parseAttr *> skipSpaces *> char '|' *> blanklines)
308+ (trimInlines . mconcat) <$>
309+ many (notFollowedBy (cellsep <|> rowsep) *> inline)
297310
298311tableRow :: PandocMonad m => MWParser m [((Alignment, Double), Blocks)]
299312tableRow = try $ skipMany htmlComment *> many tableCell