generate_output function

Generate output and apply filters, titles, and footnotes