Closed mapsam closed 9 years ago
So there's two options here as far as I know:
I'm interested in testing the latter. Here are some potential options:
Mind if I play with these, @esmithayer?
Pretty neat stuff, these libraries! I'm currently trying out Autolinker.js and it seems to work quite well.
Under init()
I started a new instance of the Autolinker library called alink
that can be used throughout the scripts. Ran into some issues when passing the newly created string with <a>
tags using .innerHTML
since that doesn't covert into DOM nodes and just stays as plain text. Work-around uses a Handlebar.registerHelper()
function that allows you to pass whatever content through a custom script before it is placed into the Handlebar template. So, new helper exists called add-links
:
Handlebars.registerHelper('add-links', function(context) {
var linked = alink.link(context);
return new Handlebars.SafeString(linked);
});
and can be used within the template as such:
{{ add-links your_content }}
You'll see it being used only for the "contact" info right now, but couldn't hurt to pass descriptions through this filter as well.
These Handlebar helpers makes me wonder if we could run {{description}}
through a filter looking for "•" entities and creating actual <li>
elements... making new issue #13
Convert strings of URLs into actual hyperlinks using some sort of regex magic