HP Forums

Full Version: How to escape square brackets?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I wonder if there is an official way of using square brackets in posts without having them interpreted as formatting tags. While there is no problem writing something like [A] or [C] (since there is no respective command) it seems to be impossible to do so with a B between square brackets because this is interpreted as the tag for bold text.

The only solution I found is using additional "bold" tags around the text:

Code:
Press [b][B][/b] to start

The result then looks like this:

Press [B] to start

But what do you do if you want an "I" in square brackets? OK, you can use the same trick with the tag for italics, but I think there must be a general solution that prevents text in square brackets to be interpreted as formatting tags.

Dieter
[​i]Test[/​i]
(07-13-2016 12:09 PM)Thomas Radtke Wrote: [ -> ][​i]Test[/​i]

OK, there seems to be an invisible character between the slash and the i. Which one is it?

Dieter
(07-13-2016 06:56 PM)Dieter Wrote: [ -> ]
(07-13-2016 12:09 PM)Thomas Radtke Wrote: [ -> ][​i]Test[/​i]

OK, there seems to be an invisible character between the slash and the i. Which one is it?

Dieter

"Zero-Width Space", hex code 200B.
Right, Joe.

But I agree a way to easily escape those markups would be nice.
(07-14-2016 12:10 PM)Thomas Radtke Wrote: [ -> ]Right, Joe.

But I agree a way to easily escape those markups would be nice.

Try this:
[i[b][/b]]Test[/i]

It should come out like this:
[i]Test[/i]

(Hat tip to Garth Wilson for the idea]
Nice [i]dea :-).

Empty elements are unfortunately not allowed: [i[b/]]
(07-14-2016 05:43 AM)Joe Horn Wrote: [ -> ]"Zero-Width Space", hex code 200B.

Fine. But how do I enter this? The Windows character map for Arial does not contain 200B, only 200C and 200D.
But these seem to work as well: [‍i]Test[/‍i] [A] [‍B] [C]. Is there an easier way than copying this character from the character map?

(07-15-2016 07:54 AM)EdS2 Wrote: [ -> ]Try this:
[i[b][/b]]Test[/i]

It should come out like this:
[i]Test[/i]

(Hat tip to Garth Wilson for the idea]

So the idea is to include another formatting tag within the tag.
[A] [B] [C] [I]. Seems to work as well, thank you.

Dieter
(07-15-2016 08:16 AM)Dieter Wrote: [ -> ]Is there an easier way than copying this character from the character map?
I don't know of any. There should be a way to enter unicode glyphs in a myBB conforming way with no tricks.
You can enter an HTML character code.

ie: zero width space is: &​#8203; (I embedded one inside itself to keep that from disappearing.)

[b]test[&​#8203;/b] produces

[b]test[​/b]
By the way, just typing a [b] shouldn't be a problem. ie

Press [B] to start

a[b] = j[i];

I didn't do anything special on these. Simple code-like references to [b] etc. work simply because I didn't use any closing tags. As long as you don't mix corresponding text formatting into the same post, they'll work without modifications. If you do want to use them along with bold and italic in the same post, then you'll want to sprinkle in the zero width spaces.
(07-16-2016 03:12 PM)Dave Hicks Wrote: [ -> ]You can enter an HTML character code.
ie: zero width space is: &​#8203;

Ah, that's good to know. Not only for this purpose.

(07-16-2016 03:12 PM)Dave Hicks Wrote: [ -> ]test[&​#8203;/b] produces

[b]test[​/b]

As you can see here, this works fine... unless some [b]bold text follows. ;-)
Maybe the best idea is including the zero-space character both in [​b] and [/​b].

Dieter
(07-16-2016 03:12 PM)Dave Hicks Wrote: [ -> ]You can enter an HTML character code.

ie: zero width space is: &​#8203; (I embedded one inside itself to keep that from disappearing.)
That was too easy X). Thanks!
RE: How to escape square brackets?

Look, even when a left bracket is immediately followed by a right bracket, the two brackets do not touch.
I feel there may be ample space to escape through either the top or bottom opening between the two brackets!

B^)
Reference URL's