diff --git a/src/core/util/core.js b/src/core/util/core.js index 985a0e829..e1e585d53 100644 --- a/src/core/util/core.js +++ b/src/core/util/core.js @@ -96,5 +96,8 @@ export function isExternal(url) { ) { return true; } + if (/^\/\\/.test(url)) { + return true; + } return false; } diff --git a/test/unit/core-util.test.js b/test/unit/core-util.test.js index 0ebbf7bbd..a6ff7d3ef 100644 --- a/test/unit/core-util.test.js +++ b/test/unit/core-util.test.js @@ -59,5 +59,17 @@ describe('core/util', () => { expect(result).toBeTruthy(); }); + + test('external url with one \\', () => { + const result = isExternal('/\\example.github.io/docsify/demo.md'); + + expect(result).toBeTruthy(); + }); + + test('external url with two \\', () => { + const result = isExternal('/\\\\example.github.io/docsify/demo.md'); + + expect(result).toBeTruthy(); + }); }); });