add optional window object to html-md()