From a7f8b529660ac638c0c15faf990545411d5268d0 Mon Sep 17 00:00:00 2001 From: David Bolack Date: Tue, 30 Jul 2024 08:56:06 -0500 Subject: [PATCH] Change default value for pageNumber on markdopwn.render() --- shared/naturalcrit/markdown.js | 2 +- tests/markdown/mustache-syntax.test.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 66d631c85..c1a1df40d 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -817,7 +817,7 @@ let globalPageNumber = 0; module.exports = { marked : Marked, - render : (rawBrewText, pageNumber=1)=>{ + render : (rawBrewText, pageNumber=0)=>{ globalVarsList[pageNumber] = {}; //Reset global links for current page, to ensure values are parsed in order varsQueue = []; //Could move into MarkedVariables() globalPageNumber = pageNumber; diff --git a/tests/markdown/mustache-syntax.test.js b/tests/markdown/mustache-syntax.test.js index 73d715232..3f7f2529b 100644 --- a/tests/markdown/mustache-syntax.test.js +++ b/tests/markdown/mustache-syntax.test.js @@ -336,7 +336,7 @@ describe('Injection: When an injection tag follows an element', ()=>{ it('Renders an parent and child element, each modified by an injector', function() { const source = dedent`**bolded text**{color:red} {color:blue}`; - const rendered = Markdown.render(source, 1).trimReturns(); + const rendered = Markdown.render(source).trimReturns(); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('

bolded text

'); }); @@ -348,13 +348,13 @@ describe('Injection: When an injection tag follows an element', ()=>{ it('Renders an image with "=" in the url, and added attributes', function() { const source = `![homebrew mug](https://i.imgur.com/hMna6G0.png?auth=12345&height=1024) {position:absolute,bottom:20px,left:130px,width:220px,a="b and c",d=e}`; - const rendered = Markdown.render(source, 1).trimReturns(); + const rendered = Markdown.render(source).trimReturns(); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

homebrew mug

`); }); it('Renders an image and added attributes with "=" in the value, ', function() { const source = `![homebrew mug](https://i.imgur.com/hMna6G0.png) {position:absolute,bottom:20px,left:130px,width:220px,a="b and c",d=e,otherUrl="url?auth=12345"}`; - const rendered = Markdown.render(source, 1).trimReturns(); + const rendered = Markdown.render(source).trimReturns(); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`

homebrew mug

`); }); });