Discovered the solution by reading the documentation! Surprise!
If anyone’s getting the same kind of error thrown when trying to use the Templater template, try the following tip:
When copying html text over to Obsidian, it adds unnecessary slashes and removes tabs. These slashes breaks the code. To avoid this, use Ctrl + Shift + V when pasting.