Trim lines
Prebuild templates and output html for main text