diff --git a/src/InlineLexer.js b/src/InlineLexer.js
index d0c9d4129b..86f62b01fa 100644
--- a/src/InlineLexer.js
+++ b/src/InlineLexer.js
@@ -82,11 +82,11 @@ module.exports = class InlineLexer {
}
src = src.substring(cap[0].length);
- out += this.options.sanitize
- ? this.options.sanitizer
+ out += this.renderer.html(this.options.sanitize
+ ? (this.options.sanitizer
? this.options.sanitizer(cap[0])
- : escape(cap[0])
- : cap[0];
+ : escape(cap[0]))
+ : cap[0]);
continue;
}
diff --git a/test/unit/marked-spec.js b/test/unit/marked-spec.js
index 7e84949492..b0c730c68c 100644
--- a/test/unit/marked-spec.js
+++ b/test/unit/marked-spec.js
@@ -80,3 +80,14 @@ describe('changeDefaults', () => {
expect(require('../../src/defaults').defaults.test).toBe(true);
});
});
+
+describe('inlineLexer', () => {
+ it('should send html to renderer.html', () => {
+ const renderer = new marked.Renderer();
+ spyOn(renderer, 'html').and.callThrough();
+ const md = 'HTML Image: ';
+ marked(md, { renderer });
+
+ expect(renderer.html).toHaveBeenCalledWith('');
+ });
+});