Merge pull request #2292 from mtcomscxstart/code-class-fix
This commit is contained in:
commit
9cd648a262
|
@ -6,7 +6,7 @@ module Jekyll
|
||||||
module CommonMethods
|
module CommonMethods
|
||||||
def add_code_tags(code, lang)
|
def add_code_tags(code, lang)
|
||||||
code = code.to_s
|
code = code.to_s
|
||||||
code = code.sub(/<pre>/, "<pre><code class=\"#{lang} language-#{lang}\" data-lang=\"#{lang}\">")
|
code = code.sub(/<pre>/, "<pre><code class=\"language-#{lang}\" data-lang=\"#{lang}\">")
|
||||||
code = code.sub(/<\/pre>/,"</code></pre>")
|
code = code.sub(/<\/pre>/,"</code></pre>")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,7 +32,7 @@ class TestRedcarpet < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should "render fenced code blocks with syntax highlighting" do
|
should "render fenced code blocks with syntax highlighting" do
|
||||||
assert_equal "<div class=\"highlight\"><pre><code class=\"ruby language-ruby\" data-lang=\"ruby\"><span class=\"nb\">puts</span> <span class=\"s2\">"Hello world"</span>\n</code></pre></div>", @markdown.convert(
|
assert_equal "<div class=\"highlight\"><pre><code class=\"language-ruby\" data-lang=\"ruby\"><span class=\"nb\">puts</span> <span class=\"s2\">"Hello world"</span>\n</code></pre></div>", @markdown.convert(
|
||||||
<<-EOS
|
<<-EOS
|
||||||
```ruby
|
```ruby
|
||||||
puts "Hello world"
|
puts "Hello world"
|
||||||
|
@ -48,7 +48,7 @@ puts "Hello world"
|
||||||
end
|
end
|
||||||
|
|
||||||
should "render fenced code blocks with syntax highlighting" do
|
should "render fenced code blocks with syntax highlighting" do
|
||||||
assert_equal "<div class=\"highlight\"><pre><code class=\"ruby language-ruby\" data-lang=\"ruby\"><span class=\"nb\">puts</span> <span class=\"s2\">\"Hello world\"</span>\n</code></pre></div>", @markdown.convert(
|
assert_equal "<div class=\"highlight\"><pre><code class=\"language-ruby\" data-lang=\"ruby\"><span class=\"nb\">puts</span> <span class=\"s2\">\"Hello world\"</span>\n</code></pre></div>", @markdown.convert(
|
||||||
<<-EOS
|
<<-EOS
|
||||||
```ruby
|
```ruby
|
||||||
puts "Hello world"
|
puts "Hello world"
|
||||||
|
@ -64,7 +64,7 @@ puts "Hello world"
|
||||||
end
|
end
|
||||||
|
|
||||||
should "render fenced code blocks without syntax highlighting" do
|
should "render fenced code blocks without syntax highlighting" do
|
||||||
assert_equal "<div class=\"highlight\"><pre><code class=\"ruby language-ruby\" data-lang=\"ruby\">puts "Hello world"\n</code></pre></div>", @markdown.convert(
|
assert_equal "<div class=\"highlight\"><pre><code class=\"language-ruby\" data-lang=\"ruby\">puts "Hello world"\n</code></pre></div>", @markdown.convert(
|
||||||
<<-EOS
|
<<-EOS
|
||||||
```ruby
|
```ruby
|
||||||
puts "Hello world"
|
puts "Hello world"
|
||||||
|
|
Loading…
Reference in New Issue