Fixed an issue with multiple links and images on the same line and added test cases for it