How to change documentation of widget components in detail

Hello,

I want to include some examples and additional text regarding widget components like oh-context.
I followed the link on the existing documentation page to this link:

https://github.com/openhab/openhab-webui/edit/main/bundles/org.openhab.ui/doc/components/oh-context.md

But there is a lot of “generated text”. So I’m not sure, what in this file I can change, so it will persist …

  1. Can I add text to the componentDescription?
  2. Can I add additional text to the PropDescription?
    Or will this all overwritten with a new generation of this page?

There is a documentation in the Repo which describes how this can bei done:

Look in particular at " Edit or add a widget" which mentions

“In case you want to edit widget parameters, make sure to adjust the widget’s parameter definition in web/src/assets/definitions/widgets/system. After editing those definitions, it is required to regenerate the component docs, see Documentation & Resources.”

Thanks stefan! But I must say “Ich verstehe nur Bahnhof”. This is too technical for me. I have no clue what is NPM and vue …

Fair enough, don’t worry. This documentation of widgets is actually directly generated from the code to match the properties of the widgets to the code and I agree this is only suited to Developers. If you want to provide examples you can always write tutorials or @rlkoshak might have a better idea where this could be a good fit in the documentation?

@stefan.hoehn Leave this to me, I don’t think anyone else is really confident with the generation of the UI component docs.

Hi @SiggiFR,

Yes. Depending on the amount we can either add it to the widgets config definition in openhab-webui/bundles/org.openhab.ui/web/src/assets/definitions/widgets/system/index.js at 1e4e69e0189ffcc67648f60366278ca3100fdc09 · openhab/openhab-webui · GitHub or to the .md you linked.
In the .md file, you can add to the auto-generated component description or replace it, see:

<!-- Note: you can overwrite the definition-provided description and add your own intro/additional sections instead -->
<!-- DO NOT REMOVE the following comments if you intend to keep the definition-provided description -->
<!-- GENERATED componentDescription -->
Non-rendered component with functions, constants, and scoped variables for widgets
<!-- GENERATED /componentDescription -->

To add something to the description, put it below the last comment.

Not inside the markdown file - we can either add extensive text below the generated stuff or add it to the oh-context param definition in openhab-webui/bundles/org.openhab.ui/web/src/assets/definitions/widgets/system/context.js at main · openhab/openhab-webui · GitHub.

I would suggest you create a draft PR with your changes, then I can help you.

2 Likes

Ok Florian,

I will try it within the next week :slight_smile:

2 Likes

…well unless, you know, ‘anyone else’ made the thing :slight_smile:

You can just ask me for these things, it’s not like I disappeared! :wink:

So it’s not perfect, but the point was to have some templates with some dynamic/don’t-touch parts and some other parts that you could simply modify in Markdown.

When you edit these files you can’t edit anything between

<!-- GENERATED xyz -->
...
<!-- GENERATED /xyz -->

Because it’s going to be regenerated when you run the generate script

So:

no, you can’t do that. It will be overwritten the next time you run the script… which should be ideally run on every build by the build server. Running it from time to time only goes so far.

But anything outside these “GENERATED” comments you can alter and in fact add images, like screenshots, for example:

or

1 Like

This was more meant about those who already were in this thread, I did not expect you to join just after me answering here :wink:

I wrote that you need to stay outside of the GENERATED comments:

This is something I am still thinking about how to do that, as the changes somehow need to be committed — with https://github.com/openhab/openhab-webui/pull/2830 GHA will verify that there are no modified files by the build, so we could make the build update the component docs and if there are changes, the build will fail and one is forced to update the component docs locally and commit them. WDYT?

I did it! Only a small change. To see how it works … :slight_smile:
You will see it https://github.com/openhab/openhab-webui/pull/2868

4 Likes