Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module HtmlTools
- def add_to_url(string)
- doc = Nokogiri::HTML.parse(self)
- doc.css("a").each do |link|
- link.attributes["href"].value = "#{link.attributes["href"].value}#{string}"
- end
- doc.to_s
- end
- end
- def markdown(string)
- options = [:hard_wrap, :filter_html, :autolink, :no_intraemphasis, :fenced_code, :gh_blockcode]
- redcarpet = Redcarpet.new(string,*options).to_html.extend(HtmlTools)
- (redcarpet.add_to_url("?utm_campain=newsletter").to_html).html_safe
- end
Add Comment
Please, Sign In to add comment