From 193cde092599480d84648090c4769b6a152a8c2c Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 3 May 2024 14:31:34 -0400 Subject: [PATCH] Passes all tests --- shared/naturalcrit/markdown.js | 5 ++++- tests/markdown/mustache-syntax.test.js | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 33bae12d6..497cc895d 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -218,13 +218,16 @@ const mustacheInjectInline = { lastToken.type = 'mustacheInjectInline'; lastToken.injectedTags = tags; return { - type : 'text', // Should match "name" above + type : 'mustacheInjectInline', // Should match "name" above raw : match[0], // Text to consume from the source text : '' }; } }, renderer(token) { + if(!token.originalType){ + return; + } token.type = token.originalType; const text = this.parser.parseInline([token]); const originalTags = extractHTMLStyleTags(text); diff --git a/tests/markdown/mustache-syntax.test.js b/tests/markdown/mustache-syntax.test.js index f42cbbac8..c210167b6 100644 --- a/tests/markdown/mustache-syntax.test.js +++ b/tests/markdown/mustache-syntax.test.js @@ -297,10 +297,10 @@ describe('Injection: When an injection tag follows an element', ()=>{ expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('

alt text

'); }); - it.failing('Renders an element modified by only the first of two consecutive injections', function() { + it('Renders an element modified by only the first of two consecutive injections', function() { const source = '{{ text}}{color:red}{background:blue}'; const rendered = Markdown.render(source).trimReturns(); - expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('text{background:blue}'); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('

text{background:blue}

'); }); it('Renders an image with added attributes', function() {