Fix issue with images.
This commit is contained in:
parent
05d9c9312e
commit
faf7e8837a
|
@ -51,7 +51,7 @@ export const replacement = (match, p1, p2, p3) => {
|
|||
const isImage = p1.trim() === '!';
|
||||
|
||||
if (isImage) {
|
||||
return ``;
|
||||
return `<img src="${linkHref}" alt="${linkText}" />`;
|
||||
}
|
||||
|
||||
if (linkHref === '' || linkText === '') {
|
||||
|
|
|
@ -43,14 +43,16 @@ describe('rookeries-links should', () => {
|
|||
expect(testMarkdown.replace(markdownPattern, replacement)).to.eq(expectedOutput);
|
||||
});
|
||||
|
||||
it('when encountering an image it should leave it alone', () => {
|
||||
it('when encountering an image it should become an image.', () => {
|
||||
const testMarkdown = "";
|
||||
const expectedOutput = "";
|
||||
const expectedOutput = "<img src=\"/image-url\" alt=\"image-alt-text\" />";
|
||||
let pattern = new RegExp(markdownPattern);
|
||||
|
||||
expect(pattern.test(testMarkdown)).to.eq(true);
|
||||
expect(testMarkdown.replace(markdownPattern, replacement)).to.eq(expectedOutput);
|
||||
});
|
||||
|
||||
// TODO: Fix issue of having two links close together with a test.
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue