איך מוסיפים onebox בתוך רשימה?

סיכום מבוסס בינה מלאכותית

The discussion centers around the inability to add a onebox to a link when it’s inside a numbered list in Discourse. rokejulianlockhart initially demonstrates the issue, showing that a link with spacing around it in a list doesn’t oneboxify, appearing as plain text //example.com. Attempts to rebuild the HTML jahan_gagan – a common fix for onebox issues – are hampered by a lack of necessary permissions rokejulianlockhart.

renato explains that the Discourse markdown-it token logic treats links outside of top-level elements (like lists) as inline oneboxes. This behavior is unexpectedly different from <details> elements, which do allow oneboxes rokejulianlockhart. renato further clarifies that the markdown parser doesn’t infer nesting from HTML tags, treating raw HTML as a flat structure.

rokejulianlockhart argues that if the CSS defines the link’s container as a block element, oneboxification should occur regardless, and suggests a lack of problematic edge cases. The original post has been converted to a #feature request rokejulianlockhart due to the current limitations.

למרות שיש לו מספיק מקום סביבו להיות אלמנט בלוק, הוא לא עושה onebox.

לייק 1

Try rebuilding the HTML of the post once — that often fixes issues where links don’t onebox properly:

לייק 1

I think the spaces in front of it would make it an inline onebox and not a full one. I’m not sure I know a workaround. :thinking:

Did that work for you?

3 לייקים

@JammyDodger, that’s what I see at every instance I’ve tried thus far (about 8, in total).

@janan_gagan, I don’t possess TL4 permission anywhere… If any of you are able to rebuild the HTML5 content of my post at /1, that would confirm whether it works. However, per the aforementioned, I’m doubtful.

In the meantime, I’ve converted this to a Contribute > Feature post, since it appears to currently be impossible.

Thanks, regardless.

לייק 1

Yes, there’s a specific logic in our markdown-it tokens that forces links to be considered inline oneboxes in cases that are not top level links (ie. not inside any list/blockquote/etc)

לייק 1

@renato, הם עדיין יכולים להפעיל oneboxify בתוך <details>, אם כי. זה נראה מוזר במיוחד לאפשר זאת, אבל לא כל אלמנט בלוק אחר. מה ההיגיון?

אין הנמקה מפורשת, פשוט כך ש-markdown-it רואה HTML גולמי בצורה שטוחה, הוא לא מנסה להסיק את הקינון מתגים שנפתחים/נסגרים.

צומת HTML גולמי

Onebox ברמה העליונה

צומת HTML גולמי

@renato, נראה לי שבמידה וה-CSS מגדיר את האלמנט שמכיל URI כאלמנט בלוק, ה-oneboxification אמור להתרחש; איני יכול לחשוב על מקרי קצה בעייתיים.