Allow fenced divs and bracketed spans to have attributes with no value #10448
Closed
jimjam-slam
started this conversation in
Ideas
Replies: 1 comment
-
Doing some more reading and realising that attributes are always supposed to have a value if they are not one of the specific boolean attributes used in HTML. So maybe this is a bad idea after all! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, fenced divs and bracketed spans in Markdown can have general attributes (not a class or ID) that get prefixed with
data-
in the resulting HTML output. However, these attributes must have a value (even if that value is just an empty string), or else Pandoc skips div/span processing altogether:On Pandoc 3.2:
The HTML spec allows absent values for attributes — in fact, boolean attributes (such as
loop
on videos) are always true if present (ie.myattribute
andmyattribute="false"
are both true, not false; for the latter you must omitmyattribute
altogether).In this case I'm talking about the custom attributes that get prefixed with
data-
on the way through Pandoc, not the specified boolean attributes in the HTML spec, but I think there are plenty of use cases where someone might want a custom attribute without a video. Lining up with the spec also helps users with HTML experience inuit what they may be able to do.For example, in qmd-lab/closeread#139 @andrewpbray and I are allowing users of our Quarto extension to play and pause videos with spans, and we're deciding between
[my trigger](.play-video)
,[my trigger](play-video)
and[my trigger](play-video="true")
as user APIs. The second is most intuitive to my mind (although I accept that may be down to taste).(Potentially related issue: #8251 addresses the
class
case specifically, where it's desirable to remove that attribute when it has an empty value.)Beta Was this translation helpful? Give feedback.
All reactions