Support reversed lists in posts by not stripping the "reversed" attribute from HTML

Hi!

Markdown doesn’t provide a native way to format “reverse lists”, i.e. those that start with a high number and count down from there. They regularly get requested in our community as they’d be quite useful for count-down-style lists of favourite things, for example.

I noticed that it’s possible to define lists in simple HTML, and some attributes like start are supported and allow starting a list at a higher number:

  1. Cheese
  2. Bread
  3. Milk
Show HTML
<ol start=3>
<li> Cheese
<li> Bread
<li> Milk
</ol>

However unfortunately, the reversed attribute doesn’t seem to be supported and is stripped out from the final post’s HTML. If it was supported, the code snippet below would result in a list counting down from 3 to 1:

<ol reversed>
<li> Cheese
<li> Bread
<li> Milk
</ol>
  1. Cheese
  2. Bread
  3. Milk

It’d be great if this attribute could be white-listed so that we can offer our users a way to create reversed lists in our forum!

4 Likes

Generally we are happy with allow listing by default very low risk attributes. ol[reversed] and ol[type] seems very low risk.

Very easy started task, PR welcome.

3 Likes

Created a PR for this.

4 Likes