This repository has been archived by the owner on Jul 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: verify Docsify links work in Github
Docsify links can reference the path of a page, without the '.md' suffix. This breaks links when page markdown is viewed elsewhere, such as in Github. This fix verifies all Docsify links refer to the full markdown filename.
- Loading branch information
Showing
10 changed files
with
40 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const common = require('./common.js') | ||
|
||
module.exports = { | ||
"names": [ "docsify-markdown-suffix" ], | ||
"description": "Docsify links should reference full file name", | ||
"tags": [ "custom", "docsify" ], | ||
"function": (params, onError) => { | ||
params | ||
.tokens | ||
.filter((token) => token.type === "inline") | ||
.forEach((inline) => { | ||
inline | ||
.children | ||
.filter((child) => child.type === 'link_open') | ||
.forEach((link) => { | ||
for (const attr of link.attrs) { | ||
if (common.isDocsifyLink(attr) && !attr[1].startsWith('#') && !attr[1].includes('.md')) { | ||
onError({ | ||
"lineNumber": inline.lineNumber, | ||
"context": attr[1] | ||
}); | ||
} | ||
} | ||
}) | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters