refactor
better link matching, image caption support