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

Link checking doesn't check the fragment identifier #108

Open
peterhartman opened this issue Apr 5, 2018 · 1 comment
Open

Link checking doesn't check the fragment identifier #108

peterhartman opened this issue Apr 5, 2018 · 1 comment

Comments

@peterhartman
Copy link

When checking links BLC seems to check the file exists but doesn't check the fragment id:

Getting links from: http://localhost:59319/
├───OK─── http://localhost:59319/#an-invalid-id (CACHED)
├───OK─── http://localhost:59319/foo.html#an-invalid-id
├───OK─── http://localhost:59319/#a-valid-id (CACHED)
└───OK─── http://localhost:59319/foo.html#a-valid-id (CACHED)
Finished! 4 links found. 0 broken.
@stevenvachon
Copy link
Owner

Document validation gets very complicated. It introduces other needs, such as live DOM apps.

aomarks added a commit to lit/lit.dev that referenced this issue Sep 1, 2021
Custom script for checking lit.dev redirects.

It would be nice if we could use the 3rd party link checker we already have for this somehow, but it doesn't support checking for anchors (see stevenvachon/broken-link-checker#108 -- understandable since it would require DOM parsing) which is one of the main failure cases.

Fixes #467 (since we shouldn't need comments if we have the redirects checked in CI).

As part of this, I created a new lit-dev-tools-esm package.

The existing lit-dev-tools package is currently CommonJS, because mostly it is used for Eleventy plugins, and Eleventy doesn't support ES modules (11ty/eleventy#836).

We want ES modules for this new redirect checker script, because it needs to import some ES modules, and that is difficult to do with TypeScript, because TypeScript doesn't allow emitting an actual import statement, which is how CommonJS -> ESM interop works (microsoft/TypeScript#43329).

We also can't really have a mix of CommonJS and ESM in the same package, because the {"type": "module"} field has to be set to one or the other in the package.json. We could use .mjs extensions, but TypeScript won't emit those.

So the simplest solution seems to be to just have two packages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants