Markdown reader: handle 'id' and 'class' in parsing key/value attrs.

# Header {id="myid" class="foo bar"}

is now equivalent to

    # Header {#myid .foo .bar}

Closes #2396.
This commit is contained in:
John MacFarlane 2015-09-25 23:01:34 -07:00
parent 8a43530380
commit dcb0b02aa3

View file

@ -639,7 +639,11 @@ keyValAttr = try $ do
val <- enclosed (char '"') (char '"') litChar
<|> enclosed (char '\'') (char '\'') litChar
<|> many (escapedChar' <|> noneOf " \t\n\r}")
return $ \(id',cs,kvs) -> (id',cs,kvs ++ [(key,val)])
return $ \(id',cs,kvs) ->
case key of
"id" -> (val,cs,kvs)
"class" -> (id',cs ++ words val,kvs)
_ -> (id',cs,kvs ++ [(key,val)])
specialAttr :: MarkdownParser (Attr -> Attr)
specialAttr = do