@@ -227,6 +227,11 @@ The documentation renders using RST notation (`.. directive::`), not
227227MyST notation.
228228:::
229229
230+ Directives can be nested, but [ the inner directives must have ** fewer** colons
231+ than outer
232+ directives] ( https://myst-parser.readthedocs.io/en/latest/syntax/roles-and-directives.html#nesting-directives ) .
233+
234+
230235:::{rst: directive } .. bzl:currentfile:: file
231236
232237This directive indicates the Bazel file that objects defined in the current
@@ -237,46 +242,85 @@ files, and `//foo:BUILD.bazel` for things in BUILD files.
237242:::
238243
239244
240- :::{rst: directive } .. bzl:target:: target
245+ ::::: {rst: directive } .. bzl:target:: target
241246
242247Documents a target. It takes no directive options. The format of ` target `
243248can either be a fully qualified label (` //foo:bar ` ), or the base target name
244249relative to ` {bzl:currentfile} ` .
245250
246- ```
251+ ````
247252:::{bzl:target} //foo:target
248253
249254My docs
250255:::
251- ```
256+ ````
257+
258+ :::::
252259
253260:::{rst: directive } .. bzl:flag:: target
254261
255262Documents a flag. It has the same format as ` {bzl:target} `
256263:::
257264
265+ ::::::{rst: directive } .. bzl:typedef:: typename
258266
259- :::{rst: directive } .. bzl:typedef:: typename
267+ Documents a user-defined structural "type". These are typically generated by
268+ the {obj}` sphinx_stardoc ` rule after following [ User-defined types] to create a
269+ struct with a ` TYPEDEF ` field, but can also be manually defined if there's
270+ no natural place for it in code, e.g. some ad-hoc structural type.
260271
261- Documents a user-defined structural "type". These are typically generated
262- by following [ User-defined types] to create a struct with a ` TYPEDEF ` field.
263-
264- ```
272+ `````
265273::::{bzl:typedef} Square
274+ Doc about Square
266275
267276:::{bzl:field} width
268277:type: int
269278:::
270279
271280:::{bzl:function} new(size)
281+ ...
272282:::
273283
274284:::{bzl:function} area()
285+ ...
275286:::
276287::::
277- ```
288+ `````
278289
279- Note that, due to a Sphinx and/or MyST bug, the number of colons for the
280- outer typedef directive must be greater than the inner directives. Otherwise,
281- only the first nested directive is parsed as part of the type def.
282- :::
290+ Note that MyST requires the number of colons for the outer typedef directive
291+ to be greater than the inner directives. Otherwise, only the first nested
292+ directive is parsed as part of the typedef, but subsequent ones are not.
293+ ::::::
294+
295+ :::::{rst: directive } .. bzl:field:: fieldname
296+
297+ Documents a field of an object. These are nested within some other directive,
298+ typically ` {bzl:typedef} `
299+
300+ Directive options:
301+ * ` :type: ` specifies the type of the field
302+
303+ ````
304+ :::{bzl:field} fieldname
305+ :type: int | None | str
306+
307+ Doc about field
308+ ````
309+ :::::
310+
311+ :::::{rst: directive } .. bzl:provider-field:: fieldname
312+
313+ Documents a field of a provider. The directive itself is autogenerated by
314+ ` sphinx_stardoc ` , but the content is simply the documentation string specified
315+ in the provider's field.
316+
317+ Directive options:
318+ * ` :type: ` specifies the type of the field
319+
320+ ````
321+ :::{bzl:provider-field} fieldname
322+ :type: depset[File] | None
323+
324+ Doc about the provider field
325+ ````
326+ :::::
0 commit comments