bazelbuild / stardoc

Stardoc: Starlark Documentation Generator
Apache License 2.0
108 stars 45 forks source link

Add types in the parameter table when generating function document with Stardoc #73

Open lisaonduty opened 4 years ago

lisaonduty commented 4 years ago

We are trying to use Stardoc when generating documentation for our Bazel macros. I can get a table generated with parameter descriptions when follow the instruction here: Macro/Function documentation

But we would also like to add the parameter Type in the table. According to DocstringUtils.java it seems like we shall write the Type in parentheses after the parameter name but before colon, as this example:

another_parameter (unused, mutable): a parameter may be followed by additional attributes in parenthese

I have seen that it's possible to add a rule template to the stardoc() rule (attribute: func_template). I started to use an own copy of the default template to play around with: //stardoc:templates/markdown_tables/func.vm If I have understood correctly it doesn't seem that the attributes that I add in paranthese is fetched. And I don't think that I will be able to retreive that information by just updating the template. So I think that it will need an update in the Stardoc code for this, correct?! Is that something that is already planned? If I'm not correct then I would appreciate information how I can retreive the value of the attribute.

Thanks!