Skip to content

cmd/doc: generate whole stdlib documentation - #564

Merged
samalba merged 3 commits into
dagger:mainfrom
samalba:cmd-doc-gen
Jun 7, 2021
Merged

samalba merged 3 commits into
dagger:mainfrom
samalba:cmd-doc-gen

Conversation

@samalba

@samalba samalba commented Jun 4, 2021

Copy link
Copy Markdown
Contributor

Adds support for generating whole stdlib documentation (markdown, json, text) and write it to the local filesystem:

Example:

dagger doc --output ~/my-docs --format json

cc @aluzzardi @slumbering for docs website integration

PS: I've also fixed formatting and typos on aws packages (aws/rds and aws/elb were broken, cc @TomChv)

@aluzzardi

Copy link
Copy Markdown
Contributor

Hey @samalba -- I just tried this, works mostly good!

Screen Shot 2021-06-04 at 2 34 28 PM

A few things:

  • Nested packages don't show up correctly. For instance, aws is there twice: once for aws.md, and once again as a navbar item for aws/XXXX.md. You can click on the first one to see aws.md, the second one is not clickable (by design, it's a "category", can't have content)
  • There are empty entries. For instance there's a js.md with nothing inside (because there's just js/yarn, no CUE file in js)
  • We should probably put the canonical package path in the title (right now it says Package aws/cloudformation -- I think Package dagger.io/aws/cloudformation` would be better, easier to copy/paste)

NOTE: It's very likely we'll end up doing custom stuff for docs generation that only works with our own website (not generic markdown anymore). For instance generating _category_.json files for sub-packages, adding special annotations to md files to customize the title, maybe even adding React code to .md files. We have to decide whether doing that in dagger or going through json and doing that in a different tool.

You can try this yourself:

  • mkdir -p ./docs/reference/universe
  • Put this in ./docs/reference/_category_.json
{
  "label": "Reference",
  "position": 5,
  "collapsed": true
}
  • Put this in ./docs/reference/universe/_category_.json:
{
  "label": "Universe",
  "position": 1,
  "collapsed": true
 }
  • dagger doc --output ./docs/reference/universe --format md
  • make docs

@aluzzardi

Copy link
Copy Markdown
Contributor

@samalba Also -- is it possible to extract the package level documentation? (just like godoc does). As in, not the docs of cloudformation.#Stack but the doc of cloudformation itself.

I think it would be extremely useful.

We could explain high level what the package does (e.g. cloudformation) and put a small example at the top:

image

@samalba

samalba commented Jun 6, 2021

Copy link
Copy Markdown
Contributor Author

@samalba Also -- is it possible to extract the package level documentation? (just like godoc does). As in, not the docs of cloudformation.#Stack but the doc of cloudformation itself.

Yes I thought it was already the check, let me check

@samalba

samalba commented Jun 7, 2021

Copy link
Copy Markdown
Contributor Author

Yes I confirm this is supported:

Screen Shot 2021-06-07 at 10 26 25 AM

Screen Shot 2021-06-07 at 10 26 38 AM

Like all other doc strings, the package doc is expected to be right above the package name.

@samalba
samalba merged commit a002d2e into dagger:main Jun 7, 2021
@samalba
samalba deleted the cmd-doc-gen branch June 7, 2021 08:27
This was referenced Jun 8, 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.

2 participants