Skip to content

Commit

Permalink
Markdown links should be external
Browse files Browse the repository at this point in the history
  • Loading branch information
wioux committed Feb 17, 2016
1 parent 08553d3 commit fff7b20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 0 additions & 2 deletions greenfield/app/assets/javascripts/greenfield/posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
$(document).ready(function(){
// resizable textarea for edit page
$('.edit-post-content textarea').autosize();

$(".post-content a").attr("target","_blank");
});
7 changes: 4 additions & 3 deletions greenfield/app/markdown/greenfield/markdown.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ def self.invalid_embeds(post)
end

def self.render(text)
renderer = Redcarpet::Markdown.new(new(:hard_wrap => true),
:autolink => true, :no_intraemphasis => true,
:fenced_code_blocks => true, :tables => true)
html_render = new(:hard_wrap => true, link_attributes: { target: '_blank' })
renderer = Redcarpet::Markdown.new(html_render,
:autolink => true, :no_intraemphasis => true,
:fenced_code_blocks => true, :tables => true)
Redcarpet::Render::SmartyPants.render(renderer.render(text)).html_safe
end

Expand Down

0 comments on commit fff7b20

Please sign in to comment.