swiftlang / swift-docc-plugin

Swift Package Manager command plugin for Swift-DocC
https://swiftpackageindex.com/apple/swift-docc-plugin/1.3.0/documentation/swiftdoccplugin
Apache License 2.0
316 stars 54 forks source link

req: dead link checking command for plugin #78

Open heckj opened 6 months ago

heckj commented 6 months ago

Feature Request: Dead Link checking command

Description:

Related to https://github.com/apple/swift-docc/issues/701, it would be nice to have a docc-plugin command, or potentially a build plugin, that could parse HTML links from within DocC content to determine if those links were still valid or not.

When/if Docc emits a digest with all possible links within it, a useful follow-on would be a docc-plugin command to check those links to report which are valid/invalid, with sufficient location information in the output to know where/what file to update.

Motivation:

Early (and still current as of this writing) DocC doesn't have the ability to provide cross-references to modules or symbols in other modules, leading to the common practice of embedding URLs for the reader's convenience. URLs and libraries change, as well as even hosting locations, so URLs aren't always as static as we'd like. Ideally, one could run a process to verify that all external links, at least at a given point in time, are still valid links.

Importance:

This is primarily a quality of life improvement, and an efficiency update to the alternative of crawling all the pages generated with a javascript-aware-and-enabled parsing engine to view the HTML for links, following them, and report on failures.

Alternatives Considered

If you considered alternative approaches for this feature, please include them here.

/cc @amartini51