diff --git a/lib/markdown.coffee b/lib/markdown.coffee index 6af7759..a332eeb 100644 --- a/lib/markdown.coffee +++ b/lib/markdown.coffee @@ -4,7 +4,7 @@ Implies that you don't mix up your tabs and spaces. Copyright 2015 Bruno Dias ### normaliseTabs = (text) -> - unless text? and typeof(text) == "string" + if not text? or typeof(text) != "string" or text == "" return "" lines = text.split('\n'); indents = lines @@ -20,6 +20,8 @@ normaliseTabs = (text) -> return curr return max ) + if smallestIndent == "" + return text return lines.map((l) -> return l.replace(new RegExp('^' + smallestIndent), '') ).join('\n')