This is a set of functions that will generate valid AMP email markup
amp-img
getImage(attributes, fallback)
Ex.
const attributes = {
src: "example.com/my-image.jpg",
layout: "fixed",
height: 400,
width: 400
}
const { html, css, scripts } = getImage(attributes, "<span>Fallback Text</span>");
will result in
<amp-img src="example.com/my-image.jpg" layout="fixed" height="400" width="400">
<span>Fallback Text</span>
</amp-img>
amp-accordion
getAccordion(sections, accordionAttributes, sectionAttributes)
Ex.
const sections = [
{ header: "<h1>Hello</h1>", content: "<p>World</p>" },
{ header: "<h1>Goodbye</h1>", content: "<p>World</p>", expanded: true }
]
const { html, css, scripts } = getImage(sections, { animate: true }, { class: "my-section" });
will result in
<amp-accordion animate>
<section class="my-section">
<h1>Hello</h1>
<p>World</p>
</section>
<section expanded class="my-section">
<h1>Goodbye</h1>
<p>World</p>
</section>
</amp-accordion>