Maker Pro
Maker Pro

Entering square bracket in text

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,699
Joined
Nov 17, 2011
Messages
13,699
How do I enter square brackets within the text body of a post? It seems the forum software tries to interpret these brackets as formatting commands and deletes the if it can't evaluate them in a meaningful way.
What I want to type is e.g.
Code:
array[i]
My current circumvention is using a code box as above. I'm sure there is a more elegant way, but which one?
 

Ian

Administrator
Aug 23, 2006
1,486
Joined
Aug 23, 2006
Messages
1,486
Unfortunately, the [ i ] tag is the BBCode for italics, so I don't think there's way to use it within a post, unless it's in a code box or has additional spacing to break the tag.

I've been testing out the next version of XenForo and they have an "inline" code option (and there's a plugin for this version to do the same). This means that you can insert code snippets within the body of text. Here's an example image I found on their forum:

upload_2017-5-23_18-15-29.png

Would that be a useful workaround? I don't think it's something I could fix entirely, but adding inline code options may help. If it's not much different to using the existing code tags, I'll leave it be - but I'm happy to add it if it's useful.
 

Ian

Administrator
Aug 23, 2006
1,486
Joined
Aug 23, 2006
Messages
1,486
Excellent :D. I've installed this now.

Here is is in action if you want to use the [i] string in a post :).

You just need to wrap the inline code with the [ICODE] tags. I'll see if I can add it to the WYSIWYG editor.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,699
Joined
Nov 17, 2011
Messages
13,699
[ and { and / and ]}\
Really nice, thanks Ian.
 

Ian

Administrator
Aug 23, 2006
1,486
Joined
Aug 23, 2006
Messages
1,486
No problem! Glad that we've got a quick fix in place :)

I'm having problems adding the code in to the editor, but I'll persist and see if I can get it in to the "insert..." menu. If I can't get it there, then it may need to be used manually for the moment (until we upgrade to XF2 in the future).
 

Ian

Administrator
Aug 23, 2006
1,486
Joined
Aug 23, 2006
Messages
1,486
I should also mention that square brackets should normally work (i.e. [ and { and / and ]), but they'll disappear when using one of the tags listed on this page:

https://www.electronicspoint.com/help/bb-codes

[i] [b] [u] will probably be the most common ones, especially "i" in programming related posts. It's a shame that the forum software doesn't invoke them only when there's a matching closing bracket, as that would avoid the problem.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,699
Joined
Nov 17, 2011
Messages
13,699
It's a shame that the forum software doesn't invoke them only when there's a matching closing bracket,
The software seems to be better than you think: it amends the "missing" closing brackets ;)
 
  • Like
Reactions: Ian

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
What's the problem with array[i]?
 

Ian

Administrator
Aug 23, 2006
1,486
Joined
Aug 23, 2006
Messages
1,486
What's the problem with array[i]?

I had to view your post to see how you did that! A very clever workaround using invisible [size=3] tags within the brackets to break the auto parsing :D.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
You're giving away all my secrets :)

Another way is if you set up the censoring to change \[ into [ and \] into ].
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
I actually had tried these escape sequences before posting.

Yeah, they're not implemented here, but there is a way in the software to do it.

The "censoring" allows the operator of the software to provide a list of words and what they will be rendered as.

You might have "shit" become "****", to limit the effect of poor use of language. It's actually pretty ineffective at that because people will always come up with a way to say s.h.i.t, s#it, sh1t, etc., but it is useful for other things. I'm not certain, but it may be used to transform :-) into :).

It does the change on the fly, after any markup has been performed, so the transformation itself can't generate tags.

Censoring /[ to [ this doesn't actually change the text, but it does change what you see. It's not an escape as such because there \ isn't a general "take what follows as literal" operator.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Well spotted!

array[i]

That works too, great.

[bold][plain]array[i][/plain][/bold]
 
Last edited:

Ian

Administrator
Aug 23, 2006
1,486
Joined
Aug 23, 2006
Messages
1,486
Browsing through EP's list of BB codes, the PLAIN tag may also work.
As in this online test..
Then enter inline[i]

Oh boy, do I feel silly - the ability has been there all along! I even had a good search of the developer forums to see how to do this :eek:. Well, I've certainly learned something today :D. Good catch @FuZZ1L0G1C!
 

Tha fios agaibh

Aug 11, 2014
2,252
Joined
Aug 11, 2014
Messages
2,252
±μΩ I have a dumb question to ask.

How do you enter the characters ±μΩ on the fly while typing?

When I try to enter them they always pop up at the beginning like this (see first 3 characters).
 

Ian

Administrator
Aug 23, 2006
1,486
Joined
Aug 23, 2006
Messages
1,486
±μΩ I have a dumb question to ask.

How do you enter the characters ±μΩ on the fly while typing?

When I try to enter them they always pop up at the beginning like this (see first 3 characters).

It should normally enter them where the cursor is (here's my test in Chrome on Windows 10: Ωμ±). If it's not doing that, I think it may be down to the browser - could you please let me know what you are using (and OS) and I'll see if I can replicate it and get it working :).
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,699
Joined
Nov 17, 2011
Messages
13,699
I want to see them here: ±Ωμ - Works like a charm in Chrome under Windows 7 - µ even via keyboard (no need to access the icon, but need icons for Ω and ±).
 
Top