Created
November 18, 2014 10:58
-
-
Save kripy/7adec39d2c11cbce96f4 to your computer and use it in GitHub Desktop.
All In Markdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# coding: utf-8 | |
require 'rubygems' | |
require 'redcarpet' | |
p_replace = '<p style="padding-top:10px;padding-left:30px;padding-right:30px;font-family:\'Helvetica Neue\',Helvetica,arial,sans-serif;font-size:15px;font-weight:normal;color:#000;line-height:20px;">' | |
i_replace = '<p><img class="image_fix"' | |
a_replace = '<a style="color:#ffff00;text-decoration:none;background-color:black" target="_blank" href' | |
renderer = Redcarpet::Render::HTML.new() | |
markdown = Redcarpet::Markdown.new(renderer, extensions = {}) | |
file = File.new("allin-2.md", "rb") | |
contents = file.read | |
output = markdown.render(contents) | |
output = output.gsub(/<p>/, p_replace) | |
output = output.gsub(/<p style="padding-top:10px;padding-left:30px;padding-right:30px;font-family:\'Helvetica Neue\',Helvetica,arial,sans-serif;font-size:15px;font-weight:normal;color:#000;line-height:20px;"><img/, i_replace) | |
output = output.gsub(/<a href/, a_replace) | |
puts output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment