Post Reply 
How to escape square brackets?
07-13-2016, 10:19 AM
Post: #1
How to escape square brackets?
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
Find all posts by this user
Quote this message in a reply
07-13-2016, 12:09 PM
Post: #2
RE: How to escape square brackets?
[​i]Test[/​i]
Find all posts by this user
Quote this message in a reply
07-13-2016, 06:56 PM
Post: #3
RE: How to escape square brackets?
(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
Find all posts by this user
Quote this message in a reply
07-14-2016, 05:43 AM
Post: #4
RE: How to escape square brackets?
(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.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
07-14-2016, 12:10 PM
Post: #5
RE: How to escape square brackets?
Right, Joe.

But I agree a way to easily escape those markups would be nice.
Find all posts by this user
Quote this message in a reply
07-15-2016, 07:54 AM
Post: #6
RE: How to escape square brackets?
(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]
Find all posts by this user
Quote this message in a reply
07-15-2016, 08:16 AM
Post: #7
RE: How to escape square brackets?
Nice [i]dea :-).

Empty elements are unfortunately not allowed: [i[b/]]
Find all posts by this user
Quote this message in a reply
07-15-2016, 08:16 AM
Post: #8
RE: How to escape square brackets?
(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
Find all posts by this user
Quote this message in a reply
07-15-2016, 09:28 AM
Post: #9
RE: How to escape square brackets?
(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.
Find all posts by this user
Quote this message in a reply
07-16-2016, 03:12 PM
Post: #10
RE: How to escape square brackets?
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]
Visit this user's website Find all posts by this user
Quote this message in a reply
07-16-2016, 03:32 PM
Post: #11
RE: How to escape square brackets?
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.
Visit this user's website Find all posts by this user
Quote this message in a reply
07-16-2016, 07:15 PM
Post: #12
RE: How to escape square brackets?
(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
Find all posts by this user
Quote this message in a reply
07-16-2016, 07:37 PM
Post: #13
RE: How to escape square brackets?
(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!
Find all posts by this user
Quote this message in a reply
02-13-2021, 10:19 PM
Post: #14
RE: How to escape square brackets?
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^)

10B, 10BII, 10C, 11C, 12C, 14B, 15C, 16C, 17B, 18C, 19BII, 20b, 22, 25, 29C, 32SII, 35, 38G, 39G, 39gs, 41CV, 48G, 97
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)