Connect with us

Entering square bracket in text

Discussion in 'Announcements, Suggestions & Feedback' started by Harald Kapp, Feb 9, 2018.

  1. Harald Kapp

    Harald Kapp Moderator Moderator

    8,829
    1,741
    Nov 17, 2011
    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?
     
  2. Ian

    Ian Administrator

    1,472
    425
    Aug 23, 2006
    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.
     
  3. Harald Kapp

    Harald Kapp Moderator Moderator

    8,829
    1,741
    Nov 17, 2011
    why, yes.
     
  4. Ian

    Ian Administrator

    1,472
    425
    Aug 23, 2006
    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.
     
  5. Harald Kapp

    Harald Kapp Moderator Moderator

    8,829
    1,741
    Nov 17, 2011
    [ and { and / and ]}\
    Really nice, thanks Ian.
     
  6. Ian

    Ian Administrator

    1,472
    425
    Aug 23, 2006
    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).
     
  7. Ian

    Ian Administrator

    1,472
    425
    Aug 23, 2006
    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.
     
  8. Harald Kapp

    Harald Kapp Moderator Moderator

    8,829
    1,741
    Nov 17, 2011
    The software seems to be better than you think: it amends the "missing" closing brackets ;)
     
    Ian likes this.
  9. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,085
    2,635
    Jan 21, 2010
    What's the problem with array[i]?
     
  10. Ian

    Ian Administrator

    1,472
    425
    Aug 23, 2006
    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.
     
  11. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,085
    2,635
    Jan 21, 2010
    You're giving away all my secrets :)

    Another way is if you set up the censoring to change \[ into [ and \] into ].
     
    Harald Kapp and Ian like this.
  12. Harald Kapp

    Harald Kapp Moderator Moderator

    8,829
    1,741
    Nov 17, 2011
    I actually had tried these escape sequences before posting.
     
  13. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,085
    2,635
    Jan 21, 2010
    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.
     
  14. FuZZ1L0G1C

    FuZZ1L0G1C

    280
    93
    Mar 25, 2014
    Browsing through EP's list of BB codes, the PLAIN tag may also work.
    As in this online test..
    Then enter inline[i]
     
    (*steve*), Ian and Harald Kapp like this.
  15. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,085
    2,635
    Jan 21, 2010
    Well spotted!

    array[i]

    That works too, great.

    [bold][plain]array[i][/plain][/bold]
     
    Last edited: Feb 20, 2018
  16. Ian

    Ian Administrator

    1,472
    425
    Aug 23, 2006
    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!
     
  17. Tha fios agaibh

    Tha fios agaibh

    1,839
    582
    Aug 11, 2014
    ±μΩ 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).
     
  18. Ian

    Ian Administrator

    1,472
    425
    Aug 23, 2006
    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 :).
     
  19. Harald Kapp

    Harald Kapp Moderator Moderator

    8,829
    1,741
    Nov 17, 2011
    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 ±).
     
  20. Tha fios agaibh

    Tha fios agaibh

    1,839
    582
    Aug 11, 2014
    Ok, I though there might be a trick to it.

    I'm using a mobile phone.
    Android 4.4.2
     
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...
Electronics Point Logo
Continue to site
Quote of the day

-