Permalink
Browse files

Removes also leading tab from backtick codeblock

  • Loading branch information...
1 parent d98a4de commit 1772a8af8f22f2f89d263285be2815ebad6189fa @fhemberger fhemberger committed Oct 16, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 plugins/backtick_code_block.rb
@@ -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
@@ -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;'))

0 comments on commit 1772a8a

Please sign in to comment.