Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: prepend root to image path #111

Merged
merged 9 commits into from
Sep 23, 2019
Prev Previous commit
Next Next commit
test: reset config after each test
curbengh committed Sep 9, 2019

Verified

This commit was signed with the committer’s verified signature.
commit 475ef9e3877892429d300ded2bae3b41ecfc4d0a
12 changes: 12 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -211,6 +211,16 @@ describe('Marked renderer', () => {
};

it('should not modify image path with default option', () => {
const r = renderer.bind(ctx);
const result = r({text: body});

result.should.eql([
'<p><img src="/bar/baz.jpg" alt="">',
'<img src="/aaa/bbb.jpg" alt="foo"></p>\n'
].join('\n'));
});

it('should not modify image path when enable relative_link', () => {
ctx.config.relative_link = true;
const r = renderer.bind(ctx);
const result = r({text: body});
@@ -219,6 +229,7 @@ describe('Marked renderer', () => {
'<p><img src="/bar/baz.jpg" alt="">',
'<img src="/aaa/bbb.jpg" alt="foo"></p>\n'
].join('\n'));

ctx.config.relative_link = false;
});

@@ -231,6 +242,7 @@ describe('Marked renderer', () => {
'<p><img src="/blog/bar/baz.jpg" alt="">',
'<img src="/blog/aaa/bbb.jpg" alt="foo"></p>\n'
].join('\n'));
ctx.config.marked.prependRoot = false;
});
});
});