Skip to content

Instantly share code, notes, and snippets.

@xzilla
Created December 4, 2012 16:00
Show Gist options
  • Save xzilla/4205488 to your computer and use it in GitHub Desktop.
Save xzilla/4205488 to your computer and use it in GitHub Desktop.
ejs template to remove html tags
create custom filter like so:
ejs.filters.plaintext = function(obj) {
return obj.replace(/(<([^>]+)>)/ig,'');
};
then call it like so:
<%=: item.content.substring(0,94) | plaintext %>
@iamnasirudeen
Copy link

It didnt work for me

@GeekyGeeky
Copy link

Worked well when i applied it directly to the html string, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment