قد يتعطل عرض "إدراج التاريخ" عند دمجه مع HTML

Continuing the discussion from Date selector in Topic Timer:

Problem

I tried to reproduce here, using multiple dates, and inserting code fences blocks, but it didn’t reproduce until
https://try.discourse.org/t/testing-insert-date-bug/1130/2 (this link will become obsolete by tomorrow, but it shows like the screenshot above.)

Cause

Finally I found the cause of the bug: the failing render follows an HTML tag with an attribute!

<abbr title="Coordinated Universal Time">UTC</abbr>

[date=2018-06-28 time=07:00 format=“HH:mm” timezones=“Europe/Brussels”] ![:arrow_right:](//cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/meta/original/3X/5/a/5aa33b89419423f0712cf1e6c72f0813cb3f082c.png) [date=2018-06-28 time=15:00 format=“HH:mm” timezones=“Europe/Brussels”]

fails to render:

UTC

07:00 :arrow_right: 15:00

Solution

Avoid using HTML tags in Markdown – Or maybe implement <abbr> in CommonMark. :slight_smile:

I suppose that an HTML tag appearing in a previous paragraph should not affect rendering later on though.

In any case: when things fail, check for a mix of HTML and Markdown.

Why do you need to use an emoji arrow? Use →

I simply pasted the result I got from using the ‘Insert Date’ button. The emoji transformation must be part of the cooking.

Edit: here is pasted the original character :right_arrow: (or with backquotes)

Edit:

'➡'.unpack('U*')
=> [10145]

Yes will be cooked as an emoji

I will give it a look to this tomorrow.

Test:

A

07:00

إعجابَين (2)

لا علاقة لهذا الأمر بإدراج التاريخ. إنه قيد مفروض على textPostProcess

على سبيل المثال، سيفشل الأمر أيضًا مع التصنيفات؛ ستعمل الأولى، لكن أي شيء يأتي بعد abbr لن يعمل (كما ذكر @sam):


Contribute > Feature

<abbr>A</abbr>

A

Contribute > Feature


فهمي هو أن الكتلة التالية بعد abbr ستُحوَّل إلى فقرة ولن تُفسَّر بواسطة textPostProcess. هذا سلوك ناتج عن مُنقّينا https://github.com/discourse/discourse/blob/master/test/javascripts/lib/sanitizer-test.js.es6#L117:

@sam، هل لديك أي فكرة حول هذا الأمر من فضلك؟ هل تظن أنه يستحق الإصلاح؟ يبدو لي أنه حالة هامشية للغاية للغاية.

Something is not right internally cause <small> does not cause this issue nor does <sub> or <ins> or <kbd>

I am guessing this is something internally is broken in sanitizer that is specific to this inline tag. Probably worth fixing.

OK this was an <abbr> and all other tags that start with <a specific bug.

Fixed per:

https://github.com/discourse/discourse/commit/b54ba4c952d79d56742e76081d692f1281e88512

4 إعجابات

This topic was automatically closed after 32 hours. New replies are no longer allowed.