Open marrus-sh opened 5 years ago
Doing some additional testing, it seems like --self-contained
specifically is the culprit here; correct polyglot markup is produced when I remove that option.
(Compare echo []{hidden=""} | pandoc -f markdown -t html --standalone
and echo []{hidden=""} | pandoc -f markdown -t html --self-contained
as a MWE.)
We're using the tagsoup library's data model to implement the --self-contained
option. Essentially we re-parse the string generated by the HTML writer using tagsoup, replace all the external things with data-urls, then render with tagsoup to HTML again. See SelfContained.hs.
Seems like they have an old open issue about this: https://github.com/ndmitchell/tagsoup/issues/23 and there's currently no workaround?
Does <div hidden="">
have the same meaning in HTML as <div hidden="hidden">
?
If so, we could replace the first with the second automatically before calling tagsoup.
Does
<div hidden="">
have the same meaning in HTML as<div hidden="hidden">
?
yes, https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes#Boolean_Attributes
but we would have to hardcode the list of boolean attributes, which is what the tagsoup issue was supposed to do, it would be ideal to fix it there I suppose.
Pandoc version: 2.7.3
I am compiling Markdown with pandoc to standalone HTML, using a custom template of my own with the
--template
flag. The full call is something along the lines of:In the template I have code like the following:
However, the HTML which results is instead:
(The
hidden
attribute has lost its=""
.)This is equivalent HTML, but it is not valid polyglot markup (it is invalid XML). One can get around this by instead writing:
(Which is defined by HTML5 to be equivalent.) But it would be nice if pandoc supported polyglot empty attributes as well.