-
|
In converting markdown to HTML, I'm attempting some progressive image loading and I would like to allow for a fallback mechanism in my image tags. Something like On my script I'm doing this: if FORMAT:match 'html' then
function Image (elem)
elem.attributes.onerror = "this.src='" ..elem.src.. "'"
elem.src = elem.src .. ".thumbnail.jpg"
return elem
end
endThis creates: <img src="image.png.thumbnail.jpg" onerror="this.src='image.png'" />as opposed to <img src="image.png.thumbnail.jpg" onerror="this.src='image.png'" />Which of course is not valid JavaScript. Additionally I've also found that pandoc sanitizes all HTML attributes. If I put a whitespace in a Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
You amend the properties of the What happens if you return a |
Beta Was this translation helpful? Give feedback.
-
|
We use blaze-html for the HTML rendering, and it does this escaping, so not easy for us to adjust. |
Beta Was this translation helpful? Give feedback.
You amend the properties of the
Imageelement and the HTML writer then creates escaped code.What happens if you return a
RawBlockinstead of theImageelement, where you assemble the code for the image yourself? In this case there should be no escaping.