Crowdhailer

Crowdhailer

Creator of Raxx

EExHTML - safely embed content into HTML

EExHTML

Extension to Embedded Elixir (EEx), that allows content to be safely embedded into HTML.

  iex> import EEx.HTML
  iex> title = "EEx Rocks!"
  iex> content = ~E"<h1><%= title %></h1>"
  %EExHTML.Safe{data: [[[[] | "<h1>"], "EEx Rocks!"] | "</h1>"]}
  iex> "#{content}"
  "<h1>EEx Rocks!</h1>"

  iex> title = "<script>"
  iex> content = ~E"<h1><%= title %></h1>"
  %EExHTML.Safe{data: [[[[] | "<h1>"], [[[] | "&lt;"], "script" | "&gt;"]] | "</h1>"]}
  iex> "#{content}"
  "<h1>&lt;script&gt;</h1>"

Works to integrate with the rest of EEx by implementing a HTML specific engine.
It is extensible for custom data types through the EExHTML.Safe protocol.
The library handles

  • Auto escaping
  • Setting JavaScript variables

Most Liked

Crowdhailer

Crowdhailer

Creator of Raxx

0.2.1 Fix encoding of JavaScript variables.

No changes to API, reasoning is as follows.

Stop using Jason.encode_to_iodata! internally as this causes ambiguity when using String.Chars protocol, it is not possible to know if integers should be encoded as numbers or chardata.

Crowdhailer

Crowdhailer

Creator of Raxx

1.0 released

Dependency on Jason is now optional and must be added to a project that wants to use safe javascript functionality

Crowdhailer

Crowdhailer

Creator of Raxx

0.1.1 released.

Minor patch to fix a superfluous quote mark entered into pages when using the javascript_variables function.

Where Next?

Popular in Announcing Top

Qqwy
Hello everyone, I wrote a small library today called MapDiff. It returns a map listing the (smallest amount of) changes to get from map...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54092 488
New
tmbb
I’ve published the first version of my Makeup library. It’s a syntax highlighter for Elixir in the spirit of Pygments, Currently it highl...
New
mindok
What is ContEx? A pure Elixir server-side data plotting/charting library outputting SVG. It has nice barcharts in particular and works g...
New
kevinlang
Hey all, We have made an Ecto3 Adapter for SQLite3, ecto_sqlite3! We have successfully on-boarded the full suite of integration tests (...
New
nikokozak
Hello all, I’ve been working on Svonix - a library for quickly integrating Svelte components into Phoenix views. It’s a much-needed succ...
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49134 226
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement