Commit Graph

27 Commits

Author SHA1 Message Date
Sonu Kapoor 2418c6aca1 refactor(docs-infra): refactors `addImageDimensionsImpl` (#37046)
This commit changes the `addImageDimensionsImpl` method to reduce
nesting. It will exit early, if the conditions are not matched.

PR Close #37046
2020-05-14 10:48:01 -07:00
Sonu Kapoor d7c77cb175 refactor(docs-infra): refactors `autoLinkCode` (#36686)
PR Close #36686
2020-04-21 12:49:55 -04:00
Sonu Kapoor bb150c2704 fixup!: build(docs-infra): Ensures that only member docs are linked (#36316)
PR Close #36316
2020-04-17 12:33:56 -04:00
Sonu Kapoor 46ff673192 fixup!: build(docs-infra): Ensures that only member docs are linked (#36316)
PR Close #36316
2020-04-17 12:33:55 -04:00
Sonu Kapoor aebd5f9af6 build(docs-infra): Ensures that only member docs are linked (#36316)
This commit ensures that `member` docs are only linked if the linking
text contains `.`.

PR Close #36316
2020-04-17 12:33:55 -04:00
Sonu Kapoor 4fb034aeec build(docs-infra): fix `autoLinkCode` to ignore docs without a path (#36316)
Previously, the auto linker generated links without an `href` when the
API was private. This commit fixes this by making sure that the `path`
of the document is not empty.

Closes #36260

PR Close #36316
2020-04-17 12:33:55 -04:00
Pete Bacon Darwin 06bca0cc66 fix(docs-infra): do not auto-link code in bash and json snippets (#33877)
Previously any code block, which was not marked with
`no-auto-link` css class would have its contents auto-linked to
API pages. Sometimes this results in false positive links being
generated.

This is problematic for triple backticked blocks, which cannot provide
the `no-auto-link` CSS class to prevent the linking.

This commit fixes the problem by allowing the auto-linker to be
configured not to auto-link code blocks that have been marked with an
"ignored" language. By default these are `bash` and `json`.

Triple backticked blocks are able to specify the language directly after
the first set of triple backticks.

Fixes #33859

PR Close #33877
2019-11-18 09:11:01 -08:00
Pete Bacon Darwin 526537fefe style(docs-infra): reformat the auto-link-code files (#33877)
PR Close #33877
2019-11-18 09:11:01 -08:00
George Kalpakas c6b180380a 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
2019-06-19 14:59:34 -07:00
Pete Bacon Darwin 9ff8155cd9 build(docs-infra): mark code blocks to disable auto-linking (#26675)
You can now mark `<code>` blocks with a `no-auto-link` css class
to tell the code auto-linker to ignore this code block.

PR Close #26675
2018-10-26 18:09:20 -04:00
Pete Bacon Darwin 131d0d8e8a build(aio): do not try to auto-link to internal API items (#24000)
This would cause dangling links since the target, being internal,
would not exist in the docs.

PR Close #24000
2018-06-13 16:47:40 -07:00
Pete Bacon Darwin 0e311e3918 build(aio): improve accuracy of code auto-linking (#22494)
The new version of `dgeni-packages/typescript` no longer strips
out "namespaces" from types, which was part of the problem of
not autolinking correctly to `HttpEventType.Response`.

Another part of the problem was that we did not include `.`
characters when matching potential code blocks for auto-linking,
which precluded properties of enums from being linked.

Finally, members we not being given a `path` property, which is
needed to effectively autolink to them. This is now set in
the `simplifyMemberAnchors` processor.

Closes #21375

PR Close #22494
2018-03-01 08:11:19 -08:00
Pete Bacon Darwin 83b32a0a0a build(aio): render heading anchors on the right
This approach simplifies the styling needed considerably.
Previously, we had to make room on the left for heading that
are in visual containers. Also we had to apply a `float:right`
when on narrow screens as the gutter not available then.
This float didn't render nicely if the heading text was longer
than could be rendered on a single line.

Closes #22131
2018-02-27 18:32:32 -08:00
Peter Bacon Darwin 7c44637fbf build(aio): tighten up code autolinking (#20468)
Do not match code "words" that are part of a hyphenated
string of characters: e.g. `platform-browser-dynamic` should
not auto-link `browser`.

Do not match code "words" that correspond to pipe names
but are not preceded by a pipe `|` character. E.g. `package.json` should
not auto link `json` to the `JsonPipe`.

Closes #20187

PR Close #20468
2017-11-16 16:20:03 -06:00
George Kalpakas 7e38f4fd1f fix(aio): fix window title on Home page (#20440)
Using `display: none` on the `<h1>` causes `innerText` to not work as expected
and include the icon ligature (`link`) in the title. This caused the window
title on the angular.io Home page to appear as "Angular - link".
This commit fixes it by not generating anchors at all for headings with the
`no-anchor` class.

Fixes #20427

PR Close #20440
2017-11-15 18:25:58 -06:00
Peter Bacon Darwin 9ab1f4a9c9 style(aio): fix docs linting issues (#19702)
These issues appeared after upgrade of eslint jasmine plugin

PR Close #19702
2017-11-01 15:24:46 -07:00
Peter Bacon Darwin 9ab9437319 build(aio): auto-link more code items
We now parse all code blocks, after they have been rendered by dgeni
and insert links to API docs that match "words" in the code.
2017-09-12 13:58:43 -04:00
Peter Bacon Darwin b8a3736275 build(aio): do not auto-link code elements already inside a link (#18776)
Closes #18769

PR Close #18776
2017-08-18 17:13:16 -05:00
Georgios Kalpakas cc2a4c41f9 build(aio): fix warning about missing `<h1>`
Fixes #17549
2017-07-31 13:40:07 -07:00
Peter Bacon Darwin c453b7bcfa build(aio): fail doc-gen if referenced images are missing 2017-07-18 11:45:05 +01:00
Peter Bacon Darwin 3a0886dc12 build(aio): capture all the headings from a doc in the vFile.headings property 2017-07-11 15:04:37 +01:00
Peter Bacon Darwin 4d5fa5c855 build(aio): capture the h1 title and attach it to the document
The HTML post-processing now collects any h1
that is found in the renderedContent and attaches
it to the doc via the `doc.vFile.title` property.
2017-05-31 08:45:31 +03:00
Peter Bacon Darwin a9d9aa18a0 build(aio): automatically link code blocks to API docs 2017-05-15 10:56:38 +01:00
Peter Bacon Darwin bcbee13e26 build(aio): fail build if more than h1 is found in a doc
Closes #16193
2017-05-11 08:15:19 +01:00
Peter Bacon Darwin ca17d4f639 build(aio): auto-fill width/height to all image tags
Parse all `<img>` tags, during doc-gen, and insert the width and height of
the sourceed image, if neither are already specified.

Warnings are reported if the `<img>` tag has no `src` attribute or the image
cannot be loaded.

The work is done in the `addImageDimensions` post-processor, which must be
configured with a `basePath` so that it knows where to find the images.

Closes #15888
2017-05-01 15:52:51 -07:00
Peter Bacon Darwin 64335d3521 build(aio): capture and log errors and warnings when post-processing HTML 2017-05-01 15:52:51 -07:00
Peter Bacon Darwin de25cfc0cb build(aio): move autolink-headings to post-processing (#16336)
The autolinking is now done on the `renderedContent` which means it also
captures and autolinks headings that were generated outside of markdown.

PR Close #16336
2017-04-27 23:42:04 -05:00