"Insert Date" rendering may break when mixed with HTML


Continuing the discussion from Date selector in Topic Timer:


I tried to reproduce here, using multiple dates, and inserting code fences blocks, but it didn’t reproduce until
Testing ‘Insert Date’ bug - Demo (this link will become obsolete by tomorrow, but it shows like the screenshot above.)


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:](//discourse-meta.s3-us-west-1.amazonaws.com/original/3X/5/a/5aa33b89419423f0712cf1e6c72f0813cb3f082c.png) [date=2018-06-28 time=15:00 format=“HH:mm” timezones=“Europe/Brussels”]

fails to render:


[date=2018-06-28 time=07:00 format=“HH:mm” timezones=“Europe/Brussels”] :arrow_right: [date=2018-06-28 time=15:00 format=“HH:mm” timezones=“Europe/Brussels”]


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.

(Jeff Atwood) #2

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 :arrow_right: (or with backquotes)


=> [10145]

(Joffrey Jaffeux) #4

Yes will be cooked as an emoji

I will give it a look to this tomorrow.



[date=2018-06-28 time=07:00 format=“HH:mm” timezones=“Europe/Brussels”]

(Joffrey Jaffeux) #5

This has actually nothing to do with insert-date. It’s a limitation of textPostProcess

For example it would fail with categories too, first one will work, ANYTHING AFTER abbr won’t (like my @sam mention) :





My understanding is that the next block after abbr will be transformed to a paragraph and not interpreted by textPostProcess. This is a behavior from our sanitizer discourse/sanitizer-test.js.es6 at master · discourse/discourse · GitHub

@sam any idea on this please? Do you think it’s worth fixing? Seems like very very edge case in my book.

(Sam Saffron) #6

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.

(Sam Saffron) #7

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

Fixed per:

(Sam Saffron) #8

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