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

Automatically generate docs from component definitions #3256

Open
langestefan opened this issue Nov 25, 2024 · 3 comments
Open

Automatically generate docs from component definitions #3256

langestefan opened this issue Nov 25, 2024 · 3 comments

Comments

@langestefan
Copy link

langestefan commented Nov 25, 2024

I've been going through the code / docs quite a bit these past few days, because I'm adding some components I need.

Is your feature request related to a problem? Please describe.

Some components have no documentation (HeatingResistor for example), some components have incomplete documentation. Fields like states and connectors are manually typed and there is no standardization in how those parts of the docs are formatted. This makes it more difficult to find what you need.

Describe the solution you’d like

Instead of manually putting docstrings at the top of component definitions I suggest we directly generate documentation from the fields inside @mtkmodel. In particular description, bounds, guess, unit and any other fields that are available from the metadata: Symbolic Metadata. This avoids the need to type everything twice. We can still have a docstring at the top with a broader description. The fields can be automatically generated and put in a table for example.

This is an example of what I would like to achieve: https://developers.home-assistant.io/docs/core/entity/number

@ChrisRackauckas
Copy link
Member

Yes, definitely agreed this would be a nice thing to add. That's a more of an MTK issue to improve the macro though.

@langestefan
Copy link
Author

Let me know if you have any ideas and where I can contribute.

@ChrisRackauckas ChrisRackauckas transferred this issue from SciML/ModelingToolkitStandardLibrary.jl Dec 3, 2024
@ChrisRackauckas
Copy link
Member

You can programmatically generate docstrings like how it's done for Num:

https://github.com/JuliaSymbolics/Symbolics.jl/pull/649/files#diff-b8c0c7fd71b608d8ede7feac325fbfa572e06bd50bc32f0b835f3dbe61bb7fa5R174-R185

We can do this on the object that's generated by the macro to have it construct the docstring using the information in the object itself.

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

No branches or pull requests

2 participants