Guest User

Untitled

a guest
Oct 19th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. module HtmlTools
  2. def add_to_url(string)
  3. doc = Nokogiri::HTML.parse(self)
  4. doc.css("a").each do |link|
  5. link.attributes["href"].value = "#{link.attributes["href"].value}#{string}"
  6. end
  7. doc.to_s
  8. end
  9. end
  10.  
  11. def markdown(string)
  12. options = [:hard_wrap, :filter_html, :autolink, :no_intraemphasis, :fenced_code, :gh_blockcode]
  13. redcarpet = Redcarpet.new(string,*options).to_html.extend(HtmlTools)
  14. (redcarpet.add_to_url("?utm_campain=newsletter").to_html).html_safe
  15. end
Add Comment
Please, Sign In to add comment