I totally agree that we don't need match jinja2 per se, but it's worth drawing inspiration from. If you are developing a custom tag, I think the case where you need to grab the content in between the start and end tags will be pretty common, so might be worth making it a little easier.

All of jinja2's templates are compiled to Python code first, and technically you can precompile it into bytecode and simply load that. I think the way it handles custom tags & getting runtime content is treating them like macros, which are similar because the macro code isn't "executed" until runtime (it's just a precompiled template wrapped in a js function).

Anyway, I do really like how easy it is to do really complex stuff in a `compile` function, and I've always found jinja2's advanced tag API kind of weird because you have to construct this weird AST to do programmatic stuff. I'm thinking we could provide a few helper functions that help generate js code so you don't have to write the js output directly, unless you're doing something really crazy. A helper function could be `compileNodesIntoFunction` which compiles the nodes inside a `function() { ... }`. Just thinking out loud.

I'm gonna add a little bit to this and see what you think. Should have some code tomorrow or Wednesday.