Add autofix for the link-rel-canonical-require rule
#342
+111
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds support for autofixing the
link-rel-canonical-requirerule in the HTMLHint extension, allowing the extension to automatically insert a canonical link tag into the<head>section of HTML documents when it is missing. The feature is documented in both the changelog and README, and new tests have been added to ensure correct behavior.Autofix Feature Addition
createLinkRelCanonicalRequireFixfunction inhtmlhint-server/src/server.ts, which generates a quick fix to add a<link rel="canonical">tag to the<head>section if it is missing. The function intelligently determines the best insertion point based on existing meta tags and respects thetag-self-closerule.createAutoFixesfunction so that diagnostics for thelink-rel-canonical-requirerule now trigger the autofix logic.Documentation Updates
htmlhint/CHANGELOG.md).link-rel-canonical-requireas a supported autofix rule.Testing and Configuration
link-rel-canonical-requirerule in the test configuration (test/autofix/.htmlhintrc).test/autofix/link-canonical-test.html) to verify the autofix behavior for canonical link tags.