Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed relative link checking for local input files. #13

Closed
wants to merge 2 commits into from
Closed

Fixed relative link checking for local input files. #13

wants to merge 2 commits into from

Conversation

chrispomeroyhale
Copy link

The link checker will correctly evaluate a relative URL contained within markdown when a remote URL is specified as a CLI argument that contains a relative link. But it failed when a local filename was specified instead. This patch addresses that issue by considering whether the markdown source URL is local.

@tcort
Copy link
Owner

tcort commented Nov 20, 2016

I'd rather do this in a more generic way. For example, in the markdown-link-check script, if it's a file being supplied, opts.baseUrl would get set to file:///your/path/here, and link-check would look at the scheme (http, https, file, etc) and choose the right checker (e.g. http/https would use request while file would use fs.stat). There would probably have to be a new command line option (for specifying the baseUrl for data from stdin): cat /path/to/*.md | markdown-link-check --base-url file:///path/to

@tcort tcort closed this Nov 20, 2016
@sethreidnz
Copy link

Want some one to try to implement this? I'm pretty keen because I was thinking about building literally that piece of what you have done here... Then I came across this repo and this thread... If you haven't already begun then I'll fork and give it a go.

@tcort
Copy link
Owner

tcort commented Jan 29, 2017

I've added support for the file: protocol (version 3.0.0), so what I have above should work now.

@chrispomeroyhale chrispomeroyhale deleted the fix-relative-links branch June 20, 2017 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants