Pass through aria- attributes to HTML5.
Also document addition of data- prefix to unknown attributes. Closes #5646.
This commit is contained in:
parent
c497d79dfd
commit
6d30d3e0b3
3 changed files with 14 additions and 4 deletions
|
@ -3967,10 +3967,11 @@ Attributes can be set on links and images:
|
|||
(This syntax is compatible with [PHP Markdown Extra] when only `#id`
|
||||
and `.class` are used.)
|
||||
|
||||
For HTML and EPUB, all attributes except `width` and `height` (but
|
||||
including `srcset` and `sizes`) are passed through as is. The other
|
||||
writers ignore attributes that are not supported by their output
|
||||
format.
|
||||
For HTML and EPUB, all known HTML5 attributes except `width` and
|
||||
`height` (but including `srcset` and `sizes`) are passed through
|
||||
as is. Unknown attributes are passed through as custom
|
||||
attributes, with `data-` prepended. The other writers ignore
|
||||
attributes that are not specifically supported by their output format.
|
||||
|
||||
The `width` and `height` attributes on images are treated specially. When
|
||||
used without a unit, the unit is assumed to be pixels. However, any of
|
||||
|
|
|
@ -621,6 +621,7 @@ toAttrs kvs = do
|
|||
if x `Set.member` (html5Attributes <> rdfaAttributes)
|
||||
|| ':' `elem` x -- e.g. epub: namespace
|
||||
|| "data-" `isPrefixOf` x
|
||||
|| "aria-" `isPrefixOf` x
|
||||
then Just $ customAttribute (fromString x) (toValue y)
|
||||
else Just $ customAttribute (fromString ("data-" ++ x))
|
||||
(toValue y)
|
||||
|
|
8
test/command/5646.md
Normal file
8
test/command/5646.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
```
|
||||
% pandoc -t html5 -f markdown
|
||||
![test](foo){aria-describedby="barbaz"}
|
||||
^D
|
||||
<figure>
|
||||
<img src="foo" aria-describedby="barbaz" alt="" /><figcaption>test</figcaption>
|
||||
</figure>
|
||||
```
|
Loading…
Reference in a new issue