truncate function: if max_length is 0 show the whole text