-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add metadata to docs output #4754
Comments
I'd like to proceed with this. Here is a more detailed plan on how this can be implemented. For a minimum, I think the following properties should be available to the docs generator. This meta data can be published as a header and also be used in other places (for example meta tags, page title).
Besides that bare minimum, the following options might also be useful:
Technically, most of this information could usually be extracted automatically from the git workdir and Visually, I'd propose to add the name and version (plus optional other data such as |
Currently, the API docs generated by
crystal doc
contain only minimal information about what it actually documents: apart from the homepage with the obviousREADME
, all other pages only show the repository name in the page title - but this is unreliable because the docs generator takes the first github or gitlab remote URL which might point to an unrelated mirror or not be present at all. And such a HTML page title might not always be visible to the reader. Other important information like the API version needs to be inferred from context, e.g. an URL likecrystal-lang.org/api/0.23.0/
. Such context cannot necessarily be assumed to be available and/or easily accessible to the reader.I suggest that every docs page should have at least a reference to the name and version of the documented API and link to an authoritative website. Preferably in a spot with high visibility like the left top corner. Additional information like author, license etc. would also be welcome, but does not need to be displayed as prominently.
A great source for this data would be the
shard.yml
file available in almost all crystal packages. The compilerdeps
tool already directly integrates theshards
binary which is distributed as part of the crystal package. To read metadata from the shard file however would require to include the shard spec parser into the standard library.It should also be possible to provide the metadata as command line arguments to the docs generator, if there is no
shards.yml
file or to explicitly overwrite specific values. The stdlib (which does not have ashards.yml
file) could be handled as a special case with hardcoded metadata.The text was updated successfully, but these errors were encountered: