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

double underscores in name eaten by markdown #793

Closed
doc-sheet opened this issue Jun 24, 2024 · 3 comments · Fixed by #803
Closed

double underscores in name eaten by markdown #793

doc-sheet opened this issue Jun 24, 2024 · 3 comments · Fixed by #803
Labels
Difficulty/1:Easy Easy ticket Good First Issue Suitable for first-time contributors Hacktoberfest Help Wanted Community help wanted Tech/Go Type/Enhancement New feature or improvement of existing feature Up For Grabs Ready for help from the community. Removed when someone volunteers

Comments

@doc-sheet
Copy link
Contributor

Hi.

GitHub version: 2.2.0, 376f881, built Tue, 13 Feb 2024 15:14:53 UTC with go1.21.7

I have no idea how to show an example so I'll try to describe it.

When you paste a link to a file with dunders in it's name like https://github.com/mattermost/mattermost-data-warehouse/blob/5a88112086f5aefc88ca60ebbbc3668a4ee35ffb/utils/geolite/__main__.py#L10

Link above code preview in chat treats __main__ as markdown

Like this:

https://github.com/mattermost/mattermost-data-warehouse/utils/geolite/main.py

1.
2.
3.
@mickmister
Copy link
Member

Hi @doc-sheet, thanks for filing this issue. This one is interesting.

So when the user posts https://github.com/mattermost/mattermost-data-warehouse/blob/5a88112086f5aefc88ca60ebbbc3668a4ee35ffb/utils/geolite/__main__.py#L10, we create a post with a link like:

[mattermost/mattermost-data-warehouse/utils/geolite/__main__.py](https://github.com/mattermost/mattermost-data-warehouse/blob/5a88112086f5aefc88ca60ebbbc3668a4ee35ffb/utils/geolite/__main__.py#L10), with the underscores being treated as bold instead of preserving them:

image

@hmhealey What are your thoughts on this? When creating a markdown link with custom text, some characters can be unintentionally treated as markdown formatting, when they are meant to be kept in tact (such as __main__.py). If I put backslashes in the link, the markdown is correctly ignored, so the plugin could do this for underscores:

[mattermost/mattermost-data-warehouse/utils/geolite/\_\_main\_\_.py](https://github.com/mattermost/mattermost-data-warehouse/blob/5a88112086f5aefc88ca60ebbbc3668a4ee35ffb/utils/geolite/__main__.py#L10)

rendered as this without the bold markdown:

mattermost/mattermost-data-warehouse/utils/geolite/__main__.py

So the solution could just be to have the plugin prepend underscores in the URL with backslashes

@mickmister mickmister added Help Wanted Community help wanted Up For Grabs Ready for help from the community. Removed when someone volunteers Hacktoberfest Tech/Go Good First Issue Suitable for first-time contributors Difficulty/1:Easy Easy ticket Type/Enhancement New feature or improvement of existing feature labels Jun 24, 2024
@hmhealey
Copy link
Member

hmhealey commented Jun 24, 2024

Yeah, that makes sense to me. You'd just be escaping the special characters which seems like a decent fix to me

@bharateshwq
Copy link

Is the issue solved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty/1:Easy Easy ticket Good First Issue Suitable for first-time contributors Hacktoberfest Help Wanted Community help wanted Tech/Go Type/Enhancement New feature or improvement of existing feature Up For Grabs Ready for help from the community. Removed when someone volunteers
Projects
4 participants