mjml2html

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 7 Imported by: 0

README

mjml2html

Usage

package main

import "github.com/TcMits/mjml2html"

func main() {
	html, err := mjml2html.ToHTML(`<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">{{ if eq 1 2 }}3{{ end }}</mj-text>
        <mj-text font-size="20px" color="#F45E43" font-family="helvetica">Hello World</mj-text>
      </mj-column>
    </mj-section>
  </mj-body>
</mjml>`)
	if err != nil {
		panic(err)
	}

	println(html)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fonts

func Fonts(f map[string]string) option

func KeepComments

func KeepComments(b bool) option

func ToHTML

func ToHTML[T ~string | *MJMLNode](v T, opts ...option) (string, error)

func ValidationLevel

func ValidationLevel(l string) option

Types

type MJMLNode

type MJMLNode struct {
	TagName    string            `json:"tagName"`
	Attributes map[string]string `json:"attributes"`
	Content    string            `json:"content,omitempty"`
	Children   []MJMLNode        `json:"children,omitempty"`
}

func ToJSON

func ToJSON(v string, opts ...option) (*MJMLNode, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL