Some javascript refactoring: Move markdown functions into their own classs, remove extraneous `window.` calls.