diff --git a/aio/tools/transforms/angular-base-package/index.js b/aio/tools/transforms/angular-base-package/index.js index 4b50e5f81c..6cd6b4b7fd 100644 --- a/aio/tools/transforms/angular-base-package/index.js +++ b/aio/tools/transforms/angular-base-package/index.js @@ -33,7 +33,8 @@ module.exports = new Package('angular-base', [ .factory(require('./readers/json')) .config(function(checkAnchorLinksProcessor) { - // TODO: re-enable + // This is disabled here to prevent false negatives for the `docs-watch` task. + // It is re-enabled in the main `angular.io-package` checkAnchorLinksProcessor.$enabled = false; }) diff --git a/aio/tools/transforms/angular.io-package/index.js b/aio/tools/transforms/angular.io-package/index.js index 94d67eb73f..3c9c34693c 100644 --- a/aio/tools/transforms/angular.io-package/index.js +++ b/aio/tools/transforms/angular.io-package/index.js @@ -9,6 +9,7 @@ const Package = require('dgeni').Package; const gitPackage = require('dgeni-packages/git'); const apiPackage = require('../angular-api-package'); const contentPackage = require('../angular-content-package'); +const { extname } = require('canonical-path'); module.exports = new Package('angular.io', [gitPackage, apiPackage, contentPackage]) @@ -20,5 +21,15 @@ module.exports = new Package('angular.io', [gitPackage, apiPackage, contentPacka .config(function(renderDocsProcessor, versionInfo) { // Add the version data to the renderer, for use in things like github links renderDocsProcessor.extraData.versionInfo = versionInfo; + }) + .config(function(checkAnchorLinksProcessor) { + checkAnchorLinksProcessor.$enabled = true; + // since we encode the HTML to JSON we need to ensure that this processor runs before that encoding happens. + checkAnchorLinksProcessor.$runBefore = ['convertToJsonProcessor']; + checkAnchorLinksProcessor.$runAfter = ['fixInternalDocumentLinks']; + // We only want to check docs that are going to be output as JSON docs. + checkAnchorLinksProcessor.checkDoc = (doc) => doc.path && doc.outputPath && extname(doc.outputPath) === '.json'; + // Since we have a `base[href="/"]` arrangement all links are relative to that and not relative to the source document's path + checkAnchorLinksProcessor.base = '/'; });