Indentation-based HTML templating language compiling to HEEx/LEEx/EEx?

Hi there! The recent developments w.r.t. Surface and HEEx are very cool!

One thing that would be the cherry on top, would be an indentation-based templating language that compiles down to one of these. If you no longer need to write closing tags, HTML (and any similar XML-like languages) can be expressed much more concisely (without any loss of expressivity).

As an example, you might look at Haml which is a Ruby-based variant (emitting ERb – Embedded Ruby files) of such a language. In Elixir there does exist Calliope which is an Haml parser. Unfortunately, Calliope has been abandoned since 2015.

I would love to write or collaborate on a templating engine like this.
However, where to start? What would be the most appropriate way to create a templating engine that builds on top of HEEx/LEEx/EEx(/Surface)?

I guess the question can be split up as:

  • How to create a templating engine which can be recognized both from a sigil and from a new file extension?
  • How to wrap (H/L)EEx inside another templating engine?

You might want to check out Slime, also with support for phoenix e and liveview, they have pretty advanced in terms of support, maybe is a good go to for contributions or inspiration


Two leads.

    Basically , soon

  2. Similar discussion -
    Formatter for HEEx templates

You could try Temple which allows you to write your templates in Elixir.

1 Like

Thank you very much for your responses!

Slime fits perfect for my use-case. Very nice to see that such a mature library already exists.
I will use it, and focus contributions there if needed.