mirror of
https://gitlab.com/Oreolek/salet.git
synced 2024-07-04 07:45:03 +03:00
Markdown indentation fix
It was bugging on some weird cases.
This commit is contained in:
parent
46a4d65b35
commit
74a7600181
|
@ -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')
|
||||
|
|
Loading…
Reference in a new issue