diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 76938c7e0..ffd2395fa 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -681,7 +681,7 @@ function MarkedVariables() { } if(match[8]) { // Inline Definition const label = match[10] ? match[10].trim().replace(/\s+/g, ' ') : null; // Trim edge spaces and shorten blocks of whitespace to 1 space - let content = match[11] ? match[11] : null; // Trim edge spaces and shorten blocks of whitespace to 1 space + let content = match[11] || null; // In case of nested (), find the correct matching end ) let level = 0; diff --git a/tests/markdown/variables.test.js b/tests/markdown/variables.test.js index be16e8a22..9a02d15eb 100644 --- a/tests/markdown/variables.test.js +++ b/tests/markdown/variables.test.js @@ -402,4 +402,10 @@ describe('Variable names that are subsets of other names', ()=>{ const rendered = Markdown.render(source).trimReturns(); expect(rendered).toBe('
14
'); }); +}); + +describe('Don\'t Eat all the parentheticals!', ()=>{ + const source='\n| title 1 | title 2 | title 3 | title 4|\n|-----------|---------|---------|--------|\n|[foo](bar) | Ipsum | ) | ) |\n'; + const rendered = Markdown.render(source).trimReturns(); + expect(rendered).toBe('| title 1 | title 2 | title 3 | title 4 |
|---|---|---|---|
| foo | Ipsum | ) | ) |