Hello & goodbye
\r\nHello&goodbye
`; + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 39, + endIndex: 95, + strategyName: "whitespaceIgnoredMatch", + }); + }); + + it("should match content surrounded by different types of whitespace", () => { + const fileContent = `\tconst data = {\n\t\tname: "John",\n\t\tage: 30,\n\t\taddress: {\n\t\t\tstreet: "Main St",\n\t\t\tcity: "NYC"\n\t\t}\n\t};`; + const searchContent = `address:{street:"MainSt",city:"NYC"}`; + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 45, + endIndex: 96, + strategyName: "whitespaceIgnoredMatch", + }); + }); + + // IMPORTANT string.length and string.slice both count UTF-16 units so emojis will count as 2 in both + it("should handle unicode characters with whitespace differences", () => { + const fileContent = `const message = {\n greeting: "Hello 👋",\n emoji: "🚀",\n unicode: "café",\n symbol: "∑"\n};`; + const searchContent = `emoji:"🚀",unicode:"café",symbol:"∑"`; + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 44, + endIndex: 89, + strategyName: "whitespaceIgnoredMatch", + }); + }); + + it("should match across multiple nested blocks with varying indentation", () => { + const fileContent = `class Calculator {\n add(a, b) {\n if (typeof a === 'number' && typeof b === 'number') {\n return a + b;\n }\n throw new Error('Invalid input');\n }\n\n multiply(x, y) {\n return x * y;\n }\n}`; + const searchContent = `if(typeofa==='number'&&typeofb==='number'){returna+b;}`; + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 43, + endIndex: 132, + strategyName: "whitespaceIgnoredMatch", + }); + }); + + it("should handle regex-like patterns with escaped characters", () => { + const fileContent = `const pattern = /\\d+\\.\\d+/g;\nconst test = \"123.456\";\nif (pattern.test(test)) {\n console.log(\"Match found\");\n}`; + const searchContent = `consttest="123.456";if(pattern.test(test)){console.log("Matchfound");}`; + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 29, + endIndex: 110, + strategyName: "whitespaceIgnoredMatch", + }); + }); + + it("should match SQL-like content with varying whitespace", () => { + const fileContent = `SELECT users.name,\n users.email,\n profiles.bio\nFROM users\nINNER JOIN profiles ON users.id = profiles.user_id\nWHERE users.active = true\nORDER BY users.name;`; + const searchContent = `SELECTusers.name,users.email,profiles.bioFROMusersINNERJOINprofiles`; + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 0, + endIndex: 89, + strategyName: "whitespaceIgnoredMatch", + }); + }); + + it("should handle content with form feeds, vertical tabs, and other rare whitespace", () => { + const fileContent = `function\fprocess\vdata(input)\u0020{\u00A0\n\treturn\u2000input.trim();\u2009\n}`; + const searchContent = `functionprocessdata(input){returninput.trim();}`; + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 0, + endIndex: 56, + strategyName: "whitespaceIgnoredMatch", + }); + }); + + it("should match content with Windows-style CRLF line endings", () => { + const fileContent = `@echo off\r\nset PATH=%PATH%;C:\\tools\r\nif \"%1\"==\"\" (\r\n echo Usage: script.bat filename\r\n exit /b 1\r\n)\r\necho Processing %1...\r\necho Done.`; + const searchContent = `if\"%1\"==\"\"(echo Usage: script.bat filename exit/b 1)`; + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 37, + endIndex: 105, + strategyName: "whitespaceIgnoredMatch", + }); + }); + + it("should handle deeply nested JSON with mixed formatting", () => { + const fileContent = `{\n \"config\": {\n \"database\": {\n \"host\": \"localhost\",\n \"port\": 5432,\n \"credentials\": {\n \"username\": \"admin\",\n \"password\": \"secret\"\n },\n \"options\": {\n \"ssl\": true,\n \"timeout\": 30000\n }\n }\n }\n}`; + const searchContent = `\"credentials\":{\"username\":\"admin\",\"password\":\"secret\"},\"options\":{\"ssl\":true,\"timeout\":30000}`; + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 87, + endIndex: 243, + strategyName: "whitespaceIgnoredMatch", + }); + }); + + it("should match XML content with attribute spacing differences", () => { + const fileContent = `\nHello World
+Hello World
+
+
@@ -17,7 +17,7 @@ We recently released Instinct, a state-of-the-art open Next Edit model. Robustly
### 1. Install Ollama
-If you haven't already installed Ollama, see our guide [here](./ollama-guide.mdx).
+If you haven't already installed Ollama, see our guide [here](./ollama-guide).
### 2. Download Instinct
diff --git a/docs/guides/netlify-mcp-continuous-deployment.mdx b/docs/guides/netlify-mcp-continuous-deployment.mdx
new file mode 100644
index 000000000..b16c8d5f3
--- /dev/null
+++ b/docs/guides/netlify-mcp-continuous-deployment.mdx
@@ -0,0 +1,614 @@
+---
+title: "Netlify Performance Optimization Cookbook"
+description: "Optimize web performance with A/B testing, automated monitoring, and data-driven improvements using Netlify MCP and Continue."
+sidebarTitle: "Using Netlify MCP for Performance Optimization"
+---
+
+