Commit 1f8218d0 by tady

Merge pull request #17 from tadyjp/wip/140226_gfm

Github Flavor Markdownに変更 #10
parents 5363a52e fcc18cba
...@@ -52,8 +52,7 @@ gem 'devise' ...@@ -52,8 +52,7 @@ gem 'devise'
gem 'omniauth-google-oauth2' gem 'omniauth-google-oauth2'
# Markdown # Markdown
gem 'redcarpet', :git => 'git://github.com/vmg/redcarpet.git', gem 'github-markdown'
:branch => "master"
# Syntax Highlight # Syntax Highlight
gem 'coderay' gem 'coderay'
......
...@@ -7,13 +7,6 @@ GIT ...@@ -7,13 +7,6 @@ GIT
activesupport activesupport
gmail_xoauth gmail_xoauth
GIT
remote: git://github.com/vmg/redcarpet.git
revision: e627bee83b80fd440fc7edb609def9cb4393e332
branch: master
specs:
redcarpet (3.1.1)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
...@@ -122,6 +115,7 @@ GEM ...@@ -122,6 +115,7 @@ GEM
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
ffi (1.9.3) ffi (1.9.3)
formatador (0.2.4) formatador (0.2.4)
github-markdown (0.6.4)
gmail_xoauth (0.4.1) gmail_xoauth (0.4.1)
oauth (>= 0.3.6) oauth (>= 0.3.6)
guard (2.4.0) guard (2.4.0)
...@@ -360,6 +354,7 @@ DEPENDENCIES ...@@ -360,6 +354,7 @@ DEPENDENCIES
devise devise
factory_girl_rails factory_girl_rails
faraday faraday
github-markdown
guard-rspec guard-rspec
guard-rubocop guard-rubocop
i18n_generators i18n_generators
...@@ -375,7 +370,6 @@ DEPENDENCIES ...@@ -375,7 +370,6 @@ DEPENDENCIES
pry-rails pry-rails
rack-mini-profiler rack-mini-profiler
rails (~> 4.0) rails (~> 4.0)
redcarpet!
rspec-rails rspec-rails
rubocop rubocop
sass-rails sass-rails
......
module ApplicationHelper 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) def h_application_format_markdown(text)
# html_render = HTMLwithCoderay.new(filter_html: true, hard_wrap: true, prettify: true) text = GitHub::Markdown.render_gfm(text)
html_render = HtmlWithPrettyPrint.new(prettify: true) text.html_safe
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
end end
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