End-of-sentence is linkified when there are zero markdown linkify tlds

AI-generated summary

A bug has been discovered in Discourse where the end of a sentence is linkified when “markdown linkify” is enabled and “markdown linkify tlds” is empty. To reproduce, users can follow the steps outlined by tanius. maiki has confirmed the issue and advised disabling “enable markdown linkify” or adding a TLD as a temporary workaround.

tanius suggests that the fix could be to not allow “markdown linkify tlds” to be empty or to treat the empty case internally with the same code used when “enable markdown linkify” is set to false. sam agrees and will add a pr-welcome to implement this validation.

The original issue was discovered by tanius while experimenting with how to disable the “convert URL to title of linked page” behavior, also known as Inline Onebox. maiki shares a workaround for making URLs readable past markdown converters by using brackets to link to a topic.

To reproduce, make the following two admin settings:

  • enable markdown linkify: true
  • markdown linkify tlds: none (that is, delete all TLDs that are set by default)

Then do a “Rebuild HTML” for any post that includes a full sentence, and note that the last word at the end of every sentence, and the following dot, is now linkified. Example:

Wait for the last word.

I am able to reproduce this, I’ll let our devs know.

In the meantime, please disable enable markdown linkify or add a TLD, to get around this. :laughing:

2 Likes

This kind of begs the question of “why”? I think the fix I support here is simply not allowing markdown linkify tlds to be empty.

Will put a pr-welcome to add a validation here.

3 Likes

Alternatively, you could allow markdown linkify tlds to be empty, but treat that case internally with the same code used when enable markdown linkify: false has been set.

You’re raising a good point there :smile:

I was just experimenting how to get rid of the “convert URL to title of linked page” behavior. Later found it’s called Inline Onebox, and cannot be disabled for Discourse-internal links.

1 Like

I often want URLs to be readable past markdown converters, so I use brackets to do so.

So to link to this topic: https://meta.discourse.org/t/end-of-sentence-is-linkified-when-there-are-zero-markdown-linkify-tlds/248342?u=maiki

So to link to this topic: <https://meta.discourse.org/t/end-of-sentence-is-linkified-when-there-are-zero-markdown-linkify-tlds/248342?u=maiki>

Not sure how standard that is, but it works in all the markdown converters I use. :slight_smile:

3 Likes