fix(docs-infra): do not auto-link http:// to the common/http (#31051)

Previously, our auto-linking feature would match `http` in URLs (such as
`http://...`) to the `common/http` package and automatically create a
link to that, which was undesirable. While it is possible to work around
that via `<code class="no-auto-link">http://...</code>`, most people
didn't even realize the issue.

Since in this case it is possible to reliably know it is a false match,
this commit fixes it by applying a custom auto-link filter that ignores
all docs for `http`, if it comes before `://`.

Fixes #31012

PR Close #31051
This commit is contained in:
George Kalpakas
2019-06-14 14:02:56 +03:00
committed by Kara Erickson
parent a73b8a62c8
commit e8f464409c
5 changed files with 67 additions and 4 deletions

View File

@ -38,6 +38,7 @@ module.exports = new Package('angular-base', [
.factory(require('./services/copyFolder'))
.factory(require('./services/filterPipes'))
.factory(require('./services/filterAmbiguousDirectiveAliases'))
.factory(require('./services/ignoreHttpInUrls'))
.factory(require('./services/getImageDimensions'))
.factory(require('./post-processors/add-image-dimensions'))
@ -128,9 +129,9 @@ module.exports = new Package('angular-base', [
})
.config(function(postProcessHtml, addImageDimensions, autoLinkCode, filterPipes, filterAmbiguousDirectiveAliases) {
.config(function(postProcessHtml, addImageDimensions, autoLinkCode, filterPipes, filterAmbiguousDirectiveAliases, ignoreHttpInUrls) {
addImageDimensions.basePath = path.resolve(AIO_PATH, 'src');
autoLinkCode.customFilters = [filterPipes, filterAmbiguousDirectiveAliases];
autoLinkCode.customFilters = [ignoreHttpInUrls, filterPipes, filterAmbiguousDirectiveAliases];
postProcessHtml.plugins = [
require('./post-processors/autolink-headings'),
addImageDimensions,