@@ -308,7 +308,15 @@ pSelfClosing f g = do
308308 return open
309309
310310pQ :: TagParser [Inline]
311−pQ = pInlinesInTags "q" (Quoted DoubleQuote)
311+pQ = do
312+ quoteContext <- stateQuoteContext `fmap` getState
313+ let quoteType = case quoteContext of
314+ InDoubleQuote -> SingleQuote
315+ _ -> DoubleQuote
316+ let innerQuoteContext = if quoteType == SingleQuote
317+ then InSingleQuote
318+ else InDoubleQuote
319+ withQuoteContext innerQuoteContext $ pInlinesInTags "q" (Quoted quoteType)
312320
313321pEmph :: TagParser [Inline]
314322pEmph = pInlinesInTags "em" Emph <|> pInlinesInTags "i" Emph