Please help me with this html rewriter worker code

hello I am trying to make a HTML rewriter worker that will convert al occurrence of to in my website. please anyone should help me with the full code, thank you.

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

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.