Merge pull request #61 from shurcooL/feature/dont-expand-tabs-inside-fenced-code-blocks Don't expand tabs inside fenced code blocks.
Vytautas Ĺ altenis vytas@rtfb.lt
Sun, 13 Apr 2014 10:56:02 +0300
2 files changed,
7 insertions(+),
3 deletions(-)
M
block_test.go
→
block_test.go
@@ -638,7 +638,7 @@
func TestFencedCodeBlock(t *testing.T) { var tests = []string{ "``` go\nfunc foo() bool {\n\treturn true;\n}\n```\n", - "<pre><code class=\"go\">func foo() bool {\n return true;\n}\n</code></pre>\n", + "<pre><code class=\"go\">func foo() bool {\n\treturn true;\n}\n</code></pre>\n", "``` c\n/* special & char < > \" escaping */\n```\n", "<pre><code class=\"c\">/* special & char < > " escaping */\n</code></pre>\n",@@ -978,7 +978,7 @@
func TestFencedCodeBlock_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) { var tests = []string{ "``` go\nfunc foo() bool {\n\treturn true;\n}\n```\n", - "<pre><code class=\"go\">func foo() bool {\n return true;\n}\n</code></pre>\n", + "<pre><code class=\"go\">func foo() bool {\n\treturn true;\n}\n</code></pre>\n", "``` c\n/* special & char < > \" escaping */\n```\n", "<pre><code class=\"c\">/* special & char < > " escaping */\n</code></pre>\n",
M
markdown.go
→
markdown.go
@@ -343,7 +343,11 @@ }
// add the line body if present if end > beg { - expandTabs(&out, input[beg:end], tabSize) + if end < lastFencedCodeBlockEnd { // Do not expand tabs while inside fenced code blocks. + out.Write(input[beg:end]) + } else { + expandTabs(&out, input[beg:end], tabSize) + } } out.WriteByte('\n')