Page MenuHomeElementl

[docs-infra] broken link test
ClosedPublic

Authored by yuhan on Feb 25 2021, 10:20 AM.

Details

Summary

v1 for validating links
Todo:

  • links to api docs
  • links with anchors
Test Plan

yarn test locally captured 486 broken links and they all make sense (yay!)

Screen Shot 2021-02-25 at 2.24.06 AM.png (3×2 px, 1 MB)

will enable the test in bk later (when we are pretty much done with the concept content)

Diff Detail

Repository
R1 dagster
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Feb 25 2021, 10:42 AM
Harbormaster failed remote builds in B26432: Diff 32299!
Harbormaster returned this revision to the author for changes because remote builds failed.Feb 25 2021, 11:21 PM
Harbormaster failed remote builds in B26483: Diff 32362!
yuhan published this revision for review.Feb 25 2021, 11:42 PM

Wow, nice work! This is great. I don't want you to rewrite a large portion of this, but just a few tips in case you want to clean some of the logic up here and have this logic be consistent with some of the other AST parsing we do:

You're currently using the compiler directly from MDX, but you may want to go through the remark (https://github.com/remarkjs/remark) interface to process the MDX.

  • scripts/snapshot.ts has an example of running remark parser over all the MDX files that includes a custom codeTransformer step
  • util/codeTransformer.ts has an example of using unist-util-visit to do the tree traversal to collect the list nodes you care about. I see that you're currently doing the AST walk by hand. You can replace "code" with "a" and "img" nodes.

These are just tips and definitely not blocking. Totally up to you about how you want to implement this. Feel free to keep as is, pending TODOs.

docs/next/package.json
51

We already have fast-glob installed, can we use that instead to avoid having two glob implementations? Example usage is in scripts/snapshot.ts

yuhan marked an inline comment as done.

use remark, visit, fast-glob

sashank added inline comments.
docs/next/__tests__/mdxInternalLinks.test.ts
76–78

Doesn't this mean that all links to api docs are never broken?

This revision is now accepted and ready to land.Mar 1 2021, 7:56 PM
docs/next/__tests__/mdxInternalLinks.test.ts
76–78

yep i marked it as a follow up TODO

This revision was automatically updated to reflect the committed changes.