Attach markdown events only when needed