Disclaimer: I know next to nothing about programming.
In this thread and post, there’s a way to target the current document and read contents of same.
So what you want to achieve is definitely possible with javascript (with or without Templater) and the Obsidian API, methinks.
How you are going to dress it up, with html, is completely irrelevant (for me), at this point.