I want to covert all img tag in my website to amp-img with HTML rewriter

hello I am trying to make a HTML rewriter worker that will convert al occurrence of <img src='https://example.com/image.png'/> to <amp-img src='https://example.com/image.png' layout='responsive'/> in my website. please anyone should help me with the full code, thank you.

A post was merged into an existing topic: Please help me with this html rewriter worker code