Skip to content

Commit

Permalink
🌎 Remove TLD of .es from linkify (#1740)
Browse files Browse the repository at this point in the history
Fixes #1736
  • Loading branch information
rowanc1 authored Jan 9, 2025
1 parent 93af5a1 commit 2ab9bfd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/nervous-buttons-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"myst-parser": patch
---

Remove .es linkify
2 changes: 1 addition & 1 deletion packages/myst-parser/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ export const MARKDOWN_IT_CONFIG = {
};

// List of valid TLDs to exclude from linkify
export const EXCLUDE_TLDS = ['py', 'md', 'dot', 'next', 'so'];
export const EXCLUDE_TLDS = ['py', 'md', 'dot', 'next', 'so', 'es'];
21 changes: 21 additions & 0 deletions packages/myst-parser/tests/linkify.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,25 @@ describe('linkify', () => {
expect(stripPositions(mystParse(content))).toEqual(expected);
expect(stripPositions(mystParse(content, { markdownit: { linkify: true } }))).toEqual(expected);
});
it('dont linkify .es', () => {
const content =
'A rising convention in French to be gender neutral and inclusive is to mix the two versions with a dot: enseignant.es.';
const expected = {
type: 'root',
children: [
{
type: 'paragraph',
children: [
{
type: 'text',
value:
'A rising convention in French to be gender neutral and inclusive is to mix the two versions with a dot: enseignant.es.',
},
],
},
],
};
expect(stripPositions(mystParse(content))).toEqual(expected);
expect(stripPositions(mystParse(content, { markdownit: { linkify: true } }))).toEqual(expected);
});
});

0 comments on commit 2ab9bfd

Please sign in to comment.