From 1b70c4ace34f7db0ac3362cfb6a4fdfa657e49a8 Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Wed, 12 Feb 2020 00:14:02 -0600 Subject: [PATCH 1/2] send inline html to renderer --- src/InlineLexer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; } From 11656f8bd4ea7a40cd083748834625e639654bda Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Wed, 12 Feb 2020 00:24:43 -0600 Subject: [PATCH 2/2] add inline html test --- test/unit/marked-spec.js | 11 +++++++++++ 1 file changed, 11 insertions(+) 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: MY IMAGE'; + marked(md, { renderer }); + + expect(renderer.html).toHaveBeenCalledWith('MY IMAGE'); + }); +});