mirror of
https://github.com/theoludwig/markdownlint-rule-relative-links.git
synced 2024-12-08 00:45:32 +01:00
fix: ignore absolute paths /absolute/path
This commit is contained in:
parent
77b8988bea
commit
c985af6156
@ -71,7 +71,8 @@ const customRule = {
|
||||
if (hrefSrc != null) {
|
||||
const url = new URL(hrefSrc, pathToFileURL(params.name))
|
||||
url.hash = ''
|
||||
const isRelative = url.protocol === 'file:'
|
||||
const isRelative =
|
||||
url.protocol === 'file:' && !hrefSrc.startsWith('/')
|
||||
if (isRelative && !fs.existsSync(url)) {
|
||||
const detail = `Link "${hrefSrc}" is dead`
|
||||
addError(onError, lineNumber, detail)
|
||||
|
2
test/fixtures/Valid.md
vendored
2
test/fixtures/Valid.md
vendored
@ -4,6 +4,8 @@
|
||||
|
||||
![Image](./image.png)
|
||||
|
||||
![Absolute Path](/absolute/path.png)
|
||||
|
||||
[External https link](https://example.com/)
|
||||
|
||||
[External https link 2](https:./external.https)
|
||||
|
Loading…
Reference in New Issue
Block a user