refactor the markdonw preview