I agree writing templates into JS like that is plain ugly.
Using HTML5 template[1] tag is a better way to go. I used it in a fun project[2] and it works flawlessly in all modern browsers
[1]: https://developer.mozilla.org/en/docs/Web/HTML/Element/templ...