View Source Premailex (Premailex v0.3.20)

Documentation for Premailex.

Summary

Functions

Adds inline styles to an HTML string.

Turns an HTML string into text.

Functions

to_inline_css(html, options \\ [])

@spec to_inline_css(String.t(), Keyword.t()) :: String.t()

Adds inline styles to an HTML string.

Examples

iex> Premailex.to_inline_css("<html><head><style>p{background-color: #fff;}</style></head><body><p style=\"color: #000;\">Text</p></body></html>")
"<html><head><style>p{background-color: #fff;}</style></head><body><p style=\"background-color: #fff; color: #000;\">Text</p></body></html>"

to_text(html)

@spec to_text(String.t()) :: String.t()

Turns an HTML string into text.

Examples

iex> Premailex.to_text("<html><head><style>p{background-color:#fff;}</style></head><body><p style=\"color:#000;\">Text</p></body></html>")
"Text"