Shop OBEX P1 Docs P2 Docs Learn Events
An alternative to [noparse] — Parallax Forums

An alternative to [noparse]

Without the [noparse] tag (which we've been denied due to a "security issue"), it's hard to explain to people why and how to use things like[code]tags. A solution is to use unicode alternatives to the left and right square brackets: [ (U+FF3B) and ](U+FF3D). They look just like ASCII square brackets, but have extra spaces in their glyphs. And the forum software will not see them as brackets and try to parse what's inside of them.

So you can use them like this, for example:

Yo, noobie! Put your code in code blocks so we can read it:

[code]
Noobie code
[/code]

The simplest way to use them is to grab them here by copying and pasting: [ ]

-Phil

Comments

  • Thanks Phil! How about the “not simplest way” for those of us who are curious?

    Paul
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2020-12-19 01:53
    diggiedoc wrote:
    How about the “not simplest way” for those of us who are curious?
    Google "unicode brackets." Scroll down the search result (https://unicode-search.net/unicode-namesearch.pl?term=BRACKET) until you find something that looks like an ASCII bracket but isn't. Copy and paste from there. That's what I did.

    Or you can enter them as HTML literals:

    [ ]

    But don't copy and paste these strings, since I used a unicode ampersand to prevent the strings from being interpreted!

    -Phil
  • Awesome! That’s exactly what I was asking for! [typed them in manually!]
  • These are interesting... ︷ and ︸
  • But shouldn't you include an explicit warning that these counterfeit Unicode brackets aren't real brackets so people aren't disappointed when they find copy-and-pasting them doesn't work?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2020-12-19 06:32
    But shouldn't you include an explicit warning that these counterfeit Unicode brackets aren't real brackets so people aren't disappointed when they find copy-and-pasting them doesn't work?
    Yes. Good point! Thanks! :)

    -Phil
  • On a different forum, I used to do the & thing to display the square brackets.

    But it seemed to confuse the newbs even more, so now I just do this:

    {code}
    put your code inside code tags, like I've done here. But use square brackets in place of the curly ones in this example.
    {/code}
  • This discussion sort of begs the question; why is [noparse][/noparse] a security risk?
  • doggiedoc wrote: »
    This discussion sort of begs the question; why is [noparse][/noparse] a security risk?

    Because Vanilla is peak crustware, I'd assume. Then again, there aren't a lot of good free choices.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2020-12-19 22:18
    Here's an even better way. In unicode there's what's called a zero width space: &​#x200B; You can embed this wherever you don't want the forum parser to interpret the strings it's embedded in, since it breaks up the continuity of the string, but without displaying anything. So a code block header doesn't need to use unicode brackets, just a zero-width space after the opening bracket, thus:

    [&​#x200B;code] and [&​#x200B;/code]

    to yield:

    [​code]
    Noobie code
    [​/code]

    I also used it in the first line of this post after the first ampersand, so the zero-width coding could be displayed without being interpreted.

    -Phil

  • Problem is that most people will copy paste it and then wonder why it doesn't work
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2020-12-19 22:23
    Wuerfel_21 wrote:
    Problem is that most people will copy paste it and then wonder why it doesn't work.
    Not if they're warned not to.

    -Phil
  • Wuerfel_21 wrote:
    Problem is that most people will copy paste it and then wonder why it doesn't work.
    Not if they're warned not to.

    -Phil

    But then it's not really much better, is it?

    Here's another idea I got though:
    Just screengrab the editor
    

    2020-12-19%2023.52.43%20forums.parallax.com%200f19ec4c141b.png
  • Wuerfel_21 wrote:
    But then it's not really much better, is it?
    Actually it is, because it at least looks like what it's supposed to. All the workarounds have caveats, like "replace the the braces in {code} with brackets," or "remove the spaces from [ code ]."

    -Phil
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2020-12-20 00:33
    Okay, here's one that works and allows copy/paste like one would expect it to:

    [[b][/b]code] and [[b][/b]/code]

    [code]
    Noobie code
    [/code]

    No caveats required!

    -Phil
  • nice one, but why not simple tell them to click on the 'C' in the toolbar of the editor?

    Mike
  • msrobots wrote:
    nice one, but why not simple tell them to click on the 'C' in the toolbar of the editor?
    Who uses the smart editor? I sure don't.

    -Phil
  • ?

    Is there more then one editor in the forum?

    Mike
  • msrobots wrote:
    Is there more then one editor in the forum?
    I think there used to be. But I just now see the toolbar on what I thought was the plain-text editor. It's so inobtrusive, I never noticed it, never used it. Wow!

    -Phil
  • Fun fact: There's a button to embed youtube videos in that tool bar. It doesn't work. The actual way to embed a youtube video is to just put it's URL in the post and it happens automagically. Forum crustware rolls again.
  • I think it's still useful to demonstrate what to do, rather just just telling someone how. The workarounds to the missing [noparse] shown here are the way to do that.

    This has been a good discussion. Thanks to all who contributed!

    -Phil
Sign In or Register to comment.