From 0ea7e6dbb085e1d5f3debaede44f8e834e90afab Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sun, 11 Mar 2012 14:38:37 +0100 Subject: [PATCH] Process descriptions with markdown --- app/helpers/asciicasts_helper.rb | 2 +- app/views/asciicasts/_asciicast.html.erb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/helpers/asciicasts_helper.rb b/app/helpers/asciicasts_helper.rb index 3f7cbc0..3b6bf73 100644 --- a/app/helpers/asciicasts_helper.rb +++ b/app/helpers/asciicasts_helper.rb @@ -45,6 +45,6 @@ EOS end def random_description - ("

" + Faker::Lorem.sentences(6).join + "

").html_safe + Faker::Lorem.sentences(6).join("\n\n") end end diff --git a/app/views/asciicasts/_asciicast.html.erb b/app/views/asciicasts/_asciicast.html.erb index e49804f..0e7cf49 100644 --- a/app/views/asciicasts/_asciicast.html.erb +++ b/app/views/asciicasts/_asciicast.html.erb @@ -6,7 +6,8 @@ <% unless (defined? skip_description) && skip_description %>
- <%= random_description %> + <% markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML) %> + <%= markdown.render(asciicast.description || random_description).html_safe %>
<% end %>