I’m building a small Sinatra app for a podcast and want to be able to add links in a textarea for the show notes.
I was looking for advice about how to best solve this. I have been looking into [wysihtml5][1] from xing but I can 't say I’m very much excited about this solution.
If anyone could point me in a better direction, much appreciation and many thanks will fly your way!
I would make the show notes a list of links, so that you aren’t mixing content. Then you can render something like
<%- @podcast.shownotes.each do |show_note| %>
<li><%= link_to show_note.text, show_note.link &></li>
<% end %>
Then every show note is a link. It might be a little less flexible, but it saves you from getting into complicated HTML content sanitization.
If you are dead-set on embedding the links in admin- or user-generated content, I’d recommend trying the Ace editor and using Liquid for content rendering and Loofah for HTML santiization.
I was thinking about looping through a link collection too but it doesn’t really fit my needs. Ace looks interesting, but maybe a bit overkill for my humble needs
Got a basic version working with WYSIHTML5 last night. Stripped out all the gobbledygook I don’t care about and load only extra JS files for the edit page. I can live with that for now and move on to bigger fish.