Skip to content

Commit

Permalink
Removes also leading tab from backtick codeblock
Browse files Browse the repository at this point in the history
  • Loading branch information
fhemberger committed Oct 16, 2011
1 parent d98a4de commit 1772a8a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugins/backtick_code_block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def render_code_block(input)
@lang = nil
@url = nil
@title = nil
input.gsub /^`{3} *([^\n]+)?\n(.+?)\n`{3}/m do
input.gsub(/^`{3} *([^\n]+)?\n(.+?)\n`{3}/m) do
@options = $1 || ''
str = $2

Expand All @@ -22,8 +22,8 @@ def render_code_block(input)
@caption = "<figcaption><span>#{$2}</span></figcaption>"
end

if str.match(/\A {4}/)
str = str.gsub /^ {4}/, ''
if str.match(/\A( {4}|\t)/)
str = str.gsub(/^( {4}|\t)/, '')
end
if @lang.nil? || @lang == 'plain'
code = tableize_code(str.gsub('<','&lt;').gsub('>','&gt;'))
Expand Down

0 comments on commit 1772a8a

Please sign in to comment.