Markdown reader: remove restriction on identifiers...

so they no longer need to begin with a letter. Closes #7920.
This commit is contained in:
John MacFarlane 2022-02-23 10:00:49 -08:00
parent ba337866e4
commit 8ceea05c75
2 changed files with 21 additions and 1 deletions

View file

@ -635,7 +635,7 @@ identifier = do
identifierAttr :: PandocMonad m => MarkdownParser m (Attr -> Attr)
identifierAttr = try $ do
char '#'
result <- identifier
result <- T.pack <$> many1 (alphaNum <|> oneOf "-_:.") -- see #7920
return $ \(_,cs,kvs) -> (result,cs,kvs)
classAttr :: PandocMonad m => MarkdownParser m (Attr -> Attr)

20
test/command/7920.md Normal file
View file

@ -0,0 +1,20 @@
```
% pandoc -t native
[hi]{#123}
^D
[ Para [ Span ( "123" , [] , [] ) [ Str "hi" ] ] ]
```
```
% pandoc -t markdown
[hi]{#123}
^D
[hi]{#123}
```
```
% pandoc -t markdown
# Hi {#123}
^D
# Hi {#123}
```