Dear sweet Oghma. We can’t even get rid of it on TTRPGs.

  • AlexisFR
    link
    English
    411 months ago

    Why do posters keep writing &Amp instead of just &?

    • @nous@programming.dev
      link
      fedilink
      English
      6
      edit-2
      11 months ago

      EDIT: seems it wont render ampersand correctly at all… so the below is just has everything escaped when I didn’t mean it to be and more confusing than it should be because of this… not sure how to get ampersand to display correctly in a code block, seems to be bugged.

      & is the HTML escape code for & ampersand. As & ampersand is a special character in HTML which means entity reference and should you can use the escaped form to get the browser to render just & rather than treating it as a reference. The same goes for other characters like < less than or > etc. However a lot of browsers still treat & ampersand as a literal in places where it does not look like a reference so the literal still works in a lot of places. But the escaped form always works.

      But when you copy html from a page your browser is probably copying the escaped form the page used in its source rather then the rendered form. It does this to let you get rich markup when pasting into documents - the app you paste into understands the html and knows when you are using heading or bolding text etc.

      But in this case the app just pasted in the escaped form with no conversation. And for security reasons likely escaped it again as you don’t want users to be able to post any old html formatting in a comment, so any html special characters in the input get escaped leaving you with a double escaped char, which the browser only unescapes one layer of when rendering.

      • @nous@programming.dev
        link
        fedilink
        English
        5
        edit-2
        11 months ago

        Heh, well, look at that… seems it is also escaping chars inside backticks, but then not undoing that on the render when it conveys them to a pre tag… Which IMO seems like a bug in lemmy.

        Let’s test some things: & \& &

        I typed: It previous as I would expect:

        But renders it escaped on the mobile app at least, disappointing…

    • Flying SquidOP
      link
      fedilink
      English
      2
      edit-2
      11 months ago

      It did it without my wanting it to. It won’t let me edit it either.