Commit fcc18cba by tady

Github Flavor Markdownに変更 #10

parent 5363a52e
......@@ -52,8 +52,7 @@ gem 'devise'
gem 'omniauth-google-oauth2'
# Markdown
gem 'redcarpet', :git => 'git://github.com/vmg/redcarpet.git',
:branch => "master"
gem 'github-markdown'
# Syntax Highlight
gem 'coderay'
......
......@@ -7,13 +7,6 @@ GIT
activesupport
gmail_xoauth
GIT
remote: git://github.com/vmg/redcarpet.git
revision: e627bee83b80fd440fc7edb609def9cb4393e332
branch: master
specs:
redcarpet (3.1.1)
GEM
remote: https://rubygems.org/
specs:
......@@ -122,6 +115,7 @@ GEM
multipart-post (>= 1.2, < 3)
ffi (1.9.3)
formatador (0.2.4)
github-markdown (0.6.4)
gmail_xoauth (0.4.1)
oauth (>= 0.3.6)
guard (2.4.0)
......@@ -360,6 +354,7 @@ DEPENDENCIES
devise
factory_girl_rails
faraday
github-markdown
guard-rspec
guard-rubocop
i18n_generators
......@@ -375,7 +370,6 @@ DEPENDENCIES
pry-rails
rack-mini-profiler
rails (~> 4.0)
redcarpet!
rspec-rails
rubocop
sass-rails
......
module ApplicationHelper
class HtmlWithPrettyPrint < Redcarpet::Render::HTML
def postprocess(full_document)
full_document.gsub('prettyprint', 'prettyprint linenums')
end
end
def h_application_format_markdown(text)
# html_render = HTMLwithCoderay.new(filter_html: true, hard_wrap: true, prettify: true)
html_render = HtmlWithPrettyPrint.new(prettify: true)
options = {
autolink: true,
space_after_headers: true,
fenced_code_blocks: true,
tables: true
}
markdown = Redcarpet::Markdown.new(html_render, options)
markdown.render(text).html_safe
text = GitHub::Markdown.render_gfm(text)
text.html_safe
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment