Skip to content

Support link checking of Markdown files #73

Closed

Description

@bnb

Currently 404s and exits on a fresh clone of one of my repos.

Steps:

git clone git@github.com:bnb/jsconf-eu-led.git # will clone into jsconf-eu-led
npx linkinator ./jsconf-eu-led # should run against jsconf-eu-led

image

While testing this, it seems that I discovered the localhost URL's port is dynamic rather than static. I'm... not sure why that would happen, considering the code inside the directory is static and not changing between runs:

image

Activity

  1. bnb commented on Jun 9, 2019

    @bnb
    Author

    And, for what it's worth, there doesn't seem to be any reference to localhost in the directory:

    image

  2. JustinBeckwith commented on Jun 9, 2019

    @JustinBeckwith
    Owner

    Ok - I know what's happening here :) linkinator is expecting you to pass it a path to a static HTML site when you use a local path. It tries to start its own static web server, on a random port, and then navigate the site.

    It can also be pointed at a plain ol' URL.

    It sounds like you were expecting this to 404 check your README.md - is that correct?

  3. bnb commented on Jun 9, 2019

    @bnb
    Author

    Yup, I was expecting it to check the README.md / other Markdown files in the directory 😅

  4. JustinBeckwith commented on Jun 9, 2019

    @JustinBeckwith
    Owner

    That's not an unreasonable expectation. Let me look at trying to support it!

  5. added
    enhancementNew feature or request
    and removed
    questionFurther information is requested
    on Jun 9, 2019
  6. grumbaut commented on Jul 9, 2019

    @grumbaut
    Contributor

    I'm getting a similar error as part of our pipeline. We build to HTML files that are used on a local development server. I'm trying to include linkinator as part of our gulp pipeline, but I sometimes get this as the only result:
    Screen Shot 2019-07-09 at 11 59 31 AM

    Here are the relevant portions of code:

    	linkChecker.on('pagestart', (fileUrl) => {
    		currentFile = sanitizeUrl(fileUrl);
    	});
    
    	linkChecker.on('link', (result) => {
    		console.log(result);
    		// if (result.state === 'BROKEN') {
    		// 	const url = result.url.includes('localhost')
    		// 		? sanitizeUrl(result.url)
    		// 		: result.url;
    		// 	this.log('linkCheck', `Broken link in ${currentFile}: ${url}`, 'red');
    		// }
    	});
    
    	const task = () => linkChecker.check({
    		path: path.resolve(this.epubDir), // this.epubDir is pointing to a local directory
    		recurse: true,
    	});
    
  7. changed the title [-]404 on (seemingly) non-existent URL[/-] [+]Support link checking of Markdown files[/+] on Jul 9, 2019
  8. JustinBeckwith commented on Jul 9, 2019

    @JustinBeckwith
    Owner

    👋 @grumbaut it sounds like your issue may be different, since you're working from generated HTML instead of Markdown (the original issue with this one). Could I trouble you to open a new issue?

  9. grumbaut commented on Jul 9, 2019

    @grumbaut
    Contributor

    Done! Thanks!

  10. bnb commented on Apr 13, 2020

    @bnb
    Author

    I just ran into this again thinking it was supported and remembered I'd had an issue previously 😅

  11. JustinBeckwith commented on Dec 3, 2020

    @JustinBeckwith
    Owner

    Well it took longer than expected, but I finally got around to this 🐢 With version 2.6.0 and up, you can now check markdown!

    $ linkinator README.md
    

    That ought to do it! Anyone want to take this for a spin and let me know how it goes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions