added trim() utility and use it in link formatting parser