class SlackHtmlToMarkdown::Parser
Public Class Methods
parse_link(html)
click to toggle source
# File lib/slackHtmlToMarkdown.rb, line 17 def self.parse_link(html) html.gsub!(/<a href="(?'link'[^"]*)">(?<text>[^<]*)<\/a>/) do "<#{$~[:link]}|#{$~[:text]}>" end html end
to_markdown(html)
click to toggle source
# File lib/slackHtmlToMarkdown.rb, line 7 def self.to_markdown(html) html.gsub!('<strong>', '*') html.gsub!('</strong>', '*') html.gsub!('<em>', '_') html.gsub!('</em>', '_') html.gsub!('<stike>', '~') html.gsub!('</strike>', '~') parse_link(html) end