Linkify all flags in the Command Line Reference

This updates the option html emitter to add anchor links and id tags to
each generated flag in the command line reference. It also fixes its
color to be consistently red in the code block, instead of the standard
Bazel green for links.

Live demo:

https://bazel-docs-staging.netlify.com/versions/master/command-line-reference.html#flag--all_incompatible_changes
https://bazel-docs-staging.netlify.com/versions/master/command-line-reference.html#flag--experimental_oom_more_eagerly_threshold

When not hovering:

![ss](https://user-images.githubusercontent.com/347918/50126797-6b1f0880-023c-11e9-85fa-5d47c7f62a25.png)

When hovering:

![ss](https://user-images.githubusercontent.com/347918/50126805-740fda00-023c-11e9-93c2-d69e719dcf34.png)

and that generates the link:

`https://docs.bazel.build/versions/<version>/command-line-reference.html#flag--experimental_oom_more_eagerly_threshold`

Expanded flags are also linkified:

![ss](https://user-images.githubusercontent.com/347918/50127567-b2f35f00-023f-11e9-8bf4-e39d3937929c.png)

There may be a concern that we don't guarantee that flags are only generated once, and can be duplicated, but because flag definitions don't change, linking to the first instance of the flag is safe.

Fixes https://github.com/bazelbuild/bazel/issues/3502

Change-Id: I6775feaa48558029b943b3206891e8b6860bb5d9
RELNOTES: None.

Closes #6954.

Change-Id: I37057365b0a117e269bdaa56bdec8153fe0a5b85
PiperOrigin-RevId: 226065220
3 files changed
tree: fc3585bfd6e18dbe0b7037712a2d71e956a7ff1e
  1. .bazelci/
  2. examples/
  3. scripts/
  4. site/
  5. src/
  6. third_party/
  7. tools/
  8. .gitattributes
  9. .gitignore
  10. AUTHORS
  11. BUILD
  12. CHANGELOG.md
  13. CODEOWNERS
  14. combine_distfiles.py
  15. combine_distfiles_to_tar.sh
  16. compile.sh
  17. CONTRIBUTING.md
  18. CONTRIBUTORS
  19. distdir.bzl
  20. ISSUE_TEMPLATE.md
  21. LICENSE
  22. README.md
  23. WORKSPACE
README.md

Bazel

{Fast, Correct} - Choose two

Build and test software of any size, quickly and reliably.

  • Speed up your builds and tests: Bazel only rebuilds what is necessary. With advanced local and distributed caching, optimized dependency analysis and parallel execution, you get fast and incremental builds.

  • One tool, multiple languages: Build and test Java, C++, Android, iOS, Go, and a wide variety of other language platforms. Bazel runs on Windows, macOS, and Linux.

  • Scalable: Bazel helps you scale your organization, codebase, and continuous integration solution. It handles codebases of any size, in multiple repositories or a huge monorepo.

  • Extensible to your needs: Easily add support for new languages and platforms with Bazel's familiar extension language. Share and re-use language rules written by the growing Bazel community.

Getting Started

Documentation

Contributing to Bazel

See CONTRIBUTING.md

Build status

Bazel is released in ‘Beta’. See the product roadmap to learn about the path toward a stable 1.0 release.