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

fix(docs): correct markdown syntax #533

Merged
merged 1 commit into from
Apr 26, 2021
Merged

Conversation

alexeagle
Copy link
Contributor

These mistakes are all visible when docs are displayed as markdown such as
on the recommended API docsite https://bazelbuild.github.io/rules_kotlin/kotlin

Mostly this is because stardoc doesn't automatically dedent multiline doc strings
(perhaps it should)

These mistakes are all visible when docs are displayed as markdown such as
on the recommended API docsite https://bazelbuild.github.io/rules_kotlin/kotlin

Mostly this is because stardoc doesn't automatically dedent multiline doc strings
(perhaps it should)
@cgruber
Copy link
Collaborator

cgruber commented Apr 24, 2021

Well that's gross. I wonder if one could run these through a de-intent function in-line. This makes the code substantially harder to read, and starlark is already crappy for that. grumble

@alexeagle
Copy link
Contributor Author

run these through a de-intent function in-line

I considered that (write a little dedent helper like python's textutil.dedent and copy-paste into every ruleset), but since stardoc is syntactic, I don't think it would help.

I'll put some time into the proper upstream fix (auto-dedent based on indent of the first line) similar to my bazelbuild/bazel@81e75cc

@alexeagle
Copy link
Contributor Author

also, a pattern we use in rules_nodejs to improve readability is to move all the docs to the top, e.g.

some.bzl

"some rules"

_DOC = """\
All about the foo rule.
It's great

    code sample
    goes here
"""

_ATTRS = {
    "bar": attr.string(
        doc = """\
bar is a useless attribute for sure
""",
        default = "thing",
    ),
}

def _foo(ctx):
    return []

foo = rule(_foo, doc = _DOC, attrs = _ATTRS)

@alexeagle
Copy link
Contributor Author

Filed bazelbuild/bazel#13402

and I'm attempting a fix upstream...

@cgruber cgruber merged commit 0f83962 into bazelbuild:master Apr 26, 2021
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.

3 participants