Adds a console at the end of the page if none was defined. Refactor out gist and console code into separate files.