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

Add BBCode escape sequences for left/right brackets #56586

Merged
merged 1 commit into from
Jan 11, 2022

Conversation

dalexeev
Copy link
Member

@dalexeev dalexeev commented Jan 7, 2022

This PR adds [lb] and [rb] BBCodes, which are displayed as [ and ] respectively. This solution is consistent with the existing ones [lrm], [rlm], etc. BBCodes for Unicode control characters.

[b]text[/b] text
[lb]b[rb]text[lb]/b[rb] [b]text[/b]

Resolves #56556.

@dalexeev dalexeev requested a review from a team as a code owner January 7, 2022 09:11
@Chaosus Chaosus added this to the 4.0 milestone Jan 7, 2022
@bruvzg
Copy link
Member

bruvzg commented Jan 7, 2022

All of these codes probably should be added to the https://github.com/godotengine/godot-docs/blob/master/tutorials/ui/bbcode_in_richtextlabel.rst, BBCodes for the special characters is not currently documented anywhere.

@akien-mga
Copy link
Member

Seems fine to me. Another option would be to add support for \[ and \] to escape brackets, so this would become \[b\]text\[/b\].

That's maybe more common/expected at least now that Markdown is so popular, but might also be more difficult to implement, so I'm fine with using [lb] and [rb] for literal brackets.

@akien-mga
Copy link
Member

This should maybe be added to doc/tools/make_rst.py too for the class reference XML+BBCode to RST converter. So far we've always enclosed non-tag brackets with [code] [/code] (which treats everything within as literals), and that seems to be good enough, but it probably makes sense to have this feature there too.

There are more of our BBCode tags which are supported in RichTextLabel but not in make_rst.py, we should probably document that for doc writers (but that's outside the scope of this PR).

@dalexeev
Copy link
Member Author

dalexeev commented Jan 7, 2022

All of these codes probably should be added to the https://github.com/godotengine/godot-docs/blob/master/tutorials/ui/bbcode_in_richtextlabel.rst, BBCodes for the special characters is not currently documented anywhere.

If this PR is accepted, then I will open the corresponding PR in the godot-docs repository.

BBCodes for the special characters is not currently documented anywhere

They are documented, just the preview on GitHub does not display them.

@akien-mga akien-mga merged commit 019474f into godotengine:master Jan 11, 2022
@akien-mga
Copy link
Member

Thanks!

@akien-mga akien-mga added the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Jan 11, 2022
@dalexeev dalexeev deleted the rtl-bracket-escapes branch January 12, 2022 15:44
@akien-mga
Copy link
Member

Cherry-picked for 3.5.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Jan 12, 2022
@akien-mga akien-mga changed the title Add BBCode escape sequences Add BBCode escape sequences for left/right brackets Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants