diff --git a/app/models/story.rb b/app/models/story.rb
index 12e92b787..8a64d9a78 100644
--- a/app/models/story.rb
+++ b/app/models/story.rb
@@ -251,7 +251,7 @@ def calculated_hotness
end
def generated_markeddown_description
- Markdowner.to_html(self.description)
+ Markdowner.to_html(self.description, allow_images = true)
end
def description=(desc)
diff --git a/app/views/global/_markdownhelp.html.erb b/app/views/global/_markdownhelp.html.erb
index d41fdeebf..f04b1f659 100644
--- a/app/views/global/_markdownhelp.html.erb
+++ b/app/views/global/_markdownhelp.html.erb
@@ -27,5 +27,14 @@
text
prefix text with at least 3 spaces |
+
+ <% if defined?(allow_images) && allow_images %>
+
+ (inline image) |
+ ![alt text](http://example.com/image.jpg) (only allowed in
+ story text |
+
+ <% end %>
+
diff --git a/app/views/stories/edit.html.erb b/app/views/stories/edit.html.erb
index cccab0519..a0906f7f5 100644
--- a/app/views/stories/edit.html.erb
+++ b/app/views/stories/edit.html.erb
@@ -32,7 +32,8 @@
- <%= render :partial => "global/markdownhelp" %>
+ <%= render :partial => "global/markdownhelp",
+ :locals => { :allow_images => true } %>
<% end %>
diff --git a/app/views/stories/new.html.erb b/app/views/stories/new.html.erb
index 00ff41cc3..edb811a82 100644
--- a/app/views/stories/new.html.erb
+++ b/app/views/stories/new.html.erb
@@ -85,7 +85,8 @@
- <%= render :partial => "global/markdownhelp" %>
+ <%= render :partial => "global/markdownhelp",
+ :locals => { :allow_images => true } %>
<% end %>
diff --git a/extras/markdowner.rb b/extras/markdowner.rb
index d536d49f3..a5367ea74 100644
--- a/extras/markdowner.rb
+++ b/extras/markdowner.rb
@@ -1,10 +1,11 @@
class Markdowner
- def self.to_html(text)
+ def self.to_html(text, allow_images = false)
if text.blank?
return ""
else
- html = RDiscount.new(text.to_s, :smart, :autolink, :safelink,
- :filter_styles, :filter_html, :no_image).to_html
+ html = RDiscount.new(text.to_s, *[ :smart, :autolink, :safelink,
+ :filter_styles, :filter_html ] + (allow_images ? [] : [ :no_image ])).
+ to_html
# change headings to just emphasis tags
html.gsub!(/<(\/)?h(\d)>/) {|_| "<#{$1}strong>" }