Entering square bracket in text

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

  1. Harald Kapp

    Harald Kapp Moderator Moderator

    Joined:
    Nov 17, 2011
    Messages:
    8,595
    Likes Received:
    1,663
    Location:
    Germany-Europe-Earth-Sol System-Milky Way-Laniakea
    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?
     
    Harald Kapp, Feb 9, 2018
    #1
  2. Harald Kapp

    Ian Administrator

    Joined:
    Aug 23, 2006
    Messages:
    1,460
    Likes Received:
    413
    Location:
    UK
    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, Feb 9, 2018
    #2
  3. Harald Kapp

    Harald Kapp Moderator Moderator

    Joined:
    Nov 17, 2011
    Messages:
    8,595
    Likes Received:
    1,663
    Location:
    Germany-Europe-Earth-Sol System-Milky Way-Laniakea
    why, yes.
     
    Harald Kapp, Feb 9, 2018
    #3
  4. Harald Kapp

    Ian Administrator

    Joined:
    Aug 23, 2006
    Messages:
    1,460
    Likes Received:
    413
    Location:
    UK
    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.
     
    Ian, Feb 9, 2018
    #4
  5. Harald Kapp

    Harald Kapp Moderator Moderator

    Joined:
    Nov 17, 2011
    Messages:
    8,595
    Likes Received:
    1,663
    Location:
    Germany-Europe-Earth-Sol System-Milky Way-Laniakea
    [ and { and / and ]}\
    Really nice, thanks Ian.
     
    Harald Kapp, Feb 9, 2018
    #5
  6. Harald Kapp

    Ian Administrator

    Joined:
    Aug 23, 2006
    Messages:
    1,460
    Likes Received:
    413
    Location:
    UK
    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, Feb 9, 2018
    #6
  7. Harald Kapp

    Ian Administrator

    Joined:
    Aug 23, 2006
    Messages:
    1,460
    Likes Received:
    413
    Location:
    UK
    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.
     
    Ian, Feb 9, 2018
    #7
  8. Harald Kapp

    Harald Kapp Moderator Moderator

    Joined:
    Nov 17, 2011
    Messages:
    8,595
    Likes Received:
    1,663
    Location:
    Germany-Europe-Earth-Sol System-Milky Way-Laniakea
    The software seems to be better than you think: it amends the "missing" closing brackets ;)
     
    Harald Kapp, Feb 9, 2018
    #8
    Ian likes this.
  9. Harald Kapp

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

    Joined:
    Jan 21, 2010
    Messages:
    24,757
    Likes Received:
    2,538
    Location:
    Mid way between Beijing and the Ronne Ice Shelf
    What's the problem with array[i]?
     
    (*steve*), Feb 9, 2018
    #9
  10. Harald Kapp

    Ian Administrator

    Joined:
    Aug 23, 2006
    Messages:
    1,460
    Likes Received:
    413
    Location:
    UK
    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.
     
    Ian, Feb 9, 2018
    #10
  11. Harald Kapp

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

    Joined:
    Jan 21, 2010
    Messages:
    24,757
    Likes Received:
    2,538
    Location:
    Mid way between Beijing and the Ronne Ice Shelf
    You're giving away all my secrets :)

    Another way is if you set up the censoring to change \[ into [ and \] into ].
     
    (*steve*), Feb 9, 2018
    #11
    Harald Kapp and Ian like this.
  12. Harald Kapp

    Harald Kapp Moderator Moderator

    Joined:
    Nov 17, 2011
    Messages:
    8,595
    Likes Received:
    1,663
    Location:
    Germany-Europe-Earth-Sol System-Milky Way-Laniakea
    I actually had tried these escape sequences before posting.
     
    Harald Kapp, Feb 9, 2018
    #12
  13. Harald Kapp

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

    Joined:
    Jan 21, 2010
    Messages:
    24,757
    Likes Received:
    2,538
    Location:
    Mid way between Beijing and the Ronne Ice Shelf
    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*), Feb 10, 2018
    #13
  14. Harald Kapp

    FuZZ1L0G1C

    Joined:
    Mar 25, 2014
    Messages:
    279
    Likes Received:
    92
    Location:
    Johannesburg North-East
    Browsing through EP's list of BB codes, the PLAIN tag may also work.
    As in this online test..
    Then enter inline[i]
     
    FuZZ1L0G1C, Feb 20, 2018
    #14
    (*steve*), Ian and Harald Kapp like this.
  15. Harald Kapp

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

    Joined:
    Jan 21, 2010
    Messages:
    24,757
    Likes Received:
    2,538
    Location:
    Mid way between Beijing and the Ronne Ice Shelf
    Well spotted!

    array[i]

    That works too, great.

    [bold][plain]array[i][/plain][/bold]
     
    Last edited: Feb 20, 2018
    (*steve*), Feb 20, 2018
    #15
  16. Harald Kapp

    Ian Administrator

    Joined:
    Aug 23, 2006
    Messages:
    1,460
    Likes Received:
    413
    Location:
    UK
    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!
     
    Ian, Feb 20, 2018
    #16
  17. Harald Kapp

    Tha fios agaibh

    Joined:
    Aug 11, 2014
    Messages:
    1,730
    Likes Received:
    569
    ±μΩ 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).
     
    Tha fios agaibh, Feb 20, 2018
    #17
  18. Harald Kapp

    Ian Administrator

    Joined:
    Aug 23, 2006
    Messages:
    1,460
    Likes Received:
    413
    Location:
    UK
    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 :).
     
    Ian, Feb 20, 2018
    #18
  19. Harald Kapp

    Harald Kapp Moderator Moderator

    Joined:
    Nov 17, 2011
    Messages:
    8,595
    Likes Received:
    1,663
    Location:
    Germany-Europe-Earth-Sol System-Milky Way-Laniakea
    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 ±).
     
    Harald Kapp, Feb 20, 2018
    #19
  20. Harald Kapp

    Tha fios agaibh

    Joined:
    Aug 11, 2014
    Messages:
    1,730
    Likes Received:
    569
    Ok, I though there might be a trick to it.

    I'm using a mobile phone.
    Android 4.4.2
     
    Tha fios agaibh, Feb 20, 2018
    #20
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...