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

BBCode is inconsistent when used in inspector tooltips with @export variables. #94336

Open
wyattbiker opened this issue Jul 14, 2024 · 3 comments

Comments

@wyattbiker
Copy link

wyattbiker commented Jul 14, 2024

Tested versions

v4.3.beta2.official [b75f048]

System information

Linux Kubuntu 23.04 KDE Plasma Version: 5.27.4 KDE Frameworks Version: 5.104.0 Qt Version: 5.15.8

Issue description

Adding tooltips to @export variables does not support many bbcodes.

image

Steps to reproduce

Create an empty 2D scene. E.g. Control
Add an external script to it. E.g. control.gd
Add the following to script and save:

extends Control

## [p]Hello[/p]Notice no paragraph.
## [bgcolor=RED]Should be background red.[/bgcolor][br][i][color=green]THIS IS ITALIC AND GREEN.[/color][/i]
## [br]Click for more info url works [url=https://yahoo.com]https://yahoo.com[/url]
## [p][right]This is a paragraph but did not break[/right]
## [br][font_size=30]Should be 10[/font] font
## [br]Strangely enough the [ br ] acts as [br] paragraph, although not documented.
@export var maximum_speed:int=100

Now hover over the exported variable maximum_speed, in the inspector. You will see that only some of the bbcodes work. For example[p], [bgcolor], [right]are ignored and shown as text. As a matter of fact I have discovered an undocumented [br] break in lieu of [p] paragraph code.

Minimal reproduction project (MRP)

Test project Archive.zip

@dalexeev
Copy link
Member

See the documentation:

Godot's class reference supports BBCode-like tags. They add nice formatting to the text which could also be used in the documentation. See also class reference bbcode. Note that this is slightly different from the RichTextLabel BBCode.

In the future, we could unify the RichTextLabel BBCode / Editor Help tags parser, since there is code duplication.

@Calinou
Copy link
Member

Calinou commented Jul 14, 2024

Note that it might not be worth supporting all BBCode tags in documentation, as they can encourage non-standard theming that can be difficult to read on some backgrounds ([color]).

Instead, the use of a standard syntax including admonitions should be encouraged as much as possible. This would also help third-party docs feel more like built-in documentation, leading to better integration of add-ons.

@wyattbiker
Copy link
Author

I agree, some of the codes may not be suitable for tooltips. I did not realize there was an alternate document for describing these, as I was just using the RichTextLabel bbcode documentation. The paragraph mentioning alternate usages is not obvious in https://docs.godotengine.org/en/stable/tutorials/ui/bbcode_in_richtextlabel.html

Maybe a See Also blue box highlighting or enhancing that paragraph would suffice.

Something like

Note that the BBCode tags can also be used to some extent in tooltips for @export script variables as well as in the XML source of the class reference. For more information, see Class reference primer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants