1
0
Fork 0
mirror of https://gitlab.com/Oreolek/salet.git synced 2024-07-02 06:45:06 +03:00

Markdown indentation fix

It was bugging on some weird cases.
This commit is contained in:
Alexander Yakovlev 2016-05-09 10:27:51 +07:00
parent 46a4d65b35
commit 74a7600181

View file

@ -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')