Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linking to topic names containing multiple backticks with in-message markdown #19873

Open
timabbott opened this issue Sep 30, 2021 · 5 comments · May be fixed by #30071
Open

Fix linking to topic names containing multiple backticks with in-message markdown #19873

timabbott opened this issue Sep 30, 2021 · 5 comments · May be fixed by #30071
Assignees
Labels
area: markdown (mentions) Mentions for users/groups/stream/topic/time. bug help wanted in progress rust community request Issues of interest to the Rust community

Comments

@timabbott
Copy link
Sponsor Member

The following syntax (note the two backticks) to link to a topic will generate a corrupted link that does not point to the intended topic.

#**design>test ` test ` test**

I don't understand the cause, but it's presumably some bad interaction between the code block functionality and this feature. Original report here: https://chat.zulip.org/#narrow/stream/9-issues/topic/broken.20topic.20link/near/1258861

I'm not sure what the best solution is. Banning backticks from topic names is an option, but perhaps a bad one, since this came up in real usage. Likely what we want is for this syntax to escape backticks, but I'm not sure how best to do that, given that this link generation feature doesn't have an already defined escape character.

@timabbott timabbott added bug area: markdown (mentions) Mentions for users/groups/stream/topic/time. labels Sep 30, 2021
@gnprice
Copy link
Member

gnprice commented Jan 19, 2022

Some discussion in that chat thread. The complete fix is that we should replace Python-Markdown with some other Markdown implementation that has a saner architecture.

That probably won't happen soon. A straightforward workaround would be for our autocompleters to not generate references that trigger this bug. Instead, they can fall back to generating the normal Markdown syntax for a link.

As for when that fallback should apply: @andersk writes:

It’s not just backticks. Any Markdown syntax of higher priority than the stream-topic pattern would be affected—so ***strong+em***, $$\LaTeX$$, and @**User Mention**.

A rough cut would be to check if the stream name, topic, or (for @-mentions) user name contain any of a list of strings like `, **, $$. Ideally the list would cover all cases that can trigger this bug, without frequently matching things that wouldn't have. But even if it isn't 100% it would still be a useful workaround.

@gnprice
Copy link
Member

gnprice commented Mar 2, 2023

A related issue: #6534

@alya
Copy link
Contributor

alya commented Mar 2, 2023

We should make sure this gets fixed as part of the expected migration to use Djot for markdown processing.

@gnprice
Copy link
Member

gnprice commented Mar 2, 2023

Yes. There's also a straightforward fix we could implement without waiting for that, if we feel users are running into it too often:

A straightforward workaround would be for our autocompleters to not generate references that trigger this bug. Instead, they can fall back to generating the normal Markdown syntax for a link.

@kuv2707
Copy link
Collaborator

kuv2707 commented Apr 27, 2024

@zulipbot claim

kuv2707 added a commit to kuv2707/zulip that referenced this issue May 13, 2024
The #**stream>topic** syntax generates broken links for
topics containing two backticks or ending with *, because of
architectural flaws in the backend markdown processor.
So we avoid generating the syntax for such topics and instead
generate the normal link syntax in markdown.

Fixes zulip#19873
@kuv2707 kuv2707 linked a pull request May 13, 2024 that will close this issue
12 tasks
kuv2707 added a commit to kuv2707/zulip that referenced this issue May 17, 2024
The #**stream>topic** syntax generates broken links for
topics containing two backticks or ending with *, because of
architectural flaws in the backend markdown processor.
So we avoid generating the syntax for such topics and instead
generate the normal link syntax in markdown.

Fixes zulip#19873
kuv2707 added a commit to kuv2707/zulip that referenced this issue May 18, 2024
The #**stream>topic** syntax generates broken links for
topics containing two backticks or ending with *, because of
architectural flaws in the backend markdown processor.
So we avoid generating the syntax for such topics and instead
generate the normal link syntax in markdown.

Fixes zulip#19873
kuv2707 added a commit to kuv2707/zulip that referenced this issue May 20, 2024
The #**stream>topic** syntax generates broken links for
topics containing two backticks or ending with *, because of
architectural flaws in the backend markdown processor.
So we avoid generating the syntax for such topics and instead
generate the normal link syntax in markdown.

Fixes zulip#19873
kuv2707 added a commit to kuv2707/zulip that referenced this issue May 20, 2024
The #**stream>topic** syntax generates broken links for
topics containing two backticks or ending with *, because of
architectural flaws in the backend markdown processor.
So we avoid generating the syntax for such topics and instead
generate the normal link syntax in markdown.

Fixes zulip#19873
kuv2707 added a commit to kuv2707/zulip that referenced this issue May 20, 2024
The #**stream>topic** syntax generates broken links for
topics containing two backticks or ending with *, because of
architectural flaws in the backend markdown processor.
So we avoid generating the syntax for such topics and instead
generate the normal link syntax in markdown.

Fixes zulip#19873
kuv2707 added a commit to kuv2707/zulip that referenced this issue May 21, 2024
The #**stream>topic** syntax generates broken links for
topics containing two backticks or ending with *, because of
architectural flaws in the backend markdown processor.
So we avoid generating the syntax for such topics and instead
generate the normal link syntax in markdown.

Fixes zulip#19873
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: markdown (mentions) Mentions for users/groups/stream/topic/time. bug help wanted in progress rust community request Issues of interest to the Rust community
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

5 participants