-
Notifications
You must be signed in to change notification settings - Fork 76
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
Docs - render object choices #4442
Conversation
{legends[c] ? ( | ||
<> | ||
{' - '} | ||
{legends[c]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
legends[c]
can be either a string or a list of strings (if it's something else it is broken), and it can contain Ansible markup.
I would probably normalize it to arrays in parseOptions
, and do something like
{legends[c].map((d) => (
<p>{this.applyDocFormatters(d)}</p>
))}
with it. Or maybe (to avoid strange formatting) don't add <p>
, and replace </p>
by <br>
? 🤷
previously, `choices` was a list of options, now it can also be an object of options: description, where description can be a string or an array of strings No-Issue
…ltiline description
@felixfontein can you re-check please? I updated choices to monospace the value, and show the potentially multiline (& formatted) description after. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides that, LGTM!
Co-authored-by: Felix Fontein <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested this and I'm not that familiar with React, but the way I understand the code it looks good :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Should have been an 'approve' review :D )
This comment was marked as outdated.
This comment was marked as outdated.
Backport to stable-4.8: 💚 backport PR created✅ Backport PR branch: Backported as #4489 🤖 @patchback |
* RenderPluginDoc - support `choices` as an object previously, `choices` was a list of options, now it can also be an object of options: description, where description can be a string or an array of strings No-Issue * PAUSED: Use `git resume` to continue working. [skip ci] * Choice, Legend - render a monospace choice name, and a potentially multiline description * also fix docs error rendering * Update src/components/render-plugin-doc/render-plugin-doc.tsx Co-authored-by: Felix Fontein <[email protected]> --------- Co-authored-by: Felix Fontein <[email protected]> (cherry picked from commit 269af3f)
* RenderPluginDoc - support `choices` as an object previously, `choices` was a list of options, now it can also be an object of options: description, where description can be a string or an array of strings No-Issue * PAUSED: Use `git resume` to continue working. [skip ci] * Choice, Legend - render a monospace choice name, and a potentially multiline description * also fix docs error rendering * Update src/components/render-plugin-doc/render-plugin-doc.tsx Co-authored-by: Felix Fontein <[email protected]> --------- Co-authored-by: Felix Fontein <[email protected]> (cherry picked from commit 269af3f)
* RenderPluginDoc - support `choices` as an object previously, `choices` was a list of options, now it can also be an object of options: description, where description can be a string or an array of strings No-Issue * PAUSED: Use `git resume` to continue working. [skip ci] * Choice, Legend - render a monospace choice name, and a potentially multiline description * also fix docs error rendering * Update src/components/render-plugin-doc/render-plugin-doc.tsx Co-authored-by: Felix Fontein <[email protected]> --------- Co-authored-by: Felix Fontein <[email protected]> (cherry picked from commit 269af3f)
* RenderPluginDoc - support `choices` as an object previously, `choices` was a list of options, now it can also be an object of options: description, where description can be a string or an array of strings No-Issue * PAUSED: Use `git resume` to continue working. [skip ci] * Choice, Legend - render a monospace choice name, and a potentially multiline description * also fix docs error rendering * Update src/components/render-plugin-doc/render-plugin-doc.tsx Co-authored-by: Felix Fontein <[email protected]> --------- Co-authored-by: Felix Fontein <[email protected]> (cherry picked from commit 269af3f) Co-authored-by: Martin Hradil <[email protected]>
ansible/ansible#81951 (comment)
In docs renderer,
choices
used to be an array of string values, that's still permissible,but now we also accept an object of
{ value: description }
instead of the array.This also changes the rendering of choices to be closer to https://docs.ansible.com/ansible/devel/collections/ansible/builtin/config_lookup.html#parameter-on_missing
=> monospace the choice value, "
value
: description"Before - Array:
Before - Object:
Now - Array:
Now - Object:
(also fixed the error message...
)