Creating a custom template

Greetings. Wondering if it is possible to create custom template (like md and html), to support a DSL, so that I can do something like:

mydsl`
   some::dsl::syntax
`

which would then be passed through the js function that interprets that DSL to output plain text, or html, or markdown or whatever…

if so, pointers to documentation or source code doing similar would be great!

These are called tagged template literals and you can write your own:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates

2 Likes

perfect, thanks