SparkPost / heml

HEML is an open source markup language for building responsive email.
https://heml.io
MIT License
4.33k stars 157 forks source link

Extending with own components? #41

Open shokurov opened 6 years ago

shokurov commented 6 years ago

As I see from the heml-elements/index.js there is no mechanism for plugging in additional components. That limits usability and, I believe, prevents real world use in large projects.

I understand that SparkPost would be having trouble allowing custom JS to be run within parse or render phases on their servers, however adding extension mechanism would have grand effect on spread of HEML as open standard.

colestrode commented 6 years ago

Hi @shokurov! Thanks for checking out HEML :) It turns out you can pass in your own elements in the options object you pass to the exported heml function:

const heml = require('heml')
heml(`<heml>...</heml>`, { elements: [ /* elements go here */ ] })

There isn't much documentation on custom elements yet (that will be coming soon I believe), but I they need to be created using the createElement function found in @heml/utils. I would look at the elements in @heml/elements for which attributes are accepted.

shokurov commented 6 years ago

Thanks for pointing out!

This definitely needs a bit more documentation..

Please, could you clarify couple more things:

  1. do components have to utilise React or is it just convenience that you use JSX in internal components?
  2. is there a description of