& is the HTML escape code for &. As & 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 < or > etc. However a lot of browsers still treat & 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.
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.
Why do posters keep writing &Amp instead of just &?
&
is the HTML escape code for&
. As&
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<
or>
etc. However a lot of browsers still treat&
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.
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:
It did it without my wanting it to. It won’t let me edit it either.