"\" renders as "<br />" in observation comments/IDs

noticed when I had typed this emoticon:
image

=

image

and on ID comments too

image

=

image

https://www.inaturalist.org/observations/62540203

1 Like

This seems to be an incorrect translation of markdown to html tags. Some, but not all, versions of markdown use the \ character at the end of a line to insert a line break. (See here for a discussion.) However, I think the html break tag should be <br> (without the slash, ref), so that may be why it is showing up as characters rather than as an invisible line break.

1 Like

interesting. it does appear to be translating a \ at the end of a line as a line break. so it is adding a <br /> tag in place of the \. (the fact that it’s creating a <br /> vs a <br> tag doesn’t bother me. <br /> is acceptable code.) but it is doing something weird, particularly in my example below.

i’m creating 2 comments that are exactly the same, except the first has an extra <hr /> (horizontal rule) in the middle of it:

note the inconsistent behavior below the horizontal rule in that first comment:

here’s the html for the first comment (note that only the first line is encapsulated within <p> </p>):

here’s the html for the second comment (note that all lines are encapsulated within <p> </p>):

so it must be trying to encapsulate everything within <p> </p> first, but the <hr /> is unexpected within <p> </p>. so everything after the <hr /> gets left outside the <p> </p>. beyond that, i’m not sure (without looking at the code) why it fails to make the translated <br /> html rather than text, and also why it fails to translate markdown outside of the <p> </p>.

@pisum, you are correct as usual: the slash in <br> makes no difference:

renders as:

I note that in iNat, markdown code for an explicit line break is probably unneeded, as the comment editor already interprets the “enter” key as a line break. The third part of my example shows that ending a line in \ not only adds the <br /> text but also deletes the original line break.