Line breaks within list items don't work as expected December 26, 2021 10:59 AM   Subscribe

Pony request: better handling of HTML lists (ordered and unordered) in posts and comments.

I sometimes try to use <ul> <ol> <li> tags to make my comments more readable.

This works OK as long as a given <li> doesn't contain any line breaks, <br> tags, or <p> tags.

However, all hell breaks loose if you do try to include any of these inside an <li> – the formatting that appears in the preview is never the same that appears in the actual comment. The site seems to strip most (all?) of them out in the submitted comment.

I'd call this a bug.

Is there any chance of getting this fixed? I can think of two possible solutions (which I would mark up with <ul> – but, y'know):

1. Less desirable: Adjust the preview so that it handles <br>, <p>, and line breaks within <li>s the same way as the actually-submitted comment.

At least this way, users wouldn't get an unexpected result when submitting the comment, or waste time composing HTML that isn't going to work.

or,

2. More desirable: Stop stripping out <br> and <p> tags that appear inside <li>s. Those savvy enough to use this markup will expect them to work.

(Since I don't know exactly how MeFi filters the HTML under the hood, I'm not sure whether this would affect the formatting of old comments. If so, you could add a list_rendering flag to the comments table, indicating whether a given comment was submitted before or after this change was made. Alternately, you might be able to write a migration to normalize the markup of old comments.)

This isn't a huge concern – but I've run into it often enough over the years that I figured it's due for a mention.
posted by escape from the potato planet to Bugs at 10:59 AM (2 comments total) 1 user marked this as a favorite

The list html has definitely always been a bit wonky. Not sure when frimble will be by to check in over the holidays and let us know how big or small a fix this requires, which would determine when it gets gotten to. :)
posted by Eyebrows McGee (staff) at 11:01 AM on December 26, 2021 [1 favorite]


Thanks!
posted by escape from the potato planet at 6:36 AM on December 29, 2021


« Older Newsletter 5: Farewell to 2021   |   What purpose do AskMe categories serve today? Newer »

You are not logged in, either login or create an account to post comments