Implements and refactors clipboard feature for markdown.