From aafc6fad7d80883a2b92936bf27db15461849afc Mon Sep 17 00:00:00 2001 From: David Bolack Date: Tue, 14 Jan 2025 21:40:15 -0600 Subject: [PATCH 1/5] Implement suggested fix for 3488 Per issue --- shared/naturalcrit/markdown.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 852243d81..76938c7e0 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'; @@ -680,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].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 // In case of nested (), find the correct matching end ) let level = 0; @@ -696,10 +697,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', From d4f6c329b8064350a654b90094c5c483c0299b7a Mon Sep 17 00:00:00 2001 From: David Bolack Date: Wed, 15 Jan 2025 17:36:18 -0600 Subject: [PATCH 2/5] Add a test! --- shared/naturalcrit/markdown.js | 2 +- tests/markdown/variables.test.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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 1title 2title 3title 4
fooIpsum))
'); }); \ No newline at end of file From 5dbb5499c6fe8f0f6c9971e13d4c07820c5e0e29 Mon Sep 17 00:00:00 2001 From: David Bolack Date: Fri, 17 Jan 2025 10:02:32 -0600 Subject: [PATCH 3/5] fix test --- tests/markdown/variables.test.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/markdown/variables.test.js b/tests/markdown/variables.test.js index 9a02d15eb..41259da7e 100644 --- a/tests/markdown/variables.test.js +++ b/tests/markdown/variables.test.js @@ -404,8 +404,10 @@ describe('Variable names that are subsets of other names', ()=>{ }); }); -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 1title 2title 3title 4
fooIpsum))
'); +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 1title 2title 3title 4
fooIpsum))
'); + }); }); \ No newline at end of file From 7c1545a07db9045de9f205c7733fbf6dc8fd0658 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 17 Jan 2025 16:52:32 +0000 Subject: [PATCH 4/5] Bump fs-extra from 11.2.0 to 11.3.0 Bumps [fs-extra](https://github.com/jprichardson/node-fs-extra) from 11.2.0 to 11.3.0. - [Changelog](https://github.com/jprichardson/node-fs-extra/blob/master/CHANGELOG.md) - [Commits](https://github.com/jprichardson/node-fs-extra/compare/11.2.0...11.3.0) --- updated-dependencies: - dependency-name: fs-extra dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 9 ++++----- package.json | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index a35f04806..8fe35a233 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", @@ -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", diff --git a/package.json b/package.json index 37720f49e..57448640c 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,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", From aa34bb44c967badaae6688bb95361ad8b62fe938 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 17 Jan 2025 03:45:57 +0000 Subject: [PATCH 5/5] Bump react-router from 7.1.1 to 7.1.2 Bumps [react-router](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router) from 7.1.1 to 7.1.2. - [Release notes](https://github.com/remix-run/react-router/releases) - [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router/CHANGELOG.md) - [Commits](https://github.com/remix-run/react-router/commits/react-router@7.1.2/packages/react-router) --- updated-dependencies: - dependency-name: react-router dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8fe35a233..41ac55fe6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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" @@ -11653,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 57448640c..a74dcf3e0 100644 --- a/package.json +++ b/package.json @@ -121,7 +121,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"