diff --git a/src/transform/plugins/links/index.ts b/src/transform/plugins/links/index.ts index 35d0aad8..ab0803ef 100644 --- a/src/transform/plugins/links/index.ts +++ b/src/transform/plugins/links/index.ts @@ -6,7 +6,7 @@ import {PAGE_LINK_REGEXP} from './constants'; import Token from 'markdown-it/lib/token'; import {Logger} from 'src/transform/log'; import {MarkdownItPluginCb, MarkdownItPluginOpts} from '../typings'; -import path, {parse, relative, resolve} from 'path'; +import path, {isAbsolute, parse, relative, resolve} from 'path'; import {StateCore} from 'src/transform/typings'; function defaultTransformLink(href: string) { @@ -113,6 +113,10 @@ function processLink(state: StateCore, tokens: Token[], idx: number, opts: ProcO return; } + if (isAbsolute(href)) { + return; + } + if (pathname) { file = resolve(path.parse(currentPath).dir, pathname); fileExists = isFileExists(file); diff --git a/test/links.test.ts b/test/links.test.ts index 1869461c..8d4372f0 100644 --- a/test/links.test.ts +++ b/test/links.test.ts @@ -77,4 +77,20 @@ describe('Links', () => { expect(result).toEqual('