From a7fab38988fa7726f3ced9747d79a2a95a81be37 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 1 Feb 2026 17:25:00 +1300 Subject: [PATCH 1/7] Add label splitting function --- src/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/index.js b/src/index.js index 95ce6b7..5c51075 100644 --- a/src/index.js +++ b/src/index.js @@ -158,6 +158,20 @@ const lookupVar = function(label, index) { index--; } + // Normal lookup has failed, attempt to resolve multiple labels into individuals + if(label?.trim().indexOf(' ') > 0){ + const labels = label.split(' '); + const outputStrings = labels.map((string)=>{ + console.log(string); + return lookupVar(string, index)?.content || string; + }); + console.log(outputStrings); + return { + content : outputStrings.join(' '), + resolved : true + }; + } + return undefined; }; From cc8e8bdb5c9bf8a6299319e6c13300e4220aa6e8 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 1 Feb 2026 17:25:09 +1300 Subject: [PATCH 2/7] Add build objects --- lib/index.cjs | 14 ++++++++++++++ lib/index.umd.js | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/lib/index.cjs b/lib/index.cjs index 1fe9ba5..33423f6 100644 --- a/lib/index.cjs +++ b/lib/index.cjs @@ -160,6 +160,20 @@ const lookupVar = function(label, index) { index--; } + // Normal lookup has failed, attempt to resolve multiple labels into individuals + if(label?.trim().indexOf(' ') > 0){ + const labels = label.split(' '); + const outputStrings = labels.map((string)=>{ + console.log(string); + return lookupVar(string, index)?.content || string; + }); + console.log(outputStrings); + return { + content : outputStrings.join(' '), + resolved : true + }; + } + return undefined; }; diff --git a/lib/index.umd.js b/lib/index.umd.js index c7fa33c..f0f5bf3 100644 --- a/lib/index.umd.js +++ b/lib/index.umd.js @@ -160,6 +160,20 @@ index--; } + // Normal lookup has failed, attempt to resolve multiple labels into individuals + if(label?.trim().indexOf(' ') > 0){ + const labels = label.split(' '); + const outputStrings = labels.map((string)=>{ + console.log(string); + return lookupVar(string, index)?.content || string; + }); + console.log(outputStrings); + return { + content : outputStrings.join(' '), + resolved : true + }; + } + return undefined; }; From 92c6d97c73e0d001ea8023f92e5a87738d3ba8f3 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 1 Feb 2026 17:31:23 +1300 Subject: [PATCH 3/7] Remove unnecessary console logging --- src/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/index.js b/src/index.js index 5c51075..80abe08 100644 --- a/src/index.js +++ b/src/index.js @@ -162,7 +162,6 @@ const lookupVar = function(label, index) { if(label?.trim().indexOf(' ') > 0){ const labels = label.split(' '); const outputStrings = labels.map((string)=>{ - console.log(string); return lookupVar(string, index)?.content || string; }); console.log(outputStrings); From 3973ff34d8baa9544b896e24ffa81fafb2ef259a Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 1 Feb 2026 17:31:38 +1300 Subject: [PATCH 4/7] Update build objects --- lib/index.cjs | 1 - lib/index.umd.js | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/index.cjs b/lib/index.cjs index 33423f6..b681e11 100644 --- a/lib/index.cjs +++ b/lib/index.cjs @@ -164,7 +164,6 @@ const lookupVar = function(label, index) { if(label?.trim().indexOf(' ') > 0){ const labels = label.split(' '); const outputStrings = labels.map((string)=>{ - console.log(string); return lookupVar(string, index)?.content || string; }); console.log(outputStrings); diff --git a/lib/index.umd.js b/lib/index.umd.js index f0f5bf3..cec6f20 100644 --- a/lib/index.umd.js +++ b/lib/index.umd.js @@ -164,7 +164,6 @@ if(label?.trim().indexOf(' ') > 0){ const labels = label.split(' '); const outputStrings = labels.map((string)=>{ - console.log(string); return lookupVar(string, index)?.content || string; }); console.log(outputStrings); From d7605226be87bfbe7382fd27603bd35820f6c7ec Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 1 Feb 2026 17:33:23 +1300 Subject: [PATCH 5/7] Remove more unneeded logging --- src/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/index.js b/src/index.js index 80abe08..9deadb4 100644 --- a/src/index.js +++ b/src/index.js @@ -164,7 +164,6 @@ const lookupVar = function(label, index) { const outputStrings = labels.map((string)=>{ return lookupVar(string, index)?.content || string; }); - console.log(outputStrings); return { content : outputStrings.join(' '), resolved : true From a1a4db7c0d9e419c71a303d2f106fd40364cdbd4 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 1 Feb 2026 17:33:37 +1300 Subject: [PATCH 6/7] Update build objects --- lib/index.cjs | 1 - lib/index.umd.js | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/index.cjs b/lib/index.cjs index b681e11..2bb6180 100644 --- a/lib/index.cjs +++ b/lib/index.cjs @@ -166,7 +166,6 @@ const lookupVar = function(label, index) { const outputStrings = labels.map((string)=>{ return lookupVar(string, index)?.content || string; }); - console.log(outputStrings); return { content : outputStrings.join(' '), resolved : true diff --git a/lib/index.umd.js b/lib/index.umd.js index cec6f20..1b21ada 100644 --- a/lib/index.umd.js +++ b/lib/index.umd.js @@ -166,7 +166,6 @@ const outputStrings = labels.map((string)=>{ return lookupVar(string, index)?.content || string; }); - console.log(outputStrings); return { content : outputStrings.join(' '), resolved : true From a251471bbc4f0dcb915c4846c165812fb803c50b Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 1 Feb 2026 17:40:49 +1300 Subject: [PATCH 7/7] Add test --- spec/__snapshots__/index.test.js.snap | 2 ++ spec/index.test.js | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/spec/__snapshots__/index.test.js.snap b/spec/__snapshots__/index.test.js.snap index eb8da88..82cfa8f 100644 --- a/spec/__snapshots__/index.test.js.snap +++ b/spec/__snapshots__/index.test.js.snap @@ -102,6 +102,8 @@ exports[`Math function parameter handling allows two variables in two-parameter exports[`Math function parameter handling allows variables in single-parameter functions 1`] = `"

4

"`; +exports[`Multiple variable names at once output multiple variables at once 1`] = `"

first second ef

"`; + exports[`Normal Links and Images Applies curly injectors to images 1`] = `"

alt text{width:100px}

"`; exports[`Normal Links and Images Renders normal images 1`] = `"

alt text

"`; diff --git a/spec/index.test.js b/spec/index.test.js index 3265e14..b935c24 100644 --- a/spec/index.test.js +++ b/spec/index.test.js @@ -410,6 +410,14 @@ describe('Variable names that are subsets of other names', ()=>{ }); }); +describe('Multiple variable names at once', ()=>{ + it('output multiple variables at once', function() { + const source = '[ab]: first\n\n[cd]: second\n\n$[ab cd ef]'; + const rendered = Markdown(source).trimReturns(); + expect(rendered).toMatchSnapshot(); + }); +}); + describe('Regression Tests', ()=>{ it('Don\'t Eat all the parentheticals!', function() { const source = '\n| title 1 | title 2 | title 3 | title 4|\n|-----------|---------|---------|--------|\n|[foo](bar) | Ipsum | ) | ) |\n';