Public API for docs helpers

Macros and Functions

stardoc_with_diff_test

Creates a stardoc target that can be auto-detected by update_docs to write the generated doc to the source tree and test that it's up to date.

This is helpful for minimizing boilerplate in repos wih lots of stardoc targets.

Example usage (generated)

load("@aspect_bazel_lib//lib:docs.bzl", "stardoc_with_diff_test")

stardoc_with_diff_test(
    # the name of the stardoc file to be written to the current source directory (.md will be appended to the name)
    name = "",
    # the label of the `bzl_library` target to generate documentation for
    bzl_library_target = None,
)

name

the name of the stardoc file to be written to the current source directory (.md will be appended to the name). Call bazel run on this target to update the file.

bzl_library_target

the label of the bzl_library target to generate documentation for

kwargs

additional attributes passed to the stardoc() rule, such as for overriding the templates


update_docs

Stamps an executable run for writing all stardocs declared with stardoc_with_diff_test to the source tree.

This is to be used in tandem with stardoc_with_diff_test() to produce a convenient workflow for generating, testing, and updating all doc files as follows:

bazel build //{docs_folder}/... && bazel test //{docs_folder}/... && bazel run //{docs_folder}:update

eg.

bazel build //docs/... && bazel test //docs/... && bazel run //docs:update

Example usage (generated)

load("@aspect_bazel_lib//lib:docs.bzl", "update_docs")

update_docs(
)

name

the name of executable target