diff options
author | Connor Shea <connor.james.shea@gmail.com> | 2016-10-28 01:51:15 +0300 |
---|---|---|
committer | Connor Shea <connor.james.shea@gmail.com> | 2016-10-28 01:51:15 +0300 |
commit | c6bcba9ce93e75326bde811b622db53aa36508ef (patch) | |
tree | 67fc94efe399056e6636c83a42e5fbb09fbeb1fc | |
parent | 842318016d6d80d7f2ec600db24410bcdda47603 (diff) |
Use Redcarpet instead of Kramdown, get Rouge syntax highlighting working for it.
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | Gemfile.lock | 4 | ||||
-rw-r--r-- | Rules | 16 | ||||
-rw-r--r-- | content/assets/stylesheets/highlight.scss | 19 | ||||
-rw-r--r-- | lib/helpers_.rb | 8 |
5 files changed, 32 insertions, 17 deletions
@@ -4,7 +4,7 @@ ruby '2.3.1' gem 'nanoc', '~> 4.0' gem 'adsf' gem 'sass' -gem 'kramdown' +gem 'redcarpet' gem 'rouge', '~> 1.11' gem 'rake', '~> 11.3' diff --git a/Gemfile.lock b/Gemfile.lock index e010ab25..b2a7f8a3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -27,7 +27,6 @@ GEM nanoc (~> 4.0) hamster (3.0.0) concurrent-ruby (~> 1.0) - kramdown (1.12.0) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) @@ -56,6 +55,7 @@ GEM rb-fsevent (0.9.8) rb-inotify (0.9.7) ffi (>= 0.5.0) + redcarpet (3.3.4) ref (2.0.0) rouge (1.11.1) ruby_dep (1.5.0) @@ -71,10 +71,10 @@ DEPENDENCIES adsf builder guard-nanoc - kramdown nanoc (~> 4.0) nokogiri (~> 1.6.8) rake (~> 11.3) + redcarpet rouge (~> 1.11) sass @@ -21,10 +21,18 @@ compile '/**/*.html' do end compile '/**/*.md' do - filter :kramdown, - input: 'GFM', - syntax_highlighter: 'rouge', - hard_wrap: false + filter :redcarpet, + renderer: HTML, + options: { + fenced_code_blocks: true, + footnotes: true, + lax_spacing: true, + no_intra_emphasis: true, + space_after_headers: true, + strikethrough: true, + superscript: true, + tables: true + } layout '/default.*' diff --git a/content/assets/stylesheets/highlight.scss b/content/assets/stylesheets/highlight.scss index e2a58712..b2ec4d60 100644 --- a/content/assets/stylesheets/highlight.scss +++ b/content/assets/stylesheets/highlight.scss @@ -1,17 +1,16 @@ /* https://github.com/aahan/pygments-github-style */ -.highlighter-rouge { - pre { - padding: 10px 15px; - border-radius: 5px; - border: 1px solid #e5e5e5; - overflow-x: auto; - margin: 20px 0; - } +pre.highlight { + padding: 10px 15px; + border-radius: 5px; + border: 1px solid #e5e5e5; + overflow-x: auto; + margin: 20px 0; // Code itself - pre.code { - border-color: #f0f0f0; + code { + border-color: transparent; + color: inherit; background-color: transparent; } diff --git a/lib/helpers_.rb b/lib/helpers_.rb index 8b95e3ef..270ec69a 100644 --- a/lib/helpers_.rb +++ b/lib/helpers_.rb @@ -1,3 +1,11 @@ include Nanoc::Helpers::LinkTo include Nanoc::Helpers::XMLSitemap include Nanoc::Helpers::ChildParentBetter + +require 'redcarpet' +require 'rouge' +require 'rouge/plugins/redcarpet' + +class HTML < Redcarpet::Render::HTML + include Rouge::Plugins::Redcarpet +end |