-
Notifications
You must be signed in to change notification settings - Fork 7
Description
In programming, it's very common to use single ticks as quote characters, such as the name 'foo' is often used for variables. But in written text, this is normally not the "correct" thing to do. Instead single quote marks, like ‘ ’. CommonMark does not directly include Smart Quotes (where ticks and double ticks are automatically converted to appropriate quote characters).
Since Discord Intl is a mixed implementation of ICU and Markdown, it could make sense to implement a form of smart quotes at some point, but in the short term, an easier solution would be to add a lint rule that detects single and double tick characters and recommends using an appropriate quote mark. We don't currently implement autofixes, so it's okay for the rule to just mark the character and tell the user to switch it, but the goal is to enforce good grammatic practices and provide better rendering without the need to use a markdown renderer or other processing on the client sides.
Importantly, ICU also uses single ticks as an escape character for starting ICU blocks, such as use brackets like '{foo} to create placeholders. This is...antithetical to people's (especially programmers') intuition from writing text, and has bitten us more than a few times already. For example, a message like they reacted with '{title}', where the expectation is that the title value gets quoted, but in reality this currently creates a plain string with no placeholder at all. In this case, it might be sensible to just change the ICU implementation to use double brackets as escapes instead, like {{nonvariable}, which is a safe thing since double brackets are not used anywhere else that would be ambiguous. But that is also a larger change that still doesn't help users write grammatically-correct messages, so it's not a solution, but could be done separately as well.
The lint rule can and should be done as a native validation, since it can then also use the context of a complete AST to offer autofixes in the future if we decide to do that (i.e., smart quotes that are ICU-aware).