Warning: Some posts on this platform may contain adult material intended for mature audiences only. Viewer discretion is advised. By clicking ‘Continue’, you confirm that you are 18 years or older and consent to viewing explicit content.
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.
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…
Why do posters keep writing &Amp instead of just &?
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 forampersand. 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 likeless than or<
>
etc. However a lot of browsers still treatampersand 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:
But renders it escaped on the mobile app at least, disappointing…
It did it without my wanting it to. It won’t let me edit it either.