If you're lucky someone made a script and posted it on the internet. The language might be AppleScript (for Macs), Powershell (Windows). Some web browsers have a scripting options (Firefox).
Be aware scripts developed on a particular OS might not work on another OS earlier or recent. You must adapt it to your own purposes.
And check whether a downloaded file is malware.
==============================================
Your script would be programmed to:
1) Examine your typed text for any words which match words you store in its data array.
2) The data array is numbered 1 through say 100. Each number has two variables attached. One variable is a key word. The second variable is the name of a file to be opened when it finds that word.
3) The file contains your html template. The script copies and pastes your typed text into the template. The easy method is to paste the text after the end of the document.
4) As your system develops, you may write IF/THEN trees, to decide which file to open if it discovers two or more key words, or whether to open additional files containing 'boilerplate' text, table of contents, copyright notices, etc.