Skip to content
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

Use stardoc to automatically generate README.md #32

Merged
merged 5 commits into from
Aug 25, 2022
Merged

Conversation

benradf
Copy link
Member

@benradf benradf commented Aug 23, 2022

This change adds targets for automatically generating README.md from stardoc docstrings as requested in #24.

  • Verify that README.md is up-to-date: bazel test //sh/docs:check-readme
  • Update README.md if necessary: bazel run //sh/docs:update-readme

Due to a stardoc / bzlmod issue these targets are not run for "modules" pipelines on CI. They are also disabled for Windows because it fails to parse the docstring for some reason (I'm guessing line ending differences):

sh\repositories.bzl:4:5 line 22: closing docstring quote should be indented the same as the opening quote

@benradf benradf marked this pull request as ready for review August 24, 2022 12:43
Copy link
Member

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

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

Thank you, that looks good!

One comment about the shape of the function docstrings.

As written in an inline comment, as a next step this can be used to extend the README to include API docs like function parameters and also document features that are currently undocumented in the README, e.g. see #23 (comment).

@@ -347,14 +347,72 @@ _sh_posix_config = repository_rule(
)

def sh_posix_configure(name = "local_posix_config", register = True):
"""Autodetect local Unix commands.
"""## Usage
Copy link
Member

Choose a reason for hiding this comment

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

It's a bit unusual to have function or rule docstrings start with a heading like that.
rules_nixpkgs generates such headings by placing them into the module docstring, e.g. here. Could the same work here, too?

Relatedly, rules_nixpkgs uses templates that also generate parameter lists and the like, e.g. here. That would be a nice improvement over the current README of rules_sh.

That said, I'm happy to leave these for a follow-up PR and already merge this one as is. After all this one achieves the goal of generating the current README from Startdoc.

Copy link
Member Author

@benradf benradf Aug 25, 2022

Choose a reason for hiding this comment

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

Sounds good - I'll look into this tomorrow if I have time. I've created #33 to track it. Thanks for approving the PR.

@benradf benradf merged commit 3dc487e into master Aug 25, 2022
@mergify mergify bot deleted the autogen-stardoc branch August 25, 2022 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants