Respect pygments config option in Redcarpet renderer. #1053

Merged
merged 4 commits into from May 7, 2013

Projects

None yet

4 participants

@parkr
Member
parkr commented May 7, 2013

An alternative to #1038.

@parkr
Member
parkr commented May 7, 2013

@mattr- All tests are now passing on my machine. What do you think of this? The @config isn't available to the subclass of Redcarpet::Render::HTML so this is what I did instead.

@mattr-
Member
mattr- commented May 7, 2013

👍 :shipit:

@parkr
Member
parkr commented May 7, 2013

😓 phew, the travis failure is just that weird cucumber stack trace thing. i'll run it again locally just to make sure it works, then i'll merge.

@parkr
Member
parkr commented May 7, 2013

Passed. Merging and I'll throw up 1.0.1.

@parkr parkr merged commit cb0054b into master May 7, 2013

1 check passed

default The Travis CI build passed
Details
@parkr parkr deleted the redcarpet-respect-pygments branch May 7, 2013
@djui
Contributor
djui commented May 8, 2013

@parkr Nice work. Thanks!

@maul-esel maul-esel commented on the diff May 8, 2013
lib/jekyll/converters/markdown/redcarpet_parser.rb
- def add_code_tags(code, lang)
- code = code.sub(/<pre>/, "<pre><code class=\"#{lang} language-#{lang}\">")
- code = code.sub(/<\/pre>/,"</code></pre>")
- end
- end
- rescue LoadError
+ @renderer ||= if @config['pygments']
+ Class.new(Redcarpet::Render::HTML) do
+ include WithPygments
+ end
+ else
+ Class.new(Redcarpet::Render::HTML) do
+ include WithoutPygments
+ end
+ end
+ rescue LoadErro
@maul-esel
maul-esel May 8, 2013 Contributor

typo?

@parkr
parkr May 8, 2013 Member

yep, good catch :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment