A Go wrapper for MRML, the MJML markup language implemented in rust.
go get github.com/codedninja/mrmlgopackage main
import (
	"fmt"
	"github.com/codedninja/mrmlgo"
)
func main() {
    mjml := `
    <mjml>
        <mj-body>
        <mj-section>
        <mj-column>
            <mj-image width="100px" src="/assets/img/logo-small.png"></mj-image>
            <mj-divider border-color="#F45E43"></mj-divider>
            <mj-text font-size="20px" color="#F45E43" font-family="helvetica">Hello World</mj-text>
        </mj-column>
        </mj-section>
    </mj-body>
    </mjml>`
    options, _ := mrmlgo.NewParseOptions(map[string]string{})
    parsed, _ := mrmlgo.ParseMJML(mjml)
    html, _ := parsed.ToHTML();
    
    fmt.Println(html)
}At the this current moment mrmlgo only supports in memory includes. You can pass a map[string]string when creating calling NewParseOptions. The format is ``map[filename]contents`.
package main
import (
	"fmt"
	"github.com/codedninja/mrmlgo"
)
func main() {
	includes := map[string]string{
		"hello-world.mjml": "<mj-text>Hello World</mj-text>",
	}
    mjml := `
    <mjml>
        <mj-body>
            <mj-include path="hello-world.mjml" />
        </mj-body>
    </mjml>`
	options, _ := mrmlgo.NewParseOptions(includes)
    parsed, _ := options.ParseMJML(mjml); 
    output, _ := parsed.ToHTML();
	fmt.Println("Output:", output)
}Coming soon.
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions, please open an issue.
- Github workflow for building rust libraries
- Add tests