Skip to content

Commit

Permalink
fix: fixed rendering of color in coverpage issue
Browse files Browse the repository at this point in the history
  • Loading branch information
anikethsaha committed Mar 9, 2020
1 parent 1811842 commit 406670c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/core/render/compiler/image.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getAndRemoveConfig } from '../compiler';
import { getAndRemoveConfig } from '../utils';
import { isAbsolutePath, getPath, getParentPath } from '../../router/util';

export const imageCompiler = ({ renderer, contentBase, router }) =>
Expand Down Expand Up @@ -38,7 +38,11 @@ export const imageCompiler = ({ renderer, contentBase, router }) =>
url = getPath(contentBase, getParentPath(router.getCurrentPath()), href);
}

return `<img src="${url}" data-origin="${href}" alt="${text}" ${attrs.join(
' '
)} />`;
if (attrs.length > 0) {
return `<img src="${url}" data-origin="${href}" alt="${text}" ${attrs.join(
' '
)} />`;
}

return `<img src="${url}" data-origin="${href}" alt="${text}"${attrs}>`;
});

0 comments on commit 406670c

Please sign in to comment.