HTML builder
Build HTML easily for emails or webpages

Title

Solo

1
email_content = naas_drivers.emailbuilder.title("My title")
Copied!

Subtitle

1
email_content = naas_drivers.emailbuilder.title("My title", "My subtitle")
Copied!

Style

1
email_content = naas_drivers.emailbuilder.title("My title", bold=False, underline=True, italic=True)
Copied!

Color

1
email_content = naas_drivers.emailbuilder.title("My title", color='blue')
Copied!

Align

1
email_content = naas_drivers.emailbuilder.title("My title", text_align='right')
Copied!

Font size

1
email_content = naas_drivers.emailbuilder.title("My title", font_size=32)
Copied!

Heading

1
email_content = naas_drivers.emailbuilder.heading("My heading")
Copied!

Font Style

1
email_content = naas_drivers.emailbuilder.heading("My heading", bold=False, underline=True, italic=True)
Copied!

Color

1
email_content = naas_drivers.emailbuilder.heading("My heading", color='blue')
Copied!

Align

1
email_content = naas_drivers.emailbuilder.heading("My heading", text_align='left')
Copied!

Font size

1
email_content = naas_drivers.emailbuilder.heading("My heading", font_size=28)
Copied!

Subheading

1
email_content = naas_drivers.emailbuilder.subheading("My subheading")
Copied!

Style

1
email_content = naas_drivers.emailbuilder.subheading("My subheading", bold=False, underline=True, italic=True)
Copied!

Color

1
email_content = naas_drivers.emailbuilder.subheading("My subheading", color='blue')
Copied!

Align

1
email_content = naas_drivers.emailbuilder.subheading("My subheading", text_align='left')
Copied!

Font size

1
email_content = naas_drivers.emailbuilder.subheading("My subheading", font_size=28)
Copied!

Text

Simple

1
email_content = naas_drivers.emailbuilder.text("My text")
Copied!

Style

1
email_content = naas_drivers.emailbuilder.text("My text", bold=True, underline=True, italic=True)
Copied!

Color

1
email_content = naas_drivers.emailbuilder.text("My text", color='blue')
Copied!

Align

1
email_content = naas_drivers.emailbuilder.text("My text", text_align='center')
Copied!

Font size

1
email_content = naas_drivers.emailbuilder.text("My text", font_size=22)
Copied!

Link

Simple

1
link = "https://google.com"
2
email_content = naas_drivers.emailbuilder.link(link)
Copied!

Title

1
link = "https://google.com"
2
email_content = naas_drivers.emailbuilder.link(link, title="My title")
Copied!

Style

1
email_content = naas_drivers.emailbuilder.text("My text", bold=True, underline=True, italic=True)
Copied!

Color

1
link = "https://google.com"
2
email_content = naas_drivers.emailbuilder.link(link, color="#F2F2F2")
Copied!

Align

1
email_content = naas_drivers.emailbuilder.text("My text", text_align='center')
Copied!

Font size

1
email_content = naas_drivers.emailbuilder.text("My text", font_size=22)
Copied!

Info

Create infobox
1
text = naas_drivers.emailbuilder.text("My text")
2
email_content = naas_drivers.emailbuilder.info(text)
Copied!

Space

Add a empty line
1
email_content = naas_drivers.emailbuilder.space()
Copied!

Separator

Add a line separator
1
email_content = naas_drivers.emailbuilder.separator()
Copied!

Button

1
email_content = naas_drivers.emailbuilder.button("https://www.google.com")
Copied!

Title

1
url = "https://www.google.com"
2
email_content = naas_drivers.emailbuilder.button(url, title="Open me")
Copied!

Size

1
url = "https://www.google.com"
2
email_content = naas_drivers.emailbuilder.button(url, width="300px")
Copied!

Colors

1
url = "https://www.google.com"
2
email_content = naas_drivers.emailbuilder.button(url, color="blue", background_color="white")
Copied!

Address

1
email_content = naas_drivers.emailbuilder.address("My title", "My content")
Copied!

List

1
list_ = ["First element",
2
"Second element",
3
"Third element"]
4
​
5
email_content = naas_drivers.emailbuilder.list(list_)
Copied!

Table

Simple

1
data = [["😁 Happier subscribers!", "πŸ‘Œ Touchable interface!", "❀️ No more frustration!"],["πŸ’Œ Semantic email markup!", "🦻 Screenreader friendly!", "πŸ’¬ Commented for easy use!"]]
2
email_content = naas_drivers.emailbuilder.table(data)
Copied!

Dataframe

The drivers will try to transform all your column with they column title
you can pass parameters with_ exemple: text_14px link_Read
``
1
data = pandas.DataFrame()
2
# each column title will be tranform in any html type
3
email_content = naas_drivers.emailbuilder.table(data)
Copied!

Header

1
email_content = naas_drivers.emailbuilder.table(data,
2
header=True, # Add a header to the table
3
header_bg_color="black", # Set the background color of the header
4
header_ft_color="white") # Set the font color of the header
Copied!

Border

1
email_content = naas_drivers.emailbuilder.table(data,
2
border=True, # Add a border to the table
3
border_color="black") # Set the color of the border
Copied!

Align

1
align = {
2
0: "left",
3
1: "center",
4
2: "righ"
5
}
6
​
7
email_content = naas_drivers.emailbuilder.table(data, col_align=align)
Copied!

Column size

1
size = {
2
0: "50%",
3
1: "10em",
4
2: "30px"
5
}
6
​
7
email_content = naas_drivers.emailbuilder.table(data, col_size=size)
Copied!

Image

Simple

1
url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
2
email_content = naas_drivers.emailbuilder.image(url)
Copied!
1
url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
2
link = "https://google.com"
3
email_content = naas_drivers.emailbuilder.image(url, link=link)
Copied!

Name

1
url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
2
name = "Image name"
3
email_content = naas_drivers.emailbuilder.image(url, name=name)
Copied!

Align

1
url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
2
align = "right" # can be right left or center
3
email_content = naas_drivers.emailbuilder.image(url, align=align)
Copied!

Size

1
url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
2
width="90%"
3
height="80%"
4
email_content = naas_drivers.emailbuilder.image(url, width=width, height=height)
Copied!

Logo

Simple

1
url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
2
email_content = naas_drivers.emailbuilder.image(url)
Copied!
1
url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
2
link = "https://google.com"
3
email_content = naas_drivers.emailbuilder.image(url, link=link)
Copied!

Name

1
url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
2
name = "Image name"
3
email_content = naas_drivers.emailbuilder.image(url, name=name)
Copied!

Align

1
url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
2
align = "right" # can be right left or center
3
email_content = naas_drivers.emailbuilder.image(url, align=align)
Copied!

Size

1
url = "https://raw.githubusercontent.com/jupyter-naas/naas/main/images/naas_logo.svg"
2
size="90px"
3
email_content = naas_drivers.emailbuilder.image(url, size=size)
Copied!

Header

1
elems = [naas_drivers.html().text("My text")]
2
email_content = naas_drivers.emailbuilder.header(elems)
Copied!

Footer

1
elem = naas_drivers.html().title("My title")
2
elems = [naas_drivers.html().text("My text")]
3
email_content = naas_drivers.emailbuilder.footer("My title", elem, elems)
Copied!

Comapny Footer

Social networks icons

1
networks = [{
2
'img_src': 'https://about.twitter.com/content/dam/about-twitter/en/brand-toolkit/brand-download-img-1.jpg.twimg.1920.jpg',
3
'href': 'https://twitter.com/'
4
}]
5
​
6
naas_drivers.emailbuilder.footer_company(networks=networks)
7
naas_drivers.emailbuilder.footer_company(networks=networks,
8
logo_width='5%',
9
logo_padding='5px',
10
logo_margin='0px 15px')
Copied!

Company informations

1
company = ["Naas: Notebooks-as-a-service",
2
"https://www.naas.ai/"]
3
​
4
naas_drivers.emailbuilder.footer_company(company=company)
Copied!
1
legal = ["Powered by CASHSTORY Β© 2021",
2
"CashStory SAS, 5 rue Hermel, 75018 Paris, France"]
3
​
4
naas_drivers.emailbuilder.footer_company(legal=legal)
Copied!

Generate

1
stock="TSLA"
2
​
3
title=f'Evolution of {stock} stock'
4
heading="πŸ‘‰ Analyze daily performance over time."
5
content:"""
6
πŸš€ Explore the data, zoom, and get deeply insights over the 100 last days Below.
7
Picture are nice but dynamic chart below are way more fun :
8
"""
9
display = 'iframe' # can be iframe, embed or False ( for display in notebook)
10
email_content = naas_drivers.emailbuilder.generate(
11
title=title,
12
heading=heading,
13
content=content,
14
button_Explore_300px=url_html,
15
display=display
16
)
Copied!

Export

1
email_content = ""
2
filenames = "myfile.html" # can be .html .png .pdf or .jpeg file
3
# can be a list too
4
filenames = ["myfile.html", "myfile.pdf"]
5
css = ".class{ color: white;}" # allow css injection
6
naas_drivers.emailbuilder.export(email_content, filenames, css)
Copied!

Convert

only support markdown to html for now
1
data = """
2
# Welcome Title
3
​
4
text here
5
"""
6
naas_drivers.emailbuilder.convert(data, input_type="markdown")
Copied!