Help Getting Started with HTMLRewriter

I am entirely new at using HTMLRewriter, but have some general js/html experience. My task is relatively simple, but I am really just not sure how HTMLRewriter works. What I need to do is;

  1. Retrieve a static HTML page
  2. Get the links from your previously deployed JSON response
  3. Use HTMLRewriter to add these links to the static HTML page
  4. Return the transformed HTML page from the Worker

I have the url "," but it is not local. So what I would like to know is; what is the correct way to copy/store this static html page in order to make changes with HTMLRewriter?

Second, how should I go about adding my own JSON url array to the retrieved HTML page using HTMLRewriter? I read about the setInnerContent function, but am not sure if that is what I should be using.

Then finally, and I’m pretty sure this is straightforward, but what is the right way to return the modified html page?

Again, my experience is in writing html/js together, so I have very little experience doing everything from within a single js file, which is from what I understand one of the biggest benefits of cloudflare. I might be approaching this incorrectly, asking the wrong questions, or completely off track, so any help is greatly appreciated.