Request: Add “type” attribute of <ol> to whitelist. Suggestion to do the same with “reversed” for <ol>, and “value” for <li>, for similar but less common reasons.
Purpose: These attributes are intended for use where the marker of ordered list items itself conveys meaning to the content of the list. Typically this is the case when list items are intended to be referred to via this marker. This is in contrast to CSS list-style-type which is intended where the choice of marker carries no significant purpose. (Though I did see it recommended for forum-wide localization, which is pretty great!)
Background: While attempting to quote an official reference document, I discovered an apparent limitation in list formatting which prevents doing so accurately. Quite often, list markers are purely stylistic. However, they are occasionally used to facilitate reference in list-heavy documents. For example, in official and legal documents, a list item (or sub-item) might be referred to by list marker: “Official Document Article I, section 1(a)(i)”
I’m uncertain of whether a standard method is available in BBCode, to the extent anything is standard in BBCode. I was unable to find anything more advanced than starting at an arbitrary digit. BBCode list tags don’t appear used by Discourse, anyway.
With HTML and HTML+style, neither produce the correct result:
Though I do notice that introducing these will leave the HTML-to-markdown converter unaware of these attributes. But as demonstrated above, markdown-it currently can’t handle markdown syntax representing these anyway. For that, it may be desirable to go a step further and implement list types in CommonMark…
The lack of this makes it very difficult to quote official documents, legal documents, software licenses, or anything else which use non-number markers for document references.
That’s a good solution if the goal is arbitrary list decorations, but the HTML type attribute is specifically meant for semantically-meaningful situations where the difference between list markers are more than decorative. From <ol>: The Ordered List element - HTML: HyperText Markup Language | MDN
Unless the type of the list number matters (like legal or technical documents where items are referenced by their number/letter), use the CSS list-style-type property instead.
It’s a common enough need that although the HTML attribute was deprecated in HTML 4.01 (with justification of it being purely stylistic), it was subsequently re-introduced in HTML5 for the specific purpose of encoding reference lists as described by MDN.
J’ai essayé d’utiliser cette solution et elle fonctionne, en corrigeant le CSS comme suit (la première ligne manquait d’un ol {):
.cooked div[data-wrap=\"letterlist\"] ol {
list-style: upper-alpha;
}
Cependant, je n’arrive pas à le faire apparaître dans la fenêtre d’aperçu de l’éditeur, ce qui sera un problème pour la plupart de mes utilisateurs. J’ai essayé d’inspecter avec le navigateur web, et il semble que le CSS personnalisé ne soit pas chargé ou appliqué à l’aperçu (je ne suis pas un professionnel dans ce domaine, donc je pourrais me tromper).
Y a-t-il un moyen, selon vous, de résoudre ce problème, @Falco ?
Il semble que l’utilisation du HTML de cette façon désactive l’interprétation de Markdown dans les <li>, ce qui n’est pas vraiment acceptable pour moi à proposer aux utilisateurs.
Pour utiliser une mise en forme supplémentaire à l’intérieur, je pense que vous devriez également utiliser la version HTML, car elle n’aime pas le mélange :
Je sais. Comme je l’ai dit, je ne trouve pas cela acceptable de proposer à mes utilisateurs — cela change complètement le balisage juste parce que vous voulez une liste légèrement différente.