Repository: Cog-Creators/Red-DiscordBot

Issue:
Formatting utils escapes if nested
### What Red version are you using?

dev

### What were you trying to do?

Just running help.

### What did you expect to happen?

No escaping.

### What actually happened?

Text being escaped while it should not. Seems to be related off #5435.
![image](https://user-images.githubusercontent.com/46051820/154867635-d214fa16-0a01-437e-a9ff-21999c33b639.png)
![image](https://user-images.githubusercontent.com/46051820/154867637-5a5fc412-7797-471f-8829-2f6d7bfcc2da.png)


### How can we reproduce this error?

Run any command that uses the formatters edited in the said PR.

### Anything else?

_No response_


Discussion:
Nesting two formatters (IE `bold(underline(text))`) causes the inner one to be "undone" by the outer one's automatic escaping of any formatting characters. #5435 replaced many literal `**__{text}__**`s with these formatter functions, which broke the formatting.

This issue only affects dev right now, however it should be fixed before the next release.

Resolving patch:
diff --git a/redbot/core/commands/help.py b/redbot/core/commands/help.py
--- a/redbot/core/commands/help.py
+++ b/redbot/core/commands/help.py
@@ -401,9 +401,11 @@ def shorten_line(a_line: str) -> str:
                 )
                 for i, page in enumerate(pagify(subtext, page_length=500, shorten_by=0)):
                     if i == 0:
-                        title = bold(underline(_("Subcommands:")))
+                        title = bold(underline(_("Subcommands:")), escape_formatting=False)
                     else:
-                        title = bold(underline(_("Subcommands: (continued)")))
+                        title = bold(underline(_("Subcommands:")), escape_formatting=False) + _(
+                            " (continued)"
+                        )
                     field = EmbedField(title, page, False)
                     emb["fields"].append(field)
 
@@ -576,9 +578,11 @@ def shorten_line(a_line: str) -> str:
                 )
                 for i, page in enumerate(pagify(command_text, page_length=500, shorten_by=0)):
                     if i == 0:
-                        title = f"{underline(bold(_('Commands:')))}"
+                        title = underline(bold(_("Commands:")), escape_formatting=False)
                     else:
-                        title = f"{underline(bold(_('Commands: (continued)')))}"
+                        title = underline(bold(_("Commands:")), escape_formatting=False) + _(
+                            " (continued)"
+                        )
                     field = EmbedField(title, page, False)
                     emb["fields"].append(field)
 
@@ -628,9 +632,9 @@ async def format_bot_help(self, ctx: Context, help_settings: HelpSettings):
             for cog_name, data in coms:
 
                 if cog_name:
-                    title = f"{underline(bold(cog_name))}:"
+                    title = underline(bold(f"{cog_name}:"), escape_formatting=False)
                 else:
-                    title = f"{underline(bold(_('No Category:')))}"
+                    title = underline(bold(_("No Category:")), escape_formatting=False)
 
                 def shorten_line(a_line: str) -> str:
                     if len(a_line) < 70:  # embed max width needs to be lower


Test patch: