Email builder

Build HTML easily for emails or webpages

Title

Solo

naas_drivers.html.title("My title")

Subtitle

naas_drivers.html.title("My title", "My subtitle")

Heading

naas_drivers.html.heading("My heading")

Subheading

naas_drivers.html.subheading("My subheading")

Text

Simple

naas_drivers.html.text("My text")

Font Size

naas_drivers.html.text("My text", font_size="42px")

Info

Create info box

text = naas_drivers.html.text("My text")
naas_drivers.html.info(text)

Space

Add a empty line

naas_drivers.html.space()

Separator

Add a line separator

naas_drivers.html.separator()

Button

naas_drivers.html.button("https://www.google.com")

Title

url = "https://www.google.com"
naas_drivers.html.button(url, title="Open me")

Size

url = "https://www.google.com"
naas_drivers.html.button(url, width="300px")

Colors

url = "https://www.google.com"
naas_drivers.html.button(url, color="blue", background_color="white")

Address

naas_drivers.html.address("My title", "My content")

Link

Simple

link = "https://google.com"
naas_drivers.html.link(link)

Title

link = "https://google.com"
naas_drivers.html.link(link, title="My title")

Color

link = "https://google.com"
naas_drivers.html.link(link, color="#F2F2F2")

​

Table

Simple

data = [["😁 Happier subscribers!", "👌 Touchable interface!", "❤ī¸ No more frustration!"],["💌 Semantic email markup!", "đŸĻģ Screenreader friendly!", "đŸ’Ŧ Commented for easy use!"]]
naas_drivers.html.table(data)

Dataframe

The drivers will try to transform all your column with they column title

you can pass parameters with_ exemple: text_14px link_Read

​

​

data = pandas.DataFrame()
# each column title will be tranform in any html type
naas_drivers.html.table(data)

Image

Simple

url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
naas_drivers.html.image(url)
url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
link = "https://google.com"
naas_drivers.html.image(url, link=link)

Name

url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
name = "Image name"
naas_drivers.html.image(url, name=name)

Align

url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
align = "right" # can be right left or center
naas_drivers.html.image(url, align=align)

Size

url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
width="90%"
height="80%"
naas_drivers.html.image(url, width=width, height=height)

Logo

Simple

url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
naas_drivers.html.image(url)
url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
link = "https://google.com"
naas_drivers.html.image(url, link=link)

Name

url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
name = "Image name"
naas_drivers.html.image(url, name=name)

Align

url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
align = "right" # can be right left or center
naas_drivers.html.image(url, align=align)

Size

url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
size="90px"
naas_drivers.html.image(url, size=size)

Header

elems = [naas_drivers.html().text("My text")]
naas_drivers.html.header(elems)

Footer

elem = naas_drivers.html().title("My title")
elems = [naas_drivers.html().text("My text")]
naas_drivers.html.footer("My title", elem, elems)

Generate

stock="TSLA"
​
title=f'Evolution of {stock} stock'
heading="👉 Analyze daily performance over time."
content:"""
🚀 Explore the data, zoom, and get deeply insights over the 100 last days Below.
Picture are nice but dynamic chart below are way more fun :
"""
display = 'iframe' # can be iframe, embed or False ( for display in notebook)
email_content = naas_drivers.html.generate(
title=title,
heading=heading,
content=content,
button_Explore_300px=url_html,
display=display
)

Export

html = email_content
filenames = "myfile.html" # can be .html .png .pdf or .jpeg file
# can be a list too
filenames = ["myfile.html", "myfile.pdf"]
css = ".class{ color: white;}" # allow css injection
naas_drivers.html.export(html, filenames, css)

Convert

only support markdown to html for now

data = """
# Welcome Title
​
text here
"""
naas_drivers.html.convert(data, input_type="markdown")