add markdown filter which downloads images. Refactor some js