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

🐍 Remove .py from linkify domains #940

Merged
merged 2 commits into from
Feb 28, 2024
Merged

🐍 Remove .py from linkify domains #940

merged 2 commits into from
Feb 28, 2024

Conversation

fwkoch
Copy link
Collaborator

@fwkoch fwkoch commented Feb 28, 2024

There are a ton of domains that linkify catches, including py... That means someone writing about their python my_script.py file gets linkified.

For now, I've addressed this by hard-coding excluded domains in myst parser. We may want to make this configurable at the MyST config level...?

I think hardcoding what is excluded is ok, since users can always explicitly make things a link. If something they want linkified is not working (because of our exclude list), they can just make it an explicit link. Potentially we even lock down the domain list way more... there are currently 1450 valid domains 😳 https://github.com/stephenmathieson/node-tlds/blob/master/index.json (1449 with py excluded).

Copy link
Collaborator

@rowanc1 rowanc1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, maybe we can change this to be configured externally rather than bundling the domain list in the parser, but that can come in the future! We should also exclude .md

@@ -67,3 +67,6 @@ export const MARKDOWN_IT_CONFIG = {
},
},
};

// List of valid TLDs to exclude from linkify
export const EXCLUDE_TLDS = ['py'];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also add md here!

@rowanc1 rowanc1 merged commit b289f03 into main Feb 28, 2024
4 checks passed
@rowanc1 rowanc1 deleted the feat/no-py-urls branch February 28, 2024 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants