Merge pull request #4090 from paulrobertlloyd/3371-kramdown-highlight
Merge pull request 4090
This commit is contained in:
		
						commit
						05a982e5bc
					
				| 
						 | 
					@ -9,7 +9,7 @@ Feature: Collections
 | 
				
			||||||
    And I have a configuration file with "collections" set to "['methods']"
 | 
					    And I have a configuration file with "collections" set to "['methods']"
 | 
				
			||||||
    When I run jekyll build
 | 
					    When I run jekyll build
 | 
				
			||||||
    Then the _site directory should exist
 | 
					    Then the _site directory should exist
 | 
				
			||||||
    And I should see "Collections: <p>Use <code>Jekyll.configuration</code> to build a full configuration for use w/Jekyll.</p>\n\n<p>Whatever: foo.bar</p>\n<p>Signs are nice</p>\n<p><code>Jekyll.sanitized_path</code> is used to make sure your path is in your source.</p>\n<p>Run your generators! default</p>\n<p>Page without title.</p>\n<p>Run your generators! default</p>" in "_site/index.html"
 | 
					    And I should see "Collections: <p>Use <code class=\"highlighter-rouge\">Jekyll.configuration</code> to build a full configuration for use w/Jekyll.</p>\n\n<p>Whatever: foo.bar</p>\n<p>Signs are nice</p>\n<p><code class=\"highlighter-rouge\">Jekyll.sanitized_path</code> is used to make sure your path is in your source.</p>\n<p>Run your generators! default</p>\n<p>Page without title.</p>\n<p>Run your generators! default</p>" in "_site/index.html"
 | 
				
			||||||
    And the "_site/methods/configuration.html" file should not exist
 | 
					    And the "_site/methods/configuration.html" file should not exist
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Scenario: Rendered collection
 | 
					  Scenario: Rendered collection
 | 
				
			||||||
| 
						 | 
					@ -108,7 +108,7 @@ Feature: Collections
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    When I run jekyll build
 | 
					    When I run jekyll build
 | 
				
			||||||
    Then the _site directory should exist
 | 
					    Then the _site directory should exist
 | 
				
			||||||
    And I should see "First document's output: <p>Use <code>Jekyll.configuration</code> to build a full configuration for use w/Jekyll.</p>\n\n<p>Whatever: foo.bar</p>" in "_site/index.html"
 | 
					    And I should see "First document's output: <p>Use <code class=\"highlighter-rouge\">Jekyll.configuration</code> to build a full configuration for use w/Jekyll.</p>\n\n<p>Whatever: foo.bar</p>" in "_site/index.html"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Scenario: Filter documents by where
 | 
					  Scenario: Filter documents by where
 | 
				
			||||||
    Given I have an "index.html" page that contains "{% assign items = site.methods | where: 'whatever','foo.bar' %}Item count: {{ items.size }}"
 | 
					    Given I have an "index.html" page that contains "{% assign items = site.methods | where: 'whatever','foo.bar' %}Item count: {{ items.size }}"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,6 +5,11 @@ module Jekyll
 | 
				
			||||||
        def initialize(config)
 | 
					        def initialize(config)
 | 
				
			||||||
          require 'kramdown'
 | 
					          require 'kramdown'
 | 
				
			||||||
          @config = config
 | 
					          @config = config
 | 
				
			||||||
 | 
					          # If kramdown supported highlighter enabled, use that
 | 
				
			||||||
 | 
					          highlighter = @config['highlighter']
 | 
				
			||||||
 | 
					          if highlighter == 'rouge' || highlighter == 'coderay'
 | 
				
			||||||
 | 
					            @config['kramdown']['syntax_highlighter'] ||= highlighter
 | 
				
			||||||
 | 
					          end
 | 
				
			||||||
        rescue LoadError
 | 
					        rescue LoadError
 | 
				
			||||||
          STDERR.puts 'You are missing a library required for Markdown. Please run:'
 | 
					          STDERR.puts 'You are missing a library required for Markdown. Please run:'
 | 
				
			||||||
          STDERR.puts '  $ [sudo] gem install kramdown'
 | 
					          STDERR.puts '  $ [sudo] gem install kramdown'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,6 +39,16 @@ class TestKramdown < JekyllUnitTest
 | 
				
			||||||
      assert_match /<p>(«|«)Pit(›|›)hy(»|»)<\/p>/, markdown.convert(%{"Pit'hy"}).strip
 | 
					      assert_match /<p>(«|«)Pit(›|›)hy(»|»)<\/p>/, markdown.convert(%{"Pit'hy"}).strip
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    should "render fenced code blocks with syntax highlighting" do
 | 
				
			||||||
 | 
					      assert_equal "<div class=\"highlighter-rouge\"><pre class=\"highlight\"><code><span class=\"nb\">puts</span> <span class=\"s2\">\"Hello world\"</span>\n</code></pre>\n</div>", @markdown.convert(
 | 
				
			||||||
 | 
					        <<-EOS
 | 
				
			||||||
 | 
					~~~ruby
 | 
				
			||||||
 | 
					puts "Hello world"
 | 
				
			||||||
 | 
					~~~
 | 
				
			||||||
 | 
					        EOS
 | 
				
			||||||
 | 
					      ).strip
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    context "moving up nested coderay options" do
 | 
					    context "moving up nested coderay options" do
 | 
				
			||||||
      setup do
 | 
					      setup do
 | 
				
			||||||
        @markdown.convert('some markup')
 | 
					        @markdown.convert('some markup')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue