Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

Conversation

@awelzel
Copy link
Contributor

@awelzel awelzel commented May 28, 2025

For documenting and referencing record fields, introduce a new role and
directive. Zeek is changed to produce ReST containing .. field:
directives instead of the definition-list style output.

Record fields can be referenced in rst as :zeek:field:Type$field. This
will produce a clickable link rendered as just field. The link goes to
the definition of the field within the named record type. It is also possible
to use :zeek:see:Type$field. In that case, the link will be Type$field
instead of just field.
Using :zeek:field:field without a Type is allowed as markup, but when
no link is wanted.


I hope this was worth it :-)

This changes the way records are rendered in the HTML docs slightly. Each field can now be linked individually, so I think that's a plus. There's also a bit more internal structure on the sphinx side rather than just treating fields as rst definitions in case we want to do more fancy things in the future.

Screenshot from 2025-05-28 15-52-31

The main difference is that the gray bar does not extend to the right anymore, but also that fields are now actually next to a Fields entry.

The record's docstring comes at the end after all fields, but that's already an issue with master today and I'm out of steam staring at sphinx/docutils:

Screenshot from 2025-05-28 15-54-38

Not also how enums are rendered similarly today (just without a nice "Fields").

Copy link
Member

@timwoj timwoj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me without diving way into how sphinx works. I like it 👍🏼

awelzel added 4 commits May 30, 2025 16:39
For documenting and referencing record fields, introduce a new role and
directive. Zeek is changed to produce ReST containing `.. field:`
directives instead of the definition-list style output.

Record fields can be referenced in rst as :zeek:field:`Type$field`. This
will produce a clickable link rendered as just `field`. The link goes to
the definition of the field within the named record type. It is also possible
to use :zeek:see:`Type$field`. In that case, the link will be `Type$field`
instead of just `field`.
Using :zeek:field:`field` without a Type is allowed as markup, but when
no link is wanted.
@awelzel awelzel force-pushed the topic/awelzel/zeek-field-directive branch from e8945ce to 86e199a Compare May 30, 2025 14:43
@awelzel awelzel merged commit 72eb0b4 into master May 30, 2025
0 of 11 checks passed
@awelzel awelzel deleted the topic/awelzel/zeek-field-directive branch May 30, 2025 14:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants