//sphinxdocs:sphinx_stardoc.bzl
Rules to generate Sphinx-compatible documentation for bzl files.
- sphinx_stardoc(name, src, deps=[], public_load_path=None, prefix=None, strip_prefix=None, create_test=True, output=None, **kwargs)
Generate Sphinx-friendly Markdown for a single bzl file.
- Args:
name for the target.
The bzl file to process, or a
bzl_librarytarget with one source file of the bzl file to process.deps– (list[label]) (default [])Targets that provide files loaded by
srcpublic_load_path– (str|None) (default None)override the file name that is reported as the file being.
prefix– (str|None) (default None)prefix to add to the output file path
strip_prefix– (str|None) (default None)Prefix to remove from the input file path. If not specified, then
native.package_nameis used.create_test– (bool) (default True)True if a test should be defined to verify the docs are buildable, False if not.
output– (str|None) (default None)Optional explicit output file to use. If not set, the output name will be derived from
src.common args passed onto rules.
- sphinx_stardocs(name, srcs=[], deps=[], docs={}, prefix=None, strip_prefix=None, **kwargs)
Generate Sphinx-friendly Markdown docs using Stardoc for bzl libraries.
A
build_testfor the docs is also generated to ensure Stardoc is able to process the files.NOTE: This generates MyST-flavored Markdown.
- Args:
, the name of the resulting file group with the generated docs.
srcs– (list[label]) (default [])Each source is either the bzl file to process or a
bzl_librarytarget with one source file of the bzl file to process.deps– (list[label]) (default [])Targets that provide files loaded by
srcdocs– (dict[str,str|dict]) (default {})of the bzl files to generate documentation for. The
outputkey is the path of the output filename, e.g.,foo/bar.md. Thesourcevalues can be either of:A
strlabel that points to abzl_librarytarget. The target name will replace_bzlwith.bzland use that as the input bzl file to generate docs for. The target itself provides the necessary dependencies.A
dictwith keysinputanddep. Theinputkey is a string label to the bzl file to generate docs for. Thedepkey is a string label to abzl_libraryproviding the necessary dependencies.
Prefix to add to the output file path. It is prepended after
strip_prefixis removed.strip_prefix– (str|None) (default None)Prefix to remove from the input file path; it is removed before
prefixis prepended. If not specified, thennative.package_nameis used.kwargs– Additional kwargs to pass onto eachsphinx_stardoctarget