Skip to content

Lists with a single empty item (i.e. +, -, *, 1234.) shouldn't be considered Markdown #1265

@dkasak

Description

@dkasak

Description

When Markdown is turned on, sending a message containing only digits followed
by a period produces a formatted_body containing HTML for an ordered list
with a single empty item.

This seems wrong because a user typing something like 2018.<enter> will
almost never mean "an ordered list with an empty item". Furthermore, it is
related to at least two usability bugs that can look very bad to the end user:

  1. Wrong rendering of ordinals with >= 3 digits in Riot Web

    wrong rendering of big ordinals

    This is a separate bug that could (and should) be fixed, but it is also
    particularly bad in combination with this bug, because typing something
    common like 2018. can trigger it.

  2. Riot Android renders such messages as empty, as described in Messages containing only digits followed by a period are invisible riot-android#2285.

    They, however, are unsure what to do with it. In a previous Riot Android
    version, it at least rendered the list ordinal correctly even when the list
    item is empty (like Riot Web), but now it has stopped working again.

    I consider this a separate bug too, since empty list items should
    nevertheless get their ordinal rendered.

I propose that messages of form ^[0-9]+\.\s*$ are considered a special case
and not treated as Markdown. This seems to me to follow the principle of least
surprise to the average user. In any case, the Riot clients should all behave
the same.

An example event:

{
"origin_server_ts": 1540893691521,
"sender": "@dkasak:termina.org.uk",
"event_id": "$15408936912708mMjYL:termina.org.uk",
"unsigned": {
    "age": 113,
    "transaction_id": "m1540893692103.11"
},
"content": {
    "body": "2018.",
    "msgtype": "m.text",
    "formatted_body": "<ol start=\"2018\">\n<li></li>\n</ol>\n",
    "format": "org.matrix.custom.html"
},
"type": "m.room.message",
"room_id": "!DCRUrRQxGhHTRwlYla:termina.org.uk"
}

Steps to reproduce

  • Ensure Markdown is turned on.
  • Type 2018. and press Enter.
  • Notice that it has a formatted_body as described above.
  • Notice that it renders as an empty message in Riot Android.

I expect this to produce an m.text event without a formatted_body. Instead,
it should only have a body with the contents "2018.".

Version information

  • Platform: both web and desktop

For the web app:

  • Browser: Firefox 63
  • OS: Arch Linux
  • URL: riot.im/app

For the desktop app:

  • OS: Arch Linux
  • Version: 0.17.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ComposerO-OccasionalAffects or can be seen by some users regularly or most users rarelyS-MinorImpairs non-critical functionality or suitable workarounds existT-Defect

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions