-
Notifications
You must be signed in to change notification settings - Fork 512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: use stardoc proto output to generate markdown docs #1629
Conversation
Ah doh, need to fix a few test failures before review. |
The template language Stardoc uses (Velocity) is niche and fairly esoteric, and requires a lot of experimenting to understand how to make it produce the desired output. In particular, it largely assumes whitespace doesn't matter, which makes it a poor fit for generating Markdown, where whitespace often does matter. Instead, a small Python program is used to consume the binary proto output of Stardoc, which converts it to Markdown. This also makes it easier to customize the overall output and re-use code for the different types of objects rendered. The visible changes to the docs are: * Module extensions are now documented * Repository rules follow the style of the other generated docs * Fixed the rendering of pip_repository docs -- it had an h2 section which broke the section grouping of the API objects. * Puts some padding between the border and content for text in params/attrs/fields listings. Other notable changes: * Make RTD builds use bzlmod. This is necessary so that the pip extension can be documented. It loads `@pythons_hub//:interpreters.bzl`, but that repo is only created when bzlmod is enabled)
3174d4c
to
9634f3d
Compare
for some reason, it crashes the stardoc interpreter under bazel 6.
…on into docs.proto.template
Ok, tests fixed. Just windows flakes left. |
…on into docs.proto.template
Co-authored-by: Ignas Anikevicius <240938+aignas@users.noreply.github.com>
Co-authored-by: Ignas Anikevicius <240938+aignas@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and merging since the questions are very minor.
@@ -12,8 +12,10 @@ | |||
# See the License for the specific language governing permissions and | |||
# limitations under the License. | |||
|
|||
load("@docs_deps//:requirements.bzl", "requirement") | |||
load("@rules_python//python:pip.bzl", "compile_pip_requirements") | |||
load("@dev_pip//:requirements.bzl", "requirement") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: technically I think we don't need this macro anymore as the same alias labels can be accessed from WORKSPACE and MODULE.bazel setups.
The template language Stardoc uses (Velocity) is niche and fairly
esoteric, and requires a lot of experimenting to understand how to
make it produce the desired output. In particular, it largely assumes
whitespace doesn't matter, which makes it a poor fit for generating
Markdown, where whitespace often does matter.
Instead, a small Python program is used to consume the binary proto
output of Stardoc, which converts it to Markdown. This also makes it
easier to customize the overall output and re-use code for the different
types of objects rendered.
The visible changes to the docs are:
section which broke the section grouping of the API objects.
params/attrs/fields listings.
Other notable changes:
extension can be documented. It loads
@pythons_hub//:interpreters.bzl
, but that repo is only createdwhen bzlmod is enabled)