diff --git a/package-lock.json b/package-lock.json index a35f04806..41ac55fe6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,7 +28,7 @@ "express": "^4.21.2", "express-async-handler": "^1.2.0", "express-static-gzip": "2.2.0", - "fs-extra": "11.2.0", + "fs-extra": "11.3.0", "idb-keyval": "^6.2.1", "js-yaml": "^4.1.0", "jwt-simple": "^0.5.6", @@ -47,7 +47,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "react-frame-component": "^5.2.7", - "react-router": "^7.1.1", + "react-router": "^7.1.2", "sanitize-filename": "1.6.3", "superagent": "^10.1.1", "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" @@ -6507,10 +6507,9 @@ } }, "node_modules/fs-extra": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", - "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", - "license": "MIT", + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz", + "integrity": "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew==", "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", @@ -11654,9 +11653,9 @@ "license": "MIT" }, "node_modules/react-router": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.1.1.tgz", - "integrity": "sha512-39sXJkftkKWRZ2oJtHhCxmoCrBCULr/HAH4IT5DHlgu/Q0FCPV0S4Lx+abjDTx/74xoZzNYDYbOZWlJjruyuDQ==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.1.2.tgz", + "integrity": "sha512-KeallSO30KLpIe/ZZqfk6pCJ1c+5JhMxl3SCS3Zx1LgaGuQbgLDmjuNi6KZ5LnAV9sWjbmBWGRw8Um/Pw6BExg==", "dependencies": { "@types/cookie": "^0.6.0", "cookie": "^1.0.1", diff --git a/package.json b/package.json index 2fabbd386..d70b05c61 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "express": "^4.21.2", "express-async-handler": "^1.2.0", "express-static-gzip": "2.2.0", - "fs-extra": "11.2.0", + "fs-extra": "11.3.0", "idb-keyval": "^6.2.1", "js-yaml": "^4.1.0", "jwt-simple": "^0.5.6", @@ -122,7 +122,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "react-frame-component": "^5.2.7", - "react-router": "^7.1.1", + "react-router": "^7.1.2", "sanitize-filename": "1.6.3", "superagent": "^10.1.1", "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 1a5ca465f..16dc14440 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -1,3 +1,4 @@ +/* eslint-disable max-depth */ /* eslint-disable max-lines */ import _ from 'lodash'; import { Parser as MathParser } from 'expr-eval'; @@ -717,7 +718,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].trim().replace(/\s+/g, ' ') : 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; @@ -733,10 +734,8 @@ function MarkedVariables() { break; } } - if(i > -1) { - combinedRegex.lastIndex = combinedRegex.lastIndex - (content.length - i); - content = content.slice(0, i).trim().replace(/\s+/g, ' '); - } + combinedRegex.lastIndex = combinedRegex.lastIndex - (content.length - i); + content = content.slice(0, i).trim().replace(/\s+/g, ' '); varsQueue.push( { type : 'varDefBlock', diff --git a/tests/markdown/variables.test.js b/tests/markdown/variables.test.js index be16e8a22..41259da7e 100644 --- a/tests/markdown/variables.test.js +++ b/tests/markdown/variables.test.js @@ -402,4 +402,12 @@ describe('Variable names that are subsets of other names', ()=>{ const rendered = Markdown.render(source).trimReturns(); expect(rendered).toBe('
14
'); }); +}); + +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'; + const rendered = Markdown.render(source).trimReturns(); + expect(rendered).toBe('| title 1 | title 2 | title 3 | title 4 |
|---|---|---|---|
| foo | Ipsum | ) | ) |